psql variable interpolation from command line

From: Jeff Boes <jboes(at)nexcerpt(dot)com>
To: pgsql-sql(at)postgresql(dot)org
Subject: psql variable interpolation from command line
Date: 2004-10-01 13:24:11
Message-ID: 1096637064./N9kC7sK2lSxm9YLIkUvcg@teranews
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

I'm at a loss to explain this one:

$ psql -v AUTHOR="'foo'" -c 'select :AUTHOR;'
ERROR: syntax error at or near ":" at character 8

$ psql -v AUTHOR="'foo'"
...
# select :AUTHOR;
?column?
----------
foo
(1 row)

In other words, why won't variable interpolation work when the "-c" flag is
used?

--
Jeff Boes vox 269.226.9550 ext 24
Database Engineer fax 269.349.9076
Nexcerpt, Inc. http://www.nexcerpt.com
...Nexcerpt... Extend your Expertise

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Jeff Boes 2004-10-01 13:28:59 Re: psql variable interpolation from command line
Previous Message Achilleus Mantzios 2004-09-30 10:51:53 Re: FOREIGN KEY and AccessExclusiveLock