-
-
Notifications
You must be signed in to change notification settings - Fork 76
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use CREATE VIRTUAL TABLE
rather than select crsql_as_crr
#181
Milestone
Comments
Open
Indexing can be done out of band / against the "base tables" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
We currently upgrade tables to
crrs
by:select crsql_as_crr
While working on the libsql integration (tursodatabase/libsql#147) @asg017 brought up a good point that we can use the create virtual table syntax.
Allowing us to do:
The problems with this approach are:
foo
will be createdWe want to somehow achieve the best of both worlds.
One where the user can use the
CREATE VIRTUAL TABLE
mechanism but still read and write directly to/from the real table and where we can still support alter table commands.Proposal
My idea for a "middle path" is this:
Users use the
CREATE VIRTUAL
but suffix their table name with_crr
:Under the hood this will:
foo
if it does not exist, with the desired schemafoo
to a crr if it does existfoo_crr
that isn't used for anything.clock
tables asshadow tables
of the vtab.Unfortunately this does generate clutter (a random
foo_crr
table). The benefits though:Supporting Schema Modification
In addition to the vtab clutter, schema modification isn't supported against vtabs. @asg017 had another idea here: model schema modification as insert against the vtab.
Given our
*_crr
vtabs are doing nothing but being clutter, we can use them for schema modification.To modify a schema with that via inserts would look like:
The text was updated successfully, but these errors were encountered: