Skip to content

Commit e5de601

Browse files
committed
Default client encoding to server encoding for dblink connections. Addresses
issue raised by Ruzsinszky Attila and confirmed by others. ----------------------------------------------------------------------
1 parent adaf601 commit e5de601

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

contrib/dblink/dblink.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
* Darko Prenosil <Darko.Prenosil@finteh.hr>
99
* Shridhar Daithankar <shridhar_daithankar@persistent.co.in>
1010
*
11-
* $PostgreSQL: pgsql/contrib/dblink/dblink.c,v 1.79 2009/06/06 21:27:56 joe Exp $
11+
* $PostgreSQL: pgsql/contrib/dblink/dblink.c,v 1.80 2009/06/09 16:35:36 joe Exp $
1212
* Copyright (c) 2001-2009, PostgreSQL Global Development Group
1313
* ALL RIGHTS RESERVED;
1414
*
@@ -48,6 +48,7 @@
4848
#include "executor/spi.h"
4949
#include "foreign/foreign.h"
5050
#include "lib/stringinfo.h"
51+
#include "mb/pg_wchar.h"
5152
#include "miscadmin.h"
5253
#include "nodes/execnodes.h"
5354
#include "nodes/nodes.h"
@@ -185,6 +186,7 @@ typedef struct remoteConnHashEnt
185186
errdetail("%s", msg))); \
186187
} \
187188
dblink_security_check(conn, rconn); \
189+
PQsetClientEncoding(conn, GetDatabaseEncodingName()); \
188190
freeconn = true; \
189191
} \
190192
} while (0)
@@ -263,6 +265,9 @@ dblink_connect(PG_FUNCTION_ARGS)
263265
/* check password actually used if not superuser */
264266
dblink_security_check(conn, rconn);
265267

268+
/* attempt to set client encoding to match server encoding */
269+
PQsetClientEncoding(conn, GetDatabaseEncodingName());
270+
266271
if (connname)
267272
{
268273
rconn->conn = conn;

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy