Re: BUG #6624: Tab completion of identifier containing single backslash triggers warnings

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Josh Kupershmidt <schmiddy(at)gmail(dot)com>
Cc: Bruce Momjian <bruce(at)momjian(dot)us>, stuart(at)stuartbishop(dot)net, pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #6624: Tab completion of identifier containing single backslash triggers warnings
Date: 2012-05-02 22:29:10
Message-ID: 3034.1335997750@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Josh Kupershmidt <schmiddy(at)gmail(dot)com> writes:
> On Wed, May 2, 2012 at 11:21 AM, Bruce Momjian <bruce(at)momjian(dot)us> wrote:
>> On Wed, May 02, 2012 at 12:59:58PM +0000, stuart(at)stuartbishop(dot)net wrote:
>>> # CREATE SEQUENCE "\foo";
>>> CREATE SEQUENCE
>>> # \ds "\

>> I am unable to reproduce this failure on my copy of 9.1.3. Have you
>> perhaps changed any server settings?

> I only get the error if I:
> SET standard_conforming_strings TO off;
> otherwise, it works fine. Perhaps it's still worth fixing though.

AFAICT, you get this behavior in every release back to 8.1, if you have
both escape_string_warning ON and standard_conforming_strings OFF;
which was the default configuration from 8.2 through 9.0. The lack of
prior complaints suggests pretty strongly that backslashes in names are
not common in the field.

The only way we could suppress such warnings would be if we made
tab-complete.c use E'' strings for literals containing name prefixes;
which is perhaps doable but it would mean having tab-complete.c roll
its own string escaping rather than use any facility now available
from libpq. (PQescapeString and friends presume that the result will
be emitted as a plain string.)

This issue isn't peculiar to tab-complete.c, either; in general, *any*
client that uses PQescapeString and friends is going to get bombarded
with this type of warning when the server is configured that way, even
though what it's doing is perfectly safe. I don't remember at the
moment why we designed those functions that way, but presumably the
alternatives were worse.

I'm inclined to think that if we got this far without complaint, there's
not a lot of point in writing new string-escaping support to solve what
is now a legacy problem.

regards, tom lane

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message leo xu 2012-05-03 03:25:51 select table indicate missing chunk number 0 for toast value 96635 in pg_toast_2619
Previous Message Robert Bernier 2012-05-02 22:27:49 Re: [seapug] Re: [BUGS] pg_dump: aborting because of server version mismatchT