Guillaume Lelarge <[EMAIL PROTECTED]> 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


-- 
Sent via pgsql-hackers mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to