public inbox for [email protected]
help / color / mirror / Atom feedDocumentation incorrect pg_partition_root function description.
2+ messages / 2 participants
[nested] [flat]
* Documentation incorrect pg_partition_root function description.
@ 2026-02-28 08:36 PG Doc comments form <[email protected]>
0 siblings, 1 reply; 2+ messages in thread
From: PG Doc comments form @ 2026-02-28 08:36 UTC (permalink / raw)
To: [email protected]; +Cc: [email protected]
The following documentation comment has been logged on the website:
Page: https://www.postgresql.org/docs/18/functions-admin.html
Description:
https://www.postgresql.org/docs/current/functions-admin.html
pg_partition_root ( regclass ) → regclass
Returns the top-most parent of the partition tree to which the given
relation belongs. Returns NULL if the relation does not exist or is not a
partition or partitioned table.
"does not exist" is not correct description, if table does not exist, we'll
get an error, not NULL:
EXAMPLE:
SELECT * FROM pg_partition_root( 'nonexisting_table' );
RESULT:
SQL Error [42P01]: ERROR: relation "nonexisting_table" does not exist
Position: 34
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: Documentation incorrect pg_partition_root function description.
@ 2026-02-28 20:12 Laurenz Albe <[email protected]>
parent: PG Doc comments form <[email protected]>
0 siblings, 0 replies; 2+ messages in thread
From: Laurenz Albe @ 2026-02-28 20:12 UTC (permalink / raw)
To: [email protected]; [email protected]
On Sat, 2026-02-28 at 08:36 +0000, PG Doc comments form wrote:
> The following documentation comment has been logged on the website:
>
> Page: https://www.postgresql.org/docs/18/functions-admin.html
> Description:
>
> https://www.postgresql.org/docs/current/functions-admin.html
>
> pg_partition_root ( regclass ) → regclass
> Returns the top-most parent of the partition tree to which the given
> relation belongs. Returns NULL if the relation does not exist or is not a
> partition or partitioned table.
>
> "does not exist" is not correct description, if table does not exist, we'll
> get an error, not NULL:
>
> EXAMPLE:
> SELECT * FROM pg_partition_root( 'nonexisting_table' );
>
> RESULT:
> SQL Error [42P01]: ERROR: relation "nonexisting_table" does not exist
> Position: 34
The error you are getting is *not* from pg_partition_root(), but from the
cast from "text" to "regclass":
SELECT 'nonexisting_table'::regclass;
ERROR: relation "nonexisting_table" does not exist
LINE 1: SELECT 'nonexisting_table'::regclass;
^
And if you take a "regclass" that corresponds to an object ID that is not
the object ID of any existing relation, you get a NULL result:
SELECT pg_partition_root('12345'::regclass);
pg_partition_root
-------------------
(1 row)
Yours,
Laurenz Albe
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2026-02-28 20:12 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2026-02-28 08:36 Documentation incorrect pg_partition_root function description. PG Doc comments form <[email protected]>
2026-02-28 20:12 ` Laurenz Albe <[email protected]>
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox