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

sqlean flags lower() as non-deterministic #109

Closed
mikeschinkel opened this issue Jan 29, 2024 · 2 comments
Closed

sqlean flags lower() as non-deterministic #109

mikeschinkel opened this issue Jan 29, 2024 · 2 comments

Comments

@mikeschinkel
Copy link

mikeschinkel commented Jan 29, 2024

Running sqlean version 3.45.0 on macOS I get this error:

Parse error near line 120: non-deterministic functions prohibited in generated columns
      domain       VARCHAR(24) GENERATED ALWAYS AS (lower(substr(email, instr(em
                                      error here ---^

The DDL for the table is:

create table email
(
   email_id     INTEGER
      primary key autoincrement,
   source       CHAR(1), -- A=Account,C=Contact
   source_email VARCHAR(48),
   is_valid     CHAR(1),
   email        VARCHAR(48),
   domain       VARCHAR(24) GENERATED ALWAYS AS (lower(substr(email, instr(email, '@') + 1)))
);

I am assuming that lower(), substr(), and instr() are all deterministic, right?

This DDL works in sqlite3 v3.37.0.

@nalgeon
Copy link
Owner

nalgeon commented Jan 29, 2024

Sure! Fixed in 0.21.9.

@nalgeon nalgeon closed this as completed Jan 29, 2024
@mikeschinkel
Copy link
Author

Wow, talk about service! Thanks.

P.S. I have another one for you, slightly harder I expect. Issue pending.

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

2 participants