Hi, Horiguchi-san

Kyotaro Horiguchi <horikyota....@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





Reply via email to