Re: pg_dump Add dumping of comments on index columns

Lists: pgsql-hackers
From: higepon <higepon(at)gmail(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: pg_dump Add dumping of comments on index columns
Date: 2009-03-23 08:28:30
Message-ID: f07386410903230128o41d8d36xaa448bde86c8141b@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Hi.
I found a TODO item "Add dumping of comments on index columns and
composite type columns" for pg_dump
and want to write a patch for it.

But I'm not sure if I understand the problem correctly.
Does "Add dumping of comments on index columns" mean that
pg_dump should dump out COMMENT statements like following?

COMMENT ON COLUMN some_index.index_column1 IS 'Hello column1';

Can anybody give me some advice on this?

Best regards,

-----
Taro Minowa(Higepon)

http://www.monaos.org/
http://code.google.com/p/mosh-scheme/


From: Bruce Momjian <bruce(at)momjian(dot)us>
To: higepon <higepon(at)gmail(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: pg_dump Add dumping of comments on index columns
Date: 2009-03-24 14:10:50
Message-ID: 200903241410.n2OEAoj22595@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

higepon wrote:
> Hi.
> I found a TODO item "Add dumping of comments on index columns and
> composite type columns" for pg_dump
> and want to write a patch for it.
>
> But I'm not sure if I understand the problem correctly.
> Does "Add dumping of comments on index columns" mean that
> pg_dump should dump out COMMENT statements like following?
>
> COMMENT ON COLUMN some_index.index_column1 IS 'Hello column1';
>
> Can anybody give me some advice on this?

Wow, I have no idea what that means. I am wondering if we should just
remove this TODO item. We don't even support comments on indexed
columns, so why would pg_dump need to dump it?

The full text is:

Add dumping of comments on index columns and composite type columns

Do we support comments on composite types?

This item first appeared on the TODO list in Postgres 8.0.

--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://enterprisedb.com

+ If your life is a hard drive, Christ can be your backup. +


From: higepon <higepon(at)gmail(dot)com>
To: Bruce Momjian <bruce(at)momjian(dot)us>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: pg_dump Add dumping of comments on index columns
Date: 2009-03-24 14:35:41
Message-ID: f07386410903240735g60815026ka7aaabb93203485e@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Hi.

> Wow, I have no idea what that means. I am wondering if we should just
> remove this TODO item. We don't even support comments on indexed
> columns, so why would pg_dump need to dump it?

Oh I see.
But we still can comment on indexed columns like following on 8.3.7,
is it unsupported feature?

create table person (social_no integer, name text, age integer, uri
text, PRIMARY KEY (social_no));
create index person_age on person using BTREE (age);
comment on column person_age.age IS 'hello index person_age.age';

And we can find the comment in pg_description table.

> Do we support comments on composite types

If we do, I will also write a patch for it.

Cheers.

-----
Taro Minowa(Higepon)

http://www.monaos.org/
http://code.google.com/p/mosh-scheme/

On Tue, Mar 24, 2009 at 11:10 PM, Bruce Momjian <bruce(at)momjian(dot)us> wrote:
> higepon wrote:
>> Hi.
>> I found a TODO item "Add dumping of comments on index columns and
>> composite type columns" for pg_dump
>> and want to write a patch for it.
>>
>> But I'm not sure if I understand the problem correctly.
>> Does "Add dumping of comments on index columns" mean that
>> pg_dump should dump out COMMENT statements like following?
>>
>>  COMMENT ON COLUMN some_index.index_column1 IS 'Hello column1';
>>
>> Can anybody give me some advice on this?
>
> Wow, I have no idea what that means.  I am wondering if we should just
> remove this TODO item.  We don't even support comments on indexed
> columns, so why would pg_dump need to dump it?
>
> The full text is:
>
>        Add dumping of comments on index columns and composite type columns
>
> Do we support comments on composite types?
>
> This item first appeared on the TODO list in Postgres 8.0.
>
> --
>  Bruce Momjian  <bruce(at)momjian(dot)us>        http://momjian.us
>  EnterpriseDB                             http://enterprisedb.com
>
>  + If your life is a hard drive, Christ can be your backup. +
>


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Bruce Momjian <bruce(at)momjian(dot)us>
Cc: higepon <higepon(at)gmail(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: pg_dump Add dumping of comments on index columns
Date: 2009-03-24 14:56:17
Message-ID: 27676.1237906577@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Bruce Momjian <bruce(at)momjian(dot)us> writes:
> Wow, I have no idea what that means. I am wondering if we should just
> remove this TODO item. We don't even support comments on indexed
> columns, so why would pg_dump need to dump it?

The system will let you do it, both cases:

regression=# create type foo as (f1 int, f2 text);
CREATE TYPE
regression=# comment on column foo.f2 is 'column of a composite type';
COMMENT
regression=# create table tt (f1 int primary key);
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "tt_pkey" for table "tt"
CREATE TABLE
regression=# comment on column tt_pkey.f1 is 'column of an index';
COMMENT

and pg_dump fails to dump both cases.

Commenting on a composite-type column seems reasonable. I'm less happy
about the other because it depends on the names assigned to index
columns, which are implementation artifacts. I'd rather see us forbid
the case.

regards, tom lane


From: higepon <higepon(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Bruce Momjian <bruce(at)momjian(dot)us>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: pg_dump Add dumping of comments on index columns
Date: 2009-03-26 07:39:41
Message-ID: f07386410903260039k6883a6a2ue46471007c575e79@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Hi.

Here is a patch for pg_dump "Commenting on a composite-type column".
This patch is for Todo item named "Add dumping of comments on index
columns and composite type columns".
As Tom Lane said, this patch is not for dumping "comments on index columns",
but only for "comment on composite-type column".

With this patch, pg_dump can dump comments on composite-type column.

--
-- Name: COLUMN bar.b1; Type: COMMENT; Schema: public; Owner: taro
--

COMMENT ON COLUMN bar.b1 IS 'column of a composite type b1';

--
-- Name: COLUMN bar.b3; Type: COMMENT; Schema: public; Owner: taro
--

COMMENT ON COLUMN bar.b3 IS 'column of a composite type b3';

Would someone please review this?

Cheers.

-----
Taro Minowa(Higepon)

Cybozu Labs, Inc.

http://www.monaos.org/
http://code.google.com/p/mosh-scheme/

On Tue, Mar 24, 2009 at 11:56 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> Bruce Momjian <bruce(at)momjian(dot)us> writes:
>> Wow, I have no idea what that means.  I am wondering if we should just
>> remove this TODO item.  We don't even support comments on indexed
>> columns, so why would pg_dump need to dump it?
>
> The system will let you do it, both cases:
>
> regression=# create type foo as (f1 int, f2 text);
> CREATE TYPE
> regression=# comment on column foo.f2 is 'column of a composite type';
> COMMENT
> regression=# create table tt (f1 int primary key);
> NOTICE:  CREATE TABLE / PRIMARY KEY will create implicit index "tt_pkey" for table "tt"
> CREATE TABLE
> regression=# comment on column tt_pkey.f1 is 'column of an index';
> COMMENT
>
> and pg_dump fails to dump both cases.
>
> Commenting on a composite-type column seems reasonable.  I'm less happy
> about the other because it depends on the names assigned to index
> columns, which are implementation artifacts.  I'd rather see us forbid
> the case.
>
>                        regards, tom lane
>

Attachment Content-Type Size
pg_dump_composite_type_v1.patch application/octet-stream 5.8 KB

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: higepon <higepon(at)gmail(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Bruce Momjian <bruce(at)momjian(dot)us>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: pg_dump Add dumping of comments on index columns
Date: 2009-03-26 14:37:15
Message-ID: 603c8f070903260737g1372be6egb725a23c1c06ef1e@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

> Would someone please review this?

Since we are about to go to beta, it may be that no one is up for
reviewing it right now. But I've added it to the CommitFest page for
the next CommitFest.

http://wiki.postgresql.org/wiki/CommitFest_2009-First

...Robert


From: higepon <higepon(at)gmail(dot)com>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Bruce Momjian <bruce(at)momjian(dot)us>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: pg_dump Add dumping of comments on index columns
Date: 2009-03-26 14:40:28
Message-ID: f07386410903260740l6542d585iecd807eb0386a850@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Hi.

> Since we are about to go to beta, it may be that no one is up for
> reviewing it right now.  But I've added it to the CommitFest page for
> the next CommitFest.

Thank you.
I wait until the next CommitFest.

-----
Taro Minowa(Higepon)

http://www.monaos.org/
http://code.google.com/p/mosh-scheme/


From: Jaime Casanova <jcasanov(at)systemguards(dot)com(dot)ec>
To: higepon <higepon(at)gmail(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Bruce Momjian <bruce(at)momjian(dot)us>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: pg_dump Add dumping of comments on index columns
Date: 2009-07-14 07:34:21
Message-ID: 3073cc9b0907140034t461ce630n7a07e2e847e1b324@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Thu, Mar 26, 2009 at 2:39 AM, higepon<higepon(at)gmail(dot)com> wrote:
> Hi.
>
> Here is a patch for pg_dump "Commenting on a composite-type column".
> This patch is for Todo item named "Add dumping of comments on index
> columns and composite type columns".

this one looks good to me, the only adjust i made to the patch is
change the name for the function that dump the comments from the
composite types columns for: dumpCompositeTypeColsComment that seems
more clearer to me...

the patch works just fine...

--
Atentamente,
Jaime Casanova
Soporte y capacitación de PostgreSQL
Asesoría y desarrollo de sistemas
Guayaquil - Ecuador
Cel. +59387171157

Attachment Content-Type Size
pg_dump_composite_type_v2.patch text/x-diff 3.7 KB

From: higepon <higepon(at)gmail(dot)com>
To: Jaime Casanova <jcasanov(at)systemguards(dot)com(dot)ec>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Bruce Momjian <bruce(at)momjian(dot)us>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: pg_dump Add dumping of comments on index columns
Date: 2009-07-15 03:20:47
Message-ID: f07386410907142020u602cd722y3e81025fc39f0fc3@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Jaime Casanova wrote:

> this one looks good to me, the only adjust i made to the patch is

Thank you for your review!

---
Taro Minowa(Higepon)

http://www.monaos.org/
http://code.google.com/p/mosh-scheme/

On Tue, Jul 14, 2009 at 4:34 PM, Jaime
Casanova<jcasanov(at)systemguards(dot)com(dot)ec> wrote:
> On Thu, Mar 26, 2009 at 2:39 AM, higepon<higepon(at)gmail(dot)com> wrote:
>> Hi.
>>
>> Here is a patch for pg_dump "Commenting on a composite-type column".
>> This patch is for Todo item named "Add dumping of comments on index
>> columns and composite type columns".
>
> this one looks good to me, the only adjust i made to the patch is
> change the name for the function that dump the comments from the
> composite types columns for: dumpCompositeTypeColsComment that seems
> more clearer to me...
>
> the patch works just fine...
>
> --
> Atentamente,
> Jaime Casanova
> Soporte y capacitación de PostgreSQL
> Asesoría y desarrollo de sistemas
> Guayaquil - Ecuador
> Cel. +59387171157
>


From: Brendan Jurd <direvus(at)gmail(dot)com>
To: Jaime Casanova <jcasanov(at)systemguards(dot)com(dot)ec>
Cc: higepon <higepon(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Bruce Momjian <bruce(at)momjian(dot)us>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: pg_dump Add dumping of comments on index columns
Date: 2009-07-22 05:53:53
Message-ID: 37ed240d0907212253peaab8abtf8fd58fbde44cfc2@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

2009/7/14 Jaime Casanova <jcasanov(at)systemguards(dot)com(dot)ec>:
> On Thu, Mar 26, 2009 at 2:39 AM, higepon<higepon(at)gmail(dot)com> wrote:
>> Here is a patch for pg_dump "Commenting on a composite-type column".
>> This patch is for Todo item named "Add dumping of comments on index
>> columns and composite type columns".
>
> this one looks good to me, the only adjust i made to the patch is
> change the name for the function that dump the comments from the
> composite types columns for: dumpCompositeTypeColsComment that seems
> more clearer to me...
>
> the patch works just fine...
>

Oops. I picked this patch up from the commitfest queue because it was
still marked as "Needs Review", not realising that Jaime had already
done an initial review of the patch.

Seems like this one should have been "Ready for Committer", but no matter.

I've also done an initial review of the patch. Everything looks sane
and the patch works as advertised. I made a couple of minor tweaks
for code-style and comment consistency, and my version 3 is attached.

I'm marking this patch Ready for Committer.

I've also added a TODO item "forbid COMMENT on columns of an index",
per Tom's comments upthread.

Cheers,
BJ

Attachment Content-Type Size
pg_dump_composite_type_v3.patch application/octet-stream 3.6 KB

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Brendan Jurd <direvus(at)gmail(dot)com>
Cc: Jaime Casanova <jcasanov(at)systemguards(dot)com(dot)ec>, higepon <higepon(at)gmail(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: pg_dump Add dumping of comments on index columns
Date: 2009-07-23 23:02:45
Message-ID: 14646.1248390165@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Brendan Jurd <direvus(at)gmail(dot)com> writes:
> I've also done an initial review of the patch. Everything looks sane
> and the patch works as advertised. I made a couple of minor tweaks
> for code-style and comment consistency, and my version 3 is attached.

> I'm marking this patch Ready for Committer.

Applied with minor revisions --- mostly, it leaked memory in the case
of no comments, and the query wasn't very schema-safe.

regards, tom lane


From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Brendan Jurd <direvus(at)gmail(dot)com>, Jaime Casanova <jcasanov(at)systemguards(dot)com(dot)ec>, higepon <higepon(at)gmail(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: pg_dump Add dumping of comments on index columns
Date: 2009-08-08 04:00:22
Message-ID: 200908080400.n7840Mt11264@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Tom Lane wrote:
> Brendan Jurd <direvus(at)gmail(dot)com> writes:
> > I've also done an initial review of the patch. Everything looks sane
> > and the patch works as advertised. I made a couple of minor tweaks
> > for code-style and comment consistency, and my version 3 is attached.
>
> > I'm marking this patch Ready for Committer.
>
> Applied with minor revisions --- mostly, it leaked memory in the case
> of no comments, and the query wasn't very schema-safe.

Just to verify, this patch was about comments on composite columns, not
about dumping comments on index columns (as the subject states), right?
We do have a TODO for index column comments:

Forbid COMMENT on columns of an index

Postgres currently allows comments to be placed on the columns of an
index, but pg_dump doesn't handle them and the column names themselves
are implementation-dependent.

--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://enterprisedb.com

+ If your life is a hard drive, Christ can be your backup. +


From: Brendan Jurd <direvus(at)gmail(dot)com>
To: Bruce Momjian <bruce(at)momjian(dot)us>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Jaime Casanova <jcasanov(at)systemguards(dot)com(dot)ec>, higepon <higepon(at)gmail(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: pg_dump Add dumping of comments on index columns
Date: 2009-08-08 04:05:24
Message-ID: 37ed240d0908072105q109d0d84u7a7bfb0c95af347@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

2009/8/8 Bruce Momjian <bruce(at)momjian(dot)us>:
> Just to verify, this patch was about comments on composite columns, not
> about dumping comments on index columns (as the subject states), right?
> We do have a TODO for index column comments:

Correct.

If you scroll up a couple of messages [1] you'll see that I added that
TODO after I reviewed the patch.

Cheers,
BJ

[1] 37ed240d0907212253peaab8abtf8fd58fbde44cfc2(at)mail(dot)gmail(dot)com