diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2022-05-09 14:15:37 -0400 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2022-05-09 14:15:37 -0400 |
commit | 91a3a74c65f4094420b28c393ac1d38af8ae4c4a (patch) | |
tree | ad9de71a94f9301ba56f36a18d2d750d7b2a47cb /src/test | |
parent | 7f0754bc4c0a0abadcbe02e886e31305c37a7053 (diff) |
Fix core dump in transformValuesClause when there are no columns.
The parser code that transformed VALUES from row-oriented to
column-oriented lists failed if there were zero columns.
You can't write that straightforwardly (though probably you
should be able to), but the case can be reached by expanding
a "tab.*" reference to a zero-column table.
Per bug #17477 from Wang Ke. Back-patch to all supported branches.
Discussion: https://postgr.es/m/17477-0af3c6ac6b0a6ae0@postgresql.org
Diffstat (limited to 'src/test')
-rw-r--r-- | src/test/regress/expected/select.out | 7 | ||||
-rw-r--r-- | src/test/regress/sql/select.sql | 5 |
2 files changed, 12 insertions, 0 deletions
diff --git a/src/test/regress/expected/select.out b/src/test/regress/expected/select.out index c441049f413..6dcd4fa8f32 100644 --- a/src/test/regress/expected/select.out +++ b/src/test/regress/expected/select.out @@ -517,6 +517,13 @@ TABLE int8_tbl; 4567890123456789 | -4567890123456789 (9 rows) +-- corner case: VALUES with no columns +CREATE TEMP TABLE nocols(); +INSERT INTO nocols DEFAULT VALUES; +SELECT * FROM nocols n, LATERAL (VALUES(n.*)) v; +-- +(1 row) + -- -- Test ORDER BY options -- diff --git a/src/test/regress/sql/select.sql b/src/test/regress/sql/select.sql index b5929b2eca6..d6f42aa0d41 100644 --- a/src/test/regress/sql/select.sql +++ b/src/test/regress/sql/select.sql @@ -148,6 +148,11 @@ SELECT 2+2, 57 UNION ALL TABLE int8_tbl; +-- corner case: VALUES with no columns +CREATE TEMP TABLE nocols(); +INSERT INTO nocols DEFAULT VALUES; +SELECT * FROM nocols n, LATERAL (VALUES(n.*)) v; + -- -- Test ORDER BY options -- |