RE: parse mistake in ecpg connect string

Поиск
Список
Период
Сортировка
От Wang, Shenhao
Тема RE: parse mistake in ecpg connect string
Дата
Msg-id 4de157df4ed540b4bb1be5cd471f761f@G08CNEXMBPEKD06.g08.fujitsu.local
обсуждение исходный текст
Ответ на Re: parse mistake in ecpg connect string  (Kyotaro Horiguchi <horikyota.ntt@gmail.com>)
Ответы RE: parse mistake in ecpg connect string  ("kuroda.hayato@fujitsu.com" <kuroda.hayato@fujitsu.com>)
Список pgsql-hackers
Hi, Horiguchi-san

Kyotaro Horiguchi <horikyota.ntt@gmail.com> wrote:

> How about the attached?

I think, this patch is good.

> > > Should we allow "::1" here as well?  On the other hand, colons are
> > > already overloaded in this syntax, so maybe allowing them in the
> > > host part is a bad idea.

> Yeah, that made me smile for the same reason:p

It seems that ecpg cannot parse the connect str with ipv6 correctly.

Such as:
EXEC SQL CONNECT TO 'tcp:postgresql://::1:5432/postgres'
connect to the server successfully, but
EXEC SQL CONNECT TO 'tcp:postgresql://::1/postgres'
failed to connect to server.

And ecpg will always wrong when parse a connect str
EXEC SQL CONNECT TO tcp:postgresql://::1:5432/postgres;
Ecpg error :
    a.pgc:16: ERROR: syntax error at or near "::"

Maybe we should support ipv6 like libpq.
In [1],
>  The host part may be either host name or an IP address. To specify an IPv6 host address, enclose it in square
brackets:

How about using square brackets like libpq, such as:
EXEC SQL CONNECT TO 'tcp:postgresql://[::1]/postgres'

Maybe we can create a new thread to talk about how ecpg support ipv6

[1]  https://www.postgresql.org/docs/13/libpq-connect.html#LIBPQ-CONNSTRING

Best regards
Shenhao Wang






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

Предыдущее
От: Kyotaro Horiguchi
Дата:
Сообщение: Re: libpq debug log
Следующее
От: Bharath Rupireddy
Дата:
Сообщение: Re: Is Recovery actually paused?