Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitda2060e

Browse files
committed
Remove premature attempt to constant-fold type coercion expressions.
While usually safe, this fails if the coercion function needs thequery snapshot to be set already. Per example from Nigel Andrews.
1 parenta6554df commitda2060e

File tree

1 file changed

+2
-28
lines changed

1 file changed

+2
-28
lines changed

‎src/backend/parser/parse_coerce.c

Lines changed: 2 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/parser/parse_coerce.c,v 2.94 2003/04/08 23:20:02 tgl Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/parser/parse_coerce.c,v 2.95 2003/04/10 02:47:46 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -219,20 +219,6 @@ coerce_type(Node *node, Oid inputTypeId, Oid targetTypeId,
219219
if (targetTypeId!=baseTypeId)
220220
result=coerce_to_domain(result,baseTypeId,targetTypeId,
221221
cformat);
222-
223-
/*
224-
* If the input is a constant, apply the type conversion
225-
* function now instead of delaying to runtime. (We could, of
226-
* course, just leave this to be done during
227-
* planning/optimization; but it's a very frequent special
228-
* case, and we save cycles in the rewriter if we fold the
229-
* expression now.)
230-
*
231-
* Note that no folding will occur if the conversion function is
232-
* not marked 'immutable'.
233-
*/
234-
if (IsA(node,Const))
235-
result=eval_const_expressions(result);
236222
}
237223
else
238224
{
@@ -464,7 +450,6 @@ coerce_type_typmod(Node *node, Oid targetTypeId, int32 targetTypMod,
464450
{
465451
List*args;
466452
Const*cons;
467-
Node*fcall;
468453

469454
/* Pass given value, plus target typmod as an int4 constant */
470455
cons=makeConst(INT4OID,
@@ -487,18 +472,7 @@ coerce_type_typmod(Node *node, Oid targetTypeId, int32 targetTypMod,
487472
args=lappend(args,cons);
488473
}
489474

490-
fcall=build_func_call(funcId,targetTypeId,args,cformat);
491-
492-
/*
493-
* If the input is a constant, apply the length coercion
494-
* function now instead of delaying to runtime.
495-
*
496-
* See the comments for the similar case in coerce_type.
497-
*/
498-
if (node&&IsA(node,Const))
499-
node=eval_const_expressions(fcall);
500-
else
501-
node=fcall;
475+
node=build_func_call(funcId,targetTypeId,args,cformat);
502476
}
503477

504478
returnnode;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp