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:
@ -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
|
||||
*/
|
||||
|
Reference in New Issue
Block a user