Both PostgreSQL and sqlite choke on
publisher_id FOREIGN KEY REFERENCES publisher(publisher_id)
In both cases removing
FOREIGN KEY
solved the issue. PostgreSQL did not like the field type of
double
, as I believe
float
is the standard type for a floating point field. That being said, a field representing a monetary value is probably better represented as a
NUMERIC
type, rather than a binary floating point. That's due to the nature of binary floating point, which cannot represent 0.01 exactly. To see this for yourself, try this in your favorite compiled language:
double d = 0.0;
for 1 ... 100
d = d + 0.01
if d == 1.0
print yes
else
print no
The result may not be what you expect!