[EMAIL PROTECTED] (David Fetter) writes:
> On Fri, Jul 07, 2006 at 05:33:14AM -0500, Andrew Dunstan wrote:
>> Christopher Browne said:
>> >
>> > The notion:  Plenty of libraries out there like Pg, DBI::Pg, and such
>> > make you specify connections in the form:
>> >   "host=my.db.host.example.org port=5678 dbname=dumb_db user=chewie"
>> Why is this better than using the service file?
> What Andrew asked.

It's not *better* than PGSERVICE; it's just that this does reflect the
connection representation widely used by every sort of library out
there that uses libpq.

Let's do a quick "guess the language"...

Which language is this?
  conn = PGconn.open("host=my.db.host.example.org port=5678 dbname=dumb_db 

How about this?
  $conn = Pg::connectdb("host=my.db.host.example.org port=5678 dbname=dumb_db 

Hmm...  This one should be easy to guess...
  import psycopg2 
  dbcon = psycopg2.connect('host=my.db.host.example.org port=5678 
dbname=dumb_db user=chewie')

This one might conceivably be easy to mistake for another...
  $dbconn = pg_connect("host=my.db.host.example.org port=5678 dbname=dumb_db 
     or die('Could not connect: ' . pg_last_error());

How about this?
  set conres [catch {set newdbc [pg_connect -conninfo 
          "host=my.db.host.example.org port=5678 dbname=dumb_db user=chewie"]} 

This isn't as obvious as it may seem...
  (setq P (pq-connectdb "host=my.db.host.example.org port=5678 dbname=dumb_db 

But this probably is...
  (setf conn (postgresql::PQconnectdb "host=my.db.host.example.org port=5678 
dbname=dumb_db user=chewie"))

Gavin would be extremely disappointed if I had left this one out :-)
  let main () =
    let c = new connection ~conninfo:"host=my.db.host.example.org port=5678 
dbname=dumb_db user=chewie" () in
    let _ = c#exec ~expect:[Copy_in] ("copy " ^ Sys.argv.(1) ^ " from stdin") in
    c#copy_in_channel stdin;

The common thing across all of these is that there's a single string
passed in to request the connection.  A string that libpq in effect
requires, but which psql, somewhat oddly, does not allow you to
directly specify.

We've had cases where we needed to store pgconn "connection
signatures", for reports, and then discovered we wanted to use them to
describe psql connections.

A "--pgconn" or "-D" option would allow doing this.

I agree that pg_service.conf is probably cleaner, but it seems
somewhat odd for The Poster Child libpq application, psql, *not* to
have a way of passing in a conninfo value.
let name="cbbrowne" and tld="acm.org" in name ^ "@" ^ tld;;
If a mute swears, does his mother wash his hands with soap? 

---------------------------(end of broadcast)---------------------------
TIP 9: In versions below 8.0, the planner will ignore your desire to
       choose an index scan if your joining column's datatypes do not

Reply via email to