ALTER TABLE / CLUSTER ON

Started by Christopher Kings-Lynnealmost 23 years ago7 messages
#1Christopher Kings-Lynne
chriskl@familyhealth.com.au

Does the new ALTER TABLE / CLUSTER ON syntax support the ONLY modifier - it
isn't documented if it is?? I guess it's not really relevant is it?

Chris

#2Christopher Kings-Lynne
chriskl@familyhealth.com.au
In reply to: Christopher Kings-Lynne (#1)
Re: ALTER TABLE / CLUSTER ON

I just managed to break the CLUSTER ON patch:

test=# create table test (a int4 primary key, b int4 unique, c int4);
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index 'test_pkey'
for table 'test'
NOTICE: CREATE TABLE / UNIQUE will create implicit index 'test_b_key' for
table 'test'
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index 'test_pkey'
for table 'test'
NOTICE: CREATE TABLE / UNIQUE will create implicit index 'test_b_key' for
table 'test'
CREATE TABLE
test=# create index blah on test(c);
CREATE INDEX
test=# alter table test cluster on a;
ERROR: ALTER TABLE: cannot find index "a" for table "test"
ERROR: ALTER TABLE: cannot find index "a" for table "test"
test=# alter table test cluster on blah;
ALTER TABLE
test=# alter table only test cluster on blah;
ERROR: parser: parse error at or near "cluster" at character 23
ERROR: parser: parse error at or near "cluster" at character 23
test=# alter table test cluster on blah;
NOTICE: ALTER TABLE: table "test" is already being clustered on index
"blah"
WARNING: Cache reference leak: cache pg_index (16), tuple 0 has count 1
NOTICE: ALTER TABLE: table "test" is already being clustered on index
"blah"
WARNING: Cache reference leak: cache pg_index (16), tuple 0 has count 1
ALTER TABLE

Chris

#3Alvaro Herrera
alvherre@dcc.uchile.cl
In reply to: Christopher Kings-Lynne (#2)
1 attachment(s)
Re: ALTER TABLE / CLUSTER ON

On Fri, Mar 21, 2003 at 11:54:24AM +0800, Christopher Kings-Lynne wrote:

I just managed to break the CLUSTER ON patch:

Damn... I dunno how I managed to miss this. Please apply the attached
patch.

--
Alvaro Herrera (<alvherre[a]dcc.uchile.cl>)
Licensee shall have no right to use the Licensed Software
for productive or commercial use. (Licencia de StarOffice 6.0 beta)

Attachments:

alter-table-cluster-on-fix.patchtext/plain; charset=us-asciiDownload
Index: backend/commands/tablecmds.c
===================================================================
RCS file: /projects/cvsroot/pgsql-server/src/backend/commands/tablecmds.c,v
retrieving revision 1.69
diff -c -r1.69 tablecmds.c
*** backend/commands/tablecmds.c	2003/03/20 18:52:47	1.69
--- backend/commands/tablecmds.c	2003/03/21 15:38:37
***************
*** 3835,3840 ****
--- 3835,3841 ----
  	{
  		elog(NOTICE, "ALTER TABLE: table \"%s\" is already being clustered on index \"%s\"",
  				NameStr(rel->rd_rel->relname), indexName);
+ 		ReleaseSysCache(indexTuple);
  		heap_close(rel, AccessExclusiveLock);
  		return;
  	}
#4Alvaro Herrera
alvherre@dcc.uchile.cl
In reply to: Christopher Kings-Lynne (#1)
Re: ALTER TABLE / CLUSTER ON

On Fri, Mar 21, 2003 at 11:21:16AM +0800, Christopher Kings-Lynne wrote:

Does the new ALTER TABLE / CLUSTER ON syntax support the ONLY modifier - it
isn't documented if it is?? I guess it's not really relevant is it?

Oh, sorry, the command does not recurse. Should it? The whole CLUSTER
thing does not recurse -- in fact that's why I didn't make the ALTER ...
CLUSTER ON version do it, but maybe it should.

--
Alvaro Herrera (<alvherre[a]dcc.uchile.cl>)
"El destino baraja y nosotros jugamos" (A. Schopenhauer)

#5Bruce Momjian
pgman@candle.pha.pa.us
In reply to: Alvaro Herrera (#3)
Re: ALTER TABLE / CLUSTER ON

Patch applied. Thanks.

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

Alvaro Herrera wrote:

On Fri, Mar 21, 2003 at 11:54:24AM +0800, Christopher Kings-Lynne wrote:

I just managed to break the CLUSTER ON patch:

Damn... I dunno how I managed to miss this. Please apply the attached
patch.

--
Alvaro Herrera (<alvherre[a]dcc.uchile.cl>)
Licensee shall have no right to use the Licensed Software
for productive or commercial use. (Licencia de StarOffice 6.0 beta)

[ Attachment, skipping... ]

---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to majordomo@postgresql.org)

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073
#6Bruce Momjian
pgman@candle.pha.pa.us
In reply to: Alvaro Herrera (#4)
Re: ALTER TABLE / CLUSTER ON

Because indexes don't span to interited tables, I don't see how it could
recurse.

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

Alvaro Herrera wrote:

On Fri, Mar 21, 2003 at 11:21:16AM +0800, Christopher Kings-Lynne wrote:

Does the new ALTER TABLE / CLUSTER ON syntax support the ONLY modifier - it
isn't documented if it is?? I guess it's not really relevant is it?

Oh, sorry, the command does not recurse. Should it? The whole CLUSTER
thing does not recurse -- in fact that's why I didn't make the ALTER ...
CLUSTER ON version do it, but maybe it should.

--
Alvaro Herrera (<alvherre[a]dcc.uchile.cl>)
"El destino baraja y nosotros jugamos" (A. Schopenhauer)

---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073
#7Christopher Kings-Lynne
chriskl@familyhealth.com.au
In reply to: Alvaro Herrera (#4)
Re: ALTER TABLE / CLUSTER ON

How can it recurse, actually - there won't be an index with the same name
in the subtable?

On Fri, 21 Mar 2003, Alvaro Herrera wrote:

Show quoted text

On Fri, Mar 21, 2003 at 11:21:16AM +0800, Christopher Kings-Lynne wrote:

Does the new ALTER TABLE / CLUSTER ON syntax support the ONLY modifier - it
isn't documented if it is?? I guess it's not really relevant is it?

Oh, sorry, the command does not recurse. Should it? The whole CLUSTER
thing does not recurse -- in fact that's why I didn't make the ALTER ...
CLUSTER ON version do it, but maybe it should.

--
Alvaro Herrera (<alvherre[a]dcc.uchile.cl>)
"El destino baraja y nosotros jugamos" (A. Schopenhauer)