Skip to content

Support for UDFs with RETURNS TABLE#2198

Merged
fulghum merged 6 commits intomainfrom
fulghum/returns-table
Jan 28, 2026
Merged

Support for UDFs with RETURNS TABLE#2198
fulghum merged 6 commits intomainfrom
fulghum/returns-table

Conversation

@fulghum
Copy link
Copy Markdown
Contributor

@fulghum fulghum commented Jan 13, 2026

No description provided.

@fulghum fulghum force-pushed the fulghum/returns-table branch from 600bb41 to 3b4bcc6 Compare January 13, 2026 21:52
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Jan 13, 2026

Main PR
covering_index_scan_postgres 581.91/s 576.10/s -1.0%
index_join_postgres 118.96/s 119.63/s +0.5%
index_join_scan_postgres 181.21/s 180.57/s -0.4%
index_scan_postgres 11.40/s 11.39/s -0.1%
oltp_point_select 2372.87/s 2295.48/s -3.3%
oltp_read_only 1718.61/s 1703.70/s -0.9%
select_random_points 109.33/s 105.62/s -3.4%
select_random_ranges 429.64/s 436.02/s +1.4%
table_scan_postgres 11.28/s 11.13/s -1.4%
types_table_scan_postgres 5.20/s 5.10/s -2.0%

@fulghum fulghum force-pushed the fulghum/returns-table branch from 3b4bcc6 to ae5b5c5 Compare January 13, 2026 22:03
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Jan 13, 2026

Main PR
Total 42090 42090
Successful 17565 17567
Failures 24525 24523
Partial Successes1 5583 5582
Main PR
Successful 41.7320% 41.7368%
Failures 58.2680% 58.2632%

${\color{red}Regressions (1)}$

rangefuncs

QUERY:          SELECT * FROM rngfunc() GROUP BY 1;
RECEIVED ERROR: expected []RecordValue, but got string (errno 1105) (sqlstate HY000)

${\color{lightgreen}Progressions (2)}$

arrays

QUERY: select unnest(array[1,2,3,4.5]::float8[]);
QUERY: select unnest(array[1,2,3,4.5]::numeric[]);

Footnotes

  1. These are tests that we're marking as Successful, however they do not match the expected output in some way. This is due to small differences, such as different wording on the error messages, or the column names being incorrect while the data itself is correct.

@fulghum fulghum force-pushed the fulghum/returns-table branch from ae5b5c5 to 8a4fcfa Compare January 13, 2026 23:06
@fulghum fulghum marked this pull request as ready for review January 14, 2026 02:12
@fulghum
Copy link
Copy Markdown
Contributor Author

fulghum commented Jan 27, 2026

The regression called out is when executing this SQL function:

CREATE OR REPLACE FUNCTION rngfunc()
          RETURNS TABLE(a varchar(5))
          AS $$ SELECT 'hello'::varchar(5) $$ LANGUAGE sql STABLE;

Doltgres was previously executing this without an error, but not correctly – it declares it returns an anonymous composite type composed of one varchar(5) but returns a varchar(5) directly, not a record. This new code correctly recognizes the return type as an anonymous composite, so when the SQL function doesn't return a record, we now get an error.

The follow up fix for this is to look at our SQL function code and have it support returning anonymous composites.

@fulghum fulghum requested a review from Hydrocharged January 27, 2026 00:45
Copy link
Copy Markdown
Collaborator

@Hydrocharged Hydrocharged left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@fulghum fulghum force-pushed the fulghum/returns-table branch 2 times, most recently from 98545b3 to 5fe956f Compare January 27, 2026 21:10
@fulghum fulghum force-pushed the fulghum/returns-table branch from 5fe956f to 92b19e9 Compare January 27, 2026 22:40
@fulghum fulghum merged commit 4969f87 into main Jan 28, 2026
19 of 20 checks passed
@fulghum fulghum deleted the fulghum/returns-table branch January 28, 2026 16:56
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.

2 participants