Re: potential bug in trigger with boolean params
От
Szymon Guz
Тема
Re: potential bug in trigger with boolean params
Дата
Msg-id
BANLkTimR=EEpukW99bHRJWg6VawYBNYMCA@mail.gmail.com
Ответ на
Re: potential bug in trigger with boolean params (tv@fuzzy.cz)
Список
Дерево обсуждения
potential bug in trigger with boolean params Szymon Guz <mabewlun@gmail.com>
Re: potential bug in trigger with boolean params tv@fuzzy.cz
Re: potential bug in trigger with boolean params Andreas Joseph Krogh <andreak@officenet.no>
Re: potential bug in trigger with boolean params Andres Freund <andres@anarazel.de>
Re: potential bug in trigger with boolean params Andres Freund <andres@anarazel.de>
Re: potential bug in trigger with boolean params Tom Lane <tgl@sss.pgh.pa.us>
Re: potential bug in trigger with boolean params Andres Freund <andres@anarazel.de>
Re: potential bug in trigger with boolean params Tom Lane <tgl@sss.pgh.pa.us>
Re: potential bug in trigger with boolean params Szymon Guz <mabewlun@gmail.com>
Re: potential bug in trigger with boolean params Andreas Joseph Krogh <andreak@officenet.no>
Re: potential bug in trigger with boolean params Szymon Guz <mabewlun@gmail.com>
On 11 May 2011 10:56, <tv@fuzzy.cz> wrote:
> Hi,The docs clearly state what the valid values are and the literal 'true' is
> I was trying to create a trigger with parameters. I've found a potential
> bug
> when the param is boolean.
>
> Here is code replicating the bug:
>
> CREATE TABLE x(x TEXT);
>
> CREATE OR REPLACE FUNCTION trigger_x() RETURNS TRIGGER AS $$
> BEGIN
> RETURN NEW;
> END; $$ LANGUAGE PLPGSQL;
>
> CREATE TRIGGER trig_x_text BEFORE INSERT ON x FOR EACH ROW EXECUTE
> PROCEDURE
> trigger_x('text');
> CREATE TRIGGER trig_x_int BEFORE INSERT ON x FOR EACH ROW EXECUTE
> PROCEDURE
> trigger_x(10);
> CREATE TRIGGER trig_x_float BEFORE INSERT ON x FOR EACH ROW EXECUTE
> PROCEDURE trigger_x(42.0);
> CREATE TRIGGER trig_x_bool BEFORE INSERT ON x FOR EACH ROW EXECUTE
> PROCEDURE
> trigger_x(true);
>
> ERROR: syntax error at or near "true"
> LINE 1: ... INSERT ON x FOR EACH ROW EXECUTE PROCEDURE trigger_x(true);
not one of them (TRUE is). See this:
http://www.postgresql.org/docs/9.0/interactive/datatype-boolean.html
regards
Tomas
Well... no.
Valid literal values for the "true" state are:
| TRUE |
| 't' |
| 'true' |
| 'y' |
| 'yes' |
| 'on' |
| '1' |
so I could use 'true'... and this doesn't work.
And SQL is not case sensitive... but I will check it for you anyway:
CREATE TRIGGER trig_x_2 BEFORE INSERT ON x FOR EACH ROW EXECUTE PROCEDURE trigger_x(TRUE);
ERROR: syntax error at or near "TRUE"
LINE 1: ... INSERT ON x FOR EACH ROW EXECUTE PROCEDURE trigger_x(TRUE);
regards
Szymon
В списке pgsql-hackers по дате отправления