Re: ALTER INDEX

Lists: pgsql-patches
From: Gavin Sherry <swm(at)linuxworld(dot)com(dot)au>
To: pgsql-patches(at)postgresql(dot)org
Subject: ALTER INDEX
Date: 2004-08-13 07:47:36
Message-ID: Pine.LNX.4.58.0408131746090.16360@linuxworld.com.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-patches

Attached is a patch implementing ALTER INDEX <name> [ RENAME | OWNER TO |
SET TABLESPACE ]

I haven't included any regression tests because most of the code should be
well tested by the existing alter table tests.

Thanks,

Gavin

Attachment Content-Type Size
alter_index.diff text/plain 11.7 KB

From: Gavin Sherry <swm(at)linuxworld(dot)com(dot)au>
To: pgsql-patches(at)postgresql(dot)org
Subject: Re: ALTER INDEX
Date: 2004-08-13 07:50:02
Message-ID: Pine.LNX.4.58.0408131749200.16390@linuxworld.com.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-patches

This patch has a fix for a 'thought-o' in the docs.

Gavin

Attachment Content-Type Size
alter_index2.diff text/plain 11.7 KB

From: Stefan Kaltenbrunner <stefan(at)kaltenbrunner(dot)cc>
To: Gavin Sherry <swm(at)linuxworld(dot)com(dot)au>
Cc: pgsql-patches(at)postgresql(dot)org
Subject: Re: ALTER INDEX
Date: 2004-08-13 08:47:29
Message-ID: 411C8021.3050708@kaltenbrunner.cc
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-patches

Gavin Sherry wrote:

