Re: COMMENT ON INDEX silently fails

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: COMMENT ON INDEX silently fails
Дата
Msg-id 16508.1475239741@sss.pgh.pa.us
обсуждение исходный текст
Ответ на COMMENT ON INDEX silently fails  (Michael Herold <quabla@hemio.de>)
Ответы Re: COMMENT ON INDEX silently fails
Список pgsql-bugs
Michael Herold <quabla@hemio.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)


            regards, tom lane

В списке pgsql-bugs по дате отправления:

Предыдущее
От: Michael Herold
Дата:
Сообщение: COMMENT ON INDEX silently fails
Следующее
От: David Fetter
Дата:
Сообщение: Re: COMMENT ON INDEX silently fails