Closed chris-braidwell closed 1 month ago
This is a question, and has already been answered on discord. Try searching there.
I've found lots of discussion re: DEFAULT
but haven't one that explains why. Can someone provide a link?
Because there are several ways of generating the default values, some of which are not trivial to convert to SQLite. As the discussions mention, there is an idea to make some defaults possible later, and possibly most if you are using pglite
.
This is still a discussion topic though, and should not be in an issue...
@chris-braidwell We can't support any Postgres expression as the default when mapping a PG schema to SQLite, so to keep things predictable and avoid causing sync issues for people who electrified tables Electric couldn't support, we added a check to make it clear that columns with DEFAULT clauses couldn't be electrified.
There are paths to partial support of defaults, we just didn't have enough capacity to address the issue.
Our team has now switched focus to https://github.com/electric-sql/electric-next?tab=readme-ov-file#electric-next. I suggest you take a look at it, there are no schema restrictions there while we're working on the "read path". And once we get to the "write path", i.e. syncing client writes to Postgres, the approach will be different there from what has been implemented in Electric so far.
👋 we've been working the last month on a rebuild of the Electric server over at a temporary repo https://github.com/electric-sql/electric-next/
You can read more about why we made the decision at https://next.electric-sql.com/about
We're really excited about all the new possibilities the new server brings and we hope you'll check it out soon and give us your feedback.
We're now moving the temporary repo back here. As part of that migration we're closing all the old issues and PRs. We really appreciate you taking the time to investigate and report the bug!
I understand electric-sql will only ever support a subset of Postgres -- certain things can't be done safely or at all when all data isn't in-scope at the time of the operation, fair enough. Like
UNIQUE
constraints, got it. Can you help me understand whyDEFAULT
isn't supported? I can't think of why for exampleis_open BOOLEAN DEFAULT FALSE
would be a problem.