pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Robert B. Easter <reaster@comptechnews.com>
To: Brian C. Doyle <bcdoyle@mindspring.com>
To: pgsql-sql@postgresql.org
Subject: Re: Novice Help Needed
Date: Thu, 18 May 2000 15:27:56 -0400
Message-ID: <00051815354701.14806@comptechnews> (raw)
In-Reply-To: <4.3.1.2.20000518131444.00af6760@pop.mindspring.com>
References: <4.3.1.2.20000518131444.00af6760@pop.mindspring.com>

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



view thread (2+ messages)

Message-ID: <00051815354701.14806@comptechnews>
Permalink:  ../00051815354701.14806@comptechnews/
Also on:    postgresql.org/message-id/00051815354701.14806@comptechnews

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-sql@postgresql.org
  Cc: reaster@comptechnews.com, bcdoyle@mindspring.com
  Subject: Re: Novice Help Needed
  In-Reply-To: <00051815354701.14806@comptechnews>
  References: <4.3.1.2.20000518131444.00af6760@pop.mindspring.com> <00051815354701.14806@comptechnews>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox