Re: table constraint + INSERT

From: "Dirk Jagdmann" <jagdmann(at)gmail(dot)com>
To: "Risto Tamme" <risto(at)ektaco(dot)ee>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: table constraint + INSERT
Date: 2006-05-18 07:40:05
Message-ID: 5d0f60990605180040t4723b98bi54e3621285cb53aa@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

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 = (90000 +
P_PARTKEY::numeric / 10 + P_PARTKEY::numeric / 100
);

and the second code should read:

create view PARTV as
select P_PARTKEY, 90000 + P_PARTKEY::numeric / 10 + P_PARTKEY::numeric
/ 100 as P_RETAILPRICE
from PART;

--
---> Dirk Jagdmann
----> http://cubic.org/~doj
-----> http://llg.cubic.org

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Michael Artz 2006-05-18 09:19:44 Re: Question about SQL Control Structure(if then, for loop)
Previous Message Dirk Jagdmann 2006-05-18 07:37:09 Re: table constraint + INSERT