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

buildSQL throw an error on boolean columns. #8

Open
tpoisseau opened this issue Feb 19, 2025 · 1 comment
Open

buildSQL throw an error on boolean columns. #8

tpoisseau opened this issue Feb 19, 2025 · 1 comment

Comments

@tpoisseau
Copy link

Inconsistent type names from PRAGMA table_info(table_name); when using types not listed in strict table.

https://www.sqlite.org/datatype3.html
https://www.sqlite.org/stricttables.html

CREATE TABLE tbl_lowercase (
  "int" integer,
  "bool" boolean NOT NULL
);
CREATE TABLE tbl_UPPERCASE (
  "int" INTEGER,
  "bool" BOOLEAN NOT NULL
);

Both are valid, but PRAGMA table_info(tbl_lowercase); => bool: boolean and PRAGMA table_info(tbl_UPPERCASE); => bool: BOOLEAN.
type of "int" is INTEGER in both cases.

Maybe we should uppercase parameter.type in buildSQL to not miss type because of case.

I would like we support also float / FLOAT (it's REAL).

For datetime I don't have strong opinion. It's OK to use TEXT for iso datetime, INTEGER for unix epoch So i'm not sure we need a dedicated process case (which would need format option)

@tpoisseau
Copy link
Author

NB: strict table is a great option, but sometimes we want more precise types (even if it has no impact on sqlite) for schema creation interoperable with other dbms. We could use an ORM / query-builder like Lucid / Knex.js

tpoisseau added a commit to tpoisseau/smart-sqlite3-filter that referenced this issue Feb 19, 2025
* support `float` column

Refs: cheminfo#8
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

No branches or pull requests

1 participant