From 34fa0ddae5cf27dd93a5855b30083185d4bb5a5b Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Fri, 4 Nov 2022 10:39:52 -0400 Subject: Fix CREATE DATABASE so we can pg_upgrade DBs with OIDs above 2^31. Commit aa0105141 repeated one of the oldest mistakes in our book: thinking that OID is the same as int32. It isn't of course, and unsurprisingly the first person who came along with a database OID above 2 billion broke it. Repair. Per bug #17677 from Sergey Pankov. Back-patch to v15. Discussion: https://postgr.es/m/17677-a99fa067d7ed71c9@postgresql.org --- src/backend/commands/dbcommands.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/backend/commands/dbcommands.c') diff --git a/src/backend/commands/dbcommands.c b/src/backend/commands/dbcommands.c index 16e422138bb..8abc2c3e0b0 100644 --- a/src/backend/commands/dbcommands.c +++ b/src/backend/commands/dbcommands.c @@ -816,7 +816,7 @@ createdb(ParseState *pstate, const CreatedbStmt *stmt) } else if (strcmp(defel->defname, "oid") == 0) { - dboid = defGetInt32(defel); + dboid = defGetObjectId(defel); /* * We don't normally permit new databases to be created with -- cgit v1.2.3