On Fri, 2003-01-10 at 12:30, Marc G. Fournier wrote:
>
> Is there any way of fixing the following?
>
> 164_459_openacs=> \d
> ERROR: parser: parse error at or near "."
> 164_459_openacs=>
>
> We've started to upgrade the client machines, before upgrading the server
> itself, but it looks like the psql client isn't backwards compatible?
>
It's not so much that the psql client isn't backward compatible, but the
\ commands arn't. Remember that \d is merely an alias for :
SELECT c.relname as "Name", CASE c.relkind WHEN 'r' THEN 'table' WHEN 'v' THEN 'view' WHEN 'i'
THEN 'index' WHEN 'S' THEN 'sequence' WHEN 's' THEN 'special' END as
"Type", u.usename as "Owner"
FROM pg_class c LEFT JOIN pg_user u ON c.relowner = u.usesysid
WHERE c.relkind IN ('r','v','S','') AND c.relname !~ '^pg_'
ORDER BY 1;
in 7.2.x and:
SELECT n.nspname as "Schema", c.relname as "Name", CASE c.relkind WHEN 'r' THEN 'table' WHEN 'v' THEN 'view' WHEN 'i'
THEN 'index' WHEN 'S' THEN 'sequence' WHEN 's' THEN 'special' END as
"Type", u.usename as "Owner"
FROM pg_catalog.pg_class c LEFT JOIN pg_catalog.pg_user u ON u.usesysid = c.relowner LEFT JOIN
pg_catalog.pg_namespacen ON n.oid = c.relnamespace
WHERE c.relkind IN ('r','v','S','') AND n.nspname NOT IN ('pg_catalog', 'pg_toast') AND
pg_catalog.pg_table_is_visible(c.oid)
ORDER BY 1,2;
in 7.3
if you run the 7.2 sql from a 7.3 psql client against a 7.2 server it
will work. One solution might be to create files with the 7.2 queries
in them so you could do something like \i relations to get a list of all
relations in the database.
If someone we're ambitious enough, you probably could modify psql to
store which version of the server it is connected and the use some type
of class structure to call the appropriate sql for the given \ command.
Thats the approach we've taken with phppgadmin 3, and while it
complicates things it does have it's benefits.
Robert Treat