Additional psql requirements - Mailing list pgsql-hackers

From Simon Riggs
Subject Additional psql requirements
Date
Msg-id 1216893131.3894.771.camel@ebony.2ndQuadrant
Whole thread Raw
Responses Re: Additional psql requirements
List 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.comPostgreSQL Training, Services and Support



pgsql-hackers by date:

Previous
From: "Marko Kreen"
Date:
Subject: Re: Do we really want to migrate plproxy and citext into PG core distribution?
Next
From: ITAGAKI Takahiro
Date:
Subject: Uncopied parameters on CREATE TABLE LIKE