pg.ddx.io  pgsql-docs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
getting table name from partition
4+ messages / 3 participants
[nested] [flat]

* getting table name from partition
@ 2021-07-14 13:45 PG Doc comments form <noreply@postgresql.org>
  2021-07-29 22:24 ` Re: getting table name from partition Bruce Momjian <bruce@momjian.us>
  0 siblings, 1 reply; 4+ messages in thread

From: PG Doc comments form @ 2021-07-14 13:45 UTC (permalink / raw)
  To: pgsql-docs@lists.postgresql.org; +Cc: michal.palenik@freemap.sk

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.


^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: getting table name from partition
  2021-07-14 13:45 getting table name from partition PG Doc comments form <noreply@postgresql.org>
@ 2021-07-29 22:24 ` Bruce Momjian <bruce@momjian.us>
  2021-07-30 07:20   ` Re: getting table name from partition Pavel Stehule <pavel.stehule@gmail.com>
  2021-08-03 15:12   ` Re: getting table name from partition Bruce Momjian <bruce@momjian.us>
  0 siblings, 2 replies; 4+ messages in thread

From: Bruce Momjian @ 2021-07-29 22:24 UTC (permalink / raw)
  To: michal.palenik@freemap.sk; pgsql-docs@lists.postgresql.org

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:

  [text/x-diff] tableoid.diff (608B, ../../20210729222417.GW9600@momjian.us/2-tableoid.diff)
  download | inline diff:
diff --git a/doc/src/sgml/ddl.sgml b/doc/src/sgml/ddl.sgml
index 7701d8000f..e0ffb020bf 100644
--- a/doc/src/sgml/ddl.sgml
+++ b/doc/src/sgml/ddl.sgml
@@ -4105,7 +4105,8 @@ ALTER INDEX measurement_city_id_logdate_key
 
     <para>
      Since a partition hierarchy consisting of the partitioned table and its
-     partitions is still an inheritance hierarchy, all the normal rules of
+     partitions is still an inheritance hierarchy,
+     <structfield>tableoid</structfield> and all the normal rules of
      inheritance apply as described in <xref linkend="ddl-inherit"/>, with
      a few exceptions:
 

^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: getting table name from partition
  2021-07-14 13:45 getting table name from partition PG Doc comments form <noreply@postgresql.org>
  2021-07-29 22:24 ` Re: getting table name from partition Bruce Momjian <bruce@momjian.us>
@ 2021-07-30 07:20   ` Pavel Stehule <pavel.stehule@gmail.com>
  1 sibling, 0 replies; 4+ messages in thread

From: Pavel Stehule @ 2021-07-30 07:20 UTC (permalink / raw)
  To: Bruce Momjian <bruce@momjian.us>; +Cc: Michal Palenik <michal.palenik@freemap.sk>; Pg Docs <pgsql-docs@lists.postgresql.org>

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




> --
>   Bruce Momjian  <bruce@momjian.us>        https://momjian.us
>   EDB                                      https://enterprisedb.com
>
>   If only the physical world exists, free will is an illusion.
>
>

^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: getting table name from partition
  2021-07-14 13:45 getting table name from partition PG Doc comments form <noreply@postgresql.org>
  2021-07-29 22:24 ` Re: getting table name from partition Bruce Momjian <bruce@momjian.us>
@ 2021-08-03 15:12   ` Bruce Momjian <bruce@momjian.us>
  1 sibling, 0 replies; 4+ messages in thread

From: Bruce Momjian @ 2021-08-03 15:12 UTC (permalink / raw)
  To: michal.palenik@freemap.sk; pgsql-docs@lists.postgresql.org

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.






^ permalink  raw  reply  [nested|flat] 4+ messages in thread


end of thread, other threads:[~2021-08-03 15:12 UTC | newest]

Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2021-07-14 13:45 getting table name from partition PG Doc comments form <noreply@postgresql.org>
2021-07-29 22:24 ` Bruce Momjian <bruce@momjian.us>
2021-07-30 07:20   ` Pavel Stehule <pavel.stehule@gmail.com>
2021-08-03 15:12   ` Bruce Momjian <bruce@momjian.us>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox