Thread: SQL Comments

SQL Comments

From
Greg Copeland
Date:
According to
http://www.commandprompt.com/ppbook/index.lxp?lxpwrap=x17549%2ehtm:
"\dd Displays all descriptions for all database objects."

When I do this, I get, "ERROR:  No such attribute a.oid".  Is this a
feature?  The documentation incorrect?  Changed since it was written?

Also, I noticed that none of the system tables appear to have any
comments on them.  Is that by design, lack of value on doing so, or
something else I don't understand?

I'm using the latest (as of several minutes ago) from CVS.

Greg




Attachment

Re: SQL Comments

From
Tom Lane
Date:
Greg Copeland <greg@CopelandConsulting.Net> writes:
> "\dd Displays all descriptions for all database objects."

> When I do this, I get, "ERROR:  No such attribute a.oid".  Is this a
> feature?  The documentation incorrect?  Changed since it was written?

Sounds to me like you are using an older psql with a newer server.
Try to get 'em in sync.

> Also, I noticed that none of the system tables appear to have any
> comments on them.  Is that by design, lack of value on doing so, or
> something else I don't understand?

Most of the pg_proc and pg_type entries have comments on 'em --- a grep
for DESCR macros counts:
/home/postgres/pgsql/src/include/catalog/pg_am.h: 4
/home/postgres/pgsql/src/include/catalog/pg_class.h: 8
/home/postgres/pgsql/src/include/catalog/pg_database.h: 1
/home/postgres/pgsql/src/include/catalog/pg_language.h: 3
/home/postgres/pgsql/src/include/catalog/pg_namespace.h: 3
/home/postgres/pgsql/src/include/catalog/pg_proc.h: 1281
/home/postgres/pgsql/src/include/catalog/pg_type.h: 53
There's never been any concerted effort to put comments on anything
else.

            regards, tom lane

Re: SQL Comments

From
Tom Lane
Date:
Greg Copeland <greg@copelandconsulting.net> writes:
> Should the version number be considered for output when psql is started
> up for interactive use?  I'm fairly sure I would of caught this my self
> if a version number were there to key off of.

> Perhaps it should say something like:
> Welcome to psql, the PostgreSQL (v7.3.1) interactive terminal.

I think
    Welcome to psql v7.3, the PostgreSQL interactive terminal.
would read more naturally ... seems like a good idea in principle
though, especially since 7.3 is going to introduce a *lot* of breakage
for the backslash commands of older psql versions.

> Maybe even a slash command which not only shows the postgres version
> that psql was compiled from but also the server version it's currently
> connected with?

> Example:
> # \v
> PSQL version 7.3.1
> Backend version 7.3.1

Maybe.  Peter, any opinion about that?

            regards, tom lane

Re: SQL Comments

From
Peter Eisentraut
Date:
Tom Lane writes:

> I think
>     Welcome to psql v7.3, the PostgreSQL interactive terminal.
> would read more naturally ...

As long as you don't put the little "v" there, I don't mind.

> > Example:
> > # \v
> > PSQL version 7.3.1

\echo :VERSION

> > Backend version 7.3.1

select version();

--
Peter Eisentraut   peter_e@gmx.net


Re: SQL Comments

From
Peter Eisentraut
Date:
Greg Copeland writes:

> Don't know about you, but IMHO, typing something like "\v" (or some such
> flag) is a a heck of a lot easier than pulling a string from my back
> pocket, ":VERSION" (where ever that came from), and knowing that there
> is a function called version() which I have to select from to obtain the
> back-end version.

If we put the psql version in the welcome screen, half of this argument is
obsolete.  And select version() is rather common knowledge.  Rather than
creating new ways to invoke the same functionality that only differ in the
number of keystrokes, let's do something genuinely better, such as issuing
a warning if the versions mismatch.

--
Peter Eisentraut   peter_e@gmx.net