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

Commit2deef96

Browse files
committed
After transforming a CASE expr with a default argument,
delete the default argument from the node. This prevents the executorfrom spitting up on the untransformed argument expression. Typicalfailure was:select (case f1 when 'val' then 'subst' else f1 end) from t1;ERROR: copyObject: don't know how to copy 704
1 parent38405e1 commit2deef96

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

‎src/backend/parser/parse_expr.c

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/parser/parse_expr.c,v 1.40 1999/02/03 21:16:57 momjian Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/parser/parse_expr.c,v 1.41 1999/04/18 17:35:51 tgl Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -345,9 +345,9 @@ transformExpr(ParseState *pstate, Node *expr, int precedence)
345345
foreach(args,c->args)
346346
{
347347
w=lfirst(args);
348-
/* shorthand form was specified, so expand... */
349348
if (c->arg!=NULL)
350349
{
350+
/* shorthand form was specified, so expand... */
351351
A_Expr*a=makeNode(A_Expr);
352352
a->oper=OP;
353353
a->opname="=";
@@ -358,16 +358,23 @@ transformExpr(ParseState *pstate, Node *expr, int precedence)
358358
lfirst(args)=transformExpr(pstate, (Node*)w,precedence);
359359
}
360360

361+
/* It's not shorthand anymore, so drop the implicit argument.
362+
* This is necessary to keep the executor from seeing an
363+
* untransformed expression...
364+
*/
365+
c->arg=NULL;
366+
367+
/* transform the default clause */
361368
if (c->defresult==NULL)
362369
{
363370
A_Const*n=makeNode(A_Const);
364371
n->val.type=T_Null;
365372
c->defresult= (Node*)n;
366373
}
367374
c->defresult=transformExpr(pstate, (Node*)c->defresult,precedence);
368-
c->casetype=exprType(c->defresult);
369375

370376
/* now check types across result clauses... */
377+
c->casetype=exprType(c->defresult);
371378
ptype=c->casetype;
372379
pcategory=TypeCategory(ptype);
373380
foreach(args,c->args)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp