pg.ddx.io pgsql-bugs@postgresql.org mailing list archive
help / color / mirror / Atom feedCOMMENT ON INDEX silently fails
7+ messages / 3 participants
[nested] [flat]
* COMMENT ON INDEX silently fails
@ 2016-09-30 11:59 Michael Herold <quabla@hemio.de>
0 siblings, 1 reply; 7+ messages in thread
From: Michael Herold @ 2016-09-30 11:59 UTC (permalink / raw)
To: pgsql-bugs
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.
I think the statement should either fail or create the respective
comment.
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
^ permalink raw reply [nested|flat] 7+ messages in thread
* Re: COMMENT ON INDEX silently fails
@ 2016-09-30 12:49 Tom Lane <tgl@sss.pgh.pa.us>
parent: Michael Herold <quabla@hemio.de>
0 siblings, 1 reply; 7+ messages in thread
From: Tom Lane @ 2016-09-30 12:49 UTC (permalink / raw)
To: Michael Herold <quabla@hemio.de>; +Cc: 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
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
^ permalink raw reply [nested|flat] 7+ messages in thread
* Re: COMMENT ON INDEX silently fails
@ 2016-09-30 19:06 David Fetter <david@fetter.org>
parent: Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 2 replies; 7+ messages in thread
From: David Fetter @ 2016-09-30 19:06 UTC (permalink / raw)
To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: Michael Herold <quabla@hemio.de>; pgsql-bugs
On Fri, Sep 30, 2016 at 08:49:01AM -0400, Tom Lane wrote:
> 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)
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
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
^ permalink raw reply [nested|flat] 7+ messages in thread
* Re: COMMENT ON INDEX silently fails
@ 2016-09-30 19:25 Michael Herold <quabla@hemio.de>
parent: David Fetter <david@fetter.org>
1 sibling, 1 reply; 7+ messages in thread
From: Michael Herold @ 2016-09-30 19:25 UTC (permalink / raw)
To: David Fetter <david@fetter.org>; +Cc: Tom Lane <tgl@sss.pgh.pa.us>; pgsql-bugs
> Sure it does.
Okay, correct phrasing would be: It has unexpected effects.
> 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.
create table foo (f1 int primary key);
comment on index foo_pkey is 'test comment';
comment on constraint foo_pkey on foo is 'test comment 2';
# \di+
List of relations
Schema | Name | Type | Owner | Table | Size | Description
--------+----------+-------+----------+-------+------------+--------------
public | foo_pkey | index | postgres | foo | 8192 bytes | test comment
(1 row)
# SELECT * FROM pg_description WHERE description LIKE 'test com%';
objoid | classoid | objsubid | description
--------+----------+----------+----------------
123732 | 1259 | 0 | test comment
123733 | 2606 | 0 | test comment 2
(2 rows)
$ pgAdmin III
Before `comment on constraint` the textarea for comment is empty and no
statement for comment in SQL pane.
Afterwards it is using 'test comment 2'.
Best,
Michael
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
^ permalink raw reply [nested|flat] 7+ messages in thread
* Re: COMMENT ON INDEX silently fails
@ 2016-09-30 19:34 Tom Lane <tgl@sss.pgh.pa.us>
parent: David Fetter <david@fetter.org>
1 sibling, 0 replies; 7+ messages in thread
From: Tom Lane @ 2016-09-30 19:34 UTC (permalink / raw)
To: David Fetter <david@fetter.org>; +Cc: Michael Herold <quabla@hemio.de>; pgsql-bugs
David Fetter <david@fetter.org> writes:
> It's not in the \df+ output, where a reasonable person could expect it
> to show up. Is this worth a patch for 10?
Uh, what? This is an index we're talking about, not a function.
regards, tom lane
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
^ permalink raw reply [nested|flat] 7+ messages in thread
* Re: COMMENT ON INDEX silently fails
@ 2016-09-30 19:36 Tom Lane <tgl@sss.pgh.pa.us>
parent: Michael Herold <quabla@hemio.de>
0 siblings, 1 reply; 7+ messages in thread
From: Tom Lane @ 2016-09-30 19:36 UTC (permalink / raw)
To: Michael Herold <quabla@hemio.de>; +Cc: David Fetter <david@fetter.org>; pgsql-bugs
Michael Herold <quabla@hemio.de> writes:
>> 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.
> $ pgAdmin III
> Before `comment on constraint` the textarea for comment is empty and no
> statement for comment in SQL pane.
> Afterwards it is using 'test comment 2'.
Well, you should take that up with the pgAdmin crew, but I'd note that
a comment on a constraint and a comment on the index underlying the
constraint are two different things.
regards, tom lane
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
^ permalink raw reply [nested|flat] 7+ messages in thread
* Re: COMMENT ON INDEX silently fails
@ 2016-09-30 19:46 Michael Herold <quabla@hemio.de>
parent: Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 0 replies; 7+ messages in thread
From: Michael Herold @ 2016-09-30 19:46 UTC (permalink / raw)
To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: David Fetter <david@fetter.org>; pgsql-bugs
On Fri, Sep 30, 2016 at 9:36 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> Well, you should take that up with the pgAdmin crew, but I'd note that
> a comment on a constraint and a comment on the index underlying the
> constraint are two different things.
Seems like pgAdmin is hiding this on purpose, which makes kind of sense.
Seems like I missed "PostgreSQL automatically creates an index for each
unique constraint and primary key constraint to enforce uniqueness."
No Bugs here.
Best,
Michael
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
^ permalink raw reply [nested|flat] 7+ messages in thread
end of thread, other threads:[~2016-09-30 19:46 UTC | newest]
Thread overview: 7+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2016-09-30 11:59 COMMENT ON INDEX silently fails Michael Herold <quabla@hemio.de>
2016-09-30 12:49 ` Tom Lane <tgl@sss.pgh.pa.us>
2016-09-30 19:06 ` David Fetter <david@fetter.org>
2016-09-30 19:25 ` Michael Herold <quabla@hemio.de>
2016-09-30 19:36 ` Tom Lane <tgl@sss.pgh.pa.us>
2016-09-30 19:46 ` Michael Herold <quabla@hemio.de>
2016-09-30 19:34 ` Tom Lane <tgl@sss.pgh.pa.us>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox