This makes dblink pass its installcheck test on platforms where
authorTom Lane <tgl@sss.pgh.pa.us>
Thu, 28 Oct 2004 22:31:11 +0000 (22:31 +0000)
committerTom Lane <tgl@sss.pgh.pa.us>
Thu, 28 Oct 2004 22:31:11 +0000 (22:31 +0000)
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

contrib/dblink/dblink.c

index f6c95ef1dcdedc2eb7e871b12fffc0c87d86adfa..1841284917abbdee9ea47fb7ae10a6a8c62b24cc 100644 (file)
@@ -310,10 +310,10 @@ dblink_open(PG_FUNCTION_ARGS)
            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;
        }
-       rcon = getConnectionByName(conname);
-       if (rcon)
-           conn = rcon->con;
    }
    else if (PG_NARGS() == 4)
    {