| From: | gearond(at)cvc(dot)net |
|---|---|
| To: | pgsql-general(at)postgresql(dot)org |
| Subject: | How to do unique users |
| Date: | 2003-02-09 03:09:39 |
| Message-ID: | B0029266871@cvc6.cvc.net |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-general |
I have the following tables (mucho simplified):
usrs{
serial usr_id,
var(54) username);
addrs(
serial addr_id,
var(54) addr};
usr_addr_type(
serial usr_addr_type_id,
var(16) type -- one of which is 'primary'};
usr_addrs{
int4 usr_id, --FK to usrs table
int4 addr_id, -- FK to addrs table
int4 usr_addr_type_id -- FK to usr_addr_type table);
================================
My problem: The usrs can have as many addresses as there are types. The
addresses are also used for 'org_addrs' in combination with 'org_addr_types'.
(This explains the 'usr_addrs' table)
I want to EFFECTIVELY do a unique index on:
'usrs.username' their 'primary' address in usr_addrs'. How would I have many
addresses in 'usr_addrs' for a particular address, but one of them used for
uniqueness of the of the 'usr'
?
---------------------------------------------
This message was sent using CVC Internet's MailMan.
http://www.cvc.net
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Dustin Sallings | 2003-02-09 03:56:08 | Re: How to do unique users |
| Previous Message | Tom Lane | 2003-02-09 00:08:26 | Re: convert integer to interval ? |