1
0
mirror of https://github.com/postgres/postgres.git synced 2025-11-07 19:06:32 +03:00

Improve the implementation of information_schema._pg_expandarray().

This function was originally coded with a handmade expansion
of the array subscripts.  We can do it a little faster and far
more legibly today, by using unnest() WITH ORDINALITY.

While at it, let's apply the rowcount estimation support that exists
for the underlying unnest() function: reduce the default ROWS estimate
to 100 and attach array_unnest_support.  I'm not sure that
array_unnest_support can do anything useful today with the call sites
that exist in information_schema, but it can't hurt, and the existing
default rowcount of 1000 is surely much too high for any of these
cases.

The psql.sql regression script is using _pg_expandarray() as a
test case for \sf+.  While we could keep doing so, the new one-line
function body makes a poor test case for \sf+ row-numbering, so
switch it to print another information_schema function.

Discussion: https://postgr.es/m/1424303.1703355485@sss.pgh.pa.us
This commit is contained in:
Tom Lane
2023-12-27 15:55:46 -05:00
parent 6c361d323b
commit 58054de2d0
5 changed files with 30 additions and 26 deletions

View File

@@ -1312,8 +1312,8 @@ rollback;
drop role regress_psql_user;
-- check \sf
\sf information_schema._pg_expandarray
\sf+ information_schema._pg_expandarray
\sf information_schema._pg_index_position
\sf+ information_schema._pg_index_position
\sf+ interval_pl_time
\sf ts_debug(text)
\sf+ ts_debug(text)