sabir-akhadov-localstack commented on code in PR #2556:
URL:
https://github.com/apache/datafusion-sqlparser-rs/pull/2556#discussion_r4330389832
##########
src/parser/mod.rs:
##########
@@ -13428,6 +13438,10 @@ impl<'a> Parser<'a> {
Ok(DataType::TsQuery)
}
_ => {
+ if self.dialect.supports_multiword_type_names() {
Review Comment:
Types with a dedicated arm never reach this path, so `CREATE TABLE t (a INT
FOO)` and `a TEXT FOO PRIMARY KEY` still fail on SQLite while `a FOO INT`
parses; sqlite 3.46 accepts both and stores the declared type as `INT FOO`.
Rewinding to `next_token_index` and taking `parse_multiword_type_name` when the
token after the dedicated arm would continue the name covers it.
##########
src/parser/mod.rs:
##########
@@ -9690,7 +9690,9 @@ impl<'a> Parser<'a> {
| Keyword::GENERATED
| Keyword::AS
),
- _ => true, // e.g. comma immediately after column name
+ // A single-quoted string is a valid type name in SQLite's ids
grammar.
+ Token::SingleQuotedString(_) => false,
Review Comment:
`CREATE TABLE t (a NULL, b INT)` is an untyped column with a `NULL`
constraint in sqlite 3.46 (`pragma_table_info` type is empty) but parses here
as `Custom(NULL)`; `Keyword::NULL` is missing from this list although the
continuation stop set in `parse_multiword_type_name` has it.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]