| From: | mk(at)fashaf(dot)co(dot)za | 
|---|---|
| To: | pgsql-general(at)postgresql(dot)org | 
| Subject: | referential integrity violation | 
| Date: | 2002-10-18 14:21:33 | 
| Message-ID: | 20021018142133.GA27715@fashaf.co.za | 
| Views: | Whole Thread | Raw Message | Download mbox | Resend email | 
| Thread: | |
| Lists: | 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)
);
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Dave Cramer | 2002-10-18 14:34:26 | Re: [JDBC] Performance problem iterating a resultset | 
| Previous Message | Riyaz | 2002-10-18 14:17:56 | Performance problem iterating a resultset |