On 12/30/16 9:28 PM, Fabrízio de Royes Mello wrote:
> The attached patch is reworked from a previous one [1] to better deal
> with get_object_address and pg_get_object_address.
>
> Regards,
>
> [1] https://www.postgresql.org/message-id/20150317171836.GC10492@momjian.us
The syntax we have used for the user/role case is ALTER USER
CURRENT_USER, not ALTER CURRENT USER, so this should be done in the same
way for databases. Eventually, we'll also want ALTER DATABASE
current_database, and probably not ALTER CURRENT DATABASE, etc.
It's also curious that we don't support COMMENT on whatever CURRENT_USER
yet. It looks like the previous patch to allow ALTER USER CURRENT_USER
etc. was not even applied to pg_dump.
I think this patch is a good direction to move in, and it seems everyone
else agreed, but I'm looking for a bit more of a holistic solution than
one command at a time here and there. Define a goal such as, allow
restoring into a differently-named database, and then see what needs to
happen to achieve that.
The implementation looks generally OK, but I'm not sure why you need
this part:
diff --git a/src/backend/catalog/objectaddress.c
b/src/backend/catalog/objectaddress.c
index bb4b080..71bffae 100644
--- a/src/backend/catalog/objectaddress.c
+++ b/src/backend/catalog/objectaddress.c
@@ -621,6 +621,9 @@ static const struct object_type_map { "database", OBJECT_DATABASE },
+ {
+ "current database", OBJECT_DATABASE
+ }, /* OCLASS_TBLSPACE */ { "tablespace", OBJECT_TABLESPACE
--
Peter Eisentraut http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services