diff options
| author | Tom Lane | 2024-01-05 19:32:34 +0000 |
|---|---|---|
| committer | Tom Lane | 2024-01-05 19:32:34 +0000 |
| commit | 43b46aae12b220b7eca8250c6c361083f35985a0 (patch) | |
| tree | d2f836af558bfad6399747af55dc53390d818fa7 /src/test | |
| parent | dbad1c53e92e364e2675f1246e443b95545d4070 (diff) | |
Clean up some edge cases in plpgsql's %TYPE parsing.
Support referencing a composite-type variable in %TYPE.
Remove the undocumented, untested, and pretty useless ability
to have the subject of %TYPE be an (unqualified) type name.
You get the same result by just not writing %TYPE.
Add or adjust some test cases to improve code coverage here.
Discussion: https://postgr.es/m/716852.1704402127@sss.pgh.pa.us
Diffstat (limited to 'src/test')
| -rw-r--r-- | src/test/regress/expected/plpgsql.out | 10 | ||||
| -rw-r--r-- | src/test/regress/sql/plpgsql.sql | 8 |
2 files changed, 9 insertions, 9 deletions
diff --git a/src/test/regress/expected/plpgsql.out b/src/test/regress/expected/plpgsql.out index 272f5d2111b..57c1ae092d5 100644 --- a/src/test/regress/expected/plpgsql.out +++ b/src/test/regress/expected/plpgsql.out @@ -5795,18 +5795,18 @@ SELECT * FROM get_from_partitioned_table(1) AS t; (1 row) CREATE OR REPLACE FUNCTION list_partitioned_table() -RETURNS SETOF partitioned_table.a%TYPE AS $$ +RETURNS SETOF public.partitioned_table.a%TYPE AS $$ DECLARE - row partitioned_table%ROWTYPE; - a_val partitioned_table.a%TYPE; + row public.partitioned_table%ROWTYPE; + a_val public.partitioned_table.a%TYPE; BEGIN - FOR row IN SELECT * FROM partitioned_table ORDER BY a LOOP + FOR row IN SELECT * FROM public.partitioned_table ORDER BY a LOOP a_val := row.a; RETURN NEXT a_val; END LOOP; RETURN; END; $$ LANGUAGE plpgsql; -NOTICE: type reference partitioned_table.a%TYPE converted to integer +NOTICE: type reference public.partitioned_table.a%TYPE converted to integer SELECT * FROM list_partitioned_table() AS t; t --- diff --git a/src/test/regress/sql/plpgsql.sql b/src/test/regress/sql/plpgsql.sql index 924d5240946..5a9b2f00402 100644 --- a/src/test/regress/sql/plpgsql.sql +++ b/src/test/regress/sql/plpgsql.sql @@ -4734,12 +4734,12 @@ END; $$ LANGUAGE plpgsql; SELECT * FROM get_from_partitioned_table(1) AS t; CREATE OR REPLACE FUNCTION list_partitioned_table() -RETURNS SETOF partitioned_table.a%TYPE AS $$ +RETURNS SETOF public.partitioned_table.a%TYPE AS $$ DECLARE - row partitioned_table%ROWTYPE; - a_val partitioned_table.a%TYPE; + row public.partitioned_table%ROWTYPE; + a_val public.partitioned_table.a%TYPE; BEGIN - FOR row IN SELECT * FROM partitioned_table ORDER BY a LOOP + FOR row IN SELECT * FROM public.partitioned_table ORDER BY a LOOP a_val := row.a; RETURN NEXT a_val; END LOOP; |
