table constraint + INSERT

Поиск
Список
Период
Сортировка
От Risto Tamme
Тема table constraint + INSERT
Дата
Msg-id E763584E741976409B9F835B475B00FC02DEB4@pe2850.EKTACO.local
обсуждение исходный текст
Ответы Re: table constraint + INSERT  ("Dirk Jagdmann" <jagdmann@gmail.com>)
Список pgsql-sql
<p><font size="2">Hello<br /><br /> I use PostgreSQL in my program and I found a strange behavior, at least for me.<br
/><br/> I have a simple table with constraint<br /><br /> CREATE TABLE "PART"<br /> (<br />   "P_PARTKEY" int4 NOT
NULL,<br/>   "P_RETAILPRICE" numeric,<br />   CONSTRAINT "PART_PRIMARY" PRIMARY KEY ("P_PARTKEY"),<br />   CONSTRAINT
"PART_check"CHECK ("P_RETAILPRICE" = (90000 + "P_PARTKEY" / 10 + "P_PARTKEY" / 100)<br /> );<br /><br /> And I try to
inserta row:<br /> INSERT INTO "PART" ("P_PARTKEY","P_RETAILPRICE") VALUES(999,90109.89);<br /><br /> but it fails:
ERROR: new row for relation "PART" violates check constraint "PART_check"<br /><br /> When you check using your head or
pocketcalculator then this INSERT seems to be correct. Is it some floating point mystery?<br /> Is there some trick?<br
/>I'm using version 8.0.1 for Windows.<br /><br /> With thanks, Risto<br /><br />  </font> 

В списке pgsql-sql по дате отправления:

Предыдущее
От: lingyu.tseng@gmail.com
Дата:
Сообщение: how referencing %rowtype variables without column names
Следующее
От: Jay Chiu
Дата:
Сообщение: Question about SQL Control Structure(if then, for loop)