[odb-users] PostgreSQL declarative partitioning - generated schema file

Boris Kolpackov boris at codesynthesis.com
Tue May 4 09:29:16 EDT 2021


Attilio Priolo <attilio.priolo at gmail.com> writes:

> CREATE TABLE "event_log" (
>   "id_timestamp" TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
>   "id_id" BIGSERIAL NOT NULL,
>   "typeid" TEXT NOT NULL,
>   "timestamp" TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
>   "ept" BIGINT NULL,
>   PRIMARY KEY ("id_timestamp",
>                "id_id"),
>   CONSTRAINT "ept_fk"
>     FOREIGN KEY ("ept")
>     REFERENCES "ept" ("id")
>     INITIALLY DEFERRED)
> PARTITION BY RANGE("timestamp");
> 
> To summarize, I would like to add the "PARTITION BY"  during the schema
> generation step because PostgreSQL does not support altering an existing
> table into a partitioned one.
> Any suggestions?

Thanks for the example. There is currently no good way to achieve this.
But we've had a similar request some time ago so perhaps it's time to
add support for table options (similar to column options). I could try
to implement this in the coming weeks if you would be willing to try
it out.



More information about the odb-users mailing list