Re: potential bug in trigger with boolean params

From: tv(at)fuzzy(dot)cz
To: "Szymon Guz" <mabewlun(at)gmail(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: potential bug in trigger with boolean params
Date: 2011-05-11 08:56:19
Message-ID: 555eb6b48f8c8ed3ebfbc1f15904db7c.squirrel@sq.gransy.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> 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

regards
Tomas

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andreas Joseph Krogh 2011-05-11 09:01:56 Re: potential bug in trigger with boolean params
Previous Message Magnus Hagander 2011-05-11 08:54:51 Re: Process wakeups when idle and power consumption