Repository navigation
Run set-returning functions in the target list - #228
Merged
Merged
Conversation
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.
Part of #3.
This change lets a query call a set-returning function in its target list, as the
ProjectSetnode of PostgreSQL does. The viewpg_stats_ext_exprsand the body of_pg_expandarrayininformation_schemaneed this, and client tools often send such queries.What changes
check_srf_placementgives the error of PostgreSQL for a call inWHERE,HAVING,FILTER,LIMIT,OFFSET,VALUES, aJOINcondition, a default, a check, an index and the parameters ofEXECUTE.CASEorCOALESCE, and a call inside the arguments of an aggregate, gives the error of PostgreSQL with its hint and position.split_pathtarget_at_srfsdoes. A call is one level above the highest call in its arguments.HAVING, and beforeORDER BY,DISTINCTandLIMIT.OUTparameter gives a row value.EXISTSof such a subquery, as PostgreSQL does.pg_stats_ext_exprsis now in the catalog with the OID of PostgreSQL 19, so all the views ofsystem_views.sqlare there. It needsrow_security_activeandpg_get_statisticsobjdef_expressions, which this change adds withpg_get_statisticsobjdefandpg_get_statisticsobjdef_columns. rupg has no objects of extended statistics, so these give null.pg_get_viewdefdoes not put parentheses around a field before a subscript, asruleutils.cdoes.GROUP BYand a call that gives a record with a polymorphicOUTtype give the error0A000for now.Test
target_srfruns a script and compares the result with the output of PostgreSQL 19 for the same script in a new database. It covers single calls, calls side by side, nested calls, calls inside expressions, strict calls with a null argument, aggregates,HAVING,ORDER BY,DISTINCT ON,LIMIT, subqueries,EXISTS,IN, row values and each error of a call in a wrong place.system_viewsnow coverspg_stats_ext_exprswith its definition, androw_security_activeand the functions of extended statistics with each error. The expected output is from PostgreSQL 19.