mirror of
https://github.com/postgres/postgres.git
synced 2025-08-22 21:53:06 +03:00
Add attisinherited column to pg_attribute; use it to guard against
column additions, deletions, and renames that would let a child table get out of sync with its parent. Patch by Alvaro Herrera, with some kibitzing by Tom Lane.
This commit is contained in:
@@ -15,7 +15,7 @@
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/nodes/copyfuncs.c,v 1.207 2002/08/27 04:55:07 tgl Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/nodes/copyfuncs.c,v 1.208 2002/08/30 19:23:19 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -1729,6 +1729,7 @@ _copyColumnDef(ColumnDef *from)
|
||||
if (from->colname)
|
||||
newnode->colname = pstrdup(from->colname);
|
||||
Node_Copy(from, newnode, typename);
|
||||
newnode->is_inherited = from->is_inherited;
|
||||
newnode->is_not_null = from->is_not_null;
|
||||
Node_Copy(from, newnode, raw_default);
|
||||
if (from->cooked_default)
|
||||
|
@@ -20,7 +20,7 @@
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/nodes/equalfuncs.c,v 1.155 2002/08/27 04:55:07 tgl Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/nodes/equalfuncs.c,v 1.156 2002/08/30 19:23:19 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -1748,6 +1748,8 @@ _equalColumnDef(ColumnDef *a, ColumnDef *b)
|
||||
return false;
|
||||
if (!equal(a->typename, b->typename))
|
||||
return false;
|
||||
if (a->is_inherited != b->is_inherited)
|
||||
return false;
|
||||
if (a->is_not_null != b->is_not_null)
|
||||
return false;
|
||||
if (!equal(a->raw_default, b->raw_default))
|
||||
|
@@ -5,7 +5,7 @@
|
||||
* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* $Header: /cvsroot/pgsql/src/backend/nodes/outfuncs.c,v 1.170 2002/08/29 00:17:04 tgl Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/nodes/outfuncs.c,v 1.171 2002/08/30 19:23:19 tgl Exp $
|
||||
*
|
||||
* NOTES
|
||||
* Every (plan) node in POSTGRES has an associated "out" routine which
|
||||
@@ -176,7 +176,8 @@ _outColumnDef(StringInfo str, ColumnDef *node)
|
||||
_outToken(str, node->colname);
|
||||
appendStringInfo(str, " :typename ");
|
||||
_outNode(str, node->typename);
|
||||
appendStringInfo(str, " :is_not_null %s :raw_default ",
|
||||
appendStringInfo(str, " :is_inherited %s :is_not_null %s :raw_default ",
|
||||
booltostr(node->is_inherited),
|
||||
booltostr(node->is_not_null));
|
||||
_outNode(str, node->raw_default);
|
||||
appendStringInfo(str, " :cooked_default ");
|
||||
|
@@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/nodes/readfuncs.c,v 1.129 2002/08/26 17:53:58 tgl Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/nodes/readfuncs.c,v 1.130 2002/08/30 19:23:19 tgl Exp $
|
||||
*
|
||||
* NOTES
|
||||
* Most of the read functions for plan nodes are tested. (In fact, they
|
||||
@@ -1485,6 +1485,10 @@ _readColumnDef(void)
|
||||
token = pg_strtok(&length); /* eat :typename */
|
||||
local_node->typename = nodeRead(true); /* now read it */
|
||||
|
||||
token = pg_strtok(&length); /* eat :is_inherited */
|
||||
token = pg_strtok(&length); /* get :is_inherited */
|
||||
local_node->is_inherited = strtobool(token);
|
||||
|
||||
token = pg_strtok(&length); /* eat :is_not_null */
|
||||
token = pg_strtok(&length); /* get :is_not_null */
|
||||
local_node->is_not_null = strtobool(token);
|
||||
|
Reference in New Issue
Block a user