Re: pg_get_databasebyid(oid) - Mailing list pgsql-hackers

From Michael Paquier
Subject Re: pg_get_databasebyid(oid)
Date
Msg-id 20190904035455.GB2170@paquier.xyz
Whole thread Raw
In response to Re: pg_get_databasebyid(oid)  (Ibrar Ahmed <ibrar.ahmad@gmail.com>)
Responses Re: pg_get_databasebyid(oid)
List pgsql-hackers
On Thu, Aug 29, 2019 at 03:47:40PM +0500, Ibrar Ahmed wrote:
> I think its a user request and don't require to be in the core of
> PostgreSQL.
> A simple SQL function can fulfill the requirement of the user.
>
> CREATE OR REPLACE FUNCTION pg_get_databasebyid(dboid integer) RETURNS name
> AS $$
>
>     SELECT datname from pg_database WHERE oid = dboid;
> $$ LANGUAGE SQL;

Indeed, I think that we can drop the patch.  FWIW, I find the
semantics of pg_get_userbyid() horrible when it comes to return a
result for a non-existing user with its own way of defining how this
information should show up.  Returning NULL would be more natural, so
I don't think that we should make more functions behave the same way.
--
Michael

Attachment

pgsql-hackers by date:

Previous
From: Masahiko Sawada
Date:
Subject: Re: [HACKERS] Transactions involving multiple postgres foreignservers, take 2
Next
From: Tom Lane
Date:
Subject: Re: Proposal: roll pg_stat_statements into core