https://www.redmine.org/https://www.redmine.org/favicon.ico?16793021292010-09-23T05:46:52ZRedmineRedmine - Defect #6468: wrong update query in Issue modelhttps://www.redmine.org/issues/6468?journal_id=206092010-09-23T05:46:52ZNelzin Alexander
<ul></ul><pre>
~/Sites/redmine-1.0 $ ruby script/about
About your application's environment
Ruby version 1.8.7 (universal-darwin10.0)
RubyGems version 1.3.5
Rack version 1.0
Rails version 2.3.5
Active Record version 2.3.5
Active Resource version 2.3.5
Action Mailer version 2.3.5
Active Support version 2.3.5
Application root /Users/alexander_nelzin/Sites/redmine-1.0
Environment development
Database adapter oracle_enhanced
Database schema version 20100819172912
</pre> Redmine - Defect #6468: wrong update query in Issue modelhttps://www.redmine.org/issues/6468?journal_id=206132010-09-23T06:41:13ZJean-Baptiste Barth
<ul></ul><p>This one looks OK. If somebody can review it on Postgres, Mysql, Sqlite, we could integrate it.</p> Redmine - Defect #6468: wrong update query in Issue modelhttps://www.redmine.org/issues/6468?journal_id=206142010-09-23T06:42:33ZJean-Baptiste Barth
<ul><li><strong>Status</strong> changed from <i>Resolved</i> to <i>New</i></li></ul><p>One more thing, don't use the "Resolved" state, we use it to track patches already committed in trunk that are waiting for merge in stable branch. Thanks</p> Redmine - Defect #6468: wrong update query in Issue modelhttps://www.redmine.org/issues/6468?journal_id=206182010-09-23T07:50:38ZNelzin Alexander
<ul></ul><p>I have also tested this patch with PostgreSQL 8.4.4 - works fine.</p> Redmine - Defect #6468: wrong update query in Issue modelhttps://www.redmine.org/issues/6468?journal_id=206192010-09-23T07:54:36ZNelzin Alexander
<ul></ul><p>Redmine with Postgres info:<br />gem postgres-pr (0.6.3)<br />PostgreSQL server 8.4.4</p>
<pre>
~/Sites/redmine-1.0-postgres $ ruby script/about
About your application's environment
Ruby version 1.8.7 (universal-darwin10.0)
RubyGems version 1.3.5
Rack version 1.0
Rails version 2.3.5
Active Record version 2.3.5
Active Resource version 2.3.5
Action Mailer version 2.3.5
Active Support version 2.3.5
Application root /Users/alexander_nelzin/Sites/redmine-1.0-postgres
Environment development
Database adapter postgresql
Database schema version 20100819172912
</pre> Redmine - Defect #6468: wrong update query in Issue modelhttps://www.redmine.org/issues/6468?journal_id=206332010-09-23T11:48:15ZFelix Schäfer
<ul></ul><p>Jean-Baptiste Barth wrote:</p>
<blockquote>
<p>This one looks OK. If somebody can review it on Postgres, Mysql, Sqlite, we could integrate it.</p>
</blockquote>
<p>Veto. I don't see what this change does other than changing how the variable is interpolated, which should have no effect whatsoever on the result.</p>
<p>The error the OP (original poster) reports seems to come from a missing <code>id</code> or <code>root_id</code> somewhere, which "should not happen".</p>
<p>Alexander: could you please look at your DB and confirm every record in the <code>issues</code> table has a <code>root_id</code>? Does this error happen on new sub-issues only, or on new issues not being sub-issues only, or on all issues?</p> Redmine - Defect #6468: wrong update query in Issue modelhttps://www.redmine.org/issues/6468?journal_id=206412010-09-23T13:16:39ZJean-Baptiste Barth
<ul></ul><p>I don't know if it will effectively solve Nelzin problem. But I thought it would be a good practice to systematically sanitize our conditions.</p> Redmine - Defect #6468: wrong update query in Issue modelhttps://www.redmine.org/issues/6468?journal_id=212182010-10-11T10:26:16ZNelzin Alexander
<ul></ul><p>I caught this error again during updating sub-issue.<br />Updated to latest stable Redmine 1.0.2.stable.4247 (OracleEnhanced)</p>
<pre>
ActiveRecord::StatementInvalid in IssuesController#update
OCIError: ORA-00936: missing expression: UPDATE "ISSUES" SET root_id = , lft = 23803, rgt = 23804 WHERE (id = 9762)
RAILS_ROOT: /Users/alexander_nelzin/Sites/redmine-1.0-dev
Application Trace | Framework Trace | Full Trace
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/connection_adapters/abstract_adapter.rb:219:in `log'
/Library/Ruby/Gems/1.8/gems/activerecord-oracle_enhanced-adapter-1.3.0/lib/active_record/connection_adapters/oracle_enhanced_adapter.rb:1726:in `log'
/Library/Ruby/Gems/1.8/gems/activerecord-oracle_enhanced-adapter-1.3.0/lib/active_record/connection_adapters/oracle_enhanced_adapter.rb:605:in `execute'
/Users/alexander_nelzin/Sites/redmine-1.0-dev/app/models/issue.rb:631:in `update_nested_set_attributes'
/Users/alexander_nelzin/Sites/redmine-1.0-dev/app/models/issue.rb:510:in `save_issue_with_child_records'
/Users/alexander_nelzin/Sites/redmine-1.0-dev/app/models/issue.rb:492:in `save_issue_with_child_records'
/Users/alexander_nelzin/Sites/redmine-1.0-dev/app/controllers/issues_controller.rb:170:in `update'
</pre>
<p>The sql query is not valid.<br />This error occurs after migrating from redmine 0.9.4 (with Issues hierarchy plugin) to 1.x.x</p>
<p>Jean-Baptiste Barth, I've checked my db and no issue has root_id, they are nulls.</p>
<blockquote>
<p>The error the OP (original poster) reports seems to come from a missing id or root_id somewhere, which "should not happen".</p>
</blockquote>
<p>Sanitizing sql conditions is a good practice, and helps to avoid such errors.</p>
<p>Btw do you have any script to convert data used by Issues hierarchy plugin to be valid in current version?</p> Redmine - Defect #6468: wrong update query in Issue modelhttps://www.redmine.org/issues/6468?journal_id=212202010-10-11T10:39:06ZFelix Schäfer
<ul></ul><p>Nelzin Alexander wrote:</p>
<blockquote>
<p>This error occurs after migrating from redmine 0.9.4 (with Issues hierarchy plugin) to 1.x.x</p>
</blockquote>
<p>That is probably the root of your problem, sanitizing the queries may alleviate it, but not solve it (especially: no one can guarantee other changes won't break stuff again later). There is an (unofficial) migration floating around on redmine.org, can't remember which issue ID it was though. Maybe search for "subtask plugin" or something similar.</p>
<blockquote>
<p>Jean-Baptiste Barth, I've checked my db and no issue has root_id, they are nulls.</p>
</blockquote>
<p>Which confirms the above assumption.</p>
<blockquote><blockquote>
<p>The error the OP (original poster) reports seems to come from a missing id or root_id somewhere, which "should not happen".</p>
</blockquote>
<p>Sanitizing sql conditions is a good practice, and helps to avoid such errors.</p>
</blockquote>
<p>I didn't say I didn't want to sanitize the SQL parameters, just that it would probably not correct the cause of your problem but only the symptom. :-) As I said, nil root_ids <em>should</em> not happen, having had the subtask plugin installed and not removed/migrated properly is one of the known causes for that.</p>
<blockquote>
<p>Btw do you have any script to convert data used by Issues hierarchy plugin to be valid in current version?</p>
</blockquote>
<p>No official, because the plugin is third-party and thus not directly supported, but as I said, there is a user-supplied migration somewhere that takes care of that.</p> Redmine - Defect #6468: wrong update query in Issue modelhttps://www.redmine.org/issues/6468?journal_id=1127812024-02-05T14:58:31ZGo MAEDA
<ul><li><strong>Status</strong> changed from <i>New</i> to <i>Closed</i></li><li><strong>Resolution</strong> set to <i>Cant reproduce</i></li></ul><p>I am closing this issue because awesome_nested_set gem, the library formerly used to implement nested sets, is no longer used in Redmine. The gem was replaced with a custom implementation in Redmine 3.0.0 (<a class="issue tracker-2 status-5 priority-4 priority-default closed" title="Feature: Replace awesome_nested_set gem with a custom implementation of nested sets (Closed)" href="https://www.redmine.org/issues/18860">#18860</a>).</p>