aboutsummaryrefslogtreecommitdiff
path: root/src/backend/commands/indexcmds.c
diff options
context:
space:
mode:
authorFujii Masao <fujii@postgresql.org>2014-11-06 18:48:33 +0900
committerFujii Masao <fujii@postgresql.org>2014-11-06 18:48:33 +0900
commit08309aaf74ee879699165ec8a2d53e56f2d2e947 (patch)
tree81f6326b3d2f6b47d6d4a2a50494e82709dcf534 /src/backend/commands/indexcmds.c
parent171c377a0abe12d1418540dc154feccd9355995e (diff)
downloadpostgresql-08309aaf74ee879699165ec8a2d53e56f2d2e947.tar.gz
postgresql-08309aaf74ee879699165ec8a2d53e56f2d2e947.zip
Implement IF NOT EXIST for CREATE INDEX.
Fabrízio de Royes Mello, reviewed by Marti Raudsepp, Adam Brightwell and me.
Diffstat (limited to 'src/backend/commands/indexcmds.c')
-rw-r--r--src/backend/commands/indexcmds.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/backend/commands/indexcmds.c b/src/backend/commands/indexcmds.c
index 3c1e90eb0e9..02055950b58 100644
--- a/src/backend/commands/indexcmds.c
+++ b/src/backend/commands/indexcmds.c
@@ -610,7 +610,14 @@ DefineIndex(Oid relationId,
stmt->isconstraint, stmt->deferrable, stmt->initdeferred,
allowSystemTableMods,
skip_build || stmt->concurrent,
- stmt->concurrent, !check_rights);
+ stmt->concurrent, !check_rights,
+ stmt->if_not_exists);
+
+ if (!OidIsValid(indexRelationId))
+ {
+ heap_close(rel, NoLock);
+ return indexRelationId;
+ }
/* Add any requested comment */
if (stmt->idxcomment != NULL)