pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: James M Doherty <jim@jdoherty.net>
Cc: pgsql-sql@postgresql.org
Subject: Re: Quote_literal()
Date: Wed, 30 Nov 2005 17:27:58 -0500
Message-ID: <1728.1133389678@sss.pgh.pa.us> (raw)
In-Reply-To: <!~!UENERkVCMDkAAQACAAAAAAAAAAAAAAAAABgAAAAAAAAAGKgFc6RcN0+tZU9CuUmdQ8KAAAAQAAAAA/QrXVG4jUi12IN6YW28cAEAAAAA@jdoherty.net>
References: <!~!UENERkVCMDkAAQACAAAAAAAAAAAAAAAAABgAAAAAAAAAGKgFc6RcN0+tZU9CuUmdQ8KAAAAQAAAAA/QrXVG4jUi12IN6YW28cAEAAAAA@jdoherty.net>

"James M Doherty" <jim@jdoherty.net> writes:
>  declare 
> 	SQL     text;
>       NSQL    text;

> SQL := ''10/3/2009'';

> NSQL := quote_literal(SQL);

> The result is '10/3/2009   with no closing quote.

Works for me:

regression=# create function foo() returns text as '
regression'# declare SQL     text;
regression'#         NSQL    text;
regression'# begin
regression'#   SQL := ''10/3/2009'';
regression'#   NSQL := quote_literal(SQL);
regression'#   return NSQL;
regression'# end' language plpgsql;
CREATE FUNCTION
regression=# select foo();
     foo
-------------
 '10/3/2009'
(1 row)


Again, I suggest giving a *complete* example, because you are obviously
not looking in the right place for your problem.

			regards, tom lane



view thread (3+ messages)  latest in thread

Message-ID: <1728.1133389678@sss.pgh.pa.us>
Permalink:  ../1728.1133389678@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/1728.1133389678@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: tgl@sss.pgh.pa.us, jim@jdoherty.net
  Subject: Re: Quote_literal()
  In-Reply-To: <1728.1133389678@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox