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

Re: Correctly quoting inside plpgsql functions

From: alberto bolchini <alberto(at)melloni49(dot)it>
To: "Joshua b(dot) Jore" <josh(at)greentechnologist(dot)org>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: Correctly quoting inside plpgsql functions
Date: 2002-04-20 14:08:42
Message-ID: 3CC1766A.1090408@melloni49.it (view raw or flat)
Thread:
Lists: pgsql-novice
Yup! thanks a lot Joshua, it works.
I've tried a few combinations of a number of qoutes, with an without the 
quote_ident/quote_literal before writing to the list, but actually the 
problem was that when I was correctly quoting, I misunderstood the error 
I got upon FETCHing the rows:
ERROR:  parser: parse error at or near "'"
it was not due to the incorrect quoting but to the incorrect FETCH I was 
issueing:
jsg_2=# FETCH ALL IN "<unnamed cursor 1>";
instead of
jsg_2=# FETCH ALL IN "<unnamed cursor 1>";

Thanx.
a.

Joshua b. Jore wrote:

>-----BEGIN PGP SIGNED MESSAGE-----
>Hash: SHA1
>
>Try quote_literal instead.
>
>Joshua b. Jore
>http://www.greentechnologist.org
>
>On Sat, 20 Apr 2002, alberto bolchini wrote:
>
>
>>jsg_2'# ''SELECT * FROM t INNER JOIN i18n ON t.id=i18n.id AND
>>i18n.language_id='' || quote_ident(l_lang) || '' ORDER BY description'';
>>
>
>>jsg_2=# select myfun('en',0);
>>NOTICE: Error occurred while executing PL/pgSQL function myfun
>>NOTICE: line 5 at open
>>ERROR: Attribute 'en' not found
>>
>-----BEGIN PGP SIGNATURE-----
>Version: GnuPG v1.0.6 (OpenBSD)
>Comment: For info see http://www.gnupg.org
>
>iD8DBQE8wXBBfexLsowstzcRArkjAKDJHOgbVyGUz9YYXwX6VJoR23k8YACfVxeO
>lJ74TlFfnPByZ+Bhfhi9mUw=
>=1Y0e
>-----END PGP SIGNATURE-----
>
>
>
>



In response to

pgsql-novice by date

Next:From: Joshua b. JoreDate: 2002-04-21 04:45:24
Subject: Re: Right-justification of column results
Previous:From: Joshua b. JoreDate: 2002-04-20 13:42:21
Subject: Re: Correctly quoting inside plpgsql functions

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