Re: Add clarification example to EXEC SQL CONNECT with password

From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Alan B <alan77codebits(at)gmail(dot)com>
Cc: pgsql-docs(at)postgresql(dot)org
Subject: Re: Add clarification example to EXEC SQL CONNECT with password
Date: 2013-01-25 16:19:42
Message-ID: 20130125161942.GA6848@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-docs

On Thu, Sep 20, 2012 at 06:17:15PM +0200, Alan B wrote:
> Hi list,
> Hope this is the right place to suggest that change in the docs, otherwise is
> there a ticket management system for this stuff somewhere?
>
> Paying attention to the documentation at http://www.postgresql.org/docs/8.4/
> static/ecpg-connect.html and subsequent versions of the page (I am using 8.4),
> there is the option to specify "user-name" in various ways. However this may be
> confused as a single parameter to the connect string while it is a combination
> of 1 or 2 parameters that cannot go into a single string.
>
> To avoid confusion I suggest providing a complete example in "Here are some
> examples of CONNECT statements:" as follows:
>
>
> EXEC SQL CONNECT TO mydb(at)sql(dot)mydomain(dot)com;
>
> EXEC SQL CONNECT TO unix:postgresql://sql.mydomain.com/mydb AS myconnection USER john;
>
> EXEC SQL BEGIN DECLARE SECTION;
> const char *target = "mydb(at)sql(dot)mydomain(dot)com";
> const char *user = "john";
> const char *passwd = "secret";
> EXEC SQL END DECLARE SECTION;
> ...
>
> EXEC SQL CONNECT TO :target USER :user USING :passwd;
> or
> EXEC SQL CONNECT TO :target USER :user/:passwd;
>
> To make the distinction of parameters and string variables evident.

I had a look at this just now, and you are right that it is very
confusing. I couldn't even figure out how to explain it in text, and
agree that your example is the best solution.

Attached patch applied to git head and 9.2. Thanks.

--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://enterprisedb.com

+ It's impossible for everything to be true. +

Attachment Content-Type Size
ecpg.diff text/x-diff 1.0 KB

In response to

Responses

Browse pgsql-docs by date

  From Date Subject
Next Message Tom Lane 2013-01-25 17:25:32 Re: Add clarification example to EXEC SQL CONNECT with password
Previous Message Bruce Momjian 2013-01-25 15:15:01 Re: Different wording in file_fdw document