Re: [COMMITTERS] pgsql: Fix dblink to treat connection names longer than NAMEDATALEN-2 - Mailing list pgsql-hackers

From Takahiro Itagaki
Subject Re: [COMMITTERS] pgsql: Fix dblink to treat connection names longer than NAMEDATALEN-2
Date
Msg-id 20100608151720.3606.52131E4D@oss.ntt.co.jp
Whole thread Raw
List pgsql-hackers
itagaki@postgresql.org (Takahiro Itagaki) wrote:

> Fix dblink to treat connection names longer than NAMEDATALEN-2 (62 bytes).
> Now long names are adjusted with truncate_identifier() and NOTICE messages
> are raised if names are actually truncated.
> 
> Modified Files:
> --------------
>     pgsql/contrib/dblink:
>         dblink.c (r1.91 -> r1.92)
>         (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/contrib/dblink/dblink.c?r1=1.91&r2=1.92)

I had a mistake in the fix below. get_connect_string() is called
not only in the case of server-based connections, but also in
connection-string-based connections. If connection strings longer
than 63 bytes are passed the routine emits "identifier will be truncated"
warning. It is an incompatbile change.

Should we revert the change, or just adjust to call truncate_identifier
with warn=false ?


*************** get_connect_string(const char *servernam
*** 2390,2399 ****     StringInfo    buf = makeStringInfo();     ForeignDataWrapper *fdw;     AclResult    aclresult;
  /* first gather the server connstr options */
 
!     if (strlen(servername) < NAMEDATALEN)
!         foreign_server = GetForeignServerByName(servername, true);      if (foreign_server)     {
--- 2390,2401 ----     StringInfo    buf = makeStringInfo();     ForeignDataWrapper *fdw;     AclResult    aclresult;
+     char       *srvname;      /* first gather the server connstr options */
!     srvname = pstrdup(servername);
!     truncate_identifier(srvname, strlen(srvname), true);
!     foreign_server = GetForeignServerByName(srvname, true);      if (foreign_server)     {



Regards,
---
Takahiro Itagaki
NTT Open Source Software Center




pgsql-hackers by date:

Previous
From: Koichi Suzuki
Date:
Subject: How to generate specific WAL records again for PostgreSQL 9.0?
Next
From: Koichi Suzuki
Date:
Subject: pg_lesslog 1.4.2 beta now available