This makes dblink pass its installcheck test on platforms where 
snprintf(data, len, "%s", NULL) crash.

The code was trying to find a connection by name when it already had an 
unnamed connection and did not have a name to search with.

Kris Jurka
Index: contrib/dblink/dblink.c
===================================================================
RCS file: /projects/cvsroot/pgsql/contrib/dblink/dblink.c,v
retrieving revision 1.36
diff -c -r1.36 dblink.c
*** contrib/dblink/dblink.c     25 Oct 2004 00:46:39 -0000      1.36
--- contrib/dblink/dblink.c     28 Oct 2004 00:07:01 -0000
***************
*** 310,319 ****
                        conname = GET_STR(PG_GETARG_TEXT_P(0));
                        curname = GET_STR(PG_GETARG_TEXT_P(1));
                        sql = GET_STR(PG_GETARG_TEXT_P(2));
                }
-               rcon = getConnectionByName(conname);
-               if (rcon)
-                       conn = rcon->con;
        }
        else if (PG_NARGS() == 4)
        {
--- 310,319 ----
                        conname = GET_STR(PG_GETARG_TEXT_P(0));
                        curname = GET_STR(PG_GETARG_TEXT_P(1));
                        sql = GET_STR(PG_GETARG_TEXT_P(2));
+                       rcon = getConnectionByName(conname);
+                       if (rcon)
+                               conn = rcon->con;
                }
        }
        else if (PG_NARGS() == 4)
        {
---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]

Reply via email to