From: | Fujii Masao <masao(dot)fujii(at)gmail(dot)com> |
---|---|
To: | PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org> |
Subject: | table partition and column default |
Date: | 2019-12-25 03:19:04 |
Message-ID: | CAHGQGwEs-59omrfGF7hOHz9iMME3RbKy5ny+iftDx3LHTEn9sA@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Hi,
As the document explains, column defaults can be specified separately for
each partition. But I found that INSERT via the partitioned table ignores
that default. Is this expected behavior or bug?
CREATE TABLE test (i INT, j INT) PARTITION BY RANGE (i);
CREATE TABLE test1 PARTITION OF test (j DEFAULT 99) FOR VALUES FROM (1) TO (10);
INSERT INTO test VALUES (1, DEFAULT);
INSERT INTO test1 VALUES (2, DEFAULT);
SELECT * FROM test;
i | j
---+--------
1 | (null)
2 | 99
(2 rows)
In the above example, INSERT accessing directly to the partition uses
the default, but INSERT via the partitioned table not.
Regards,
--
Fujii Masao
From | Date | Subject | |
---|---|---|---|
Next Message | Michael Paquier | 2019-12-25 03:24:10 | Re: Assert failure due to "drop schema pg_temp_3 cascade" for temporary tables and \d+ is not showing any info after drooping temp table schema |
Previous Message | Kyotaro Horiguchi | 2019-12-25 03:18:26 | Re: Assert failure due to "drop schema pg_temp_3 cascade" for temporary tables and \d+ is not showing any info after drooping temp table schema |