aboutsummaryrefslogtreecommitdiff
path: root/src/backend/commands/tablecmds.c
diff options
context:
space:
mode:
authorRobert Haas <rhaas@postgresql.org>2010-07-25 23:21:22 +0000
committerRobert Haas <rhaas@postgresql.org>2010-07-25 23:21:22 +0000
commita3b012b560f8871e9c24abb24e28cabc6d3c92ea (patch)
tree26b6d7f182580269737c3d7c11365c933332e21f /src/backend/commands/tablecmds.c
parentedff75bef809629c197c27b23f57baa36330d12e (diff)
downloadpostgresql-a3b012b560f8871e9c24abb24e28cabc6d3c92ea.tar.gz
postgresql-a3b012b560f8871e9c24abb24e28cabc6d3c92ea.zip
CREATE TABLE IF NOT EXISTS.
Reviewed by Bernd Helmle.
Diffstat (limited to 'src/backend/commands/tablecmds.c')
-rw-r--r--src/backend/commands/tablecmds.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c
index c5981d4e5b2..2fdce989c01 100644
--- a/src/backend/commands/tablecmds.c
+++ b/src/backend/commands/tablecmds.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/commands/tablecmds.c,v 1.333 2010/07/23 20:04:18 petere Exp $
+ * $PostgreSQL: pgsql/src/backend/commands/tablecmds.c,v 1.334 2010/07/25 23:21:21 rhaas Exp $
*
*-------------------------------------------------------------------------
*/
@@ -548,8 +548,18 @@ DefineRelation(CreateStmt *stmt, char relkind)
stmt->oncommit,
reloptions,
true,
- allowSystemTableMods);
+ allowSystemTableMods,
+ stmt->if_not_exists);
+ /*
+ * If heap_create_with_catalog returns InvalidOid, it means that the user
+ * specified "IF NOT EXISTS" and the relation already exists. In that
+ * case we do nothing further.
+ */
+ if (relationId == InvalidOid)
+ return InvalidOid;
+
+ /* Store inheritance information for new rel. */
StoreCatalogInheritance(relationId, inheritOids);
/*