PSQL and backward compatibility

From: Rod Taylor <rbt(at)rbt(dot)ca>
To: PostgreSQL Development <pgsql-hackers(at)postgresql(dot)org>
Subject: PSQL and backward compatibility
Date: 2003-01-25 01:57:27
Message-ID: 1043459847.58142.113.camel@jester
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

I've started playing with a structure based on the description in this
message:
http://groups.google.com/groups?hl=en&lr=lang_en&ie=UTF-8&oe=UTF-8&safe=off&selm=1043257402.83856.112.camel%40jester&rnum=21

Basically, it consists of a very simple schema to tell PSQL what \?
commands are available, and the query to use to fetch the information.

- User types \d<command>. Psql (as a last resort after the checks in
command.c) will query the database to see if the \d<command> exists with
the number of arguments the user has supplied.
- If it exists (regular expression match of what the user typed as
<command> against column cmd_expression), it pulls out the SQL, prepares
it via PREPARE, EXECUTES it, and displays the results.

See schema and simple psql.patch attached. Caching, etc. could be done
to speed things up -- not to mention keeping the plans around, but this
was a quick hack.

2 sample commands are included. \dqtest (prints out a row of junk),
\dqdb (prints db listing -- like \l), and \dqdb <arg> (prints db listing
-- but with a LIKE match on the dbname).

Thoughts or remarks?

It allows all versions of psql using that table to pick up available
commands for the database (old psql, new db gets commands for new db)
but translations for column headers, etc. will be wonky as they're still
tied to psql.

--
Rod Taylor <rbt(at)rbt(dot)ca>

PGP Key: http://www.rbt.ca/rbtpub.asc

Attachment Content-Type Size
psql.patch text/plain 4.2 KB
psql_SCHEMA text/plain 1.1 KB

Browse pgsql-hackers by date

  From Date Subject
Next Message Kevin Brown 2003-01-25 02:11:59 Re: Mount options for Ext3?
Previous Message David Durst 2003-01-25 01:30:08 Re: Function for adding Money type