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
Views: Raw Message | Whole Thread | Download mbox | Resend email
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

Browse pgsql-hackers by date

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