From: | Peter Eisentraut <peter(dot)eisentraut(at)enterprisedb(dot)com> |
---|---|
To: | Julien Rouhaud <rjuju123(at)gmail(dot)com> |
Cc: | pgsql-hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: Database-level collation version tracking |
Date: | 2022-02-09 11:48:35 |
Message-ID: | 53b309c4-22c2-c781-5a54-ee4d824e8478@enterprisedb.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On 08.02.22 13:55, Julien Rouhaud wrote:
> I'm just saying that without such a lock you can easily trigger the "cache
> lookup" error, and that's something that's supposed to happen with normal
> usage I think. So it should be a better message saying that the database has
> been concurrently dropped, or actually simply does not exist like it's done in
> AlterDatabaseOwner() for the same pattern:
>
> [...]
> tuple = systable_getnext(scan);
> if (!HeapTupleIsValid(tuple))
> ereport(ERROR,
> (errcode(ERRCODE_UNDEFINED_DATABASE),
> errmsg("database \"%s\" does not exist", dbname)));
> [...]
In my code, the existence of the database is checked by
dboid = get_database_oid(stmt->dbname, false);
This also issues an appropriate user-facing error message if the
database does not exist.
The flow in AlterDatabaseOwner() is a bit different, it looks up the
pg_database tuple directly from the name. I think both are correct. My
code has been copied from the analogous code in AlterCollation().
From | Date | Subject | |
---|---|---|---|
Next Message | Ashutosh Sharma | 2022-02-09 12:01:02 | Re: Make mesage at end-of-recovery less scary. |
Previous Message | Ranier Vilela | 2022-02-09 11:15:45 | Possible uninitialized use of the variables (src/backend/access/transam/twophase.c) |