public inbox for [email protected]  
help / color / mirror / Atom feed
From: Bruce Momjian <[email protected]>
To: Alan B <[email protected]>
Cc: [email protected]
Subject: Re: Add clarification example to EXEC SQL CONNECT with password
Date: Fri, 25 Jan 2013 11:19:42 -0500
Message-ID: <[email protected]> (raw)
In-Reply-To: <CAGbN=G6P1dy4Q03oKdQig_oUWj82W_x67MRMwX2J+9DrFc=cxw@mail.gmail.com>
References: <CAGbN=G6P1dy4Q03oKdQig_oUWj82W_x67MRMwX2J+9DrFc=cxw@mail.gmail.com>
List-Unsubscribe: <mailto:[email protected]?body=unsub%20pgsql-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 [email protected];
> 
> EXEC SQL CONNECT TO unix:postgresql://sql.mydomain.com/mydb AS myconnection USER john;
> 
> EXEC SQL BEGIN DECLARE SECTION;
> const char *target = "[email protected]";
> 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  <[email protected]>        http://momjian.us
  EnterpriseDB                             http://enterprisedb.com

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


-- 
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] ecpg.diff (1.0K, 2-ecpg.diff)
  download | inline diff:
diff --git a/doc/src/sgml/ecpg.sgml b/doc/src/sgml/ecpg.sgml
new file mode 100644
index 63aaf89..bf01857
*** a/doc/src/sgml/ecpg.sgml
--- b/doc/src/sgml/ecpg.sgml
*************** EXEC SQL CONNECT TO unix:postgresql://sq
*** 194,202 ****
  EXEC SQL BEGIN DECLARE SECTION;
  const char *target = "[email protected]";
  const char *user = "john";
  EXEC SQL END DECLARE SECTION;
   ...
! EXEC SQL CONNECT TO :target USER :user;
  </programlisting>
     The last form makes use of the variant referred to above as
     character variable reference.  You will see in later sections how C
--- 194,205 ----
  EXEC SQL BEGIN DECLARE SECTION;
  const char *target = "[email protected]";
  const char *user = "john";
+ const char *passwd = "secret";
  EXEC SQL END DECLARE SECTION;
   ...
! EXEC SQL CONNECT TO :target USER :user USING :passwd;
! 
! EXEC SQL CONNECT TO :target USER :user/:passwd;
  </programlisting>
     The last form makes use of the variant referred to above as
     character variable reference.  You will see in later sections how C


view thread (11+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected]
  Subject: Re: Add clarification example to EXEC SQL CONNECT with password
  In-Reply-To: <[email protected]>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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