From: Ashutosh Bapat <ashutosh.bapat@enterprisedb.com>
To: pgsql-hackers@lists.postgresql.org
Cc: Amit Langote <amitlangote09@gmail.com>
Subject: Re: BUG #15212: Default values in partition tables don't work as expected and allow NOT NULL violation
Date: Tue, 10 Jul 2018 13:50:47 +0000
Message-ID: <153123064797.1384.12444178573294974260.pgcf@coridan.postgresql.org> (raw)
In-Reply-To: <c0b59d52-b2b3-3ea9-f225-0dad54c1d3a7@lab.ntt.co.jp>
References: <152746742177.1291.9847032632907407358@wrigleys.postgresql.org>
<c0b59d52-b2b3-3ea9-f225-0dad54c1d3a7@lab.ntt.co.jp>
I didn't see any hackers thread linked to this CF entry. Hence sending this mail through CF app.
The patch looks good to me. It applies cleanly, compiles cleanly and make check passes.
I think you could avoid condition
+ /* Do not override parent's NOT NULL constraint. */
+ if (restdef->is_not_null)
+ coldef->is_not_null = restdef->is_not_null;
by rewriting this line as
coldef->is_not_null = coldef->is_not_null || restdef->is_not_null;
The comment looks a bit odd either way since we are changing coldef->is_not_null based on restdef->is_not_null. That's because of the nature of boolean variables. May be a bit of explanation is needed.
On a side note, I see
coldef->constraints = restdef->constraints;
Shouldn't we merge the constraints instead of just overwriting those?
--
Best Wishesh
Ashutosh
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-bugs@postgresql.org
Cc: ashutosh.bapat@enterprisedb.com, pgsql-hackers@lists.postgresql.org, amitlangote09@gmail.com
Subject: Re: BUG #15212: Default values in partition tables don't work as expected and allow NOT NULL violation
In-Reply-To: <153123064797.1384.12444178573294974260.pgcf@coridan.postgresql.org>
References: <152746742177.1291.9847032632907407358@wrigleys.postgresql.org> <c0b59d52-b2b3-3ea9-f225-0dad54c1d3a7@lab.ntt.co.jp> <153123064797.1384.12444178573294974260.pgcf@coridan.postgresql.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox