1
0
mirror of https://github.com/postgres/postgres.git synced 2025-06-11 20:28:21 +03:00

Add CINE option for CREATE TABLE AS and CREATE MATERIALIZED VIEW

Fabrízio de Royes Mello reviewed by Rushabh Lathia.
This commit is contained in:
Andrew Dunstan
2014-12-13 13:56:09 -05:00
parent e311cd6ded
commit e39b6f953e
11 changed files with 90 additions and 2 deletions

View File

@ -28,6 +28,7 @@
#include "access/sysattr.h"
#include "access/xact.h"
#include "access/xlog.h"
#include "catalog/namespace.h"
#include "catalog/toasting.h"
#include "commands/createas.h"
#include "commands/matview.h"
@ -86,6 +87,22 @@ ExecCreateTableAs(CreateTableAsStmt *stmt, const char *queryString,
QueryDesc *queryDesc;
ScanDirection dir;
if (stmt->if_not_exists)
{
Oid nspid;
nspid = RangeVarGetCreationNamespace(stmt->into->rel);
if (get_relname_relid(stmt->into->rel->relname, nspid))
{
ereport(NOTICE,
(errcode(ERRCODE_DUPLICATE_TABLE),
errmsg("relation \"%s\" already exists, skipping",
stmt->into->rel->relname)));
return InvalidOid;
}
}
/*
* Create the tuple receiver object and insert info it will need
*/