From: Korry Douglas on 20 Apr 2010 12:00 In gram.y, the productions for the TRIM() expression expect an argument of trim_list: TRIM '(' trim_list ')' TRIM '(' TRAILING trim_list ')' TRIM '(' LEADING trim_list ')' TRIM '(' BOTH trim_list ')' And trim_list is defined as: trim_list: a_expr FROM expr_list { $$ = lappend($3, $1); } | FROM expr_list { $$ = $2; } | expr_list { $$ = $1; } But it seems wrong for trim_list to be defined in terms of expr_list's. The way it's currently written, we allow expressions such as: TRIM( 'foo', now(), 4+2) or TRIM( LEADING FROM 'foo', 4+2) The parser translates the TRIM expression into a call to btrim() (or ltrim() or rtrim()) and we seem to (accidentally) make up a silly argument list if the user includes an actual expr_list (with multiple expressions). The first example results in "function ltrim(unknown, timestamp with time zone, integer) does not exist". The second example above is translated to ltrim(4+2, 'foo'). It seems to me that trim_list should defined as: trim_list: a_expr FROM a_expr { $$ = list_make2($3, $1); } | FROM a_expr { $$ = list_make1($2); } | a_expr { $$ = list_make1($1); } Am I missing something? -- Korry ----------------------------------------------------------------------- Korry Douglas Senior Database Dude EnterpriseDB Corporation The Enterprise Postgres Company Phone: (804)241-4301 Mobile: (620) EDB-NERD -- Sent via pgsql-hackers mailing list (pgsql-hackers(a)postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers
|
Pages: 1 Prev: SpinLockAcquire question Next: should I post the patch as committed? |