| From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
|---|---|
| To: | Hajo(at)Lemcke(dot)com |
| Cc: | pgsql-bugs(at)postgresql(dot)org |
| Subject: | Re: BUG #8132: Not Null column should set default value when inserting or setting null |
| Date: | 2013-05-02 15:05:11 |
| Message-ID: | 25036.1367507111@sss.pgh.pa.us |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-bugs |
Hajo(at)Lemcke(dot)com writes:
> I would like to have the default value replace a given null value if the
> column is specified with not null and default.
> The SQL specification only requires to set the default value when the column
> is omitted on insert or update.
> I think this is a flaw in the specification because it requires developers
> to create multiple statements for inserts and updates for all combinations
> of default not null columns.
This may be a flaw in the specification, but you'd need to talk to the
SQL standards committee to get it changed, not us. We're quite unlikely
to change away from standard-mandated behavior.
If you really need such behavior to support broken application logic,
you can implement it with a BEFORE INSERT/UPDATE trigger.
regards, tom lane
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Thomas Kellerer | 2013-05-02 16:07:22 | Re: BUG #8132: Not Null column should set default value when inserting or setting null |
| Previous Message | Grégory Bellier | 2013-05-02 14:47:49 | After reboot some dll files are missing preventing PG to start |