]> granicus.if.org Git - postgresql/commitdiff
Throw error sooner for unlogged GiST indexes.
authorTom Lane <tgl@sss.pgh.pa.us>
Wed, 8 Feb 2012 21:19:31 +0000 (16:19 -0500)
committerTom Lane <tgl@sss.pgh.pa.us>
Wed, 8 Feb 2012 21:19:31 +0000 (16:19 -0500)
Throwing an error only after we've built the main index fork is pretty
unfriendly when the table already contains data.  Per gripe from Jay
Levitt.

src/backend/access/gist/gist.c

index 4e732d1d8570f6c880d1e15b38f798b14fa8cff2..61be9dbf230e9d2e5ea291c1f6ff061bb73e1dc8 100644 (file)
@@ -113,6 +113,16 @@ gistbuild(PG_FUNCTION_ARGS)
                elog(ERROR, "index \"%s\" already contains data",
                         RelationGetRelationName(index));
 
+       /*
+        * We can't yet handle unlogged GiST indexes, because we depend on LSNs.
+        * This is duplicative of an error in gistbuildempty, but we want to check
+        * here so as to throw error before doing all the index-build work.
+        */
+       if (heap->rd_rel->relpersistence == RELPERSISTENCE_UNLOGGED)
+               ereport(ERROR,
+                               (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+                                errmsg("unlogged GiST indexes are not supported")));
+
        /* no locking is needed */
        initGISTstate(&buildstate.giststate, index);