Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WDwAe-0003Zh-0k for pgsql-bugs@arkaria.postgresql.org; Thu, 13 Feb 2014 13:17:40 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1WDwAd-00067U-CI for pgsql-bugs@arkaria.postgresql.org; Thu, 13 Feb 2014 13:17:39 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WDmIY-0002fj-26 for pgsql-bugs@postgresql.org; Thu, 13 Feb 2014 02:45:10 +0000 Received: from wrigleys.postgresql.org ([204.145.124.246]) by magus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WDmIQ-0006cx-J3 for pgsql-bugs@postgresql.org; Thu, 13 Feb 2014 02:45:09 +0000 MIME-Version: 1.0 Subject: BUG #9204: truncate_identifier may be called unnecessarily on escaped quoted identifiers To: pgsql-bugs@postgresql.org From: pythonesque@gmail.com Date: Thu, 13 Feb 2014 02:44:15 +0000 Message-ID: <20140213024415.2708.54432@wrigleys.postgresql.org> X-Pg-Spam-Score: -0.3 (/) Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org 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