Skip to content

Conversation

@LucaCappelletti94
Copy link
Contributor

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

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.)

CREATE TYPE complex (INPUT = in_fn, OUTPUT = out_fn, INTERNALLENGTH = 16);

Simple Declarations - Parse type shells without representation

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant