mirror of
https://github.com/postgres/postgres.git
synced 2025-11-10 17:42:29 +03:00
Don't try to constant-fold functions returning RECORD. We were never
able to do this before, but I had tried to make an exception for functions with OUT parameters. Michael Fuhr found one problem with it already, and I found another, which was it didn't work for strict functions with a NULL input. While both of these could be worked around, the probability that there are more gotchas seems high; I think prudence dictates just reverting to the former behavior for now. Accordingly, remove the kluge added to get_expr_result_type() for Michael's case.
This commit is contained in:
@@ -7,7 +7,7 @@
|
||||
* Copyright (c) 2002-2005, PostgreSQL Global Development Group
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/utils/fmgr/funcapi.c,v 1.23 2005/05/30 23:09:07 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/utils/fmgr/funcapi.c,v 1.24 2005/07/03 21:14:18 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -235,36 +235,6 @@ get_expr_result_type(Node *expr,
|
||||
NULL,
|
||||
resultTypeId,
|
||||
resultTupleDesc);
|
||||
else if (expr && IsA(expr, Const) &&
|
||||
((Const *) expr)->consttype == RECORDOID &&
|
||||
!((Const *) expr)->constisnull)
|
||||
{
|
||||
/*
|
||||
* Pull embedded type info from a RECORD constant. We have to be
|
||||
* prepared to handle this case in the wake of constant-folding of
|
||||
* record-returning functions.
|
||||
*/
|
||||
HeapTupleHeader td;
|
||||
int32 typmod;
|
||||
|
||||
td = DatumGetHeapTupleHeader(((Const *) expr)->constvalue);
|
||||
Assert(HeapTupleHeaderGetTypeId(td) == RECORDOID);
|
||||
typmod = HeapTupleHeaderGetTypMod(td);
|
||||
if (resultTypeId)
|
||||
*resultTypeId = RECORDOID;
|
||||
if (typmod >= 0)
|
||||
{
|
||||
if (resultTupleDesc)
|
||||
*resultTupleDesc = lookup_rowtype_tupdesc(RECORDOID, typmod);
|
||||
result = TYPEFUNC_COMPOSITE;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (resultTupleDesc)
|
||||
*resultTupleDesc = NULL;
|
||||
result = TYPEFUNC_RECORD;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* handle as a generic expression; no chance to resolve RECORD */
|
||||
|
||||
Reference in New Issue
Block a user