Re: potential bug in trigger with boolean params - Mailing list pgsql-hackers

From Andreas Joseph Krogh
Subject Re: potential bug in trigger with boolean params
Date
Msg-id 24249614.350.1305106170514.JavaMail.on@prod2
Whole thread Raw
In response to Re: potential bug in trigger with boolean params  (Szymon Guz <mabewlun@gmail.com>)
List pgsql-hackers
<p>På onsdag 11. mai 2011 kl 11:30:51 skrev <strong>Szymon Guz</strong> <<a
href="mailto:mabewlun@gmail.com">mabewlun@gmail.com</a>>:<blockquotestyle="border-left: 1px solid rgb(204, 204,
204);margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><br /><br /><div class="gmail_quote">On 11 May 2011 11:01, Andreas
JosephKrogh <span dir="ltr"><<a href="mailto:andreak@officenet.no">andreak@officenet.no</a>></span> wrote:<br
/><blockquoteclass="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"> På onsdag 11.
mai2011 kl 10:56:19 skrev <<a href="mailto:tv@fuzzy.cz">tv@fuzzy.cz</a>>:<br /><div><div> </div><div
class="h5">>> Hi,<br /> > > I was trying to create a trigger with parameters. I've found a potential<br />
>> bug<br /> > > when the param is boolean.<br /> > ><br /> > > Here is code replicating the
bug:<br/> > ><br /> > > CREATE TABLE x(x TEXT);<br /> > ><br /> > > CREATE OR REPLACE FUNCTION
trigger_x()RETURNS TRIGGER AS $$<br /> > > BEGIN<br /> > >         RETURN NEW;<br /> > > END; $$
LANGUAGEPLPGSQL;<br /> > ><br /> > > CREATE TRIGGER trig_x_text BEFORE INSERT ON x FOR EACH ROW EXECUTE<br
/>> > PROCEDURE<br /> > > trigger_x('text');<br /> > > CREATE TRIGGER trig_x_int BEFORE INSERT ON x
FOREACH ROW EXECUTE<br /> > > PROCEDURE<br /> > > trigger_x(10);<br /> > > CREATE TRIGGER
trig_x_floatBEFORE INSERT ON x FOR EACH ROW EXECUTE<br /> > > PROCEDURE trigger_x(42.0);<br /> > > CREATE
TRIGGERtrig_x_bool BEFORE INSERT ON x FOR EACH ROW EXECUTE<br /> > > PROCEDURE<br /> > >
trigger_x(true);<br/> > ><br /> > > ERROR:  syntax error at or near "true"<br /> > > LINE 1: ...
INSERTON x FOR EACH ROW EXECUTE PROCEDURE trigger_x(true);<br /> ><br /> > The docs clearly state what the valid
valuesare and the literal 'true' is<br /> > not one of them (TRUE is). See this:<br /> ><br /> > <a
href="http://www.postgresql.org/docs/9.0/interactive/datatype-boolean.html"
target="_blank">http://www.postgresql.org/docs/9.0/interactive/datatype-boolean.html</a><br/></div></div> What are you
tryingto accomplish? "CREATE OR REPLACE FUNCTION trigger_x()" does not declare any formal-parameters, so calling it
witharguments doesn't make sense. I'm surprised creating the other triggers didn't produce an error stating "No
functiondefined with the name trigger_ix and the given argument-type".<br /><br /></blockquote><div> </div><div>That's
howyou define trigger function. Later you can use params when defining trigger.</div></div></blockquote><p>Pardon my
ignorance:-)<br/><br /><span style="font-family: monospace; font-size: 10px;">--<br /> Andreas Joseph Krogh
<andreak@officenet.no><br/> Senior Software Developer / CTO<br /> Public key:
http://home.officenet.no/~andreak/public_key.asc<br/>
------------------------+---------------------------------------------+<br/> OfficeNet AS            | The most
difficultthing in the world is to |<br /> Rosenholmveien 25       | know how to do a thing and to watch         |<br />
1414Trollåsen          | somebody else doing it wrong, without       |<br /> NORWAY                  | comment.       
                           |<br /> Org.nr: NO 981 479 076  |                                             |<br />      
                 |                                             |<br /> Tlf:    +47 24 15 38 90 |                       
                    |<br /> Fax:    +47 24 15 38 91 |                                             |<br /> Mobile: +47
909 56 963 |                                             |<br />
------------------------+---------------------------------------------+<br/></span> 

pgsql-hackers by date:

Previous
From: Nicolas Barbier
Date:
Subject: Re: the big picture for index-only scans
Next
From: Heikki Linnakangas
Date:
Subject: Re: time-delayed standbys