Re: Request for builtin function: Double_quote

From: "Josh Berkus" <josh(at)agliodbs(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, josh(at)agliodbs(dot)com
Cc: pgsql-sql(at)postgresql(dot)org, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Request for builtin function: Double_quote
Date: 2002-06-18 15:49:33
Message-ID: web-1531608@davinci.ethosmedia.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-sql

Chris, Tom:

Yes, thank you Chris, I meant a builtin SQL function.

> > Given the amount of qoute nesting we do in Postgres, I thought that
> we need a
> > function that handles automatic doubling of quotes within strings.
> I've
> > written one in PL/pgSQL (below). I'd really love to see this
> turned into a
> > builtin C function.
>
> What does this do that isn't already done by quote_literal?

Well, first off, quote_literal isn't in the documentation under
"Functions and Operators". So this is the first I've heard about it
-- or probably anyone else outside the core team. How long has it
been around?

Second, double_quote does not return the outside quotes, just the
inside ones ... it's for passing string values to EXECUTE statements.
However, now that I know that quote_literal exists, I can simplify
the double_quote statement considerably.

Therefore, I withdraw my initial request, and request instead that
quote_literal be added to the function documentation in String
Functions and Operators.

I will event supply text for the functions table:

function returns
quote_literal(string text) text

explain
Returns the entire string passed to it, including quote marks. Useful
for nesting quotes, such as in the EXECUTEing dynamic queries.

example result
quote_literal('O''Reilly') 'O''Reilly'

-Josh Berkus

-Josh Berkus

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Greg Copeland 2002-06-18 15:56:38 Re: Roadmap for a Win32 port
Previous Message Michael Meskes 2002-06-18 15:09:43 Re: ECPG won't compile anymore

Browse pgsql-sql by date

  From Date Subject
Next Message Bruno Wolff III 2002-06-18 16:02:16 Re: Users
Previous Message Tom Lane 2002-06-18 14:48:53 Re: Request for builtin function: Double_quote