SQL Comments

Started by Greg Copelandover 23 years ago8 messagesgeneral
Jump to latest
#1Greg Copeland
greg@CopelandConsulting.Net

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

#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Greg Copeland (#1)
Re: SQL Comments

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

#3Tom Lane
tgl@sss.pgh.pa.us
In reply to: Greg Copeland (#1)
Re: SQL Comments

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

#4Peter Eisentraut
peter_e@gmx.net
In reply to: Tom Lane (#3)
Re: SQL Comments

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

#5Alvaro Herrera
alvherre@atentus.com
In reply to: Peter Eisentraut (#4)
little psql additions

I append two little patches to psql. One is for \v. It is very simple
in that it ignores multibyte stuff, for example.

template1=# \v
Client:
PostgreSQL 7.3devel on i686-pc-linux-gnu, compiled by GCC 2.96
Server:
PostgreSQL 7.2.1 on i686-pc-linux-gnu, compiled by GCC 2.96

The second enables tab-complete to analyze. It ignores schema stuff (so
does every tab-completion command AFAICS)

--
Alvaro Herrera (<alvherre[a]atentus.com>)
"Nunca se desea ardientemente lo que solo se desea por razon" (F. Alexandre)

Attachments:

psql.tab.patchtext/plain; charset=US-ASCII; name=psql.tab.patchDownload+8-0
psql.version.patchtext/plain; charset=US-ASCII; name=psql.version.patchDownload+12-0
#6Peter Eisentraut
peter_e@gmx.net
In reply to: Peter Eisentraut (#4)
Re: SQL Comments

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

#7Bruce Momjian
bruce@momjian.us
In reply to: Alvaro Herrera (#5)
Re: little psql additions

I am taking only the tab completion part of this. Tom Lane added the
version to the psql startup display.

Your patch has been added to the PostgreSQL unapplied patches list at:

http://candle.pha.pa.us/cgi-bin/pgpatches

I will try to apply it within the next 48 hours.

---------------------------------------------------------------------------

Alvaro Herrera wrote:

I append two little patches to psql. One is for \v. It is very simple
in that it ignores multibyte stuff, for example.

template1=# \v
Client:
PostgreSQL 7.3devel on i686-pc-linux-gnu, compiled by GCC 2.96
Server:
PostgreSQL 7.2.1 on i686-pc-linux-gnu, compiled by GCC 2.96

The second enables tab-complete to analyze. It ignores schema stuff (so
does every tab-completion command AFAICS)

--
Alvaro Herrera (<alvherre[a]atentus.com>)
"Nunca se desea ardientemente lo que solo se desea por razon" (F. Alexandre)

Content-Description: Analyze tab completion

[ Attachment, skipping... ]

Content-Description: Version backslash command

[ Attachment, skipping... ]

---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/users-lounge/docs/faq.html

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073
#8Bruce Momjian
bruce@momjian.us
In reply to: Alvaro Herrera (#5)
Re: little psql additions

I have applied the tab completion part of this patch. The version
feature was added to the standard startup banner.

---------------------------------------------------------------------------

Alvaro Herrera wrote:

I append two little patches to psql. One is for \v. It is very simple
in that it ignores multibyte stuff, for example.

template1=# \v
Client:
PostgreSQL 7.3devel on i686-pc-linux-gnu, compiled by GCC 2.96
Server:
PostgreSQL 7.2.1 on i686-pc-linux-gnu, compiled by GCC 2.96

The second enables tab-complete to analyze. It ignores schema stuff (so
does every tab-completion command AFAICS)

--
Alvaro Herrera (<alvherre[a]atentus.com>)
"Nunca se desea ardientemente lo que solo se desea por razon" (F. Alexandre)

Content-Description: Analyze tab completion

[ Attachment, skipping... ]

Content-Description: Version backslash command

[ Attachment, skipping... ]

---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/users-lounge/docs/faq.html

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073