mirror of
https://github.com/postgres/postgres.git
synced 2025-11-10 17:42:29 +03:00
Instead of supposing (wrongly, in the general case) that the rowtype
of an inheritance child table is binary-compatible with the rowtype of its parent, invent an expression node type that does the conversion correctly. Fixes the new bug exhibited by Kris Shannon as well as a lot of old bugs that would only show up when using multiple inheritance or after altering the parent table.
This commit is contained in:
@@ -18,7 +18,7 @@
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/nodes/equalfuncs.c,v 1.232 2004/11/05 19:15:59 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/nodes/equalfuncs.c,v 1.233 2004/12/11 23:26:33 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -380,6 +380,24 @@ _equalRelabelType(RelabelType *a, RelabelType *b)
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool
|
||||
_equalConvertRowtypeExpr(ConvertRowtypeExpr *a, ConvertRowtypeExpr *b)
|
||||
{
|
||||
COMPARE_NODE_FIELD(arg);
|
||||
COMPARE_SCALAR_FIELD(resulttype);
|
||||
|
||||
/*
|
||||
* Special-case COERCE_DONTCARE, so that planner can build coercion
|
||||
* nodes that are equal() to both explicit and implicit coercions.
|
||||
*/
|
||||
if (a->convertformat != b->convertformat &&
|
||||
a->convertformat != COERCE_DONTCARE &&
|
||||
b->convertformat != COERCE_DONTCARE)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool
|
||||
_equalCaseExpr(CaseExpr *a, CaseExpr *b)
|
||||
{
|
||||
@@ -1844,6 +1862,9 @@ equal(void *a, void *b)
|
||||
case T_RelabelType:
|
||||
retval = _equalRelabelType(a, b);
|
||||
break;
|
||||
case T_ConvertRowtypeExpr:
|
||||
retval = _equalConvertRowtypeExpr(a, b);
|
||||
break;
|
||||
case T_CaseExpr:
|
||||
retval = _equalCaseExpr(a, b);
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user