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

Commitf3d4019

Browse files
committed
Ensure consistent logical replication of datetime and float8 values.
In walreceiver, set the publisher's relevant GUCs (datestyle,intervalstyle, extra_float_digits) to the same values that pg_dump uses,and for the same reason: we need the output to be read the same wayregardless of the receiver's settings. Without this, it's possiblefor subscribers to misinterpret transmitted values.Although this is clearly a bug fix, it's not without downsides:subscribers that are storing values into some other datatype, such astext, could get different results than before, and perhaps be unhappyabout that. Given the lack of previous complaints, it seems bestto change this only in HEAD, and to call it out as an incompatiblechange in v15.Japin Li, per report from Sadhuprasad PatroDiscussion:https://postgr.es/m/CAFF0-CF=D7pc6st-3A9f1JnOt0qmc+BcBPVzD6fLYisKyAjkGA@mail.gmail.com
1 parent01fc652 commitf3d4019

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

‎src/backend/replication/libpqwalreceiver/libpqwalreceiver.c

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,8 +128,8 @@ libpqrcv_connect(const char *conninfo, bool logical, const char *appname,
128128
{
129129
WalReceiverConn*conn;
130130
PostgresPollingStatusTypestatus;
131-
constchar*keys[5];
132-
constchar*vals[5];
131+
constchar*keys[6];
132+
constchar*vals[6];
133133
inti=0;
134134

135135
/*
@@ -153,8 +153,20 @@ libpqrcv_connect(const char *conninfo, bool logical, const char *appname,
153153
vals[i]=appname;
154154
if (logical)
155155
{
156+
/* Tell the publisher to translate to our encoding */
156157
keys[++i]="client_encoding";
157158
vals[i]=GetDatabaseEncodingName();
159+
160+
/*
161+
* Force assorted GUC parameters to settings that ensure that the
162+
* publisher will output data values in a form that is unambiguous to
163+
* the subscriber. (We don't want to modify the subscriber's GUC
164+
* settings, since that might surprise user-defined code running in
165+
* the subscriber, such as triggers.) This should match what pg_dump
166+
* does.
167+
*/
168+
keys[++i]="options";
169+
vals[i]="-c datestyle=ISO -c intervalstyle=postgres -c extra_float_digits=3";
158170
}
159171
keys[++i]=NULL;
160172
vals[i]=NULL;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp