From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Andrew Dunstan <andrew(at)dunslane(dot)net> |
Cc: | Andrew Gierth <andrew(at)tao11(dot)riddles(dot)org(dot)uk>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: ALTER TABLE ADD COLUMN fast default |
Date: | 2021-04-05 16:10:48 |
Message-ID: | 554470.1617639048@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Andrew Dunstan <andrew(at)dunslane(dot)net> writes:
> On 4/4/21 6:50 PM, Tom Lane wrote:
>> Meh. "pg_class.relchecks is inconsistent with the number of entries
>> in pg_constraint" does not seem to me like a scary enough situation
>> to justify a panic response. Maybe there's an argument for failing
>> at the point where we'd need to actually apply the CHECK constraints
>> (similarly to what my patch is doing for missing defaults).
>> But preventing the user from, say, dumping the data in the table
>> seems to me to be making the situation worse not better.
> OK, fair argument.
Here's a v2 that applies the same principles to struct ConstrCheck
as AttrDefault, ie create only valid entries (no NULL strings), and
if there's not the right number, complain at point of use rather
than failing the relcache load.
There is a hole in this, which is that if pg_class.relchecks = 0
then we won't even look in pg_constraint, so we won't realize if
there is an inconsistency. But that was true before, and I don't
want to expend an almost-always-useless catalog search to see if
relchecks = 0 is a lie.
I also tried to bring the related message texts up to something
approaching project standards, though I didn't convert them into
translatable ereports.
regards, tom lane
Attachment | Content-Type | Size |
---|---|---|
fix-adbin-inconsistencies-2.patch | text/x-diff | 19.7 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2021-04-05 16:21:36 | Re: ALTER TABLE ADD COLUMN fast default |
Previous Message | Alvaro Herrera | 2021-04-05 15:48:14 | Re: Additional Chapter for Tutorial - arch-dev.sgml |