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

psql Feature request \set query

From: Josh Berkus <josh(at)agliodbs(dot)com>
To: postgres hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: psql Feature request \set query
Date: 2008-10-22 22:38:21
Message-ID: 200810221538.21464.josh@agliodbs.com (view raw or flat)
Thread:
Lists: pgsql-hackers
Hackers,

Just had a feature request from Wheeler, and I don't see why it shouldn't 
go on our todo list.

Currently, in psql you can do:

\set myvar 2008-10-23

and you can do

\set myvar `date`

but you can't do 

\set myvar "Select now()"

even though you could, bizarrely, do:

\set myvar `psql -c "SELECT now();"` 

... provided you were willing to parse out the garbage in the output.

This seems inconsistent, and it seems like the ability to store the results 
of a single-row-returning query in a psql variable would be useful for 
testing.  yes/no?

-- 
--Josh

Josh Berkus
PostgreSQL
San Francisco

Responses

pgsql-hackers by date

Next:From: Alvaro HerreraDate: 2008-10-22 22:48:37
Subject: Re: psql Feature request \set query
Previous:From: Josh BerkusDate: 2008-10-22 22:31:48
Subject: Re: Reminder: only 10 days until final CommitFest

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