Dear Hackers,

In the previous discussion [1], we noticed that ECPG cannot accept IPv6
connection string, it means the following statement does not work well:

EXEC SQL CONNECT TO 'tcp:postgresql://::1/postgres';

This is caused because colons are gotten entangled in the ECPGconnect(), 
and Wang suggests that we should support IPv6 like libpq:

> The host part may be either host name or an IP address.
> To specify an IPv6 host address, enclose it in square brackets:

The square bracket must be searched first for implementing the suggestion,
and it means some refactoring is needed for ECPGconnect().

I attached two patches, 0001 contains some refactoring, and 0002 contains
fixes for accepting IPv6. Currently the following statement can be passed:

EXEC SQL CONNECT TO 'tcp:postgresql://[::1]/postgres';

I think this is WIP, because some problems remain:

* Only an SQL literal or a host variable is acceptable.
  I understand we should support other notations, but now hacking.
* parse_options() was not refactored because
  it does not affect to parsing the host.
  I will try it if should be.
* New parse functions are have similar part,
  but I did not standardize them because approved characters
  are different.

How do you think?

Best Regards,
Hayato Kuroda
FUJITSU LIMITED

Attachment: v1-0001-refactor_ecpgconnect.patch
Description: v1-0001-refactor_ecpgconnect.patch

Attachment: v1-0002-allow-IPv6.patch
Description: v1-0002-allow-IPv6.patch

Reply via email to