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 default SQLite schemas #1201

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

shybovycha
Copy link

According to SQLite docs, there are at least two schemas supported: main and temp:

If a schema-name is specified, it must be either "main", "temp", or the name of an attached database. In this case the new table is created in the named database. If the "TEMP" or "TEMPORARY" keyword occurs between the "CREATE" and "TABLE" then the new table is created in the temp database. It is an error to specify both a schema-name and the TEMP or TEMPORARY keyword, unless the schema-name is "temp". If no schema name is specified and the TEMP keyword is not present then the table is created in the main database.

Thus, two things need to happen for this JDBC driver to be compatible with SQLite (at least from this feature perspective):

  1. the DatabaseMetadata#getSchemas() must return at least those two schemas (main and temp); hopefully the attached database too, but I am unsure if this is possible to determine at the relevant point in the code
  2. the DatabaseMetadata#supportsSchemasInTableDefinitions() must return true to indicate the consumers the table could be referenced either via its raw name or using a schema prefix

Currently the driver returns an empty result set for the DatabaseMetadata#getSchemas() and false for DatabaseMetadata#supportsSchemasInTableDefinitions(). This breaks some of the consumers (for instance, the applications using 3rd party APIs or the driver directly when trying to determine database schema at runtime).

@shybovycha shybovycha force-pushed the fix/sqlite-supports-schemas branch from 24fa937 to 55a0935 Compare October 22, 2024 03:34
@shybovycha shybovycha marked this pull request as draft October 22, 2024 03:51
@gotson
Copy link
Collaborator

gotson commented Oct 22, 2024

#829 may be related

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 this pull request may close these issues.

2 participants