From: | "Egashira, Yusuke" <egashira(dot)yusuke(at)jp(dot)fujitsu(dot)com> |
---|---|
To: | 'Tom Lane' <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | "pgsql-docs(at)lists(dot)postgresql(dot)org" <pgsql-docs(at)lists(dot)postgresql(dot)org> |
Subject: | RE: About limitation characters in ECPG's connection string |
Date: | 2019-09-18 00:32:40 |
Message-ID: | 848B1649C8A6274AA527C4472CA11EDD5FCA20CC@G01JPEXMBYT02 |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-docs |
Hi Tom,
> We put in a change about that last month:
>
> https://git.postgresql.org/gitweb/?p=postgresql.git&a=commitdiff&h=756349c87
Thank you for accepting my claim and updating document!
And sorry for not checking the development version of the document.
> > Note that this parameter does not allow the symbols with special meaning of
> > the URI parts, e.g. "&" and "?".
>
> Hm, I agree that the options part doesn't accept "&", but I don't see
> anything preventing use of a "?" there.
I have checked additional pattern about this limitation, and I found also "?" is not able to use in below case.
user : tst
password : test?pass
connection string: tcp:postgresql://localhost/egashira?user=tst&password=test?pss
This seems to be caused by ECPGconnect's parsing routine.
https://github.com/postgres/postgres/blob/master/src/interfaces/ecpg/ecpglib/connect.c#L371
----
if (strncmp(dbname + offset, "postgresql://", strlen("postgresql://")) == 0)
{
/*------
* new style:
* <tcp|unix>:postgresql://server[:port|:/unixsocket/path:]
* [/db-name][?options]
*------
*/
offset += strlen("postgresql://");
tmp = strrchr(dbname + offset, '?');
if (tmp != NULL) /* options given */
{
options = ecpg_strdup(tmp + 1, lineno);
*tmp = '\0';
}
----
In "tcp:postgresql://" style connection string, ECPGconnect searches for "?" from the end of the connection string to extract options part.
If "?" is in options string part (e.g. as a password value) , the extracting will be failed.
Regards.
Yusuke Egashira.
-----Original Message-----
From: Tom Lane [mailto:tgl(at)sss(dot)pgh(dot)pa(dot)us]
Sent: Wednesday, September 18, 2019 12:55 AM
To: Egashira, Yusuke/江頭 勇佑 <egashira(dot)yusuke(at)jp(dot)fujitsu(dot)com>
Cc: pgsql-docs(at)lists(dot)postgresql(dot)org
Subject: Re: About limitation characters in ECPG's connection string
PG Doc comments form <noreply(at)postgresql(dot)org> writes:
> Please add the note about the limitation characters in connection string.
> For example, I think that below explanation should be in the Parameter
> section of connection_target.
We put in a change about that last month:
https://git.postgresql.org/gitweb/?p=postgresql.git&a=commitdiff&h=756349c87
Although that hasn't yet propagated to any released branches,
you can see it in the "devel" version of that documentation page:
https://www.postgresql.org/docs/devel/ecpg-connect.html#ECPG-CONNECTING
> Note that this parameter does not allow the symbols with special meaning of
> the URI parts, e.g. "&" and "?".
Hm, I agree that the options part doesn't accept "&", but I don't see
anything preventing use of a "?" there.
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | Michael Paquier | 2019-09-18 01:49:14 | Re: Is it typo of connection_name? |
Previous Message | Andreas Joseph Krogh | 2019-09-17 23:23:28 | Re: PostgreSQL License |