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

Re: Patch: psql \whoami option

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: David Christensen <david(at)endpoint(dot)com>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, Steve Singer <ssinger_pg(at)sympatico(dot)ca>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Patch: psql \whoami option
Date: 2010-07-18 17:30:00
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-hackers
David Christensen <david(at)endpoint(dot)com> writes:
> machack:machack:5432=# \c "foo""bar"
> You are now connected to database "foo"bar".

What this is reflecting is that backslash commands have their own weird
rules for processing double quotes.  What I was concerned about was that
double quotes in SQL are normally used for protecting mixed case, and
you don't need that for \c:

regression=# create database "FooBar";
regression=# \c foobar
FATAL:  database "foobar" does not exist
Previous connection kept
regression=# \c FooBar
You are now connected to database "FooBar".

The fact that there are double quotes around the database name in the
"You are now connected..." message is *not* meant to imply that that is
a valid double-quoted SQL identifier, either.  It's just an artifact of
how we set off names in English-language message style.  In another
language it might look like <<FooBar>> or some such.

My opinion remains that you should just print the user and database
names as-is, without trying to inject any quoting into the mix.  You're
more likely to confuse people than help them if you do that.

			regards, tom lane

In response to


pgsql-hackers by date

Next:From: David ChristensenDate: 2010-07-18 17:33:51
Subject: Re: Patch: psql \whoami option
Previous:From: David ChristensenDate: 2010-07-18 17:29:22
Subject: Re: Patch: psql \whoami option

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