Re: [17] CREATE SUBSCRIPTION ... SERVER

Поиск
Список
Период
Сортировка
От Jeff Davis
Тема Re: [17] CREATE SUBSCRIPTION ... SERVER
Дата
Msg-id 9a235a36d71a50bff5c14dc14df40f5b1e703e2e.camel@j-davis.com
обсуждение исходный текст
Ответ на Re: [17] CREATE SUBSCRIPTION ... SERVER  (Joe Conway <mail@joeconway.com>)
Список pgsql-hackers
On Mon, 2024-01-15 at 15:53 -0500, Joe Conway wrote:
> I took a quick scan through the patch. The only thing that jumped out
> at
> me was that it seems like it might make sense to use
> quote_literal_cstr() rather than defining your own
> appendEscapedValue()
> function?

The rules are slightly different. Libpq expects a connection string to
escape only single-quote and backslash, and the escape character is
always backslash:

https://www.postgresql.org/docs/16/libpq-connect.html#LIBPQ-CONNSTRING-KEYWORD-VALUE

quote_literal_cstr() has more complicated rules. If there's a backslash
anywhere in the string, it uses the E'' form. If it encounters a
backslash it escapes it with backslash, but if it encounters a single-
quote it escapes it with single-quote. See:

https://www.postgresql.org/docs/16/sql-syntax-lexical.html#SQL-SYNTAX-STRINGS
https://www.postgresql.org/docs/16/sql-syntax-lexical.html#SQL-SYNTAX-STRINGS-ESCAPE

I'll include some tests and a better comment for it in the next patch
set.

Regards,
    Jeff Davis




В списке pgsql-hackers по дате отправления:

Предыдущее
От: Robert Haas
Дата:
Сообщение: Re: Fixing backslash dot for COPY FROM...CSV
Следующее
От: Nathan Bossart
Дата:
Сообщение: Re: make pg_ctl more friendly