referential integrity violation - Mailing list pgsql-general

From mk@fashaf.co.za
Subject referential integrity violation
Date
Msg-id 20021018142133.GA27715@fashaf.co.za
Whole thread Raw
Responses Re: referential integrity violation  (Darren Ferguson <darren@crystalballinc.com>)
Re: referential integrity violation  (Stephan Szabo <sszabo@megazone23.bigpanda.com>)
List pgsql-general
Hi guys

I have created a Pg DB, Ive included 2 of the tables.
When inserting non NULL values everything works just fine,
but when i want to leave a table empty i get the following error:

EXEC: ERROR: referential integrity violation - key referenced from pc not found in slip_printer

Im recieving the information from a Perl CGI form that is filled in and then INSERT it using perl DBI

If any more information is needed please let me know. As far as i know i should be allowed to have null.

TIA
Merritt

CREATE TABLE slip_printer (
    id        SERIAL PRIMARY KEY,
    make        VARCHAR(256) NOT NULL,
    model        VARCHAR(256) NOT NULL,
    UNIQUE (make, model)
);

CREATE TABLE pc (
    id        SERIAL PRIMARY KEY,
    store        INTEGER REFERENCES store (id) NOT NULL,
    cpu_type    INTEGER REFERENCES cpu_type (id) NOT NULL,
    cpu_mhz        INTEGER REFERENCES cpu_mhz (id) NOT NULL,
    memory_type    INTEGER REFERENCES memory_type (id) NOT NULL,
    memory_amount    INTEGER,    /* amount of chips/sticks, not size in MB */
    hdd        INTEGER REFERENCES hdd (id),
    hdd_serial    VARCHAR(256),
    monitor        INTEGER REFERENCES monitor (id) NOT NULL,
    slip_printer    INTEGER REFERENCES slip_printer (id),
    report_printer    INTEGER REFERENCES report_printer (id),
    cash_drawer    INTEGER REFERENCES cash_drawer (id) NOT NULL,
    scanner        INTEGER REFERENCES scanner (id) NOT NULL,
    ups        INTEGER REFERENCES ups (id),
    modem        INTEGER REFERENCES modem (id)
);

Attachment

pgsql-general by date:

Previous
From: "Roberto (SmartBit)"
Date:
Subject: Re: Finding a value in an array field
Next
From: Darren Ferguson
Date:
Subject: Re: referential integrity violation