question for serial types with CHECK conditions - Mailing list pgsql-hackers

From Guido Barosio
Subject question for serial types with CHECK conditions
Date
Msg-id f7f6b4c70704280830n2d47c187ra22784360757bc19@mail.gmail.com
Whole thread Raw
Responses Re: question for serial types with CHECK conditions  (Michael Glaesemann <grzm@seespotcode.net>)
List pgsql-hackers
Hey ya,
  Found a behaviour that caught my attention. While it's not a real
problem, and definetely not serious, I realize that it may be good to
write about it, cause I couldn't find previous posts on the matter.
 Basically, I am preparing a presentation for an install party, and
while I was checking the documentation for certain bullets I arrived
to the CHECK stuff.
 Therefore, I went into my psql and threw the following, without
paying too much attention:
  CREATE TABLE checksss (a serial CHECK (a > 1 and a < 10), b varchar);

followed by a :
  INSERT INTO checksss (b) values ('asdf');
  Obviously, postgresql replied with a big : "new row ...violates
check constraint ..."
  Now, my question is: Shouldn't postgresql avoid the creation of the
table while a serial type contains a check condition? A serial type
represents a sequence, but is not the same as creating the sequence
per se, with special conditions from start.
  I may be radically wrong, and this is probably the case, but I
couldn't resist and choose to ask.

Kind regards,
-- 
Guido Barosio
-----------------------
http://www.globant.com
guido.barosio@globant.com


pgsql-hackers by date:

Previous
From: Stefan Kaltenbrunner
Date:
Subject: Re: strange buildfarm failures
Next
From: "Guido Barosio"
Date:
Subject: Re: question for serial types with CHECK conditions