aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2012-02-08 16:19:27 -0500
committerTom Lane <tgl@sss.pgh.pa.us>2012-02-08 16:19:27 -0500
commit331bf6712c71a1c110bc52423eede8b4bac221a1 (patch)
tree28bb602412cd779c8a22a5638097be1e52b187a0
parentd77354eaec53ed469a6f2444813ff3a4fd9d7a48 (diff)
downloadpostgresql-331bf6712c71a1c110bc52423eede8b4bac221a1.tar.gz
postgresql-331bf6712c71a1c110bc52423eede8b4bac221a1.zip
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.
-rw-r--r--src/backend/access/gist/gistbuild.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/backend/access/gist/gistbuild.c b/src/backend/access/gist/gistbuild.c
index 021a8dcf44b..3dc3e96df4d 100644
--- a/src/backend/access/gist/gistbuild.c
+++ b/src/backend/access/gist/gistbuild.c
@@ -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);