Index: openacs-4/packages/acs-kernel/sql/postgresql/lob.sql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-kernel/sql/postgresql/lob.sql,v
diff -u -r1.3 -r1.4
--- openacs-4/packages/acs-kernel/sql/postgresql/lob.sql	11 Dec 2003 21:39:52 -0000	1.3
+++ openacs-4/packages/acs-kernel/sql/postgresql/lob.sql	1 Jul 2004 11:29:17 -0000	1.4
@@ -19,7 +19,8 @@
 create sequence lob_sequence;
 
 create table lobs (
-	lob_id			integer not null primary key,
+	lob_id			integer not null 
+                            constraint lobs_lob_id_pk primary key,
 	refcount		integer not null default 0
 );
 
@@ -33,11 +34,14 @@
 for each row execute procedure on_lobs_delete();
 
 create table lob_data (
-	lob_id			integer not null references lobs,
-	segment			integer not null,
-	byte_len		integer not null,
-	data			bytea not null,
-	primary key (lob_id, segment)
+        lob_id              integer not null
+                            constraint lob_data_lob_id_fk
+                            references lobs on delete cascade,
+        segment             integer not null,
+        byte_len            integer not null,
+        data                bytea not null,
+        constraint lob_data_lob_id_segment_pk
+        primary key (lob_id, segment)
 );
 
 create index lob_data_index on lob_data(lob_id);
