<?xml version="1.0" encoding="utf-8"?>
<launchpad-bug id="1028296">
  <date_last_updated>2012-07-31 16:41:08.460151+00:00</date_last_updated>
  <api_links>
    <bug_api_link>https://api.launchpad.net/1.0/bugs/1028296</bug_api_link>
    <bug_owner_link>https://api.launchpad.net/1.0/~mikhail-v-gavrilov</bug_owner_link>
    <milestone_link></milestone_link>
    <linked_branches_collection_link>https://api.launchpad.net/1.0/bugs/1028296/linked_branches</linked_branches_collection_link>
    <activity_link>https://api.launchpad.net/1.0/bugs/1028296/activity</activity_link>
  </api_links>
  <bug_web_link>https://bugs.launchpad.net/bugs/1028296</bug_web_link>
  <owner>NT Man</owner>
  <assignee></assignee>
  <milestone_title></milestone_title>
  <duplicate_link></duplicate_link>
  <duplicate_bug_id></duplicate_bug_id>
  <title>Changing Server SQL Mode not apply to stored procedures</title>
  <status>Invalid</status>
  <importance>Undecided</importance>
  <created>2012-07-24 07:55:27.085261+00:00</created>
  <description>
<![CDATA[Changing Server SQL Mode not apply to stored procedures

SET sql_mode='NO_BACKSLASH_ESCAPES,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE';


Query: insert into bonus_results (calc_date, id_prod_type, id_user) value ('2012-08-00', 1, 2) 

Error Code: 1292
Incorrect date value: '2012-08-00' for column 'calc_date' at row 1

It's right, but same SQL in stored procedures continue work :(

Workaround only recreate all stored procedures :(]]>  </description>
  <activities>
    <activity datechanged="2012-07-24T07:55:27.085261+00:00">
      <oldvalue>
<![CDATA[]]>      </oldvalue>
      <newvalue>
<![CDATA[]]>      </newvalue>
      <whatchanged>bug</whatchanged>
      <person>NT Man</person>
      <message>added bug</message>
    </activity>
    <activity datechanged="2012-07-30T13:02:00.198562+00:00">
      <oldvalue>
<![CDATA[New]]>      </oldvalue>
      <newvalue>
<![CDATA[Invalid]]>      </newvalue>
      <whatchanged>maria: status</whatchanged>
      <person>Elena Stepanova</person>
      <message></message>
    </activity>
  </activities>
  <comments>
    <comment commentlink="https://api.launchpad.net/1.0/maria/+bug/1028296/comments/1" datecreated="2012-07-24T14:03:35.793079+00:00">
      <person>NT Man</person>
      <subject>
<![CDATA[Re: Changing Server SQL Mode not apply to stored procedures]]>      </subject>
      <content>
<![CDATA[The situation is very bad, because that is created by the developers of stored procedures from a wrong configured session will lead to their procedures will not work properly in a production environment.]]>      </content>
    </comment>
    <comment commentlink="https://api.launchpad.net/1.0/maria/+bug/1028296/comments/2" datecreated="2012-07-24T14:24:39.868890+00:00">
      <person>Elena Stepanova</person>
      <subject>
<![CDATA[Re: Changing Server SQL Mode not apply to stored procedures]]>      </subject>
      <content>
<![CDATA[Hi, 

Please check MySQL documentation, specifically http://dev.mysql.com/doc/refman/5.5/en/create-procedure.html:

"MySQL stores the sql_mode system variable setting that is in effect at the time a routine is created, and always executes the routine with this setting in force, regardless of the server SQL mode in effect when the routine is invoked."]]>      </content>
    </comment>
    <comment commentlink="https://api.launchpad.net/1.0/maria/+bug/1028296/comments/3" datecreated="2012-07-26T02:34:46.712101+00:00">
      <person>NT Man</person>
      <subject>
<![CDATA[Re: Changing Server SQL Mode not apply to stored procedures]]>      </subject>
      <content>
<![CDATA[That's too bad it is a potential source of errors and glitches in serious applications using MySQL. I think this behavior should be changed. sql_mode specified by the application itself must also apply to the code inside the stored procedures.]]>      </content>
    </comment>
    <comment commentlink="https://api.launchpad.net/1.0/maria/+bug/1028296/comments/4" datecreated="2012-07-30T13:01:54.413271+00:00">
      <person>Elena Stepanova</person>
      <subject>
<![CDATA[Re: Changing Server SQL Mode not apply to stored procedures]]>      </subject>
      <content>
<![CDATA[Or, in your variant it can become a breach of security, if a DBA creates a routine which is supposed to be executed with certain SQL_MODE, and then any user can redefine this mode.

Anyway, you can always file a feature request for the change in MySQL (or in MariaDB, for that matter). 
]]>      </content>
    </comment>
    <comment commentlink="https://api.launchpad.net/1.0/maria/+bug/1028296/comments/5" datecreated="2012-07-31T06:17:21.146992+00:00">
      <person>NT Man</person>
      <subject>
<![CDATA[Re: Changing Server SQL Mode not apply to stored procedures]]>      </subject>
      <content>
<![CDATA[Thanks Elena. When I can file a feature request?]]>      </content>
    </comment>
    <comment commentlink="https://api.launchpad.net/1.0/maria/+bug/1028296/comments/6" datecreated="2012-07-31T12:13:37.554810+00:00">
      <person>NT Man</person>
      <subject>
<![CDATA[Re: Changing Server SQL Mode not apply to stored procedures]]>      </subject>
      <content>
<![CDATA[Thanks Elena. Where I can file a feature request?]]>      </content>
    </comment>
    <comment commentlink="https://api.launchpad.net/1.0/maria/+bug/1028296/comments/7" datecreated="2012-07-31T16:41:08.041409+00:00">
      <person>Elena Stepanova</person>
      <subject>
<![CDATA[Re: Changing Server SQL Mode not apply to stored procedures]]>      </subject>
      <content>
<![CDATA[Hi,

I would say the most appropriate place is http://bugs.mysql.com/. 

If you, however, want to file it specifically for MariaDB, you can convert this one to a feature request (change the importance to 'Wishlst'). But to make it worthwhile, you will also need to provide good enough reasoning why the current behavior, when a DBA defines SQL_MODE upon a storage procedure creation, is more dangerous than you suggestion, when any user can override SQL_MODE defined by the DBA and execute the procedure as they please. 

Better still, and more efficient too, would it be if you provided a patch which implements the behavior you are after and takes care about possible security problems. 

Thanks.]]>      </content>
    </comment>
  </comments>
</launchpad-bug>
