SQLite Forum

STRICT is keyword?

STRICT is keyword?

(1) By anonymous on 2021-12-09 22:01:07 [link] [source]

STRICT is keyword since 3.37? sqlite3_keyword_name don't return STRICT. But https://sqlite.org/stricttables.html have "STRICT keyword" text (2.2).

(2) By Larry Brasfield (larrybr) on 2021-12-09 22:17:50 in reply to 1 [link] [source]

See https://sqlite.org/c3ref/keyword_check.html about semi-special "keywords", to learn that words in some parts of the syntax need not be reserved as fully-fledged keywords.

As for "sqlite3_keyword_name don't return STRICT": It's in the compacted word table, so it appears that it should be returned. Are you claiming it is not, in v3.37?

(3) By anonymous on 2021-12-10 05:13:58 in reply to 2 [link] [source]

Yes, for me STRICT not returned. sqlite3_keyword_count also return 147.

(4) By Larry Brasfield (larrybr) on 2021-12-10 06:26:04 in reply to 3 [link] [source]

I suspect it's one of those sometimes-a-keyword words. Consider:
create table STRICT (x);
which succeeds, whereas tables named with "real" keywords are disallowed.

(5) By anonymous on 2021-12-10 07:31:54 in reply to 4 [link] [source]

create table REAL (x);
works as expected.
I'm talking about seems  
https://sqlite.org/lang_keywords.html and 
loses STRICT keyword and must be updated.

(6) By Stephan Beal (stephan) on 2021-12-10 07:55:07 in reply to 5 [source]

create table REAL (x); works as expected.

Larry meant "real" keywords in the sense of "genuine" keywords, as opposed semi-/pseudo-keywords. He was not referring to the "real" numeric type.

(7) By Richard Hipp (drh) on 2021-12-10 14:21:31 in reply to 1 [link] [source]

Is STRICT a keyword? That depends on how you define "keyword".

STRICT is not a keyword according to the lexical analyzer. The lexical analyzer understands STRICT as an identifier, and passes it into the parser as an identifier. But the parser recognizes the STRICT identifier as a keyword if it occurs at the end of a CREATE TABLE statement.

So, the parser thinks STRICT is a keyword, but the lexical analyzer does not. The sqlite3_keyword_name() interface goes off of what the lexical analyzer thinks. The documentation generally follows the thinking of the parser.

(8) By Larry Brasfield (larrybr) on 2021-12-10 14:32:36 in reply to 1 [link] [source]

The doc on STRICT has been updated to clarify the positional dependence of STRICT's keywordness and absence in the regular ("strict") keyword list known to sqlite3_keyword_{count,check,name}().

This update will be pushed to the site in due course.