public inbox for [email protected]  
help / color / mirror / Atom feed
libpq "service" parameter not documented as not allowed inside a pg_service file
3+ messages / 2 participants
[nested] [flat]

* libpq "service" parameter not documented as not allowed inside a pg_service file
@ 2014-12-20 01:52 David Johnston <[email protected]>
  2015-04-01 20:52 ` Re: libpq "service" parameter not documented as not allowed inside a pg_service file Bruce Momjian <[email protected]>
  0 siblings, 1 reply; 3+ messages in thread

From: David Johnston @ 2014-12-20 01:52 UTC (permalink / raw)
  To: pgsql-docs

While the fact that you cannot do:

[service_template]
host=xxx.xxx.xxx.xxx

[service_db1]
dbname=db1
service=service_template

seems obvious there is nothing in the documentation that says this is
prohibited; and attempting a simple alias entry:

[realentry]
user=not_system_user
dbname=whatever

[aliasentry]
service=realentry

psql "service=aliasentry"

results in the error:

FATAL:  role "system-user" does not exist

Version 9.3

SIDE NOTE: between the "FATAL:" and the word "role" are two spaces instead
of what probably should be one.

Anyway,

http://www.postgresql.org/docs/9.4/static/libpq-pgservice.html

says that "[...] and the parameters are connection parameters; [...]

and one of those parameters is "service"

http://www.postgresql.org/docs/9.4/static/libpq-connect.html#LIBPQ-PARAMKEYWORDS

I would suggest:

"connection parameters; see Section 31.1.2 for a list but note that you may
not include the "service" parameter within the pg_service file (i.e.,
aliases are not allowed).

Thoughts?

David J.

P.S.

Any chance on actually making this work?  The recent comment about "\c
service=name" not working properly seems to fall into the same category so
maybe fix them both at the same time - though the other issue is probably
more of a bug while this is a feature request (unless the interplay is
non-trivial)...

I'm going to link to this post and add a comment to that thread.


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

* Re: libpq "service" parameter not documented as not allowed inside a pg_service file
  2014-12-20 01:52 libpq "service" parameter not documented as not allowed inside a pg_service file David Johnston <[email protected]>
@ 2015-04-01 20:52 ` Bruce Momjian <[email protected]>
  2015-04-08 14:26   ` Re: libpq "service" parameter not documented as not allowed inside a pg_service file Bruce Momjian <[email protected]>
  0 siblings, 1 reply; 3+ messages in thread

From: Bruce Momjian @ 2015-04-01 20:52 UTC (permalink / raw)
  To: David Johnston <[email protected]>; +Cc: pgsql-docs

On Fri, Dec 19, 2014 at 06:52:42PM -0700, David Johnston wrote:
> While the fact that you cannot do:
> 
> [service_template]
> host=xxx.xxx.xxx.xxx
> 
> [service_db1]
> dbname=db1
> service=service_template
> 
> seems obvious there is nothing in the documentation that says this is
> prohibited; and attempting a simple alias entry:

I have developed the attached patch to warn users that nesting of
service entries is not supported.  I prefer code warnings over
documentation because the user gets the warning as soon as they try
something, rather than having to hunt in the documentation.  I don't
think this issue has come up enough to warrant a doc mention too though.

-- 
  Bruce Momjian  <[email protected]>        http://momjian.us
  EnterpriseDB                             http://enterprisedb.com

  + Everyone has their own god. +


-- 
Sent via pgsql-docs mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-docs


Attachments:

  [text/x-diff] pg_service.diff (722B, 2-pg_service.diff)
  download | inline diff:
diff --git a/src/interfaces/libpq/fe-connect.c b/src/interfaces/libpq/fe-connect.c
new file mode 100644
index e2a06b3..083e6df
*** a/src/interfaces/libpq/fe-connect.c
--- b/src/interfaces/libpq/fe-connect.c
*************** parseServiceFile(const char *serviceFile
*** 4061,4066 ****
--- 4061,4076 ----
  				}
  				*val++ = '\0';
  
+ 				if (strcmp(key, "service") == 0)
+ 				{
+ 					printfPQExpBuffer(errorMessage,
+ 									  libpq_gettext("nested service specifications not supported in service file \"%s\", line %d\n"),
+ 									  serviceFile,
+ 									  linenr);
+ 					fclose(f);
+ 					return 3;
+ 				}
+ 
  				/*
  				 * Set the parameter --- but don't override any previous
  				 * explicit setting.


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

* Re: libpq "service" parameter not documented as not allowed inside a pg_service file
  2014-12-20 01:52 libpq "service" parameter not documented as not allowed inside a pg_service file David Johnston <[email protected]>
  2015-04-01 20:52 ` Re: libpq "service" parameter not documented as not allowed inside a pg_service file Bruce Momjian <[email protected]>
@ 2015-04-08 14:26   ` Bruce Momjian <[email protected]>
  0 siblings, 0 replies; 3+ messages in thread

From: Bruce Momjian @ 2015-04-08 14:26 UTC (permalink / raw)
  To: David Johnston <[email protected]>; +Cc: pgsql-docs

On Wed, Apr  1, 2015 at 04:52:48PM -0400, Bruce Momjian wrote:
> On Fri, Dec 19, 2014 at 06:52:42PM -0700, David Johnston wrote:
> > While the fact that you cannot do:
> > 
> > [service_template]
> > host=xxx.xxx.xxx.xxx
> > 
> > [service_db1]
> > dbname=db1
> > service=service_template
> > 
> > seems obvious there is nothing in the documentation that says this is
> > prohibited; and attempting a simple alias entry:
> 
> I have developed the attached patch to warn users that nesting of
> service entries is not supported.  I prefer code warnings over
> documentation because the user gets the warning as soon as they try
> something, rather than having to hunt in the documentation.  I don't
> think this issue has come up enough to warrant a doc mention too though.

Patch applied.  Thanks for the report.

-- 
  Bruce Momjian  <[email protected]>        http://momjian.us
  EnterpriseDB                             http://enterprisedb.com

  + Everyone has their own god. +


-- 
Sent via pgsql-docs mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-docs




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


end of thread, other threads:[~2015-04-08 14:26 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2014-12-20 01:52 libpq "service" parameter not documented as not allowed inside a pg_service file David Johnston <[email protected]>
2015-04-01 20:52 ` Bruce Momjian <[email protected]>
2015-04-08 14:26   ` Bruce Momjian <[email protected]>

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