Re: PRIMARY KEY on a *group* of columns imply that each column is - Mailing list pgsql-general

From Ron Mayer
Subject Re: PRIMARY KEY on a *group* of columns imply that each column is
Date
Msg-id 427115AA.8060300@cheapcomplexdevices.com
Whole thread Raw
In response to Re: PRIMARY KEY on a *group* of columns imply that each column is  (Marco Colombo <pgsql@esiway.net>)
List pgsql-general
Marco Colombo wrote:
> That is, given a variable A, you can always write a boolean expression
> that evaluates True or False to test if A is _equal_ to None/undef/NULL
> (in C):

And of course you can do this in SQL as well.

> ('a', NULL) is neither the same _nor different_ from ('a', 2).

Uh, I'm not sure what you mean by "the same"; but
certainly ('a',NULL) is distinct from ('a',2).

>The result of comparison is NULL, no matter how you're testing it:

Unless you're testing with the IS DISTINCT FROM operator.



fli=# select ('a',NULL) IS DISTINCT FROM ('a',2);
  ?column?
----------
  t
(1 row)

> marco=# select ('a', 2) = ('a', NULL);
>  ?column?
> ----------
>
> (1 row)
>
> marco=# select ('a', 2) <> ('a', NULL);
>  ?column?
> ----------
>
> (1 row)


fli=# select ('a',NULL) IS DISTINCT FROM ('a',NULL);
  ?column?
----------
  f
(1 row)


> That's why NULLs are not allowed in primary keys...

But in general I agree with most of the rest of what you said.

pgsql-general by date:

Previous
From: Tony Caduto
Date:
Subject: Is there a bug in the win32 pg_restore (version 8.02) ?
Next
From: fisher73@gazeta.pl (NO-fisher-SPAM_PLEASE)
Date:
Subject: temp tables ORACLE/PGSQL