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

Re: quote_literal(integer) does not exist

From: Andreas 'ads' Scherbaum <adsmail(at)wars-nicht(dot)de>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Re: quote_literal(integer) does not exist
Date: 2007-11-25 12:51:56
Message-ID: 20071125135156.42a5a8a2@localhost (view raw or flat)
Thread:
Lists: pgsql-hackers
On Sat, 24 Nov 2007 21:17:39 -0500 Tom Lane wrote:

> "Andreas 'ads' Scherbaum" <adsmail(at)wars-nicht(dot)de> writes:
> > we have some plpgsql functions which use quote_literal() regardless of
> > the data type. With Beta 3 this does not work anymore[1].
> 
> If you're unwilling to fix your application, you can hack around that
> for yourself.
> 
> regression=# select quote_literal(42);   
> ERROR:  function quote_literal(integer) does not exist
> LINE 1: select quote_literal(42);
>                ^
> HINT:  No function matches the given name and argument types. You might need to add explicit type casts.
> 
> regression=# create function quote_literal(anyelement) returns text as $$
> regression$# select pg_catalog.quote_literal($1 :: pg_catalog.text)
> regression$# $$ language sql;
> CREATE FUNCTION
> 
> regression=# select quote_literal(42);
>  quote_literal 
> ---------------
>  '42'
> (1 row)

Already had a similar function in my test case, but yours is more
elegant. I also think, that we will fix our applications or at least
most of them.

But that's not the point: more people will run into this problem and
this looks like a showstopper for updating to 8.3.

By the way, the function is named quote_literal(), not quote_text().
From my point of view i expect to get everything correctly quoted,
what's feeded as input into this function. Given the fact, that
previous versions accepted every input without notice about the
implicit cast, i don't see not so much blame in the application.


Kind regards

-- 
				Andreas 'ads' Scherbaum
PostgreSQL User Group Germany

In response to

Responses

pgsql-hackers by date

Next:From: Simon RiggsDate: 2007-11-25 13:02:49
Subject: Re: Open 8.3 issues
Previous:From: D'Arcy J.M. CainDate: 2007-11-25 11:47:48
Subject: Re: [COMMITTERS] pgsql: Add regression tests for MONEY type.

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