Re: Novice Help Needed - Mailing list pgsql-sql

From Robert B. Easter
Subject Re: Novice Help Needed
Date
Msg-id 00051815354701.14806@comptechnews
Whole thread Raw
In response to Novice Help Needed  ("Brian C. Doyle" <bcdoyle@mindspring.com>)
List pgsql-sql
On Thu, 18 May 2000, Brian C. Doyle wrote:
> Hello,
> 
> I am in need of a rule or trigger that will only allow one entry where the 
> date and a userid field are the same?
> 
> So on the insert I want it to first check and see if userid and date exist 
> and if so do not enter them.  If they do exist, allow the insert
> 
> Brian C. Doyle

If I understand, maybe you can just make a composite primary key out of userid
and date.

CREATE TABLE  atable (userid    INTEGER,thedate    TIMESTAMP,PRIMARY KEY (userid, thedate)
);
--  Robert B. Easter
reaster@comptechnews.com


pgsql-sql by date:

Previous
From: Kate Collins
Date:
Subject: SQL command speed
Next
From: mig@utdt.edu
Date:
Subject: Re: SQL command speed