Fix START_REPLICATION failure with publication names containing backslashes - Mailing list pgsql-hackers

From vignesh C
Subject Fix START_REPLICATION failure with publication names containing backslashes
Date
Msg-id CALDaNm18fTpUg+16y+w0Tjzwuwb=F11P7yF7TCXnmnJofWxbdg@mail.gmail.com
Whole thread Raw
Responses RE: Fix START_REPLICATION failure with publication names containing backslashes
List pgsql-hackers
Hi,

While reviewing another patch, I noticed that START_REPLICATION fails
to parse publication names that contain backslash characters (e.g. \0,
\n), even though such names are perfectly valid when used with CREATE
PUBLICATION. This can be reproduced with the following:
CREATE PUBLICATION "regress_pub_\0\n";
CREATE SUBSCRIPTION regress_sub CONNECTION 'dbname=postgres
host=localhost port=5432' PUBLICATION "regress_pub_\0\n";

CREATE PUBLICATION allows quoted identifiers that may include
backslashes. However, when the subscriber sends such a publication
name back to the walsender as part of START_REPLICATION, the
replication grammar rejects it and throws a syntax error. This happens
because the publication name is passed through escape string
processing before being sent, even though the replication grammar does
not accept escape string forms. The attached patch removes the
unnecessary escape-string handling and passes the publication name as
it is. Replication grammar does not require escape string processing
here, and sending the raw identifier ensures consistent behaviour
between CREATE PUBLICATION and START_REPLICATION.

Regards,
Vignesh

Attachment

pgsql-hackers by date:

Previous
From: David Geier
Date:
Subject: Re: Reduce timing overhead of EXPLAIN ANALYZE using rdtsc?
Next
From: Maxim Orlov
Date:
Subject: Re: POC: make mxidoff 64 bits