preston-footprint opened a new issue, #2962:
URL: https://github.com/apache/datafusion-sqlparser-rs/issues/2962
Redshift, like Postgres, accepts the generic typed-literal form `type
'string'` for any type name. sqlparser parses it as a typed string only for
types it knows, such as `regclass`. For other type names it reads the type as a
column and the string as an alias.
```sql
select regtype 'int4'
```
- sqlparser 0.64.0: `ExprWithAlias { expr: Identifier("regtype"), alias:
Ident { value: "int4", quote_style: Some('\'') } }`, i.e. the column `regtype`
aliased as `'int4'`.
- Redshift: one row, `integer`, i.e. the literal `'int4'` cast to `regtype`.
Other forms behave the same way: `select "regtype" 'int4'` returns `integer`
and `select regproc 'version'` returns `version` on Redshift, while sqlparser
parses both as aliased columns. `select regclass 'pg_user'` already parses as a
typed string because sqlparser has a `Regclass` data type.
Postgres documents the syntax under "Constants of Other Types"
(https://www.postgresql.org/docs/8.0/sql-syntax.html#SQL-SYNTAX-CONSTANTS-GENERIC),
and Redshift is based on PostgreSQL 8.0.2
(https://docs.aws.amazon.com/redshift/latest/dg/c_redshift-and-postgres-sql.html).
--
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]