]> 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:27 +0000 (16:19 -0500)
committerTom Lane <tgl@sss.pgh.pa.us>
Wed, 8 Feb 2012 21:19:27 +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/gistbuild.c

index 021a8dcf44b98539940ed08a0d4a9c41bce16c2d..3dc3e96df4d9c13833c8b1dc15a5a3e06f5078fc 100644 (file)
@@ -144,6 +144,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 */
        buildstate.giststate = initGISTstate(index);