test.patch

text/plain

Filename: test.patch
Type: text/plain
Part: 0
Message: Re: Large expressions in indexes can't be stored (non-TOASTable)

Patch

Format: unified
File+
src/test/regress/expected/misc_sanity.out 25 0
src/test/regress/sql/misc_sanity.sql 20 0
diff --git a/src/test/regress/expected/misc_sanity.out b/src/test/regress/expected/misc_sanity.out
index 45e7492877..2af66cf648 100644
--- a/src/test/regress/expected/misc_sanity.out
+++ b/src/test/regress/expected/misc_sanity.out
@@ -60,6 +60,31 @@ ORDER BY 1, 2;
  pg_largeobject_metadata | lomacl        | aclitem[]
 (9 rows)
 
+-- **************** pg_index ****************
+-- Look for system indexes that use varlena columns in pg_index.  There
+-- shouldn't be any to avoid circularity hazards with pg_index's TOAST table.
+--
+-- The first query returns the varlena columns in pg_index.  Each should be
+-- listed in the second query's WHERE clause.
+SELECT attname
+FROM pg_attribute
+WHERE attstorage != 'p' AND
+      attrelid = 'pg_catalog.pg_index'::regclass
+ORDER BY 1;
+ attname  
+----------
+ indexprs
+ indpred
+(2 rows)
+
+SELECT relname
+FROM pg_class c JOIN pg_index i ON indexrelid = c.oid
+WHERE c.oid < 16384 AND
+      (i.indexprs IS NOT NULL OR i.indpred IS NOT NULL);
+ relname 
+---------
+(0 rows)
+
 -- system catalogs without primary keys
 --
 -- Current exceptions:
diff --git a/src/test/regress/sql/misc_sanity.sql b/src/test/regress/sql/misc_sanity.sql
index 16f3a7c0c1..3e87c50b84 100644
--- a/src/test/regress/sql/misc_sanity.sql
+++ b/src/test/regress/sql/misc_sanity.sql
@@ -53,6 +53,26 @@ WHERE c.oid < 16384 AND
 ORDER BY 1, 2;
 
 
+-- **************** pg_index ****************
+
+-- Look for system indexes that use varlena columns in pg_index.  There
+-- shouldn't be any to avoid circularity hazards with pg_index's TOAST table.
+--
+-- The first query returns the varlena columns in pg_index.  Each should be
+-- listed in the second query's WHERE clause.
+
+SELECT attname
+FROM pg_attribute
+WHERE attstorage != 'p' AND
+      attrelid = 'pg_catalog.pg_index'::regclass
+ORDER BY 1;
+
+SELECT relname
+FROM pg_class c JOIN pg_index i ON indexrelid = c.oid
+WHERE c.oid < 16384 AND
+      (i.indexprs IS NOT NULL OR i.indpred IS NOT NULL);
+
+
 -- system catalogs without primary keys
 --
 -- Current exceptions: