Local parent table and Foreign table(s) as partition(s), is it possible?

From: Sbob <sbob(at)quadratum-braccas(dot)com>
To: Pgsql-admin <pgsql-admin(at)lists(dot)postgresql(dot)org>
Subject: Local parent table and Foreign table(s) as partition(s), is it possible?
Date: 2022-09-14 17:41:24
Message-ID: 25206e71-b388-3c51-ce17-5fd0912398eb@quadratum-braccas.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

All;

I see the below options in the CREATE FOREIGN TABLE, however I assume
these would both connect to a master/parent table on the foreign server.
Is it possible to have a Foreign Table that acts as a partition of a
local parent table, via either method (INHERITS or PARTITION OF)?

Thanks in advance...

|INHERITS ( /|parent_table|/ [, ... ] )|

The optional |INHERITS| clause specifies a list of tables from which
the new foreign table automatically inherits all columns. Parent
tables can be plain tables or foreign tables. See the similar form
of |CREATE TABLE|
<https://www.postgresql.org/docs/current/sql-createtable.html> for
more details.

|PARTITION OF /|parent_table|/ { FOR VALUES /|partition_bound_spec|/ |
DEFAULT }|

This form can be used to create the foreign table as partition of
the given parent table with specified partition bound values. See
the similar form of |CREATE TABLE|
<https://www.postgresql.org/docs/current/sql-createtable.html> for
more details. Note that it is currently not allowed to create the
foreign table as a partition of the parent table if there are
|UNIQUE| indexes on the parent table. (See also |ALTER TABLE ATTACH
PARTITION|
<https://www.postgresql.org/docs/current/sql-altertable.html>.)

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Laurenz Albe 2022-09-14 18:01:11 Re: Local parent table and Foreign table(s) as partition(s), is it possible?
Previous Message Alvaro Herrera 2022-09-13 11:11:14 Re: Error when execute insert/update