docs: pg_replication_origin_oid() description does not match behaviour

From: Ian Lawrence Barwick <barwick(at)gmail(dot)com>
To: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: docs: pg_replication_origin_oid() description does not match behaviour
Date: 2022-01-18 01:19:41
Message-ID: CAB8KJ=htJjBL=103URqjOxV2mqb4rjphDpMeKdyKq_QXt6h05w@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi

From the documentation for pg_replication_origin_oid() [1]:

> Looks up a replication origin by name and returns the internal ID.
> If no such replication origin is found an error is thrown.

However, it actually returns NULL if the origin does not exist:

postgres=# SELECT * FROM pg_replication_origin;
roident | roname
---------+--------
(0 rows)

postgres=# SELECT pg_replication_origin_oid('foo'),
pg_replication_origin_oid('foo') IS NULL;
pg_replication_origin_oid | ?column?
---------------------------+----------
| t
(1 row)

Given that the code has remained unchanged since the function was
introduced in 9.5, it seems reasonable to change the documentation
to match the function behaviour rather than the other way round.

Regards

Ian Barwick

[1] https://www.postgresql.org/docs/current/functions-admin.html#FUNCTIONS-REPLICATION-TABLE

--
EnterpriseDB: https://www.enterprisedb.com

Attachment Content-Type Size
doc-pg_replication_origin_oid.patch text/x-patch 844 bytes

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2022-01-18 01:23:57 Re: docs: pg_replication_origin_oid() description does not match behaviour
Previous Message Michael Paquier 2022-01-18 01:19:32 Re: drop tablespace failed when location contains .. on win32