TODO: Move psql backslash information into views
New Files:
src/backend/catalog/pg_tools_schema.sql
Other:
Committer needs to bump CATVERSION
This goes a little further than the TODO entry...
A table psql_commands in the new pg_tools schema which holds a regular
expression "command" and a couple of columns with sql. The command is
matched against what the user types in, allowing psql commands to be
backend based -- not psql based.
The two columns holding queries are for the table structure (arbitrary)
and the footer area, which resolves down to category and info.
The display is the same as it used to be, as are all of the commands
except for \dd <param>. Preparing that particular query seems to fail,
and I can't see anything wrong with it or PostgreSQL.
It would be *very* simple to add long versions of all the commands
should that be wanted.
Potential problems:
A gettext() function has been moved into the backend to continue support
of various text transformations in the functions. I'm not sure how
Peters scripts work, but I doubt they currently function with this
technique.
Since identities (columns) cannot be changed by a function, they're
still doing their gettext() call within the psql client.
There are a few hardcoded keywords for expected results in psql. This
was done to accommodate the multi-table output for the \d *.* style
command. It's expected that these commands will exist, though the
structure is determined by the back-end and not psql.
Backward compatibility is completely broken. This isn't much of a
problem as the protocol change will also break backward compatibility in
a much harsher fashion. Needless to say, pre-7.4 client/libraries will
not work with 7.4 very nicely.
Bonus use:
In my own installation, in certain databases, I've added special
'internal' commands that will do pre-set queries with display in psql.
\bt <date> -> lists off billing transactions for that date.
\email <clientid> -> Gives me a clients email based on client id.
Takes seconds to add a new command to psql if you already have the
query.
--
Rod Taylor <rbt@rbt.ca>
PGP Key: http://www.rbt.ca/rbtpub.asc