Re: Plans for partitioning of inheriting tables - Mailing list pgsql-general

From Adrian Klaver
Subject Re: Plans for partitioning of inheriting tables
Date
Msg-id d9d6a2f4-379b-45f3-9005-ab047625c1a4@aklaver.com
Whole thread Raw
In response to Plans for partitioning of inheriting tables  (Thiemo Kellner <thiemo@gelassene-pferde.biz>)
Responses Re: Plans for partitioning of inheriting tables
List pgsql-general
On 10/25/24 11:47, Thiemo Kellner wrote:
> 
> Am 25.10.2024 um 17:57 schrieb Adrian Klaver:
>>
>>> I do not feel it applies to my case. I tried to create a partitioned 
>>> table that inherits columns from a base table. The documentation you 
>>> provided the URL seems to speak of realising partitioning by using 
>>> inheritance.
>>
>> This needs a code example to go any further.
> 
> Sorry, my bad. I posted the URL of the table that is inherited from. The 
> recepient is 
>
https://sourceforge.net/p/treintaytres/code/HEAD/tree/trunk/code_files/data_storage/PostgreSQL/tables/TOPO_FILES.pg_sqlcreate
tableif not exists TOPO_FILES (
 
> 
>       SOURCE_ID          uuid
>          constraint TOPO_FILES␟FK_01
>              references SOURCES (ID)
>              match full
>          not null
>      ,FILE_NAME          text
>          not null
>      ,TILE               raster
>          not null
>      ,FILE_CREATION_PIT  timestamp(6) with time zone
>          not null
>      ,FILE_HASH          text
>          not null
>      ,constraint TOPO_FILES␟PK primary key (ID)
>      ,constraint TOPO_FILES␟UQ unique (SOURCE_ID
>                                       ,FILE_NAME)
> )
> inherits(TEMPLATE_TECH);
> -- partition by hash (source_id); --NOTE Up to PG 17, partitioning with inheriting table is not possible.

It is just not the way you want to do it, see:

https://www.postgresql.org/docs/current/ddl-partitioning.html#DDL-PARTITIONING-USING-INHERITANCE


> 
> 
> The spender table
ishttps://sourceforge.net/p/treintaytres/code/HEAD/tree/trunk/code_files/data_storage/PostgreSQL/tables/TEMPLATE_TECH.pg_sql
> 
> create table if not exists TEMPLATE_TECH (
>       ID                 uuid
>          constraint TEMPLATE_TECH␟PK primary key
>          not null
>          default gen_random_uuid()
>      ,ENTRY_PIT          timestamp(6) with time zone
>          not null
>          default clock_timestamp()
> );
> 
> 

-- 
Adrian Klaver
adrian.klaver@aklaver.com




pgsql-general by date:

Previous
From: Don Seiler
Date:
Subject: Re: Index Partition Size Double of its Table Partition?
Next
From: Bruce Momjian
Date:
Subject: Re: What to do with a PAAS-pg server