how to see column comments?

Started by Norman J. Clarkeabout 25 years ago11 messagesgeneral
Jump to latest
#1Norman J. Clarke
norman@combimatrix.com

Hello,

I have not been able to get psql to show column comments in version
7.1beta4. Am I doing anything wrong, or is this a bug? A transcript of my
psql session is below.

Norm

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

norman=# create table test_table (col1 integer);

CREATE

norman=# comment on table test_table is 'this is a table comment';

COMMENT

norman=# \dd test_table

Object descriptions
Name | Object | Description
------------+-------------+-------------------------
test_table | relation(r) | this is a table comment
(1 row)

norman=# comment on column test_table.col1 is 'this is a column comment';

COMMENT

norman=# \dd test_table.col1

Object descriptions
Name | Object | Description
------+--------+-------------
(0 rows)

#2Mike Mascari
mascarm@mascari.com
In reply to: Norman J. Clarke (#1)
RE: how to see column comments?

Try \d+ test_table.

Hope that helps,

Mike Mascari
mascarm@mascari.com

-----Original Message-----
From: Norman J. Clarke [SMTP:norman@combimatrix.com]
Sent: Thursday, February 15, 2001 8:24 PM
To: pgsql-general@postgresql.org
Subject: [GENERAL] how to see column comments?

Hello,

I have not been able to get psql to show column comments in version
7.1beta4. Am I doing anything wrong, or is this a bug? A transcript of my
psql session is below.

Norm

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

norman=# create table test_table (col1 integer);

CREATE

norman=# comment on table test_table is 'this is a table comment';

COMMENT

norman=# \dd test_table

Object descriptions
Name | Object | Description
------------+-------------+-------------------------
test_table | relation(r) | this is a table comment
(1 row)

norman=# comment on column test_table.col1 is 'this is a column comment';

COMMENT

norman=# \dd test_table.col1

Object descriptions
Name | Object | Description
------+--------+-------------
(0 rows)

#3Christopher Sawtell
csawtell@xtra.co.nz
In reply to: Norman J. Clarke (#1)
Re: how to see column comments?

You have to put the actual name (attribute) of the column, not "col1"

On Fri, 16 Feb 2001 14:24, Norman J. Clarke wrote:

Hello,

I have not been able to get psql to show column comments in version
7.1beta4. Am I doing anything wrong, or is this a bug? A transcript of
my psql session is below.

Norm

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

norman=# create table test_table (col1 integer);

CREATE

norman=# comment on table test_table is 'this is a table comment';

COMMENT

norman=# \dd test_table

Object descriptions
Name | Object | Description
------------+-------------+-------------------------
test_table | relation(r) | this is a table comment
(1 row)

norman=# comment on column test_table.col1 is 'this is a column
comment';

COMMENT

norman=# \dd test_table.col1

Object descriptions
Name | Object | Description
------+--------+-------------
(0 rows)

--
Sincerely etc.,

NAME Christopher Sawtell
CELL PHONE 021 257 4451
ICQ UIN 45863470
EMAIL csawtell @ xtra . co . nz
CNOTES ftp://ftp.funet.fi/pub/languages/C/tutorials/sawtell_C.tar.gz

-->> Please refrain from using HTML or WORD attachments in e-mails to me
<<--

#4Mike Mascari
mascarm@mascari.com
In reply to: Christopher Sawtell (#3)
RE: how to see column comments?

Actually, I responded a bit too hastily. That looks like a bug in psql to
me. I see it in 7.0.3 as well. The query that psql is generating is
incorrect:

SELECT relhasindex, relkind, relchecks, reltriggers, relhasrules
FROM pg_class WHERE relname='table.column';

It should be querying pg_attribute.

It seems \d+ tablename is currently the only way to view column comments.

Hope that helps,

Mike Mascari
mascarm@mascari.com

-----Original Message-----
From: Norman J. Clarke [SMTP:norman@combimatrix.com]
Sent: Thursday, February 15, 2001 8:24 PM
To: pgsql-general@postgresql.org
Subject: [GENERAL] how to see column comments?

Hello,

I have not been able to get psql to show column comments in version
7.1beta4. Am I doing anything wrong, or is this a bug? A transcript of my
psql session is below.

Norm

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

norman=# create table test_table (col1 integer);

CREATE

norman=# comment on table test_table is 'this is a table comment';

COMMENT

norman=# \dd test_table

Object descriptions
Name | Object | Description
------------+-------------+-------------------------
test_table | relation(r) | this is a table comment
(1 row)

norman=# comment on column test_table.col1 is 'this is a column comment';

COMMENT

norman=# \dd test_table.col1

Object descriptions
Name | Object | Description
------+--------+-------------
(0 rows)

#5Noname
phillip@formstar.com
In reply to: Mike Mascari (#4)
How to use gethostbyname()

In psql, gethostbyname() is defined as taking a text parameter and return an
inet type value or reference.

However, if you do

psql=# select gethostbyname('www.postgres.org');
gethostbyname
---------------
<unprintable>
(1 row)

the inet address will be unprintable.

Has anyone got any idea?

Phillip Pan
-----------

#6Tom Lane
tgl@sss.pgh.pa.us
In reply to: Noname (#5)
Re: How to use gethostbyname()

<phillip@formstar.com> writes:

In psql, gethostbyname() is defined as taking a text parameter and return an
inet type value or reference.

Huh? There's no such function in the standard Postgres distribution.

regards, tom lane

#7Peter Eisentraut
peter_e@gmx.net
In reply to: Noname (#5)
Re: How to use gethostbyname()

phillip@formstar.com writes:

In psql, gethostbyname() is defined as taking a text parameter and return an
inet type value or reference.

I don't see a function gethostbyname() in my copy. Where did you get it
from and what is its source code?

--
Peter Eisentraut peter_e@gmx.net http://yi.org/peter-e/

#8Bruce Momjian
bruce@momjian.us
In reply to: Peter Eisentraut (#7)
Re: How to use gethostbyname()

phillip@formstar.com writes:

In psql, gethostbyname() is defined as taking a text parameter and return an
inet type value or reference.

I don't see a function gethostbyname() in my copy. Where did you get it
from and what is its source code?

Don't tell me it is one of those "grab from libc" tricks.

CREATE FUNCTION getpid () returns int4 as '/lib/libc.so.6' LANGUAGE 'C';
SELECT getpid();

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026
#9Noname
phillip@formstar.com
In reply to: Tom Lane (#6)
Re: How to use gethostbyname()

On Fri, 16 Feb 2001, Tom Lane wrote:

<phillip@formstar.com> writes:

In psql, gethostbyname() is defined as taking a text parameter and return an
inet type value or reference.

Huh? There's no such function in the standard Postgres distribution.

If you do a '\df' at prompt, you will be able to see I am not lying.

Phillip Pan
-----------

#10Noname
phillip@formstar.com
In reply to: Noname (#9)
Re: How to use gethostbyname()

I am running Postgres 7.0.0 and compiled Postgres myself. However, I did not add
any parameters to 'configure' script.

<phillip@formstar.com> writes:

On Fri, 16 Feb 2001, Tom Lane wrote:

<phillip@formstar.com> writes:

In psql, gethostbyname() is defined as taking a text parameter and return an
inet type value or reference.

Huh? There's no such function in the standard Postgres distribution.

If you do a '\df' at prompt, you will be able to see I am not lying.

regression=# \df
...
text | format_type | oid, integer
integer | get_bit | bytea, integer
integer | get_byte | bytea, integer
name | getdatabaseencoding |
name | getpgusername |
integer | hashbpchar | character
integer | hashchar | "char"
integer | hashfloat4 | real
...

It's not in 7.1, nor 7.0. Where did you get it from? Which Postgres
version are you running, anyway?

regards, tom lane

Phillip Pan
-----------

#11Tom Lane
tgl@sss.pgh.pa.us
In reply to: Noname (#10)
Re: How to use gethostbyname()

<phillip@formstar.com> writes:

I am running Postgres 7.0.0 and compiled Postgres myself. However, I
did not add any parameters to 'configure' script.

Nonetheless, gethostbyname() is *not* a function provided in the
standard distribution. You must have gotten it from someplace else.
You'll need to find the author and ask him/her how it's supposed to
work.

regards, tom lane