From: | Dmitry Koval <d(dot)koval(at)postgrespro(dot)ru> |
---|---|
To: | Alexander Lakhin <exclusion(at)gmail(dot)com>, Alexander Korotkov <aekorotkov(at)gmail(dot)com> |
Cc: | Robert Haas <robertmhaas(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
Subject: | Re: Add SPLIT PARTITION/MERGE PARTITIONS commands |
Date: | 2024-04-30 21:14:07 |
Message-ID: | 6bec2319-0722-44c2-9a99-65548d4c8c63@postgrespro.ru |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Hi!
30.04.2024 6:00, Alexander Lakhin пишет:
> Maybe I'm doing something wrong, but the following script:
> CREATE TABLE t (i int, PRIMARY KEY(i)) PARTITION BY RANGE (i);
> CREATE TABLE tp_0 PARTITION OF t FOR VALUES FROM (0) TO (1);
> CREATE TABLE tp_1 PARTITION OF t FOR VALUES FROM (1) TO (2);
>
> CREATE TABLE t2 (LIKE t INCLUDING ALL);
> CREATE TABLE tp2 (LIKE tp_0 INCLUDING ALL);
> creates tables t2, tp2 without not-null constraints.
To create partitions is used the "CREATE TABLE ... LIKE ..." command
with the "EXCLUDING INDEXES" modifier (to speed up the insertion of values).
CREATE TABLE t (i int, PRIMARY KEY(i)) PARTITION BY RANGE(i);
CREATE TABLE t2 (LIKE t INCLUDING ALL EXCLUDING INDEXES EXCLUDING IDENTITY);
\d+ t2;
...
Not-null constraints:
"t2_i_not_null" NOT NULL "i"
Access method: heap
[1]
https://github.com/postgres/postgres/blob/d12b4ba1bd3eedd862064cf1dad5ff107c5cba90/src/backend/commands/tablecmds.c#L21215
--
With best regards,
Dmitry Koval
Postgres Professional: http://postgrespro.com
From | Date | Subject | |
---|---|---|---|
Next Message | Jacob Champion | 2024-04-30 21:29:27 | pg_parse_json() should not leak token copies on failure |
Previous Message | Dmitry Dolgov | 2024-04-30 21:11:12 | Re: Build with meson + clang + sanitizer resulted in undefined reference |