sql-parser-cst
sql-parser-cst copied to clipboard
PostgreSQL: cast operator support polishing
We do not support yet:
- quoted cast often needed when using enums defined in camelcase (some ORMs do that...)
- double/more cast for example needed when doing complicated date manipulation
https://nene.github.io/sql-explorer/
SELECT
id, name, address::"text" AS addr
FROM
customer
WHERE
customer.due_date > NOW()
ORDER BY
name DESC
Syntax Error: Unexpected "\""
Was expecting to see: "BIT", "CHARACTER", "DOUBLE", "INTERVAL", [A-Z,a-z,_,\x80-], [A-Z,a-z,_], or whitespace
--> undefined:3:22
|
3 | id, name, address::"text"::localtime AS addr
| ^
-- example SQL
SELECT
id, name, address::text::localtime AS addr
FROM
customer
WHERE
customer.due_date > NOW()
ORDER BY
name DESC
Syntax Error: Unexpected ":"
Was expecting to see: "!", "!=", "!~", "!~*", "!~~", "!~~*", "#", "#-", "#>", "#>>", "$", "$$", "%", "&", "'", "(", "*", "+", ",", "-", "->", "->>", "/", ";", "<", "<<", "<=", "<>", "<@", "=", ">", ">=", ">>", "?", "?&", "?|", "@", "@>", "@?", "@@", "AND", "AS", "AT", "BETWEEN", "COLLATE", "E", "EXCEPT", "FETCH", "FOR", "FROM", "GROUP", "HAVING", "ILIKE", "IN", "INTERSECT", "INTO", "IS", "ISNULL", "LIKE", "LIMIT", "NOT", "NOTNULL", "OFFSET", "OPERATOR", "OR", "ORDER", "SIMILAR", "U&", "UNION", "WHERE", "WINDOW", "WITH", "WITHOUT", "[", "^", "^@", "`", "|", "|/", "||", "||/", "~", "~*", "~~", "~~*", [0-9], [A-Z,a-z,_,\x80-], [A-Z,a-z,_], end of input, identifier, or whitespace
--> undefined:3:26
|
3 | id, name, address::text::localtime AS addr
| ^