Skip to content
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

support SQLite virtual tables (introduce TableModifier) #494

Closed

Conversation

evgeniy-terekhin
Copy link
Contributor

This PR introduces support for SQLite VIRTUAL tables

it does so by introducing a new entity for CreateTableStatement - TableModifier

The idea of TableModifier is that it modifies the very CREATE TABLE part of the statement (in this case it is CREATE VIRTUAL TABLE).
At the moment TableModifier is a struct with just one field virtual_table. The idea is that it will contain as many fields as there are options to modify the table. Fpostgres for instance we can have several modifiers at once (e.g CREATE GLOBAL TEMPORARY TABLE).

Copy link
Member

@ikrivosheev ikrivosheev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@evgeniy-terekhin hello! Thank you for the PR! Can you run rustfmt?)

@ikrivosheev
Copy link
Member

@evgeniy-terekhin what is difference between modifier and options?

@evgeniy-terekhin
Copy link
Contributor Author

@evgeniy-terekhin what is difference between modifier and options?

this is a very good question
In principle they should (and most likely must) serve the same purpose

hovever the way table options are implemented at the moment it is impossible to add VIRTUAL table support as another variant of TableOpt enum

A viable idea can be to extend TableModifier with fields corrsponding to TableOpt variants

struct TableModifier {
   virtual_table: Option<String>,
   character_set: Option<String>
   ...
}

and instead of iterating over table options in the very end of prepare_table_create_statement we could conditionally render depending on contents of individual fields of the modifier struct.

@billy1624
Copy link
Member

I'm not familiar with virtual table in SQLite. So, please correct me if I'm wrong.

Seems like SQLite virtual table is not the same as temporary table in MySQL and Postgres. In other words, they are two different things and virtual table is a special feature offered by SQLite only.

@evgeniy-terekhin
Copy link
Contributor Author

@billy1624 yes it is an SQLite-specific feature

However I think that it would be really hard to implement this properly and probably the effort wouldn't worth it

So I am closing this PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

3 participants