Re: Check constraints on non-immutable keys

From: Magnus Hagander <magnus(at)hagander(dot)net>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Check constraints on non-immutable keys
Date: 2010-06-30 14:40:58
Message-ID: AANLkTilJjP2iUBCcrjTqMKRN9DUKl1jxGWiTYAYKNgzV@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Jun 30, 2010 at 16:38, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> Magnus Hagander <magnus(at)hagander(dot)net> writes:
>> Shouldn't we disallow anything that's not IMMUTABLE in a check constraint?
>
> I think you'd get too many howls of pain ... also, such a restriction is
> likely contrary to SQL spec.

Really? That sounds strange, but I can't claim to k now the SQL spec..

> The example seems to me to be in the category of "so don't do that"
> rather than something that we need to save users from.  Yes, it's

In that case, should we at least throw a warning?

> stupid, but for example the very similar check of "a < now()"
> would be perfectly safe and arguably useful.

Well, things like timezone settings could come in effect there as well...

--
Magnus Hagander
Me: http://www.hagander.net/
Work: http://www.redpill-linpro.com/

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2010-06-30 14:48:18 Re: Keepalives win32
Previous Message Tom Lane 2010-06-30 14:38:31 Re: Check constraints on non-immutable keys