Skip site navigation (1) Skip section navigation (2)

Re: Patch: psql \whoami option

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Steve Singer <ssinger_pg(at)sympatico(dot)ca>
Cc: David Christensen <david(at)endpoint(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Patch: psql \whoami option
Date: 2010-06-21 04:07:01
Message-ID: AANLkTimLyZogCsZk-ach8z_li5nhtShiWwm8lvSZhOG-@mail.gmail.com (view raw or flat)
Thread:
Lists: pgsql-hackers
On Sun, Jun 20, 2010 at 10:51 PM, Steve Singer <ssinger_pg(at)sympatico(dot)ca> wrote:
> One comment I have on the output format is that values (ie the database
> name) are enclosed in double quotes but the values being quoted can contain
> double quotes that are not being escaped.   For example
>
> Connected to database: "testing"er", user: "ssinger", port: "5432" via local
> domain socket
>
> (where my database name is testing"er ).  Programs will have a hard time
> parsing this.  I'm not sure if this is a valid concern but I'm mentioning
> it.

It seems like for user and database it might be sensible to apply
PQescapeIdentifier to the value before printing it.  This will
double-quote it and escape any internal double-quotes appropriately.
The port is, I guess, being stored as a string, but doesn't it have to
be an integer?  In which case, why quote it at all?

Is there really a point to the non-DSN format or should we just use
the DSN format always?

-- 
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise Postgres Company

In response to

Responses

pgsql-hackers by date

Next:From: Ron MayerDate: 2010-06-21 04:20:33
Subject: Re: Keepalive for max_standby_delay
Previous:From: Robert HaasDate: 2010-06-21 03:54:21
Subject: Re: beta3 & the open items list

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group