> Index: src/bin/psql/tab-complete.c
> ===================================================================
> RCS file: /usr/local/cvsroot/pgsql-server/src/bin/psql/tab-complete.c,v
> retrieving revision 1.109
> diff -2 -c -r1.109 tab-complete.c
> *** src/bin/psql/tab-complete.c 28 Jul 2004 14:23:30 -0000 1.109
> --- src/bin/psql/tab-complete.c 13 Aug 2004 06:34:55 -0000
> ***************
> *** 633,637 ****
> {
> static const char *const list_ALTER[] =
> ! {"DATABASE", "GROUP", "SCHEMA", "TABLE", "TRIGGER", "USER", NULL};
>
> COMPLETE_WITH_LIST(list_ALTER);
> --- 633,638 ----
> {
> static const char *const list_ALTER[] =
> ! {"DATABASE", "GROUP", "SCHEMA", "TABLE", "TRIGGER", "USER", "INDEX",
> ! NULL};
>
> COMPLETE_WITH_LIST(list_ALTER);
> ***************
> *** 647,650 ****
> --- 648,661 ----
> COMPLETE_WITH_LIST(list_ALTERDATABASE);
> }
> + /* ALTER INDEX <name> */
> + else if (pg_strcasecmp(prev3_wd, "ALTER") == 0 &&
> + pg_strcasecmp(prev2_wd, "INDEX") == 0)
> + {
> + static const char *const list_ALTERDATABASE[] =
> + {"SET TABLESPACE", "OWNER TO", "RENAME TO", NULL};
> +
> + COMPLETE_WITH_LIST(list_ALTERDATABASE);

minor issue/nit(?): reusing list_ALTERDATABASE for the ALTER INDEX part
looks a little strange ...

Stefan(who could really need some feedback on his own tab-complete patch
*g*)


From: Gavin Sherry <swm(at)linuxworld(dot)com(dot)au>
To: Stefan Kaltenbrunner <stefan(at)kaltenbrunner(dot)cc>
Cc: pgsql-patches(at)postgresql(dot)org
Subject: Re: ALTER INDEX
Date: 2004-08-13 11:36:03
Message-ID: Pine.LNX.4.58.0408132134560.17689@linuxworld.com.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-patches

Oops.

Too much with the ol' cut and paste.

I'm happy to send an updated patch but perhaps the committer, assuming the
patch is accepted, would be kind enough to update for me.

Thanks for reviewing.

Gavin

On Fri, 13 Aug 2004, Stefan Kaltenbrunner wrote:

> Gavin Sherry wrote:
>
>
> > Index: src/bin/psql/tab-complete.c
> > ===================================================================
> > RCS file: /usr/local/cvsroot/pgsql-server/src/bin/psql/tab-complete.c,v
> > retrieving revision 1.109
> > diff -2 -c -r1.109 tab-complete.c
> > *** src/bin/psql/tab-complete.c 28 Jul 2004 14:23:30 -0000 1.109
> > --- src/bin/psql/tab-complete.c 13 Aug 2004 06:34:55 -0000
> > ***************
> > *** 633,637 ****
> > {
> > static const char *const list_ALTER[] =
> > ! {"DATABASE", "GROUP", "SCHEMA", "TABLE", "TRIGGER", "USER", NULL};
> >
> > COMPLETE_WITH_LIST(list_ALTER);
> > --- 633,638 ----
> > {
> > static const char *const list_ALTER[] =
> > ! {"DATABASE", "GROUP", "SCHEMA", "TABLE", "TRIGGER", "USER", "INDEX",
> > ! NULL};
> >
> > COMPLETE_WITH_LIST(list_ALTER);
> > ***************
> > *** 647,650 ****
> > --- 648,661 ----
> > COMPLETE_WITH_LIST(list_ALTERDATABASE);
> > }
> > + /* ALTER INDEX <name> */
> > + else if (pg_strcasecmp(prev3_wd, "ALTER") == 0 &&
> > + pg_strcasecmp(prev2_wd, "INDEX") == 0)
> > + {
> > + static const char *const list_ALTERDATABASE[] =
> > + {"SET TABLESPACE", "OWNER TO", "RENAME TO", NULL};
> > +
> > + COMPLETE_WITH_LIST(list_ALTERDATABASE);
>
> minor issue/nit(?): reusing list_ALTERDATABASE for the ALTER INDEX part
> looks a little strange ...
>
>
> Stefan(who could really need some feedback on his own tab-complete patch
> *g*)
>
>
> !DSPAM:411c802d169118747610806!
>
>


From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Stefan Kaltenbrunner <stefan(at)kaltenbrunner(dot)cc>
Cc: Gavin Sherry <swm(at)linuxworld(dot)com(dot)au>, pgsql-patches(at)postgresql(dot)org
Subject: Re: ALTER INDEX
Date: 2004-08-18 03:28:27
Message-ID: 200408180328.i7I3SRT01498@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-patches


Your adjustment has been added to the PostgreSQL unapplied patches list at:

http://momjian.postgresql.org/cgi-bin/pgpatches

It will be applied as soon as one of the PostgreSQL committers reviews
and approves it.

---------------------------------------------------------------------------

Stefan Kaltenbrunner wrote:
> Gavin Sherry wrote:
>
>
> > Index: src/bin/psql/tab-complete.c
> > ===================================================================
> > RCS file: /usr/local/cvsroot/pgsql-server/src/bin/psql/tab-complete.c,v
> > retrieving revision 1.109
> > diff -2 -c -r1.109 tab-complete.c
> > *** src/bin/psql/tab-complete.c 28 Jul 2004 14:23:30 -0000 1.109
> > --- src/bin/psql/tab-complete.c 13 Aug 2004 06:34:55 -0000
> > ***************
> > *** 633,637 ****
> > {
> > static const char *const list_ALTER[] =
> > ! {"DATABASE", "GROUP", "SCHEMA", "TABLE", "TRIGGER", "USER", NULL};
> >
> > COMPLETE_WITH_LIST(list_ALTER);
> > --- 633,638 ----
> > {
> > static const char *const list_ALTER[] =
> > ! {"DATABASE", "GROUP", "SCHEMA", "TABLE", "TRIGGER", "USER", "INDEX",
> > ! NULL};
> >
> > COMPLETE_WITH_LIST(list_ALTER);
> > ***************
> > *** 647,650 ****
> > --- 648,661 ----
> > COMPLETE_WITH_LIST(list_ALTERDATABASE);
> > }
> > + /* ALTER INDEX <name> */
> > + else if (pg_strcasecmp(prev3_wd, "ALTER") == 0 &&
> > + pg_strcasecmp(prev2_wd, "INDEX") == 0)
> > + {
> > + static const char *const list_ALTERDATABASE[] =
> > + {"SET TABLESPACE", "OWNER TO", "RENAME TO", NULL};
> > +
> > + COMPLETE_WITH_LIST(list_ALTERDATABASE);
>
> minor issue/nit(?): reusing list_ALTERDATABASE for the ALTER INDEX part
> looks a little strange ...
>
>
> Stefan(who could really need some feedback on his own tab-complete patch
> *g*)
>
> ---------------------------(end of broadcast)---------------------------
> TIP 1: subscribe and unsubscribe commands go to majordomo(at)postgresql(dot)org
>

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073


From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Gavin Sherry <swm(at)linuxworld(dot)com(dot)au>
Cc: pgsql-patches(at)postgresql(dot)org
Subject: Re: ALTER INDEX
Date: 2004-08-20 04:30:17
Message-ID: 200408200430.i7K4UHb13526@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-patches


Patch applied. Thanks.

I originally thought of this as a feature addition, but I realized that
ALTER INDEX is being added because people are going to want to move
tablespaces for indexes, and without this, they can't easily.

---------------------------------------------------------------------------

Gavin Sherry wrote:
> This patch has a fix for a 'thought-o' in the docs.
>
> Gavin

Content-Description:

[ Attachment, skipping... ]

>
> ---------------------------(end of broadcast)---------------------------
> TIP 7: don't forget to increase your free space map settings

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073


From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Stefan Kaltenbrunner <stefan(at)kaltenbrunner(dot)cc>
Cc: Gavin Sherry <swm(at)linuxworld(dot)com(dot)au>, pgsql-patches(at)postgresql(dot)org
Subject: Re: ALTER INDEX
Date: 2004-08-20 04:30:42
Message-ID: 200408200430.i7K4Ugu13598@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-patches


I have made this adjustment.

---------------------------------------------------------------------------

Stefan Kaltenbrunner wrote:
> Gavin Sherry wrote:
>
>
> > Index: src/bin/psql/tab-complete.c
> > ===================================================================
> > RCS file: /usr/local/cvsroot/pgsql-server/src/bin/psql/tab-complete.c,v
> > retrieving revision 1.109
> > diff -2 -c -r1.109 tab-complete.c
> > *** src/bin/psql/tab-complete.c 28 Jul 2004 14:23:30 -0000 1.109
> > --- src/bin/psql/tab-complete.c 13 Aug 2004 06:34:55 -0000
> > ***************
> > *** 633,637 ****
> > {
> > static const char *const list_ALTER[] =
> > ! {"DATABASE", "GROUP", "SCHEMA", "TABLE", "TRIGGER", "USER", NULL};
> >
> > COMPLETE_WITH_LIST(list_ALTER);
> > --- 633,638 ----
> > {
> > static const char *const list_ALTER[] =
> > ! {"DATABASE", "GROUP", "SCHEMA", "TABLE", "TRIGGER", "USER", "INDEX",
> > ! NULL};
> >
> > COMPLETE_WITH_LIST(list_ALTER);
> > ***************
> > *** 647,650 ****
> > --- 648,661 ----
> > COMPLETE_WITH_LIST(list_ALTERDATABASE);
> > }
> > + /* ALTER INDEX <name> */
> > + else if (pg_strcasecmp(prev3_wd, "ALTER") == 0 &&
> > + pg_strcasecmp(prev2_wd, "INDEX") == 0)
> > + {
> > + static const char *const list_ALTERDATABASE[] =
> > + {"SET TABLESPACE", "OWNER TO", "RENAME TO", NULL};
> > +
> > + COMPLETE_WITH_LIST(list_ALTERDATABASE);
>
> minor issue/nit(?): reusing list_ALTERDATABASE for the ALTER INDEX part
> looks a little strange ...
>
>
> Stefan(who could really need some feedback on his own tab-complete patch
> *g*)
>
> ---------------------------(end of broadcast)---------------------------
> TIP 1: subscribe and unsubscribe commands go to majordomo(at)postgresql(dot)org
>

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073


From: "Marc G(dot) Fournier" <scrappy(at)postgresql(dot)org>
To: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
Cc: Gavin Sherry <swm(at)linuxworld(dot)com(dot)au>, pgsql-patches(at)postgresql(dot)org
Subject: Re: ALTER INDEX
Date: 2004-08-20 04:40:41
Message-ID: 20040820013940.Q30511@ganymede.hub.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-patches

On Fri, 20 Aug 2004, Bruce Momjian wrote:

>
> Patch applied. Thanks.
>
> I originally thought of this as a feature addition, but I realized that
> ALTER INDEX is being added because people are going to want to move
> tablespaces for indexes, and without this, they can't easily.

Which would fall under adding a feature onto the tablespaces, not fixing a
bug in tablespaces itself ... does *not* having ALTER INDEX *break*
tablespaces? Causes it not to work, or not build?

>
> ---------------------------------------------------------------------------
>
>
> Gavin Sherry wrote:
>> This patch has a fix for a 'thought-o' in the docs.
>>
>> Gavin
>
> Content-Description:
>
> [ Attachment, skipping... ]
>
>>
>> ---------------------------(end of broadcast)---------------------------
>> TIP 7: don't forget to increase your free space map settings
>
> --
> Bruce Momjian | http://candle.pha.pa.us
> pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
> + If your life is a hard drive, | 13 Roberts Road
> + Christ can be your backup. | Newtown Square, Pennsylvania 19073
>
> ---------------------------(end of broadcast)---------------------------
> TIP 7: don't forget to increase your free space map settings
>

----
Marc G. Fournier Hub.Org Networking Services (http://www.hub.org)
Email: scrappy(at)hub(dot)org Yahoo!: yscrappy ICQ: 7615664


From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: "Marc G(dot) Fournier" <scrappy(at)postgresql(dot)org>
Cc: Gavin Sherry <swm(at)linuxworld(dot)com(dot)au>, pgsql-patches(at)postgresql(dot)org
Subject: Re: ALTER INDEX
Date: 2004-08-20 04:46:32
Message-ID: 200408200446.i7K4kWr20599@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-patches

Marc G. Fournier wrote:
> On Fri, 20 Aug 2004, Bruce Momjian wrote:
>
> >
> > Patch applied. Thanks.
> >
> > I originally thought of this as a feature addition, but I realized that
> > ALTER INDEX is being added because people are going to want to move
> > tablespaces for indexes, and without this, they can't easily.
>
> Which would fall under adding a feature onto the tablespaces, not fixing a
> bug in tablespaces itself ... does *not* having ALTER INDEX *break*
> tablespaces? Causes it not to work, or not build?

No, but it is a missing capability many will complain about. I can
easily remove it. I saw no one comment when I added it to the patches
queue.

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
Cc: "Marc G(dot) Fournier" <scrappy(at)postgresql(dot)org>, Gavin Sherry <swm(at)linuxworld(dot)com(dot)au>, pgsql-patches(at)postgresql(dot)org
Subject: Re: ALTER INDEX
Date: 2004-08-20 04:51:11
Message-ID: 16393.1092977471@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-patches

Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> writes:
> No, but it is a missing capability many will complain about. I can
> easily remove it. I saw no one comment when I added it to the patches
> queue.

I hadn't seen you add it to the patches queue ...

I did see Gavin's submission but did not yet have time to look at the
details. What does it *do* exactly --- simply allow INDEX as a
substitute for TABLE in the syntax, or more? I'm not thrilled at the
idea of adding a lot of duplicate coding for this.

regards, tom lane


From: Gavin Sherry <swm(at)linuxworld(dot)com(dot)au>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>, "Marc G(dot) Fournier" <scrappy(at)postgresql(dot)org>, pgsql-patches(at)postgresql(dot)org
Subject: Re: ALTER INDEX
Date: 2004-08-20 05:32:12
Message-ID: Pine.LNX.4.58.0408201530040.21451@linuxworld.com.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-patches

On Fri, 20 Aug 2004, Tom Lane wrote:

> Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> writes:
> > No, but it is a missing capability many will complain about. I can
> > easily remove it. I saw no one comment when I added it to the patches
> > queue.
>
> I hadn't seen you add it to the patches queue ...
>
> I did see Gavin's submission but did not yet have time to look at the
> details. What does it *do* exactly --- simply allow INDEX as a
> substitute for TABLE in the syntax, or more? I'm not thrilled at the
> idea of adding a lot of duplicate coding for this.

I tried to avoid any duplication. The patch still uses all the ALTER TABLE
code. Its just a grammar modification and some setting of completion tags.

That being said, I felt obliged to provide at patch when I started hearing
noise about ALTER TABLE <index name> being a bit of a hack -- which it is.

Gavin


From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Gavin Sherry <swm(at)linuxworld(dot)com(dot)au>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, "Marc G(dot) Fournier" <scrappy(at)postgresql(dot)org>, pgsql-patches(at)postgresql(dot)org
Subject: Re: ALTER INDEX
Date: 2004-08-20 15:02:07
Message-ID: 200408201502.i7KF27708884@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-patches

Gavin Sherry wrote:
> On Fri, 20 Aug 2004, Tom Lane wrote:
>
> > Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> writes:
> > > No, but it is a missing capability many will complain about. I can
> > > easily remove it. I saw no one comment when I added it to the patches
> > > queue.
> >
> > I hadn't seen you add it to the patches queue ...
> >
> > I did see Gavin's submission but did not yet have time to look at the
> > details. What does it *do* exactly --- simply allow INDEX as a
> > substitute for TABLE in the syntax, or more? I'm not thrilled at the
> > idea of adding a lot of duplicate coding for this.
>
> I tried to avoid any duplication. The patch still uses all the ALTER TABLE
> code. Its just a grammar modification and some setting of completion tags.
>
> That being said, I felt obliged to provide at patch when I started hearing
> noise about ALTER TABLE <index name> being a bit of a hack -- which it is.

The issue was that few people currently modify indexes because in the
past you could only rename an index or change its owner. With
tablespaces, we are going to have lots more people moving indexes
around, and I think people were getting confused because there was no
ALTER INDEX to move them.

I can still back it out and leave it for 8.1 but it probably will reduce
confusion and perhaps need for an FAQ, "How do I move an index between
tablespaces?"

FYI, I just fixed a typo in the ALTER INDEX manual page that mentioned
INDEXSPACE instead of TABLESPACE.

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073