getting table name from partition

Started by PG Bug reporting formalmost 5 years ago4 messagesdocs
Jump to latest
#1PG Bug reporting form
noreply@postgresql.org

The following documentation comment has been logged on the website:

Page: https://www.postgresql.org/docs/13/ddl-partitioning.html
Description:

I would like to add a sentence like this into the description of
partitions:

You receive the name of the partition table data is from using
tableoid::regclass as column name in the select.

to tell the option of getting "real" tablename, eg when partitions are based
on locality.

#2Bruce Momjian
bruce@momjian.us
In reply to: PG Bug reporting form (#1)
Re: getting table name from partition

On Wed, Jul 14, 2021 at 01:45:12PM +0000, PG Doc comments form wrote:

The following documentation comment has been logged on the website:

Page: https://www.postgresql.org/docs/13/ddl-partitioning.html
Description:

I would like to add a sentence like this into the description of
partitions:

You receive the name of the partition table data is from using
tableoid::regclass as column name in the select.

to tell the option of getting "real" tablename, eg when partitions are based
on locality.

We already have this sentence in the partition docs:

Since a partition hierarchy consisting of the partitioned table
and its partitions is still an inheritance hierarchy, all the normal
rules of inheritance apply as described in Section 5.10, with a few exceptions:

but it doesn't make it clear that tableoid, which is mentioned in
Section 5.10 also works, so here is a patch to add a mention of
tableoid.

--
Bruce Momjian <bruce@momjian.us> https://momjian.us
EDB https://enterprisedb.com

If only the physical world exists, free will is an illusion.

Attachments:

tableoid.difftext/x-diff; charset=us-asciiDownload+2-1
#3Pavel Stehule
pavel.stehule@gmail.com
In reply to: Bruce Momjian (#2)
Re: getting table name from partition

Hi

pá 30. 7. 2021 v 0:24 odesílatel Bruce Momjian <bruce@momjian.us> napsal:

On Wed, Jul 14, 2021 at 01:45:12PM +0000, PG Doc comments form wrote:

The following documentation comment has been logged on the website:

Page: https://www.postgresql.org/docs/13/ddl-partitioning.html
Description:

I would like to add a sentence like this into the description of
partitions:

You receive the name of the partition table data is from using
tableoid::regclass as column name in the select.

to tell the option of getting "real" tablename, eg when partitions are

based

on locality.

We already have this sentence in the partition docs:

Since a partition hierarchy consisting of the partitioned table
and its partitions is still an inheritance hierarchy, all the
normal
rules of inheritance apply as described in Section 5.10, with a
few exceptions:

but it doesn't make it clear that tableoid, which is mentioned in
Section 5.10 also works, so here is a patch to add a mention of
tableoid.

I think Michal's example is good and very practical, and although formally
it is documented well,
can be useful for a lot of people to see a practical example. This is very
nice usage of tableoid

Regards

Pavel

Show quoted text

--
Bruce Momjian <bruce@momjian.us> https://momjian.us
EDB https://enterprisedb.com

If only the physical world exists, free will is an illusion.

#4Bruce Momjian
bruce@momjian.us
In reply to: Bruce Momjian (#2)
Re: getting table name from partition

On Thu, Jul 29, 2021 at 06:24:17PM -0400, Bruce Momjian wrote:

On Wed, Jul 14, 2021 at 01:45:12PM +0000, PG Doc comments form wrote:

The following documentation comment has been logged on the website:

Page: https://www.postgresql.org/docs/13/ddl-partitioning.html
Description:

I would like to add a sentence like this into the description of
partitions:

You receive the name of the partition table data is from using
tableoid::regclass as column name in the select.

to tell the option of getting "real" tablename, eg when partitions are based
on locality.

We already have this sentence in the partition docs:

Since a partition hierarchy consisting of the partitioned table
and its partitions is still an inheritance hierarchy, all the normal
rules of inheritance apply as described in Section 5.10, with a few exceptions:

but it doesn't make it clear that tableoid, which is mentioned in
Section 5.10 also works, so here is a patch to add a mention of
tableoid.

Patch applied back to PG 10, where the partition syntax was added.

--
Bruce Momjian <bruce@momjian.us> https://momjian.us
EDB https://enterprisedb.com

If only the physical world exists, free will is an illusion.