diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2007-05-01 18:53:52 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2007-05-01 18:53:52 +0000 |
commit | b4349519c178b2b46cc42872a28d896291b6464e (patch) | |
tree | 4aeacf2228a6df440ad4ca33d1c554e2e125e9fa /src/backend | |
parent | c4320619635800a6116a02eee08b232c5abea266 (diff) | |
download | postgresql-b4349519c178b2b46cc42872a28d896291b6464e.tar.gz postgresql-b4349519c178b2b46cc42872a28d896291b6464e.zip |
Fix a thinko in my patch of a couple months ago for bug #3116: it did the
wrong thing when inlining polymorphic SQL functions, because it was using the
function's declared return type where it should have used the actual result
type of the current call. In 8.1 and 8.2 this causes obvious failures even if
you don't have assertions turned on; in 8.0 and 7.4 it would only be a problem
if the inlined expression were used as an input to a function that did
run-time type determination on its inputs. Add a regression test, since this
is evidently an under-tested area.
Diffstat (limited to 'src/backend')
-rw-r--r-- | src/backend/optimizer/util/clauses.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/backend/optimizer/util/clauses.c b/src/backend/optimizer/util/clauses.c index 417cecff8e9..5233a338e6f 100644 --- a/src/backend/optimizer/util/clauses.c +++ b/src/backend/optimizer/util/clauses.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/optimizer/util/clauses.c,v 1.243 2007/04/30 00:14:54 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/optimizer/util/clauses.c,v 1.244 2007/05/01 18:53:51 tgl Exp $ * * HISTORY * AUTHOR DATE MAJOR EVENT @@ -3063,11 +3063,11 @@ inline_function(Oid funcid, Oid result_type, List *args, * compatible with the original expression result type. To avoid * confusing matters, insert a RelabelType in such cases. */ - if (exprType(newexpr) != funcform->prorettype) + if (exprType(newexpr) != result_type) { - Assert(IsBinaryCoercible(exprType(newexpr), funcform->prorettype)); + Assert(IsBinaryCoercible(exprType(newexpr), result_type)); newexpr = (Node *) makeRelabelType((Expr *) newexpr, - funcform->prorettype, + result_type, -1, COERCE_IMPLICIT_CAST); } |