feat: support typed result columns in PostgreSQL ROWS FROM - #2648
Merged
manticore-projects merged 2 commits intoSep 20, 2026
Merged
manticore-projects merged 2 commits into
manticore-projects merged 2 commits into
Conversation
Contributor
|
Nice, thank you much! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PostgreSQL allows each record-returning function in
ROWS FROMto declare its own result columns, for exampleROWS FROM (json_to_recordset('[{"a":1}]') AS (a integer)) WITH ORDINALITY. This currently fails to parse.Attach typed result-column definitions to their Function nodes through
getResultColumnDefinitions(), reusing ColumnDefinition, ColDataType and structured COLLATE options. The existing mutable ROWS FROM function list and outer alias/ordinality remain intact, so moving functions also moves their definitions. A dedicated production accepts column names, types and optional collations without accepting table constraints.Share result-column rendering between Function and its deparser, and route TableFunction arguments through the supplied expression visitor. This supports AST edits and custom expression rewriting inside ordinary and ROWS FROM table functions.
Validation: Gradle
checkpassed (7500 tests, 0 failures, 0 errors, 25 skipped), including grammar and static checks. Mavenclean verifyalso passed (7482 tests, 0 failures, 0 errors, 25 skipped). PostgreSQL 18.6 accepted all 12 positive fixtures and both rendered forms (36 executions), and rejected all eight negative fixtures. Positive and negative inputs are stored as TSV test data. Tests cover multiple functions, typed/untyped mixtures, lateral references, aliases, ordinality, numeric/array/time-zone types, collations, quoted names, mutable-list edits, custom deparsers and table discovery inside function arguments.Syntax reference: PostgreSQL table functions and ROWS FROM.