Re: [SQL] table constraint + INSERT

2006-05-18 Thread Dirk Jagdmann
Too bad, some code got truncated... CREATE TABLE PART ( P_PARTKEY int4 NOT NULL, P_RETAILPRICE numeric, CONSTRAINT PART_PRIMARY PRIMARY KEY (P_PARTKEY), CONSTRAINT PART_check CHECK (P_RETAILPRICE = (9 + P_PARTKEY::numeric / 10 + P_PARTKEY::numeric / 100 ); and the second code should read

Re: [SQL] table constraint + INSERT

2006-05-18 Thread Dirk Jagdmann
I have a simple table with constraint CREATE TABLE "PART" ( "P_PARTKEY" int4 NOT NULL, "P_RETAILPRICE" numeric, CONSTRAINT "PART_PRIMARY" PRIMARY KEY ("P_PARTKEY"), CONSTRAINT "PART_check" CHECK ("P_RETAILPRICE" = (9 + "P_PARTKEY" / 10 + "P_PARTKEY" / 100) ); And I try to in

[SQL] table constraint + INSERT

2006-05-17 Thread Risto Tamme
Title: table constraint + INSERT Hello I use PostgreSQL in my program and I found a strange behavior, at least for me. I have a simple table with constraint CREATE TABLE "PART" (   "P_PARTKEY" int4 NOT NULL,   "P_RETAILPRICE" numeric,   CONSTRAINT "PART_PRIMARY" PRIMARY KEY ("P_PARTKEY"),