Keith Gaughan wrote:
> Jochem van Dieten wrote:
>> 
>> The SQL DEFAULT keyword is not just meant for use in DDL. SQL is 
>> defined in such a way that you can also use DEFAULT in DML to 
>> (re)set any column to its default value. You don't even have to 
>> know what that default is. So in SQL you can use the command 
>> "UPDATE subscribers SET title = DEFAULT" to restore the default 
>> value for the title field in the subscribers table.
>> 
>> More complete implementations already have your better solution.
> 
> Yeah, and did I not point out that something like that would be a
> better solution?

No argument there.


> If you go back and read what I wrote after the bit you
> snipped again, you'll see that all I was doing was offering reason
> why they would have chosen to use that NULL hack rather than doing
> things neatly.

No need to offer reason why they 'would have', we know why they 
'did'. Previous versions of the MySQL manual (they removed it 
together with all the comments about transactions being bad, 
stored procedures being unnecessary etc.) explained:
<quote>
The reason for the above rules is that we can't check these 
conditions before the query starts to execute. If we encounter a 
problem after updating a few rows, we can't just rollback as the 
table type may not support this. We can't stop because in that 
case the update would be 'half done' which is probably the worst 
possible scenario. In this case it's better to 'do the best you 
can' and then continue as if nothing happened.
</quote> 
http://sunsite.mff.cuni.cz/MIRRORS/ftp.mysql.com/doc/en/Design_Limitations.html


Apart from being the wrong one, I don't think the reason you 
offer is valid. The API is still burdened with handling of 
DEFAULT because DEFAULT is implemented for insert statements, so 
I fail to see any gains there.


MySQL has the DEFAULT for insert statements, yet they still use a 
NULL hack for insert statements and at the same time they don't 
have the DEFAULT for update statements. So you can neither 
enforce a NOT NULL constraint even when you really mean NOT NULL, 
nor update a field to its default.

MySQL NULL handling is inconsistent at best and its behaviour is 
worse than that of most other DBMS when it comes to NULLs.

Jochem

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Logware (www.logware.us): a new and convenient web-based time tracking 
application. Start tracking and documenting hours spent on a project or with a 
client with Logware today. Try it for free with a 15 day trial account.
http://www.houseoffusion.com/banners/view.cfm?bannerid=67

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:208339
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to