Received: from localhost.localdomain (postgresql.org [64.49.215.8]) by localhost (Postfix) with ESMTP id 1CB36476FA4; Tue, 18 Jun 2002 13:04:47 -0400 (EDT) Received: from davinci.ethosmedia.com (davinci.ethosmedia.com [209.10.40.250]) by postgresql.org (Postfix) with ESMTP id ED71D476B0F; Tue, 18 Jun 2002 11:49:30 -0400 (EDT) Received: from [63.195.55.98] (account ) by davinci.ethosmedia.com (CommuniGate Pro WebUser 3.5.9) with HTTP id 1531608; Tue, 18 Jun 2002 08:49:33 -0700 From: "Josh Berkus" Subject: Re: Request for builtin function: Double_quote To: Tom Lane , josh@agliodbs.com Cc: pgsql-sql@postgresql.org, pgsql-hackers@postgresql.org X-Mailer: CommuniGate Pro Web Mailer v.3.5.9 Date: Tue, 18 Jun 2002 08:49:33 -0700 Message-ID: In-Reply-To: <26287.1024411733@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 8bit X-Archive-Number: 200206/229 X-Sequence-Number: 8194 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