Re: quote_boolean() and friends missing

From: Markus Bertheau ☭ <twanger(at)bluetwanger(dot)de>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: quote_boolean() and friends missing
Date: 2005-06-20 14:05:28
Message-ID: 1119276328.4688.19.camel@dicaprio.akademie1.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

В Пнд, 20/06/2005 в 10:01 -0400, Tom Lane пишет:
> Markus Bertheau =?UTF-8?Q?=E2=98=AD?= <twanger(at)bluetwanger(dot)de> writes:
> > I'm writing an application with a lot of PL/pgSQL and am constructing
> > SQL queries on the fly. The quote_literal() and quote_ident() functions
> > proved very much needed. Similarly, I need functions that return the SQL
> > representation of all the other datatypes, not just TEXT: quote_boolean
> > (), quote_date() and so on. For the sake of completeness I think these
> > functions should exist. While the use of to_char() resp. decode() for
> > some types is possible, it does feel like a workaround to me. Opinions?
> > Do these functions belong in the PostgreSQL core?
>
> What exactly do you think they would do? There is no analogy to
> inserting escape characters for those other datatypes.

They would return the SQL representation of a given value.

quote_boolean(TRUE) = 'TRUE'
quote_bytea('\377'::bytea) = '\\377' (literally \377)

Maybe quote_* is not the right name, but the functionality is needed.
I'm currently looking for a way to get the SQL representation of a bytea
value and it looks like I'm going to have to write a C function for
that.

Markus

--
Markus Bertheau ☭ <twanger(at)bluetwanger(dot)de>

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2005-06-20 14:10:32 Re: quote_boolean() and friends missing
Previous Message Tom Lane 2005-06-20 14:01:20 Re: quote_boolean() and friends missing