BUG #9204: truncate_identifier may be called unnecessarily on escaped quoted identifiers

Поиск
Список
Период
Сортировка
От pythonesque@gmail.com
Тема BUG #9204: truncate_identifier may be called unnecessarily on escaped quoted identifiers
Дата
Msg-id 20140213024415.2708.54432@wrigleys.postgresql.org
обсуждение исходный текст
Ответы Re: BUG #9204: truncate_identifier may be called unnecessarily on escaped quoted identifiers  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-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.

В списке pgsql-bugs по дате отправления:

Предыдущее
От: rotten@windfish.net
Дата:
Сообщение: BUG #9202: C Functions crash database too easily
Следующее
От: sharvarichorghe@gmail.com
Дата:
Сообщение: BUG #9207: Functions Updations