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

<null> entries in .schema output #170

Closed
mjpieters opened this issue Nov 10, 2023 · 0 comments · Fixed by #171
Closed

<null> entries in .schema output #170

mjpieters opened this issue Nov 10, 2023 · 0 comments · Fixed by #171

Comments

@mjpieters
Copy link
Contributor

SQLite creates internal indexes for primary keys and unique constraints, and the value for the sql column in the sqlite_schema system table is NULL for these. Thus, running .schema on any sqlite database with at least one table with a primary key or unique constraint results in <null> entries when you run .schema.

These should be filtered out; a WHERE sql IS NOT NULL filter should do. I don't see any need to filter out other internal objects (starting with sqlite_) here, they have their uses, but the output for internal indexes have no context and only confuse.

mjpieters added a commit to mjpieters/litecli that referenced this issue Nov 10, 2023
See the [schema table `sql` column documentation][schema]:

> The `sqlite_schema.sql` is NULL for the internal indexes that are automatically
> created by UNIQUE or PRIMARY KEY constraints.

[schema]: https://www.sqlite.org/schematab.html#interpretation_of_the_schema_table

Fixes dbcli#170
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant