ALTER TABLE...SET WITHOUT CLUSTER

Started by Christopher Kings-Lynneover 22 years ago5 messagespatches
Jump to latest
#1Christopher Kings-Lynne
chriskl@familyhealth.com.au

This patch imlements the TODO that calls for the ability to turn off all
clustering on a table.

Syntax is ALTER TABLE ... SET WITHOUT CLUSTER;

Doc patch plus regression test is included.

Chris

Attachments:

nocluster.txttext/plain; name=nocluster.txtDownload+89-65
#2Christopher Kings-Lynne
chriskl@familyhealth.com.au
In reply to: Christopher Kings-Lynne (#1)
Re: ALTER TABLE...SET WITHOUT CLUSTER

OK, based on Tom's comments about qualified_name vs. relation_expr, I
may have used the wrong one in this case. Will check soon.

Chris

Christopher Kings-Lynne wrote:

Show quoted text

This patch imlements the TODO that calls for the ability to turn off all
clustering on a table.

Syntax is ALTER TABLE ... SET WITHOUT CLUSTER;

Doc patch plus regression test is included.

Chris

#3Christopher Kings-Lynne
chriskl@familyhealth.com.au
In reply to: Christopher Kings-Lynne (#1)
Re: ALTER TABLE...SET WITHOUT CLUSTER

This patch imlements the TODO that calls for the ability to turn off all
clustering on a table.

Syntax is ALTER TABLE ... SET WITHOUT CLUSTER;

Doc patch plus regression test is included.

OK, I have a problem here. This is the new grammar that I added:

/* ALTER TABLE <name> SET WITHOUT CLUSTER */
| ALTER TABLE relation_expr SET WITHOUT CLUSTER
{
AlterTableStmt *n = makeNode(AlterTableStmt);
n->subtype = 'L';
n->relation = $3;
n->name = NULL;
$$ = (Node *)n;
}

Now, I have to change that relation_expr to qualified_name. However,
this causes shift/reduce errors. (Due to ALTER TABLE relation_expr SET
WITHOUT OIDS.)

Even changing the syntax to "qualified_name DROP CLUSTER" doesn't work
due to the existence of "relation_expr DROP ...".

What's the solution? I can't figure it out...

Chris

#4Bruce Momjian
bruce@momjian.us
In reply to: Christopher Kings-Lynne (#3)
Re: ALTER TABLE...SET WITHOUT CLUSTER

Christopher Kings-Lynne wrote:

This patch imlements the TODO that calls for the ability to turn off all
clustering on a table.

Syntax is ALTER TABLE ... SET WITHOUT CLUSTER;

Doc patch plus regression test is included.

OK, I have a problem here. This is the new grammar that I added:

/* ALTER TABLE <name> SET WITHOUT CLUSTER */
| ALTER TABLE relation_expr SET WITHOUT CLUSTER
{
AlterTableStmt *n = makeNode(AlterTableStmt);
n->subtype = 'L';
n->relation = $3;
n->name = NULL;
$$ = (Node *)n;
}

Now, I have to change that relation_expr to qualified_name. However,
this causes shift/reduce errors. (Due to ALTER TABLE relation_expr SET
WITHOUT OIDS.)

Even changing the syntax to "qualified_name DROP CLUSTER" doesn't work
due to the existence of "relation_expr DROP ...".

I have an idea. Change the code to use relation_expr, then throw an
error from gram.y if $$->inhOpt != INH_DEFAULT.

-- 
  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
#5Christopher Kings-Lynne
chriskl@familyhealth.com.au
In reply to: Bruce Momjian (#4)
Re: ALTER TABLE...SET WITHOUT CLUSTER

Even changing the syntax to "qualified_name DROP CLUSTER" doesn't work
due to the existence of "relation_expr DROP ...".

I have an idea. Change the code to use relation_expr, then throw an
error from gram.y if $$->inhOpt != INH_DEFAULT.

Yeah, that was the plan. I have been too busy (or too lazy more like)
to actually get around to doing it and submitting it however... I am
actually more tempted to do the right thing and actually make it recurse
properly over the hierarchy...

Chris