LucaCappelletti94 opened a new pull request, #2094: URL: https://github.com/apache/datafusion-sqlparser-rs/pull/2094
Adds full parsing for all PostgreSQL `CREATE TYPE` statement variants. Previously only composite and enum types were supported. ## What's New **Range Types** - Parse range type definitions with 6 configuration options ```sql CREATE TYPE int4range AS RANGE (SUBTYPE = int4, CANONICAL = fn); ``` **Base Types** - Parse low-level type definitions with 19 options (INPUT/OUTPUT functions, ALIGNMENT, STORAGE, etc.) ```sql CREATE TYPE complex (INPUT = in_fn, OUTPUT = out_fn, INTERNALLENGTH = 16); ``` **Simple Declarations** - Parse type shells without representation ```sql CREATE TYPE typename; ``` The AST extends `UserDefinedTypeRepresentation` with three new variants (`Range`, `SqlDefinition`, `None`) and adds five supporting enums (`UserDefinedTypeRangeOption`, `UserDefinedTypeSqlDefinitionOption`, `Alignment`, `UserDefinedTypeStorage`, `UserDefinedTypeInternalLength`) with comprehensive rustdoc. The parser refactors `parse_create_type()` into modular functions (`parse_create_type_composite()`, `parse_create_type_range()`, and base type option parsers) that handle all PostgreSQL type configuration syntax. Tests provide comprehensive coverage with explicit AST verification for all variants and edge cases. Added 17 PostgreSQL-specific keywords, necessary to parse the keywords used in the type options (ALIGNMENT, CANONICAL, INTERNALLENGTH, PASSEDBYVALUE, RECEIVE, SEND, STORAGE, SUBTYPE, TYPMOD_IN, etc.). Closes issue #2092 -- 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]
