Project

General

Profile

Bug #10089

database lacks 'not null' constraints

Added by Dieter Plaetinck about 5 years ago.

Status:
New
Priority:
Low
Assignee:
-
Category:
-
Target version:
-
Start date:
09/01/2014
Due date:
% Done:

0%

Estimated time:
Affected Version:
git development version
System:
all
bitness:
64-bit
hardware architecture:
amd64/x86

Description

Already spoke about this with houz, documenting here for posterity and to make sure we don't forget.

irc quote:

08:38:52 < Dieterbe> hey houz , i noticed some tables don't have 'not null' constraints, like tagged_images
09:16:09 < houz> Dieterbe: what do you want to have the not null on and why?
10:21:34 < Dieterbe> houz: imgid integer, tagid integer <-- both of these should have a not null constraint, no? that would prevent from bad
records making their way into the db
10:22:07 < Dieterbe> houz: i was actually working on a script to update that table, and that's how i found out that tagged_images accepts
records such as (null, 123) or (null, null)
10:22:11 < houz> maybe, but 1) i don't see how they would get into the db and 2) they wouldn't really hurt i guess
10:23:00 < Dieterbe> not null constraints is just a good way to avoid bad data and to expose bugs quicker
10:26:32 < houz> probably. i will add it. thanks for reporting :)

even though i mostly care about tagged_images right now, it would be good to have not null constraints in all tables where we refer to an id.

Also available in: Atom PDF

Go to top