On a tangent to the never-ending NULL debate, I've got a table:
CREATE TABLE events (
event_id INTEGER PRIMARY KEY,
tag_fk INTEGER REFERENCES tags (tag_id),
place_fk INTEGER REFERENCES places (place_id),
event_date CHAR(18) NOT NULL DEFAULT '000000003000000001',
sort_date DATE NOT NULL DEFAULT '40041024BC',
event_note TEXT NOT NULL DEFAULT ''
);
The event_note will contain text in roughly 1 out of 5 rows:
pgslekt=> select count(*) from events;
count
-------
29473
(1 row)
pgslekt=> select count(*) from events where event_note <> '';
count
-------
5572
(1 row)
I wonder if this is sane design, in theory and in practice, or should I
break out the event_note field in a separate table?
--
Leif Biberg Kristensen | Registered Linux User #338009
http://solumslekt.org/ | Cruising with Gentoo/KDE