diff options
author | Fujii Masao <fujii@postgresql.org> | 2014-11-06 18:48:33 +0900 |
---|---|---|
committer | Fujii Masao <fujii@postgresql.org> | 2014-11-06 18:48:33 +0900 |
commit | 08309aaf74ee879699165ec8a2d53e56f2d2e947 (patch) | |
tree | 81f6326b3d2f6b47d6d4a2a50494e82709dcf534 /src/backend/commands/indexcmds.c | |
parent | 171c377a0abe12d1418540dc154feccd9355995e (diff) | |
download | postgresql-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.c | 9 |
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) |