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

question for serial types with CHECK conditions

From: "Guido Barosio" <gbarosio(at)gmail(dot)com>
To: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: question for serial types with CHECK conditions
Date: 2007-04-28 15:30:08
Message-ID: f7f6b4c70704280830n2d47c187ra22784360757bc19@mail.gmail.com (view raw or flat)
Thread:
Lists: 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(dot)barosio(at)globant(dot)com

Responses

pgsql-hackers by date

Next:From: shieldyDate: 2007-04-28 15:40:04
Subject: SOS, help me please, one problem towards the postgresql develope on windows
Previous:From: shieldyDate: 2007-04-28 12:56:46
Subject: I have made the first step on postgresql, but got some problems

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