mirror of
https://github.com/postgres/postgres.git
synced 2025-04-24 10:47:04 +03:00
Hack parse_coerce so it won't try to constant-fold the dummy Const
nodes introduced by make_subplan(). It'd be better if we used a different node type for subplan result placeholders, but for now...
This commit is contained in:
parent
9da6d2c0e7
commit
dadb14fa60
@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $Header: /cvsroot/pgsql/src/backend/parser/parse_coerce.c,v 2.39 2000/03/20 15:42:45 momjian Exp $
|
* $Header: /cvsroot/pgsql/src/backend/parser/parse_coerce.c,v 2.40 2000/03/23 07:36:03 tgl Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -38,8 +38,9 @@ coerce_type(ParseState *pstate, Node *node, Oid inputTypeId,
|
|||||||
{
|
{
|
||||||
Node *result;
|
Node *result;
|
||||||
|
|
||||||
if (targetTypeId == InvalidOid ||
|
if (targetTypeId == inputTypeId ||
|
||||||
targetTypeId == inputTypeId)
|
targetTypeId == InvalidOid ||
|
||||||
|
node == NULL)
|
||||||
{
|
{
|
||||||
/* no conversion needed */
|
/* no conversion needed */
|
||||||
result = node;
|
result = node;
|
||||||
@ -141,8 +142,13 @@ coerce_type(ParseState *pstate, Node *node, Oid inputTypeId,
|
|||||||
*
|
*
|
||||||
* Note that no folding will occur if the conversion function is
|
* Note that no folding will occur if the conversion function is
|
||||||
* not marked 'iscachable'.
|
* not marked 'iscachable'.
|
||||||
|
*
|
||||||
|
* HACK: if constant is NULL, don't fold it here. This is needed
|
||||||
|
* by make_subplan(), which calls this routine on placeholder Const
|
||||||
|
* nodes that mustn't be collapsed. (It'd be a lot cleaner to make
|
||||||
|
* a separate node type for that purpose...)
|
||||||
*/
|
*/
|
||||||
if (IsA(node, Const))
|
if (IsA(node, Const) && ! ((Const *) node)->constisnull)
|
||||||
result = eval_const_expressions(result);
|
result = eval_const_expressions(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -614,7 +620,6 @@ PromoteLesserType(Oid inType1, Oid inType2, Oid *newType1, Oid *newType2)
|
|||||||
{
|
{
|
||||||
case (BPCHAROID):
|
case (BPCHAROID):
|
||||||
case (VARCHAROID):
|
case (VARCHAROID):
|
||||||
case (BYTEA):
|
|
||||||
case (TEXTOID):
|
case (TEXTOID):
|
||||||
|
|
||||||
case (INT2OID):
|
case (INT2OID):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user