I have two columns, both individually nullable, but a row needs to have
a value in one or the other. What is the best way to implement the
constraints? I currently have:

create table f (
  a int, 
  b int,
  check (a + b is null),
  check (coalesce(a,b) is not null)
);

Is there a better way to do it?



--
George Pavlov
http://mynewplace.com
415.348.2010 desk
415.235.3180 mobile 

---------------------------(end of broadcast)---------------------------
TIP 4: Have you searched our list archives?

               http://archives.postgresql.org

Reply via email to