Idea - fallback mode for psql backslash commands using information_schema

Lists: pgsql-hackers
From: "Dawid Kuroczko" <qnex42(at)gmail(dot)com>
To: "PostgreSQL-development Hackers" <pgsql-hackers(at)postgresql(dot)org>
Subject: Idea - fallback mode for psql backslash commands using information_schema
Date: 2008-12-29 14:19:50
Message-ID: 758d5e7f0812290619r1f993b8bhf76db277472e66b3@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Hi!

I think I've got a nice TODO item for psql client:

When a client connects to a database which has unknown (newer)
version it might be advisable to 'fallback' some commands to use
INFORMATION_SCHEMA instead of system catalogs.

For instance when connected to 8.4dev server using 8.3 client,
after issuing \d foo_table you get:
ERROR: column "reltriggers" does not exist
LINE1: SELECT relhasindex, relkind, relchecks, reltriggers, relhasr....

Of course the information_schema will probably be less efficient
and won't have PostgreSQL-specific items like 'Has OIDs', but
the user experience should be better.

My question is: does it look like a good TODO item? :)

Best regards,
Dawid
--
.................. ``The essence of real creativity is a certain
: *Dawid Kuroczko* : playfulness, a flitting from idea to idea
: qnex42(at)gmail(dot)com : without getting bogged down by fixated demands.''
`..................' Sherkaner Underhill, A Deepness in the Sky, V. Vinge


From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Dawid Kuroczko <qnex42(at)gmail(dot)com>
Cc: PostgreSQL-development Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Idea - fallback mode for psql backslash commands using information_schema
Date: 2008-12-29 21:02:04
Message-ID: 200812292102.mBTL24X23106@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Dawid Kuroczko wrote:
> Hi!
>
> I think I've got a nice TODO item for psql client:
>
> When a client connects to a database which has unknown (newer)
> version it might be advisable to 'fallback' some commands to use
> INFORMATION_SCHEMA instead of system catalogs.
>
>
> For instance when connected to 8.4dev server using 8.3 client,
> after issuing \d foo_table you get:
> ERROR: column "reltriggers" does not exist
> LINE1: SELECT relhasindex, relkind, relchecks, reltriggers, relhasr....
>
> Of course the information_schema will probably be less efficient
> and won't have PostgreSQL-specific items like 'Has OIDs', but
> the user experience should be better.
>
> My question is: does it look like a good TODO item? :)

That seems like duplicate effort. The clearer solution would just be to
use information_scema where possible for all psql backslash commands so
you don't have to maintain two versions. I think the problem is that
lots of information we need is not in the information schema.

--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://enterprisedb.com

+ If your life is a hard drive, Christ can be your backup. +