Re: Check constraints on non-immutable keys

Поиск
Список
Период
Сортировка
От Robert Haas
Тема Re: Check constraints on non-immutable keys
Дата
Msg-id AANLkTilwRhS-QMxudzd0ffTy6FSJKA22eKJTVZeb-m3B@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Check constraints on non-immutable keys  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: Check constraints on non-immutable keys  (Richard Huxton <dev@archonet.com>)
Re: Check constraints on non-immutable keys  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
On Wed, Jun 30, 2010 at 11:49 AM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> Robert Haas <robertmhaas@gmail.com> writes:
>> My scintillating contribution to this discussion is the observation
>> that unrestorable dumps suck.
>
> No doubt, but is this a real problem in practice?

Magnus tells me that that was what prompted his original email.

> I can't recall many
> field complaints about it.  And the ones I do recall wouldn't have been
> prevented by a check as stupid as "are there immutable functions in
> here".

Hopefully there aren't too many ways to get data into a table that
doesn't satisfy its check constraint - what else are you thinking of?
Short of direct system catalog manipulation with malice aforethought,
redefining a function to return different results after the fact is
the only other case I can think of, and I'd propose we block that
somehow too if I could figure out how.

> I still say that what such a check is likely to do is encourage
> people to mis-label mutable functions as immutable ... which will cause
> them a lot of *other* headaches.

If it does, those headaches are their fault, whereas this one, at
least as I see it, is our fault.  The fact that you can injure
yourself badly with a sharp knife is not an excuse for someone to hand
it to you pointy-end-first.

I think it would be useful to have check constraints that are only
enforced on new data, and allowing immutable functions there would
make sense.  But I can't think of any reasonable use case for having a
non-immutable check constraint of the type we have now.  Can you?
Besides breaking pg_dump, it can also potentially foul up constraint
exclusion.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise Postgres Company


В списке pgsql-hackers по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Check constraints on non-immutable keys
Следующее
От: Richard Huxton
Дата:
Сообщение: Re: Check constraints on non-immutable keys