Bruce Momjian <bruce@momjian.us> writes:
> If we go in this direction, I assume we would just disallow a schema
> name matching the database name.
That seems quite impossible to enforce.
regression=# create database d1;
CREATE DATABASE
regression=# alter database d1 rename to d2;
ALTER DATABASE
The system had no way to know that d1 doesn't contain a schema named d2.
And you can't fix that by restricting the ALTER to be done on the
current database:
regression=# \c d2
You are now connected to database "d2" as user "postgres".
d2=# alter database d2 rename to d3;
ERROR: current database cannot be renamed
Between that and the point that this restriction would certainly break
existing installations, this is a non-starter.
regards, tom lane