Commit e5de6012 authored by Joe Conway's avatar Joe Conway

Default client encoding to server encoding for dblink connections. Addresses

issue raised by Ruzsinszky Attila and confirmed by others.

 ----------------------------------------------------------------------
parent adaf6013
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* Darko Prenosil <Darko.Prenosil@finteh.hr> * Darko Prenosil <Darko.Prenosil@finteh.hr>
* Shridhar Daithankar <shridhar_daithankar@persistent.co.in> * Shridhar Daithankar <shridhar_daithankar@persistent.co.in>
* *
* $PostgreSQL: pgsql/contrib/dblink/dblink.c,v 1.79 2009/06/06 21:27:56 joe Exp $ * $PostgreSQL: pgsql/contrib/dblink/dblink.c,v 1.80 2009/06/09 16:35:36 joe Exp $
* Copyright (c) 2001-2009, PostgreSQL Global Development Group * Copyright (c) 2001-2009, PostgreSQL Global Development Group
* ALL RIGHTS RESERVED; * ALL RIGHTS RESERVED;
* *
...@@ -48,6 +48,7 @@ ...@@ -48,6 +48,7 @@
#include "executor/spi.h" #include "executor/spi.h"
#include "foreign/foreign.h" #include "foreign/foreign.h"
#include "lib/stringinfo.h" #include "lib/stringinfo.h"
#include "mb/pg_wchar.h"
#include "miscadmin.h" #include "miscadmin.h"
#include "nodes/execnodes.h" #include "nodes/execnodes.h"
#include "nodes/nodes.h" #include "nodes/nodes.h"
...@@ -185,6 +186,7 @@ typedef struct remoteConnHashEnt ...@@ -185,6 +186,7 @@ typedef struct remoteConnHashEnt
errdetail("%s", msg))); \ errdetail("%s", msg))); \
} \ } \
dblink_security_check(conn, rconn); \ dblink_security_check(conn, rconn); \
PQsetClientEncoding(conn, GetDatabaseEncodingName()); \
freeconn = true; \ freeconn = true; \
} \ } \
} while (0) } while (0)
...@@ -263,6 +265,9 @@ dblink_connect(PG_FUNCTION_ARGS) ...@@ -263,6 +265,9 @@ dblink_connect(PG_FUNCTION_ARGS)
/* check password actually used if not superuser */ /* check password actually used if not superuser */
dblink_security_check(conn, rconn); dblink_security_check(conn, rconn);
/* attempt to set client encoding to match server encoding */
PQsetClientEncoding(conn, GetDatabaseEncodingName());
if (connname) if (connname)
{ {
rconn->conn = conn; rconn->conn = conn;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment