pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: pythonesque@gmail.com
To: pgsql-bugs@postgresql.org
Subject: BUG #9204: truncate_identifier may be called unnecessarily on escaped quoted identifiers
Date: Thu, 13 Feb 2014 02:44:15 +0000
Message-ID: <20140213024415.2708.54432@wrigleys.postgresql.org> (raw)
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>

The following bug has been logged on the website:

Bug reference:      9204
Logged by:          Joshua Yanovski
Email address:      pythonesque@gmail.com
PostgreSQL version: 9.3.2
Operating system:   Ubuntu 12.0.4
Description:        

As in description.  This follows from how these are scanned in scan.l:

	ident = litbuf_udeescape('\\', yyscanner);
if (yyextra->literallen >= NAMEDATALEN)
truncate_identifier(ident, yyextra->literallen, true);

Because literallen is the length of the original string, this does
unnecessary work (and reports a misleading notice) if the resulting string
is shorter.

psql -v 'VERBOSITY=verbose' -c "select
U&\"abcdefghabcdefghabcdefghabcdefghabcdefghabcdefghabcdefghabcd\\3737\"
FROM dummy"
NOTICE:  42622: identifier
"abcdefghabcdefghabcdefghabcdefghabcdefghabcdefghabcdefghabcd㜷" will be
truncated to
"abcdefghabcdefghabcdefghabcdefghabcdefghabcdefghabcdefghabcd㜷"
LOCATION:  truncate_identifier, scansup.c:195

It is a pretty borderline edge case and doesn't have any serious
consequences, but it does seem like it should be easy to fix without a huge
hit to efficiency, considering that the length can be calculated in constant
time from known information in litbuf_udeescape.


-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs



view thread (5+ messages)  latest in thread

Message-ID: <20140213024415.2708.54432@wrigleys.postgresql.org>
Permalink:  ../20140213024415.2708.54432@wrigleys.postgresql.org/
Also on:    postgresql.org/message-id/20140213024415.2708.54432@wrigleys.postgresql.org

 · 

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: pythonesque@gmail.com
  Subject: Re: BUG #9204: truncate_identifier may be called unnecessarily on escaped quoted identifiers
  In-Reply-To: <20140213024415.2708.54432@wrigleys.postgresql.org>
  References: <20140213024415.2708.54432@wrigleys.postgresql.org>

* 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