Hi, Kuroda-san:
Kuroda, Hayato/黒田 隼人 <[email protected]> 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