1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-27 12:41:57 +03:00

Implement "WITH / WITHOID OIDS" clause for CREATE TABLE AS. This is

intended to allow application authors to insulate themselves from
changes to the default value of 'default_with_oids' in future releases
of PostgreSQL.

This patch also fixes a bug in the earlier implementation of the
'default_with_oids' GUC variable: code in gram.y should not examine
the value of GUC variables directly due to synchronization issues.
This commit is contained in:
Neil Conway
2004-01-10 23:28:45 +00:00
parent cf4c925dd4
commit 98dcf085e3
14 changed files with 185 additions and 58 deletions

View File

@ -6,7 +6,7 @@
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $PostgreSQL: pgsql/src/backend/parser/analyze.c,v 1.293 2004/01/05 20:58:58 neilc Exp $
* $PostgreSQL: pgsql/src/backend/parser/analyze.c,v 1.294 2004/01/10 23:28:45 neilc Exp $
*
*-------------------------------------------------------------------------
*/
@ -41,6 +41,7 @@
#include "utils/acl.h"
#include "utils/builtins.h"
#include "utils/fmgroids.h"
#include "utils/guc.h"
#include "utils/lsyscache.h"
#include "utils/relcache.h"
#include "utils/syscache.h"
@ -1974,6 +1975,21 @@ transformSelectStmt(ParseState *pstate, SelectStmt *stmt)
if (stmt->intoColNames)
applyColumnNames(qry->targetList, stmt->intoColNames);
switch (stmt->intoHasOids)
{
case MUST_HAVE_OIDS:
qry->intoHasOids = true;
break;
case MUST_NOT_HAVE_OIDS:
qry->intoHasOids = false;
break;
case DEFAULT_OIDS:
qry->intoHasOids = default_with_oids;
break;
}
/* mark column origins */
markTargetListOrigins(pstate, qry->targetList);