Skip site navigation (1) Skip section navigation (2)

Re: replacing mysql enum

From: Greg Stark <gsstark(at)mit(dot)edu>
To: Ian Barwick <barwick(at)gmail(dot)com>
Cc: Stephan Szabo <sszabo(at)megazone(dot)bigpanda(dot)com>,Kenneth Gonsalves <lawgon(at)thenilgiris(dot)com>, pgsql-sql(at)postgresql(dot)org
Subject: Re: replacing mysql enum
Date: 2004-12-11 17:25:50
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-sql
Ian Barwick <barwick(at)gmail(dot)com> writes:

> What I still don't quite understand is why IN in a CHECK context is
> handled differently to say: select 1 where 'x' in (null,'a','b','c') ?
> This could be a bit of a gotcha for anyone constructing a constraint
> similar to the original poster's and not realising it has no effect.


WHERE foo IN (null, ...)

returns null if foo isn't explicitly in the list (ie, "it may or may not equal
the unknown value in the list"). And I think constraints that return null are
deemed to have succeeded.


In response to

pgsql-sql by date

Next:From: Tom LaneDate: 2004-12-11 17:56:50
Subject: Re: replacing mysql enum
Previous:From: Frank BaxDate: 2004-12-11 17:10:02
Subject: Re: Cast NULL into Timestamp?

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group