fmguerreiro opened a new pull request, #2314:
URL: https://github.com/apache/datafusion-sqlparser-rs/pull/2314
## Summary
Adds parser support for four PostgreSQL catalog DDL statements that
currently fail to parse:
**CREATE CAST** (pgmold-89)
- `CREATE CAST (src AS dst) WITH FUNCTION func(arg_types) [AS ASSIGNMENT |
AS IMPLICIT]`
- `CREATE CAST (src AS dst) WITHOUT FUNCTION [AS ASSIGNMENT | AS IMPLICIT]`
- `CREATE CAST (src AS dst) WITH INOUT [AS ASSIGNMENT | AS IMPLICIT]`
**CREATE CONVERSION** (pgmold-91)
- `CREATE CONVERSION name FOR 'encoding' TO 'encoding' FROM function`
- `CREATE DEFAULT CONVERSION name FOR 'encoding' TO 'encoding' FROM function`
**CREATE LANGUAGE** (pgmold-92)
- `CREATE [OR REPLACE] [TRUSTED] [PROCEDURAL] LANGUAGE name`
- Optional `HANDLER func`, `INLINE func`, `VALIDATOR func` clauses
- `NO VALIDATOR` is handled (parsed as absent validator)
**CREATE RULE** (pgmold-93)
- `CREATE RULE name AS ON {SELECT|INSERT|UPDATE|DELETE} TO table [WHERE
cond] DO {ALSO|INSTEAD} {NOTHING|stmt|(stmt; ...)}`
## Changes
- `src/keywords.rs`: add ALSO, ASSIGNMENT, CONVERSION, IMPLICIT, INLINE,
PROCEDURAL, TRUSTED
- `src/ast/ddl.rs`: add `CreateCast`, `CastFunctionKind`, `CastContext`,
`CreateConversion`, `CreateLanguage`, `CreateRule`, `RuleEvent`, `RuleAction`
with Display and From impls
- `src/ast/mod.rs`: re-export new types, add Statement variants and Display
arms
- `src/ast/spans.rs`: add `Span::empty()` arms for new variants
- `src/parser/mod.rs`: dispatch in `parse_create`, add four parse functions
- `tests/sqlparser_postgres.rs`: round-trip tests using
`pg().verified_stmt(sql)` for all variants
## Notes
Fork CI does not run automatically (known quirk); correctness is verified
via inline tests. No Cargo.toml version bump — left at 0.60.9 per convention.
--
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]