pg.ddx.io  pgsql-docs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
About limitation characters in ECPG's connection string
3+ messages / 3 participants
[nested] [flat]

* About limitation characters in ECPG's connection string
@ 2019-09-17 08:31 PG Doc comments form <noreply@postgresql.org>
  2019-09-17 15:55 ` Re: About limitation characters in ECPG's connection string Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 1 reply; 3+ messages in thread

From: PG Doc comments form @ 2019-09-17 08:31 UTC (permalink / raw)
  To: pgsql-docs@lists.postgresql.org; +Cc: egashira.yusuke@jp.fujitsu.com

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


^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: About limitation characters in ECPG's connection string
  2019-09-17 08:31 About limitation characters in ECPG's connection string PG Doc comments form <noreply@postgresql.org>
@ 2019-09-17 15:55 ` Tom Lane <tgl@sss.pgh.pa.us>
  2019-09-18 00:32   ` RE: About limitation characters in ECPG's connection string Egashira, Yusuke <egashira.yusuke@jp.fujitsu.com>
  0 siblings, 1 reply; 3+ messages in thread

From: Tom Lane @ 2019-09-17 15:55 UTC (permalink / raw)
  To: egashira.yusuke@jp.fujitsu.com; +Cc: pgsql-docs@lists.postgresql.org

PG Doc comments form <noreply@postgresql.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





^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* RE: About limitation characters in ECPG's connection string
  2019-09-17 08:31 About limitation characters in ECPG's connection string PG Doc comments form <noreply@postgresql.org>
  2019-09-17 15:55 ` Re: About limitation characters in ECPG's connection string Tom Lane <tgl@sss.pgh.pa.us>
@ 2019-09-18 00:32   ` Egashira, Yusuke <egashira.yusuke@jp.fujitsu.com>
  0 siblings, 0 replies; 3+ messages in thread

From: Egashira, Yusuke @ 2019-09-18 00:32 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: pgsql-docs@lists.postgresql.org <pgsql-docs@lists.postgresql.org>

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@sss.pgh.pa.us] 
Sent: Wednesday, September 18, 2019 12:55 AM
To: Egashira, Yusuke/$B9>F,(B $BM&M$(B <egashira.yusuke@jp.fujitsu.com>
Cc: pgsql-docs@lists.postgresql.org
Subject: Re: About limitation characters in ECPG's connection string

PG Doc comments form <noreply@postgresql.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







^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2019-09-18 00:32 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2019-09-17 08:31 About limitation characters in ECPG's connection string PG Doc comments form <noreply@postgresql.org>
2019-09-17 15:55 ` Tom Lane <tgl@sss.pgh.pa.us>
2019-09-18 00:32   ` Egashira, Yusuke <egashira.yusuke@jp.fujitsu.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox