Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitd1824a5

Browse files
committed
Fix regression in dblink_disconnect() reported by Eduardo Stern:
persistent_conn was left dangling after a disconnect in theunnamed connection case, causing a subsequent disconnect tocrash the backend.
1 parentdd01cfe commitd1824a5

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

‎contrib/dblink/dblink.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,8 @@ dblink_disconnect(PG_FUNCTION_ARGS)
256256
deleteConnection(conname);
257257
pfree(rcon);
258258
}
259+
else
260+
persistent_conn=NULL;
259261

260262
PG_RETURN_TEXT_P(GET_TEXT("OK"));
261263
}

‎contrib/dblink/expected/dblink.out

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -185,13 +185,11 @@ SELECT dblink_disconnect();
185185
OK
186186
(1 row)
187187

188-
-- should generate "noconnectionto the server" error
188+
-- should generate "connectionnot available" error
189189
SELECT *
190190
FROM dblink('SELECT * FROM foo') AS t(a int, b text, c text[])
191191
WHERE t.a > 7;
192-
ERROR: sql error
193-
DETAIL: no connection to the server
194-
192+
ERROR: connection not available
195193
-- put more data into our slave table, first using arbitrary connection syntax
196194
-- but truncate the actual return value so we can use diff to check for success
197195
SELECT substr(dblink_exec('dbname=regression','INSERT INTO foo VALUES(10,''k'',''{"a10","b10","c10"}'')'),1,6);

‎contrib/dblink/sql/dblink.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ FROM dblink_fetch('rmt_foo_cursor',4) AS t(a int, b text, c text[]);
105105
-- close the persistent connection
106106
SELECT dblink_disconnect();
107107

108-
-- should generate "noconnectionto the server" error
108+
-- should generate "connectionnot available" error
109109
SELECT*
110110
FROM dblink('SELECT * FROM foo')AS t(aint, btext, ctext[])
111111
WHEREt.a>7;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp