pg.ddx.io pgsql-bugs@postgresql.org mailing list archive
help / color / mirror / Atom feedBUG #8132: Not Null column should set default value when inserting or setting null
3+ messages / 3 participants
[nested] [flat]
* BUG #8132: Not Null column should set default value when inserting or setting null
@ 2013-05-02 08:18 Hajo@Lemcke.com
2013-05-02 15:05 ` Re: BUG #8132: Not Null column should set default value when inserting or setting null Tom Lane <tgl@sss.pgh.pa.us>
2013-05-02 16:07 ` Re: BUG #8132: Not Null column should set default value when inserting or setting null Thomas Kellerer <spam_eater@gmx.net>
0 siblings, 2 replies; 3+ messages in thread
From: Hajo@Lemcke.com @ 2013-05-02 08:18 UTC (permalink / raw)
To: pgsql-bugs
The following bug has been logged on the website:
Bug reference: 8132
Logged by: Hajo Lemcke
Email address: Hajo@Lemcke.com
PostgreSQL version: 9.2.4
Operating system: Win-7
Description:
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.
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: BUG #8132: Not Null column should set default value when inserting or setting null
2013-05-02 08:18 BUG #8132: Not Null column should set default value when inserting or setting null Hajo@Lemcke.com
@ 2013-05-02 15:05 ` Tom Lane <tgl@sss.pgh.pa.us>
1 sibling, 0 replies; 3+ messages in thread
From: Tom Lane @ 2013-05-02 15:05 UTC (permalink / raw)
To: Hajo@Lemcke.com; +Cc: pgsql-bugs
Hajo@Lemcke.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
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: BUG #8132: Not Null column should set default value when inserting or setting null
2013-05-02 08:18 BUG #8132: Not Null column should set default value when inserting or setting null Hajo@Lemcke.com
@ 2013-05-02 16:07 ` Thomas Kellerer <spam_eater@gmx.net>
1 sibling, 0 replies; 3+ messages in thread
From: Thomas Kellerer @ 2013-05-02 16:07 UTC (permalink / raw)
To: pgsql-bugs
Hajo@Lemcke.com wrote on 02.05.2013 10:18:
> 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.
You can use DEFAULT instead of NULL, no need to have different statements.
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2013-05-02 16:07 UTC | newest]
Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2013-05-02 08:18 BUG #8132: Not Null column should set default value when inserting or setting null Hajo@Lemcke.com
2013-05-02 15:05 ` Tom Lane <tgl@sss.pgh.pa.us>
2013-05-02 16:07 ` Thomas Kellerer <spam_eater@gmx.net>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox