inserting boolean values in dynamic queries - Mailing list pgsql-sql

From Raphael Bauduin
Subject inserting boolean values in dynamic queries
Date
Msg-id f5227160809180249q508b7a1rf11795a5b38b9f41@mail.gmail.com
Whole thread Raw
Responses Re: inserting boolean values in dynamic queries  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-sql
Hi,

I'm building a dynamic query as described at
http://www.postgresql.org/docs/8.3/interactive/plpgsql-statements.html#PLPGSQL-STATEMENTS-EXECUTING-DYN
:

EXECUTE 'UPDATE tbl SET '       || quote_ident(colname)       || ' = '       || quote_literal(newvalue)       || '
WHEREkey = '       || quote_literal(keyvalue); 



It works fine, except when I want to include a boolean value: the cast
of newvalue from boolean to text causes problem.

I can change my code and work with 't' and 'f' values as text, but
wondered if there wasa way to use boolean values in a dynamically
generated query.

Thanks

Raphaël

--
Web database: http://www.myowndb.com
Free Software Developers Meeting: http://www.fosdem.org


pgsql-sql by date:

Previous
From: Steve Midgley
Date:
Subject: Re: surrogate vs natural primary keys
Next
From: "Rafael Domiciano"
Date:
Subject: Re: Doubts about FK