Fixed null default value (closes #9)
Closes #9 (closed)
Merge request reports
Activity
added 4 commits
-
b00067b8...91db79f2 - 3 commits from branch
master
- 0e2a10b9 - Fixed null default value (closes #9 (closed))
-
b00067b8...91db79f2 - 3 commits from branch
lgtm
For the record, there's an edge case:
CREATE DOMAIN whatever AS TEXT DEFAULT 'definitely not null'; CREATE TABLE tbl ( id int, col whatever NOT NULL ); INSERT INTO tbl (id) VALUES (1) RETURNING *;
gives you
id | col ---|-------------------- 1 | definitely not null
If a column doesn't specify its default value, the database falls back to the default value of the column's type. Incidentally, that is
null
for all postgres's base types (with some negligible internal exceptions) but, as demonstrated, it doesn't have to benull
for user-defined types.If we wanted to be rigorous about this, we'd also have to cross-check
pg_type.typdefault
of the column's type. But I don't think we need to go into such depths atm. I'll create a follow-up.mentioned in commit d5d30557
mentioned in issue #11
Please register or sign in to reply