Re: Database-level collation version tracking - Mailing list pgsql-hackers

From Peter Eisentraut
Subject Re: Database-level collation version tracking
Date
Msg-id 53b309c4-22c2-c781-5a54-ee4d824e8478@enterprisedb.com
Whole thread Raw
In response to Re: Database-level collation version tracking  (Julien Rouhaud <rjuju123@gmail.com>)
Responses Re: Database-level collation version tracking  (Julien Rouhaud <rjuju123@gmail.com>)
List 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().



pgsql-hackers by date:

Previous
From: Ranier Vilela
Date:
Subject: Possible uninitialized use of the variables (src/backend/access/transam/twophase.c)
Next
From: Ashutosh Sharma
Date:
Subject: Re: Make mesage at end-of-recovery less scary.