1
0
mirror of https://github.com/postgres/postgres.git synced 2025-08-22 21:53:06 +03:00

Replace pg_attribute.attisinherited with attislocal and attinhcount

columns, to allow more correct behavior in multiple-inheritance cases.
Patch by Alvaro Herrera, review by Tom Lane.
This commit is contained in:
Tom Lane
2002-09-22 19:42:52 +00:00
parent 634e440b58
commit c328b6dd8b
21 changed files with 578 additions and 293 deletions

View File

@@ -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.212 2002/09/18 21:35:20 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/nodes/copyfuncs.c,v 1.213 2002/09/22 19:42:51 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -1732,7 +1732,8 @@ _copyColumnDef(ColumnDef *from)
if (from->colname)
newnode->colname = pstrdup(from->colname);
Node_Copy(from, newnode, typename);
newnode->is_inherited = from->is_inherited;
newnode->inhcount = from->inhcount;
newnode->is_local = from->is_local;
newnode->is_not_null = from->is_not_null;
Node_Copy(from, newnode, raw_default);
if (from->cooked_default)

View File

@@ -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.159 2002/09/18 21:35:20 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/nodes/equalfuncs.c,v 1.160 2002/09/22 19:42:51 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -1769,7 +1769,9 @@ _equalColumnDef(ColumnDef *a, ColumnDef *b)
return false;
if (!equal(a->typename, b->typename))
return false;
if (a->is_inherited != b->is_inherited)
if (a->inhcount != b->inhcount)
return false;
if (a->is_local != b->is_local)
return false;
if (a->is_not_null != b->is_not_null)
return false;

View File

@@ -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.174 2002/09/18 21:35:21 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/nodes/outfuncs.c,v 1.175 2002/09/22 19:42:51 tgl Exp $
*
* NOTES
* Every (plan) node in POSTGRES has an associated "out" routine which
@@ -176,8 +176,9 @@ _outColumnDef(StringInfo str, ColumnDef *node)
_outToken(str, node->colname);
appendStringInfo(str, " :typename ");
_outNode(str, node->typename);
appendStringInfo(str, " :is_inherited %s :is_not_null %s :raw_default ",
booltostr(node->is_inherited),
appendStringInfo(str, " :inhcount %d :is_local %s :is_not_null %s :raw_default ",
node->inhcount,
booltostr(node->is_local),
booltostr(node->is_not_null));
_outNode(str, node->raw_default);
appendStringInfo(str, " :cooked_default ");

View File

@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/nodes/readfuncs.c,v 1.133 2002/09/18 21:35:21 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/nodes/readfuncs.c,v 1.134 2002/09/22 19:42:51 tgl Exp $
*
* NOTES
* Most of the read functions for plan nodes are tested. (In fact, they
@@ -1526,9 +1526,13 @@ _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 :inhcount */
token = pg_strtok(&length); /* get :inhcount */
local_node->inhcount = atoi(token);
token = pg_strtok(&length); /* eat :is_local */
token = pg_strtok(&length); /* get :is_local */
local_node->is_local = strtobool(token);
token = pg_strtok(&length); /* eat :is_not_null */
token = pg_strtok(&length); /* get :is_not_null */