pg.ddx.io pgsql-sql@postgresql.org mailing list archive
help / color / mirror / Atom feedNovice Help Needed
2+ messages / 2 participants
[nested] [flat]
* Novice Help Needed
@ 2000-05-18 18:01 Brian C. Doyle <bcdoyle@mindspring.com>
2000-05-18 19:27 ` Re: Novice Help Needed Robert B. Easter <reaster@comptechnews.com>
0 siblings, 1 reply; 2+ messages in thread
From: Brian C. Doyle @ 2000-05-18 18:01 UTC (permalink / raw)
To: pgsql-sql
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
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: Novice Help Needed
2000-05-18 18:01 Novice Help Needed Brian C. Doyle <bcdoyle@mindspring.com>
@ 2000-05-18 19:27 ` Robert B. Easter <reaster@comptechnews.com>
0 siblings, 0 replies; 2+ messages in thread
From: Robert B. Easter @ 2000-05-18 19:27 UTC (permalink / raw)
To: Brian C. Doyle <bcdoyle@mindspring.com>; 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
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2000-05-18 19:27 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2000-05-18 18:01 Novice Help Needed Brian C. Doyle <bcdoyle@mindspring.com>
2000-05-18 19:27 ` Robert B. Easter <reaster@comptechnews.com>
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