GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — Keep constraints when editing tables that use ON CONFLICT on CHECK or NULL by deepsidhu1313 · Pull Request #4242 · sqlitebrowser/sqlitebrowser Conversation
Contributor
SQLite accepts CHECK(expr) ON CONFLICT x at table level and NULL ON CONFLICT x on a column. Our grammar rejected both, so such a table counted as not fully parsed and any edit in the Edit Table dialog rebuilt it from the pragma name and type only, silently dropping every constraint (PRIMARY KEY, NOT NULL, UNIQUE, CHECK). The grammar now accepts both (CheckConstraint gets a conflict action). The dialog also keeps the conflict action when an index constraint is switched between Unique and Primary Key. New tests in test-sqlobjects (7 failed before; 285 pass now). The first commit (Qt6 compile fix for test-sqlobjects) can be dropped if Qt6 work lands separately. Refs #1264
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactionsQCOMPARE() cannot deduce the type of a bare braced-init-list in Qt6, so spell out sqlb::StringVector for the rowidColumns() comparisons. Check that the conflict action of column and table PRIMARY KEY, NOT NULL and UNIQUE constraints survives parsing a CREATE TABLE statement and writing it out again, for every conflict action, and that it also survives the kind of edits the Edit Table dialog applies to a copy of the table before DBBrowserDB::alterTable() recreates it from the generated SQL (renaming the table or columns, changing or dropping columns, extending the key). Related: sqlitebrowser#1264 SQLite accepts a conflict clause after a table CHECK constraint and after the NULL column constraint, but our grammar rejected both. A table using either was then not fully parsed, so the Edit Table dialog could only offer the columns reported by the pragma and recreating the table from that dropped all of its constraints. Accept the clause in both places. For CHECK it is kept and written out again, so the definition isn't changed; for NULL, which isn't stored in the model at all, it is ignored just like the constraint itself. Related: sqlitebrowser#1264 Switching a constraint between Unique and Primary Key in the Edit Table dialog replaces it by a new constraint, which only copied the name. The ON CONFLICT clause of the old constraint was silently dropped. Carry it over and update the primary key's "On Conflict" combo box accordingly. Related: sqlitebrowser#1264 This branch has not been deployedNo deployments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
ReviewersNo reviewsUh oh!
There was an error while loading. Please reload this page. AssigneesNo one assignedLabels
None yet
ProjectsMilestoneNo milestoneDevelopmentSuccessfully merging this pull request may close these issues. Uh oh!
There was an error while loading. Please reload this page. Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later. |
| You are visitor 01402503 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |