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

Add support for generated table columns #2107

Open
2 of 4 tasks
MKleusberg opened this issue Jan 30, 2020 · 11 comments
Open
2 of 4 tasks

Add support for generated table columns #2107

MKleusberg opened this issue Jan 30, 2020 · 11 comments
Assignees
Labels
enhancement Feature requests.

Comments

@MKleusberg
Copy link
Member

MKleusberg commented Jan 30, 2020

There is this new feature called generated columns in SQLite 3.31.0. See here for details. We should add support for this in the future. As far as I can tell these parts of DB4S need to be changed:

  • Parser and SQL object representation classes
  • Disable writing to these columns in the Browse Data tab
  • Automatically refresh contents of generated columns when other columns are changed in the Browse Data tab
  • Add support for this in the Edit Table dialog

The first item is the most important one since it is required for even opening these databases.

@MKleusberg MKleusberg added the enhancement Feature requests. label Jan 30, 2020
@MKleusberg MKleusberg self-assigned this Jan 30, 2020
MKleusberg added a commit that referenced this issue Feb 9, 2020
This adds support for parsing, storing, and generating GENERATED ALWAYS
AS columns as added in SQLite 3.31.0.

See issue #2107.
MKleusberg added a commit that referenced this issue Feb 17, 2020
This fixes inserting new rows into tables with generated columns by not
trying to insert NULL values into these columns. With this change these
columns are effectively treated as if they had a default value which
means that the Add Record dialog does not need to show by default
anymore.

See issue #2107.
MKleusberg added a commit that referenced this issue Feb 20, 2020
This disables all cells in generated columns for editing in the Browse
Data tab. Since the values of these columns are generated by SQLite
there is no way to edit them directly and each attempt will result in an
error. So it is best to not allow editing them in the UI.

See issue #2107.
@mnmkng
Copy link

mnmkng commented Mar 26, 2020

👍 I just spent some time figuring out why my DB would not load due to a syntax error, when it's working fine otherwise. How's this issue moving forward? I tried the latest nightly build for Mac OS and it still could not load the DB. Can I help?

@MKleusberg
Copy link
Member Author

@mnmkng This should work in the latest nightly build and in the release candidate for version 3.12.0 of DB4S. Can you check again? If you still can't open the DB with that this is an issue we should investigate 😄

@mnmkng
Copy link

mnmkng commented Jun 11, 2020

Sorry, I removed the generated columns and replaced them with Node.js side calculations shortly after. So it’s been working fine for some time. 🙂

@justinclift
Copy link
Member

@laqrix Would you be ok to test our recent release candidate, or one of our recent nightly builds, and let us know if this is working for you?

@laqrix
Copy link

laqrix commented Jun 11, 2020

The release candidate appears to work. My test was not extensive, just attempt to load and browse a database with generated columns. Thanks!

@justinclift
Copy link
Member

justinclift commented Jun 11, 2020

Awesome, thanks heaps @laqrix. 😄

@MKleusberg Guessing we should add this to the list of v3.12.x improvements?

@MKleusberg
Copy link
Member Author

@justinclift It's already mentioned in the Enhancements section of the Alpha release notes 😄

Add support for parsing, browsing, and editing tables with GENERATED ALWAYS AS columns (#2107)

@justinclift
Copy link
Member

Cool. Looks like we can close this then. Good work @MKleusberg. 😄

@MKleusberg
Copy link
Member Author

Let me reopen this issue for now as there is still some work to do as mentioned in the original issue text 😄

@MKleusberg MKleusberg reopened this Jun 12, 2020
@justinclift
Copy link
Member

Oops. 😉

@mate377
Copy link

mate377 commented Aug 29, 2020

Regarding the third point:

  • Automatically refresh contents of generated columns when other columns are changed in the Browse Data tab

the column value is refreshed when a query act on the column, for example applying a filter. So is it really necessary?

I would say that the fourth point:

  • Add support for this in the Edit Table dialog

is really important since by now one can only create or modify a table with a GENERATED column through issuing a SQL statement. An Idea to implement this in the editor would be to add a column in the edit dialog called "generated" which adds a GENERATED columns set automatically as VIRTUAL, and a checkbox which allows to change it from VIRTUAL to STORED.

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

No branches or pull requests

5 participants