mirror of
https://github.com/postgres/postgres.git
synced 2025-09-02 04:21:28 +03:00
Reimplement CASE val WHEN compval1 THEN ... WHEN compval2 THEN ... END
so that the 'val' is computed only once, per recent discussion. The speedup is not much when 'val' is just a simple variable, but could be significant for larger expressions. More importantly this avoids issues with multiple evaluations of a volatile 'val', and it allows the CASE expression to be reverse-listed in its original form by ruleutils.c.
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
* procedural language
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/pl/plpgsql/src/pl_exec.c,v 1.97 2004/02/25 18:10:51 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/pl/plpgsql/src/pl_exec.c,v 1.98 2004/03/17 20:48:43 tgl Exp $
|
||||
*
|
||||
* This software is copyrighted by Jan Wieck - Hamburg.
|
||||
*
|
||||
@@ -3729,6 +3729,9 @@ exec_simple_check_node(Node *node)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
case T_CaseTestExpr:
|
||||
return TRUE;
|
||||
|
||||
case T_ArrayExpr:
|
||||
{
|
||||
ArrayExpr *expr = (ArrayExpr *) node;
|
||||
@@ -3770,6 +3773,9 @@ exec_simple_check_node(Node *node)
|
||||
case T_CoerceToDomain:
|
||||
return exec_simple_check_node((Node *) ((CoerceToDomain *) node)->arg);
|
||||
|
||||
case T_CoerceToDomainValue:
|
||||
return TRUE;
|
||||
|
||||
case T_List:
|
||||
{
|
||||
List *expr = (List *) node;
|
||||
|
Reference in New Issue
Block a user