Additional psql requirements

From: Simon Riggs <simon(at)2ndquadrant(dot)com>
To: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Additional psql requirements
Date: 2008-07-24 09:52:11
Message-ID: 1216893131.3894.771.camel@ebony.2ndQuadrant
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

I have some suggestions for additional psql features. I'm not planning
to work on them myself, just proposing them so others can do so if they
agree and wish to do so.

* default values for substitution values
Need a command to set the default value of a substitution variable, so
that it takes a specific value if *not* explicitly set on the command
line (or any time prior to setting the default).
e.g. \default

* access to version number
e.g. special variables called
PGMINORVERSION (= 8.3.3)
PGVERSION (= 8.3)

* simple mechanism for conditional execution
Similar to #IFDEF
e.g.
\ifdef (PGVERSION >= 8.3) labelname
...
\label labelname
(..or simply \endif, in which case I'd like \else as well please)

* ability to set substitution variables from command execution
Allow the result of an SQL command to be placed in a sub variable
e.g. \eval fooinfo 'select info from foo;'

* an option to echo an error statement to STDERR
-a echoes the SQL statement to STDOUT, so if you separate them you can't
match up which SQL had which error

The purpose of all of them is to enhance our ability to produce install
scripts for various things. Common uses would include

* setting a default schema, yet allowing overrides to that
* installing languages if not already installed
* checking whether other components are already correctly installed
* installing things based upon the encoding of the database
* skipping certain features if version incorrect
* conditional execution whether superuser or not

--
Simon Riggs www.2ndQuadrant.com
PostgreSQL Training, Services and Support

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message ITAGAKI Takahiro 2008-07-24 10:09:35 Uncopied parameters on CREATE TABLE LIKE
Previous Message Marko Kreen 2008-07-24 09:20:45 Re: Do we really want to migrate plproxy and citext into PG core distribution?