Bug #22104 'DEFAULT(col_name)' function behaviour

Submitted: 8 Sep 2006 3:04 Modified: 8 Sep 2006 9:57
Reporter: Roman Lamotkin Email Updates:
Status: Won't fix Impact on me:
None 
Category:MySQL Server Severity:S4 (Feature request)
Version:5.0.22 OS:Windows (Win 98 SE)
Assigned to: CPU Architecture:Any

[8 Sep 2006 3:04] Roman Lamotkin
Description:
I've got a feature request on the 'DEFAULT(col_name)'
function.
I believe its behaviour should be reverted back
to a never-error result, even if a column has no
default value.
I've got a PHP script, which processes many tables
with many fields in batch mode, and sometimes,
if user cleared up a field's value, it has to be
reverted to a default state. Why should I keep
in mind if a default value was specified or not?
Why should I run extra 'DESCRIBE table_name' and
act according to the results?

There is a possible "workaround", though.
Even if a field is declared as 'NOT NULL',
setting it '=NULL' does the task well.
But it's obviously not a good programming style!

How to repeat:
---
[8 Sep 2006 9:57] Valeriy Kravchuk
Thank you for a feature request. I do not think that older behaviour of DEFAULT will be reverted for versions 5.x.y though, as it will influence new applications written for 5.0.x, once again.

Using DEFAULT(col) for column with no default value was also a workaround of a kind.

Portions of this website are copyright © 2001, 2002 The PHP Group

Page generated in 0.037 sec. using MySQL 8.4.7-u6-cloud

Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.