mirror of
https://github.com/postgres/postgres.git
synced 2025-06-04 12:42:24 +03:00
dblink: Fix variable confusion introduced in e4602483e95
Thanks to Robins to find the issue and Nathan for promptly writing a test case to prevent future problems like this. Reported-by: Nathan Bossart <nathandbossart@gmail.com> Reported-by: Robins Tharakan <tharakan@gmail.com> Author: Nathan Bossart <nathandbossart@gmail.com> Discussion: https://postgr.es/m/20230130193008.GA2740781@nathanxps13
This commit is contained in:
parent
c289117505
commit
fbed4bc59e
@ -321,7 +321,7 @@ dblink_connect(PG_FUNCTION_ARGS)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (pconn->conn)
|
if (pconn->conn)
|
||||||
libpqsrv_disconnect(conn);
|
libpqsrv_disconnect(pconn->conn);
|
||||||
pconn->conn = conn;
|
pconn->conn = conn;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -938,6 +938,25 @@ DROP SERVER fdtest;
|
|||||||
ALTER FOREIGN DATA WRAPPER dblink_fdw OPTIONS (nonexistent 'fdw');
|
ALTER FOREIGN DATA WRAPPER dblink_fdw OPTIONS (nonexistent 'fdw');
|
||||||
ERROR: invalid option "nonexistent"
|
ERROR: invalid option "nonexistent"
|
||||||
HINT: There are no valid options in this context.
|
HINT: There are no valid options in this context.
|
||||||
|
-- test repeated calls to dblink_connect
|
||||||
|
SELECT dblink_connect(connection_parameters());
|
||||||
|
dblink_connect
|
||||||
|
----------------
|
||||||
|
OK
|
||||||
|
(1 row)
|
||||||
|
|
||||||
|
SELECT dblink_connect(connection_parameters());
|
||||||
|
dblink_connect
|
||||||
|
----------------
|
||||||
|
OK
|
||||||
|
(1 row)
|
||||||
|
|
||||||
|
SELECT dblink_disconnect();
|
||||||
|
dblink_disconnect
|
||||||
|
-------------------
|
||||||
|
OK
|
||||||
|
(1 row)
|
||||||
|
|
||||||
-- test asynchronous notifications
|
-- test asynchronous notifications
|
||||||
SELECT dblink_connect(connection_parameters());
|
SELECT dblink_connect(connection_parameters());
|
||||||
dblink_connect
|
dblink_connect
|
||||||
|
@ -489,6 +489,11 @@ DROP SERVER fdtest;
|
|||||||
-- should fail
|
-- should fail
|
||||||
ALTER FOREIGN DATA WRAPPER dblink_fdw OPTIONS (nonexistent 'fdw');
|
ALTER FOREIGN DATA WRAPPER dblink_fdw OPTIONS (nonexistent 'fdw');
|
||||||
|
|
||||||
|
-- test repeated calls to dblink_connect
|
||||||
|
SELECT dblink_connect(connection_parameters());
|
||||||
|
SELECT dblink_connect(connection_parameters());
|
||||||
|
SELECT dblink_disconnect();
|
||||||
|
|
||||||
-- test asynchronous notifications
|
-- test asynchronous notifications
|
||||||
SELECT dblink_connect(connection_parameters());
|
SELECT dblink_connect(connection_parameters());
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user