From: Tom Lane Date: Wed, 8 Feb 2012 21:19:31 +0000 (-0500) Subject: Throw error sooner for unlogged GiST indexes. X-Git-Tag: REL9_1_3~23 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=1e7d008bf899764f20b8f23bc182886f908277f9;p=postgresql Throw error sooner for unlogged GiST indexes. 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. --- diff --git a/src/backend/access/gist/gist.c b/src/backend/access/gist/gist.c index 4e732d1d85..61be9dbf23 100644 --- a/src/backend/access/gist/gist.c +++ b/src/backend/access/gist/gist.c @@ -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);