RE: Refactor ECPGconnect and allow IPv6 connection

From: "wangsh(dot)fnst(at)fujitsu(dot)com" <wangsh(dot)fnst(at)fujitsu(dot)com>
To: "kuroda(dot)hayato(at)fujitsu(dot)com" <kuroda(dot)hayato(at)fujitsu(dot)com>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: RE: Refactor ECPGconnect and allow IPv6 connection
Date: 2021-02-24 05:53:13
Message-ID: OSBPR01MB4214ED2FD6B27DD8EBC5BB83F29F9@OSBPR01MB4214.jpnprd01.prod.outlook.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi, Kuroda-san:

Kuroda, Hayato/黒田 隼人 <kuroda(dot)hayato(at)fujitsu(dot)com> wrote:

> * parse_options() was not refactored because
> it does not affect to parsing the host.
> I will try it if should be.

It seems host only can be the name of server, please refer [1].
And if I use command:
./bin/psql "postgresql://server1:26000/postgres?host=[::1]"

The error report is:
psql: error: could not translate host name "[::1]" to address: Name or service not known

So, I think parse_options() is not need to be refactored.

> How do you think?

In patch:
> ecpg_log("end of string reached when looking for matching \"]\" in IPv6 host address: \"%s\"\n", buf);

I think we can use the message as same as the message in fe-connect.c:
> libpq_gettext("end of string reached when looking for matching \"]\" in IPv6 host address in URI: \"%s\"\n"),

BTW, in fe-connect.c:

if (*p && *p != ':' && *p != '/' && *p != '?' && *p != ',')
{
appendPQExpBuffer(errorMessage,
libpq_gettext("unexpected character \"%c\" at position %d in URI (expected \":\" or \"/\"): \"%s\"\n"),
*p, (int) (p - buf + 1), uri);
goto cleanup;
}
Maybe we can add the expected character, like (expected ':', '/', '?' or ',')

I think this patch is good to me, I will review this patch later

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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Rahila Syed 2021-02-24 06:06:50 Re: a misbehavior of partition row movement (?)
Previous Message Ajin Cherian 2021-02-24 05:48:20 Re: repeated decoding of prepared transactions