Skip site navigation (1) Skip section navigation (2)

Re: inserting boolean values in dynamic queries

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Raphael Bauduin" <rblists(at)gmail(dot)com>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: inserting boolean values in dynamic queries
Date: 2008-09-18 12:35:47
Message-ID: 16326.1221741347@sss.pgh.pa.us (view raw, whole thread or download thread mbox)
Thread:
Lists: pgsql-sql
"Raphael Bauduin" <rblists(at)gmail(dot)com> writes:
> EXECUTE 'UPDATE tbl SET '
>         || quote_ident(colname)
>         || ' = '
>         || quote_literal(newvalue)
>         || ' WHERE key = '
>         || 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.

What problem?  'true' and 'false' are accepted as input for boolean
AFAICS.

			regards, tom lane

In response to

Responses

pgsql-sql by date

Next:From: Raphael BauduinDate: 2008-09-18 13:53:50
Subject: Re: inserting boolean values in dynamic queries
Previous:From: Rafael DomicianoDate: 2008-09-18 11:49:20
Subject: Re: Doubts about FK

Privacy Policy | About PostgreSQL
Copyright © 1996-2018 The PostgreSQL Global Development Group