Re: COMMENT ON INDEX silently fails

From: David Fetter <david(at)fetter(dot)org>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Michael Herold <quabla(at)hemio(dot)de>, pgsql-bugs(at)postgresql(dot)org
Subject: Re: COMMENT ON INDEX silently fails
Date: 2016-09-30 19:06:52
Message-ID: 20160930190652.GA9774@fetter.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Fri, Sep 30, 2016 at 08:49:01AM -0400, Tom Lane wrote:
> Michael Herold <quabla(at)hemio(dot)de> writes:
> > The statement
> > COMMENT ON INDEX object_name IS '...'
> > does not fail if object_name is a table constraint. However, it does
> > not seem to have any effect.
>
> Sure it does.
>
> regression=# create table foo (f1 int primary key);
> CREATE TABLE
> regression=# \d foo
> Table "public.foo"
> Column | Type | Modifiers
> --------+---------+-----------
> f1 | integer | not null
> Indexes:
> "foo_pkey" PRIMARY KEY, btree (f1)
>
> regression=# select * from pg_description where objoid = 'foo_pkey'::regclass;
> objoid | classoid | objsubid | description
> --------+----------+----------+-------------
> (0 rows)
>
> regression=# comment on index foo_pkey is 'test comment';
> COMMENT
> regression=# select * from pg_description where objoid = 'foo_pkey'::regclass;
> objoid | classoid | objsubid | description
> --------+----------+----------+--------------
> 478892 | 1259 | 0 | test comment
> (1 row)
>
> I suspect you were expecting the comment to be displayed in some place it
> isn't, but that's hard to discuss intelligently when you didn't say where
> you expected it to show up. It is there in, eg, \di+ output:
>
> regression=# \di+ foo_pkey
> List of relations
> Schema | Name | Type | Owner | Table | Size | Description
> --------+----------+-------+----------+-------+------------+--------------
> public | foo_pkey | index | postgres | foo | 8192 bytes | test comment
> (1 row)

It's not in the \df+ output, where a reasonable person could expect it
to show up. Is this worth a patch for 10?

Best,
David.
--
David Fetter <david(at)fetter(dot)org> http://fetter.org/
Phone: +1 415 235 3778 AIM: dfetter666 Yahoo!: dfetter
Skype: davidfetter XMPP: david(dot)fetter(at)gmail(dot)com

Remember to vote!
Consider donating to Postgres: http://www.postgresql.org/about/donate

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Reyes Ponce 2016-09-30 19:19:38 Re: BUG #14343: UPSERT (ON CONFLICT) doesn't check ON CONFLICT constraint first
Previous Message Tom Lane 2016-09-30 12:49:01 Re: COMMENT ON INDEX silently fails