Re: pg_get_databasebyid(oid)

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: Ibrar Ahmed <ibrar(dot)ahmad(at)gmail(dot)com>
Cc: Sergei Kornilov <sk(at)zsrv(dot)org>, PostgreSQL mailing lists <pgsql-hackers(at)postgresql(dot)org>, alexey(dot)lesovsky(at)dataegret(dot)com
Subject: Re: pg_get_databasebyid(oid)
Date: 2019-09-04 03:54:55
Message-ID: 20190904035455.GB2170@paquier.xyz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2019-09-04 04:14:50 Re: Proposal: roll pg_stat_statements into core
Previous Message Masahiko Sawada 2019-09-04 03:44:20 Re: [HACKERS] Transactions involving multiple postgres foreign servers, take 2