Comments on: Do we need sql_mode? https://shlomi-noach.github.io/blog/mysql/do-we-need-sql_mode Blog by Shlomi Noach Wed, 09 Jun 2010 04:36:15 +0000 hourly 1 https://wordpress.org/?v=5.3.3 By: Those oversized, undersized variables defaults | code.openark.org https://shlomi-noach.github.io/blog/mysql/do-we-need-sql_mode/comment-page-1#comment-14558 Wed, 09 Jun 2010 04:36:15 +0000 https://shlomi-noach.github.io/blog/?p=462#comment-14558 […] I’ve discussed this in length before. My opinion […]

]]>
By: code.openark.org » Blog Archive » MySQL security: data integrity issues https://shlomi-noach.github.io/blog/mysql/do-we-need-sql_mode/comment-page-1#comment-380 Wed, 21 Jan 2009 10:32:53 +0000 https://shlomi-noach.github.io/blog/?p=462#comment-380 […] my earlier posts here and here. Roland Bouman also offers suggestions for fixing this […]

]]>
By: shlomi https://shlomi-noach.github.io/blog/mysql/do-we-need-sql_mode/comment-page-1#comment-295 Mon, 12 Jan 2009 15:24:47 +0000 https://shlomi-noach.github.io/blog/?p=462#comment-295 More discussion is available on Roland Bouman‘s post.

]]>
By: Lukas https://shlomi-noach.github.io/blog/mysql/do-we-need-sql_mode/comment-page-1#comment-294 Mon, 12 Jan 2009 12:53:46 +0000 https://shlomi-noach.github.io/blog/?p=462#comment-294 Developer centric means you are looking after the worries of someone that writes the application. DBA centric is about who manages the data and who gets a call when the database goes up in smoke.

]]>
By: Roland Bouman https://shlomi-noach.github.io/blog/mysql/do-we-need-sql_mode/comment-page-1#comment-291 Mon, 12 Jan 2009 08:21:57 +0000 https://shlomi-noach.github.io/blog/?p=462#comment-291 Hi Lukas!

I am not sure what you mean by a developer perspective. My point is that it depends on the application whether things like zero dates and zero in dates are permissable.

I agree the case where multiple database users access the same tables is a problem.

I am sure you are aware that for stored procedures, views and events the sql_mode that was in effect at DDL time is stored together with the definitions of these object. At runtime, that sql_mode is applied in order to allow the code to run predictably.

Well, this always made me wonder….why should tables and triggers be excluded from this? Logically it seems to be in the same league, but I suspect it cannot be implemented in an efficient way for tables.

regards,
Roland

]]>
By: Lukas https://shlomi-noach.github.io/blog/mysql/do-we-need-sql_mode/comment-page-1#comment-287 Sun, 11 Jan 2009 21:20:17 +0000 https://shlomi-noach.github.io/blog/?p=462#comment-287 Roland .. that is a very developer centric view (rather than DBA) .. however what happens when you have two apps messing with the same data? I think for the good of MySQL users, people should be pushed towards the strict sql compliance mode and only if they beg their DBA’s they can get an instance with the legacy BC crap.

]]>
By: code.openark.org » Blog Archive » sql_mode: a suggestion https://shlomi-noach.github.io/blog/mysql/do-we-need-sql_mode/comment-page-1#comment-285 Sun, 11 Jan 2009 16:09:21 +0000 https://shlomi-noach.github.io/blog/?p=462#comment-285 […] thought this deserves more than a comment on my previous post on the subject, in which I expressed the opinion that sql_mode is […]

]]>
By: Roland Bouman https://shlomi-noach.github.io/blog/mysql/do-we-need-sql_mode/comment-page-1#comment-284 Sun, 11 Jan 2009 15:43:20 +0000 https://shlomi-noach.github.io/blog/?p=462#comment-284 Hi All!

@Schlomi: sure, feel free to quote me. (I guess it would be best to include a link to this comment thread so ppl can verify real quick who said what, but this is just a suggestion)

Actually, what I meant was container privileges like:

GRANT SET [SESSION|GLOBAL] SQL_MODE TO user[@host]

But your suggestion gave me the idea that it would in addition be nice to do:

CREATE USER user[@host] IDENTIFIED BY ‘pasword’
DEFAULT SQL_MODE = ‘….’;

(and this would assign the default sql_mode on connect)

As for sql_mode not having to exist at all – well, that would be for the best. But it is not going to happen – not with MySQL. Things are as they are because they evolved that way. Backwards compatibility is being considered by the MySQL dev

@Lukas: I don’t need to support legacy apps. Or well, I do, but this was not what I was thinking about. I like to try out lots of these php apps like wordpress, joomla, drupal, dotProject etc. whatever I feel like I might need at some point. I find that in many, many cases, the installers of these apps break on my perhaps mysql-wise unorthodox settings. I suppose I could have a completely default MySQL installation on the side, but my stance remains that, given the current state of MySQL, it should be on the application to ensure the right SQL_MODE is set right after connecting to the database server.

I have written about a few of my experiences in this regard here:

http://rpbouman.blogspot.com/2007/04/so-wordpress-does-not-like-mysql-sql.html
http://rpbouman.blogspot.com/2007/04/guess-whatwordpress-does-not-like.html

I have also filed a dotProject bug relating to this, and this was solved (Kudos to Adam Donnison!)

http://bugs.dotproject.net/view.php?id=2323

]]>
By: Lukas https://shlomi-noach.github.io/blog/mysql/do-we-need-sql_mode/comment-page-1#comment-272 Sat, 10 Jan 2009 16:33:35 +0000 https://shlomi-noach.github.io/blog/?p=462#comment-272 Roland: if you need to support legacy apps, why not offer them a separate server instance? I think this is the cleaner approach.

]]>
By: shlomi https://shlomi-noach.github.io/blog/mysql/do-we-need-sql_mode/comment-page-1#comment-270 Sat, 10 Jan 2009 09:17:33 +0000 https://shlomi-noach.github.io/blog/?p=462#comment-270 Hi Roland,

I see your point. If I understand your intention, though, you’re referring to a completely new set of privileges, integrated into the privileges system.
That in itself is just fine. In my opinion, though, sql_mode must still not exist.
So for being able to set zero for dates you would
GRANT ZERO_ON_DATE ON world.* TO ‘someuser’@’somehost’
But that user should *not* be able to
SET sql_mode=’ZERO_ON_DATE’
How does that sound?

With your permission, I would like to quote you on a post I’m writing on the subject.

Regards,
Shlomi

]]>