Re: Problem with unique index

From: Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com>
To: Sharon Cowling <sharon(dot)cowling(at)sslnz(dot)com>
Cc: <pgsql-sql(at)postgresql(dot)org>
Subject: Re: Problem with unique index
Date: 2002-01-13 20:50:00
Message-ID: 20020113124559.T16954-100000@megazone23.bigpanda.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql


On Sun, 13 Jan 2002, Sharon Cowling wrote:

> CREATE RULE addperson_rule AS ON INSERT TO addperson_view DO INSTEAD(
> INSERT INTO person VALUES (new.person_id, new.firstname, new.lastname,
> new.dob, new.street, new.suburb, new.city, new.homephone,
> new.workphone, new.mobile, new.type, new.date_approved,
> new.approved_by, new.vehicle_type, new.vehicle_rego, new.notes);

I may be confused, but if you don't want to specify values for
drivers_licence and firearms_licence in the above insert, aren't you doing
to need to list the columns since notes comes after those columns?

> Table Structure:
> CREATE TABLE person(
> person_id INT NOT NULL,
> firstname VARCHAR(25) NOT NULL,
> lastname VARCHAR(25) NOT NULL,
> dob date NOT NULL,
> street VARCHAR(50) NOT NULL,
> suburb VARCHAR(50),
> city VARCHAR(50) NOT NULL,
> homephone INT,
> workphone INT,
> mobile INT,
> type VARCHAR(30) NOT NULL,
> date_approved DATE NOT NULL,
> approved_by VARCHAR(50) NOT NULL,
> vehicle_type VARCHAR(50),
> vehicle_rego VARCHAR(6),
> drivers_licence VARCHAR(10) UNIQUE,
> firearms_licence VARCHAR(20) UNIQUE,
> notes VARCHAR(80),
> PRIMARY KEY (person_id));

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Tom Lane 2002-01-13 20:53:16 Re: Problem with unique index
Previous Message Sharon Cowling 2002-01-13 20:23:00 Problem with unique index