]> git.ipfire.org Git - thirdparty/postgresql.git/commitdiff
Add a test for creating an index on a whole-row expression.
authorRobert Haas <rhaas@postgresql.org>
Tue, 24 Mar 2026 14:06:38 +0000 (10:06 -0400)
committerRobert Haas <rhaas@postgresql.org>
Tue, 24 Mar 2026 14:06:46 +0000 (10:06 -0400)
Surprisingly, we have no existing test for this. Had this test
been present before commit 570e2fcc041a55ba8991a640cc3f3f0e122feac3
the Assert added in commit c98ad086ad9b1ca9dbb2725f246298fa8450d82f
would have caught the bug.

Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: http://postgr.es/m/CA+TgmoacixUZVvi00hOjk_d9B4iYKswWP1gNqQ8Vfray-AcOCA@mail.gmail.com

src/test/regress/expected/indexing.out
src/test/regress/sql/indexing.sql

index dc629928c8fa9027d9bbf0524a0ab25b0f486656..f50868ca6a6b80d2c1c7a3aa144e6ca2e1076fea 100644 (file)
@@ -1669,3 +1669,14 @@ reindex index test_pg_index_toast_index;
 drop index test_pg_index_toast_index;
 drop function test_pg_index_toast_func;
 drop table test_pg_index_toast_table;
+-- test creation of an index involving a whole-row expression
+create table test_pg_wholerow_index (a int, b text, c numeric);
+create or replace function row_image(test_pg_wholerow_index)
+    returns test_pg_wholerow_index as $$select $1$$ language sql immutable;
+insert into test_pg_wholerow_index values (1, 'multiplication', 1.0);
+create index row_image_index
+    on test_pg_wholerow_index ((row_image(test_pg_wholerow_index)));
+insert into test_pg_wholerow_index values (2, 'addition', 0);
+drop index row_image_index;
+drop function row_image(test_pg_wholerow_index);
+drop table test_pg_wholerow_index;
index b5cb01c2d7097cb95b833fd0d92d2a99b53f81b8..129130d04d4e13e1f7002929575f3b2c97a27091 100644 (file)
@@ -934,3 +934,15 @@ reindex index test_pg_index_toast_index;
 drop index test_pg_index_toast_index;
 drop function test_pg_index_toast_func;
 drop table test_pg_index_toast_table;
+
+-- test creation of an index involving a whole-row expression
+create table test_pg_wholerow_index (a int, b text, c numeric);
+create or replace function row_image(test_pg_wholerow_index)
+    returns test_pg_wholerow_index as $$select $1$$ language sql immutable;
+insert into test_pg_wholerow_index values (1, 'multiplication', 1.0);
+create index row_image_index
+    on test_pg_wholerow_index ((row_image(test_pg_wholerow_index)));
+insert into test_pg_wholerow_index values (2, 'addition', 0);
+drop index row_image_index;
+drop function row_image(test_pg_wholerow_index);
+drop table test_pg_wholerow_index;