On 01/06/10 05:55, Takahiro Itagaki wrote:
"Takahiro Itagaki"wrote:
Contib/dblink module seems to have a bug in handling
connection names in NAMEDATALEN-1 bytes.
Here is a patch to fix the bug. I think it comes from wrong usage
of snprintf(NAMEDATALEN - 1). It just copies 62 bytes + \0.

In addition, it should be safe to use pg_mbcliplen() to truncate
extra bytes in connection names because we might return invalid
text when a multibyte character is at 62 or 63 bytes.
Hmm, seems that dblink should call truncate_identifier() for the
truncation, to be consistent with truncation of table names etc.

I also spotted this in dblink.c:
/* first gather the server connstr options */
if (strlen(servername) < NAMEDATALEN)
foreign_server = GetForeignServerByName(servername, true);
I think that's wrong. We normally consistently truncate identifiers at
creation and at use, so that if you create an object with a very long
name and it's truncated, you can still refer to it with the untruncated
name because all such references are truncated too.

Heikki Linnakangas
EnterpriseDB http://www.enterprisedb.com

Search Discussions

Discussion Posts


Follow ups

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 2 of 5 | next ›
Discussion Overview
grouppgsql-hackers @
postedJun 1, '10 at 2:54a
activeJun 3, '10 at 1:07a



site design / logo © 2022 Grokbase