Re: Patch for ALTER DATABASE WITH TABLESPACE - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Patch for ALTER DATABASE WITH TABLESPACE
Date
Msg-id 26888.1225828604@sss.pgh.pa.us
Whole thread Raw
In response to Re: Patch for ALTER DATABASE WITH TABLESPACE  (Guillaume Lelarge <guillaume@lelarge.info>)
Responses Re: Patch for ALTER DATABASE WITH TABLESPACE
List pgsql-hackers
Guillaume Lelarge <guillaume@lelarge.info> writes:
> Bernd Helmle a �crit :
>> However, i'm not satisfied with the syntax, which is currently ALTER
>> DATABASE name TABLESPACE foo. We use all over the place SET TABLESPACE
>> (e.g. for tables and indexes) and SET SCHEMA for namespaces even, so
>> this looks inconsistent. However, hacking this requires a little bit
>> more parser-foo, a quick hack shows reduce conflicts due to
>> SetResetClause rule. So what do we want in this case?

> My first intent was to use SET TABLESPACE. But the other parameter
> available in the ALTER DATABASE statement use the WITH syntax. So, to be
> coherent with the actual ALTER DATABASE statement, I used the WITH syntax.

FWIW, bison seems perfectly happy with this:
 AlterDatabaseStmt:             ALTER DATABASE database_name opt_with alterdb_opt_list                  {
     AlterDatabaseStmt *n = makeNode(AlterDatabaseStmt);                     n->dbname = $3;
n->options= $5;                     $$ = (Node *)n;                  }
 
+             | ALTER DATABASE database_name SET TABLESPACE name
+                  {
+                     AlterDatabaseStmt *n = makeNode(AlterDatabaseStmt);
+                     n->dbname = $3;
+                     ...
+                     $$ = (Node *)n;
+                  }         ;

Not sure what Bernd tried exactly, but it can be done.

I see the point about the parallel to CREATE DATABASE, but on the other
hand we also have ALTER DATABASE SET for parameters.  I suspect people
are more likely to expect the SET syntax.
        regards, tom lane



pgsql-hackers by date:

Previous
From: "David Blewett"
Date:
Subject: Re: Enable pl/python to return records based on multiple OUT params
Next
From: "Jonah H. Harris"
Date:
Subject: [PATCH] Cleanup of PLpgSQL_recfield