Re: quote_literal(integer) does not exist - Mailing list pgsql-hackers

From Brendan Jurd
Subject Re: quote_literal(integer) does not exist
Date
Msg-id 37ed240d0711250519u3eaf9e8dt848b7d650b6f81ec@mail.gmail.com
Whole thread Raw
In response to Re: quote_literal(integer) does not exist  (Andreas 'ads' Scherbaum <adsmail@wars-nicht.de>)
Responses Re: quote_literal(integer) does not exist  ("Pavel Stehule" <pavel.stehule@gmail.com>)
Re: quote_literal(integer) does not exist  ("Pavel Stehule" <pavel.stehule@gmail.com>)
Re: quote_literal(integer) does not exist  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
On Nov 25, 2007 11:51 PM, Andreas 'ads' Scherbaum <adsmail@wars-nicht.de> wrote:
> 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.

I had a similar experience to Andreas when I first migrated my app to
8.3b1 for testing.  It wasn't hard to fix, but did seem like an
unnecessary barrier to upgrading.

I agree that the name of the function (and its behavior up till now)
encourage users to think of it as a "quote whatever I throw at you"
function, which is indeed what you would want/expect in the context of
building a dynamic query.

Having quote_literal take its argument as text was fine whilst we were
automatically casting arguments, but in 8.3 it seems that
quote_literal(anyelement) makes a lot more sense than
quote_literal(text).

So, I wonder why we don't just adapt the internal function to take
anyelement?  It would save a lot of apps from being broken by the move
to 8.3, and make the function more convenient.

Regards,
BJ


pgsql-hackers by date:

Previous
From: "Guillaume Smet"
Date:
Subject: Re: 8.3devel slower than 8.2 under read-only load
Next
From: "Guillaume Smet"
Date:
Subject: Re: 8.3devel slower than 8.2 under read-only load