From: | Josh Kupershmidt <schmiddy(at)gmail(dot)com> |
---|---|
To: | pgsql-hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | psql: bogus descriptions displayed by \d+ |
Date: | 2011-07-16 15:54:37 |
Message-ID: | CAK3UJRHzL+C3YgS-JcZHPxD+tqem2Esh6AxL6qgoCzJnrnMRhg@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Hi all,
The psql output for \d+ on indexes, sequences, and views is rather
bogus. Examples below from the SQL at bottom.
So, if you look at \d+ newtbl, the right-most column named Description
should display any comments attached to newtbl's columns. You should
see "bcol column comment" as the Description for column bcol. That
works OK.
Now, try this:
test=# \d+ newtbl_idx_bcol
Index "public.newtbl_idx_bcol"
Column | Type | Definition | Storage | Description
--------+---------+------------+---------+-------------
bcol | integer | bcol | plain |
What's the Description displayed in that table? Well, right now it's
totally broken (not displaying anything). I'm not sure if we should
try to display the comment attached to column bcol in this case: if
so, what would we do for e.g. functional indexes?
A similar situation exists for sequences and views displayed by \d+.
I'd be OK with just ripping out "Description" entirely in these cases;
if you want to see the comment attached to the index or sequence
itself, you can use \di+ or \ds+. Although now might also be a good
time to think about properly displaying sequence or index comments via
\d+, and how they should be displayed.
Thoughts?
Josh
-- Example SQL creating a few objects with comments. --
CREATE TABLE newtbl (acol serial PRIMARY KEY,
bcol int NOT NULL,
ccol text DEFAULT NULL,
dcol text NOT NULL);
COMMENT ON TABLE newtbl IS 'newtbl table comment';
COMMENT ON COLUMN newtbl.bcol IS 'bcol column comment';
COMMENT ON SEQUENCE newtbl_acol_seq IS 'sequence comment';
CREATE INDEX newtbl_idx_bcol ON newtbl (bcol);
COMMENT ON INDEX newtbl_idx_bcol IS 'single-column index on newtbl';
CREATE VIEW myview AS SELECT * FROM newtbl;
COMMENT ON VIEW myview IS 'view comment';
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2011-07-16 16:09:53 | Re: psql: bogus descriptions displayed by \d+ |
Previous Message | Florian Pflug | 2011-07-16 15:51:54 | Re: Commitfest Status: Sudden Death Overtime |