Re: potential bug in trigger with boolean params

Поиск
Список
Период
Сортировка
Искать
От
Andreas Joseph Krogh
Тема
Re: potential bug in trigger with boolean params
Дата
в 06:09:02
Msg-id
28137112.347.1305104516684.JavaMail.on@prod2
Ответ на
Список
Дерево обсуждения
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>
På onsdag 11. mai 2011 kl 10:56:19 skrev :
> > Hi,
> > 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);
> 
> The docs clearly state what the valid values are and the literal 'true' is
> not one of them (TRUE is). See this:
> 
> http://www.postgresql.org/docs/9.0/interactive/datatype-boolean.html

What are you trying to accomplish? "CREATE OR REPLACE FUNCTION trigger_x()" does not declare any formal-parameters, so calling it with arguments doesn't make sense. I'm surprised creating the other triggers didn't produce an error stating "No function defined with the name trigger_ix and the given argument-type".

--
Andreas Joseph Krogh 
Senior Software Developer / CTO
Public key: http://home.officenet.no/~andreak/public_key.asc
------------------------+---------------------------------------------+
OfficeNet AS            | The most difficult thing in the world is to |
Rosenholmveien 25       | know how to do a thing and to watch         |
1414 Trollåsen          | somebody else doing it wrong, without       |
NORWAY                  | comment.                                    |
Org.nr: NO 981 479 076  |                                             |                       |                                             |
Tlf:    +47 24 15 38 90 |                                             |
Fax:    +47 24 15 38 91 |                                             |
Mobile: +47 909  56 963 |                                             |
------------------------+---------------------------------------------+

В списке pgsql-hackers по дате отправления
От: Szymon Guz
Дата:
От: Andres Freund
Дата:
FAQ