Re: [GENERAL] referential integrity and defaults, DB design or trick

2007-12-22 Thread Ivan Sergio Borgonovo
On Fri, 21 Dec 2007 08:19:08 + Richard Huxton [EMAIL PROTECTED] wrote: Ivan Sergio Borgonovo wrote: The default property (that is actually made by several fields) in my case is not completely homogeneous with the others, because it has a double meaning. It is cleaner to split the

Re: [GENERAL] referential integrity and defaults, DB design or trick

2007-12-21 Thread Richard Huxton
Ivan Sergio Borgonovo wrote: The default property (that is actually made by several fields) in my case is not completely homogeneous with the others, because it has a double meaning. It is cleaner to split the meanings and the data. It usually is. A lot of the design decisions you can regret

Re: [GENERAL] referential integrity and defaults, DB design or trick

2007-12-20 Thread Ivan Sergio Borgonovo
On Wed, 19 Dec 2007 17:24:52 +0100 Ivan Sergio Borgonovo [EMAIL PROTECTED] wrote: I've something like this: create table i ( iid serial primary key, name varchar(32) ); create table p ( pid serial primary key, iid int references i(iid) on delete cascade,

Re: [GENERAL] referential integrity and defaults, DB design or trick

2007-12-20 Thread Erik Jones
On Dec 20, 2007, at 8:50 AM, Ivan Sergio Borgonovo wrote: On Wed, 19 Dec 2007 17:24:52 +0100 Ivan Sergio Borgonovo [EMAIL PROTECTED] wrote: I've something like this: create table i ( iid serial primary key, name varchar(32) ); create table p ( pid serial primary key,

Re: [GENERAL] referential integrity and defaults, DB design or trick

2007-12-20 Thread Ivan Sergio Borgonovo
On Thu, 20 Dec 2007 09:55:29 -0600 Erik Jones [EMAIL PROTECTED] wrote: On Dec 20, 2007, at 8:50 AM, Ivan Sergio Borgonovo wrote: On Wed, 19 Dec 2007 17:24:52 +0100 Ivan Sergio Borgonovo [EMAIL PROTECTED] wrote: I've something like this: create table i ( iid serial primary

Re: [GENERAL] referential integrity and defaults, DB design or trick

2007-12-20 Thread Richard Huxton
Ivan Sergio Borgonovo wrote: * i has a default property i.name he is hungry by default i.name=hungry * i has a set of other property he can chose from in p (thirsty, happy...) * c is the chosen property of the day (c actually will contain more than a p) c can contain: 1) sorry not chosen yet

Re: [GENERAL] referential integrity and defaults, DB design or trick

2007-12-20 Thread Sam Mason
On Thu, Dec 20, 2007 at 06:31:47PM +0100, Ivan Sergio Borgonovo wrote: On Thu, 20 Dec 2007 09:55:29 -0600 Erik Jones [EMAIL PROTECTED] wrote: On Dec 20, 2007, at 8:50 AM, Ivan Sergio Borgonovo wrote: On Wed, 19 Dec 2007 17:24:52 +0100 Ivan Sergio Borgonovo [EMAIL PROTECTED] wrote: I've

Re: [GENERAL] referential integrity and defaults, DB design or trick

2007-12-20 Thread Ivan Sergio Borgonovo
On Thu, 20 Dec 2007 17:53:23 + Richard Huxton [EMAIL PROTECTED] wrote: CREATE TABLE properties ( pid serial, name text, PRIMARY KEY (pid) ); CREATE TABLE user_default_property ( uid int NOT NULL REFERENCES users, pid int NOT NULL REFERENCES properties, PRIMARY KEY

[GENERAL] referential integrity and defaults, DB design or trick

2007-12-19 Thread Ivan Sergio Borgonovo
I've something like this: create table i ( iid serial primary key, name varchar(32) ); create table p ( pid serial primary key, iid int references i(iid) on delete cascade, name varchar(32) ); create table c ( bid serial primary key, pid int