Is it typo of connection_name?

2019-09-17 Thread PG Doc comments form
The following documentation comment has been logged on the website:

Page: https://www.postgresql.org/docs/11/ecpg-sql-connect.html
Description:

The "connection_name" parameter's explanation is not in Parameters
section.
Instead of it, "connection_object" parameter is in Parameters section. Its
explanation seems about "connection_name".
Is it typo about "connection_name" in Synopsis section, or
"connection_object" in Parameters section?


About limitation characters in ECPG's connection string

2019-09-17 Thread PG Doc comments form
The following documentation comment has been logged on the website:

Page: https://www.postgresql.org/docs/11/ecpg-sql-connect.html
Description:

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.


Note that this parameter does not allow the symbols with special meaning of
the URI parts, e.g. "&" and "?". 
-

I checked some symbols with special meaning of the URI parts whether it is
able to use in connection_target, and I could not connect to database with
the string containing "&" and "?".

I reported this limitation in pg-general.
https://www.postgresql.org/message-id/848B1649C8A6274AA527C4472CA11EDD5FC70CBE%40G01JPEXMBYT02


Re: About limitation characters in ECPG's connection string

2019-09-17 Thread Tom Lane
PG Doc comments form  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




RE: About limitation characters in ECPG's connection string

2019-09-17 Thread Egashira, Yusuke
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:
 *  
: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:t...@sss.pgh.pa.us] 
Sent: Wednesday, September 18, 2019 12:55 AM
To: Egashira, Yusuke/江頭 勇佑 
Cc: pgsql-docs@lists.postgresql.org
Subject: Re: About limitation characters in ECPG's connection string

PG Doc comments form  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






Re: Is it typo of connection_name?

2019-09-17 Thread Michael Paquier
On Tue, Sep 17, 2019 at 08:39:27AM +, PG Doc comments form wrote:
> The "connection_name" parameter's explanation is not in Parameters
> section.
> Instead of it, "connection_object" parameter is in Parameters section. Its
> explanation seems about "connection_name".
> Is it typo about "connection_name" in Synopsis section, or
> "connection_object" in Parameters section?

Good catch.  If you look at the code (ecpg.trailer), connection_object
refers to the name of the parameter, while connection_name refers to
"AS connection_object" as a whole.  So it seems to me that the
intention is to use connection_object in the synopsis of the docs.
Any thoughts from others?
--
Michael


signature.asc
Description: PGP signature