プロジェクト

全般

プロフィール

Vote #62639

完了

Unable to delete issue statuses

Admin Redmine さんが3年以上前に追加. 3年以上前に更新.

ステータス:
Closed
優先度:
通常
担当者:
-
カテゴリ:
-
対象バージョン:
開始日:
2008/02/12
期日:
進捗率:

0%

予定工数:
category_id:
0
version_id:
1
issue_org_id:
644
author_id:
354
assigned_to_id:
0
comments:
10
status_id:
5
tracker_id:
1
plus1:
0
affected_version:
closed_on:
affected_version_id:
ステータス-->[Closed]

説明

Hi,

I'm still using redmine 0.5.0 and wanted to give a try to redmine 0.6.3. I'm using PostgreSQL as the redmine database. So I did a dump of the database from one server, and imported to the test server. Configured the version 0.6.3 to use the new database, and did a

rake db:migrate RAILS_ENV="production"

Everything went ok and I started testing the new version (running with webbrick).

If I go to Administration and then Issue statuses and create a new issue status, I cannot delete the issue status I just created. I get the message "Unable to delete issue status".

Looking at the logs, i find the following:

IssueStatus Load (0.000132) SELECT * FROM issue_statuses WHERE (issue_statuses."id" = 11)
SQL (0.000047) BEGIN
Issue Load (0.000383) SELECT * FROM issues WHERE (status_id=11) LIMIT 1
Workflow Delete all (0.000195) DELETE FROM workflows WHERE (old_status_id = 11)
IssueStatus Update (0.000125) UPDATE issue_statuses SET position = (position - 1) WHERE (1 = 1 AND position > 8)
IssueStatus Update (0.000000) PGError: ERROR: null value in column "position" violates not-null constraint
: UPDATE issue_statuses SET "is_closed" = 'f', "name" = 'klklkl', "position" = NULL, "is_default" = 'f' WHERE "id" = 11
SQL (0.000052) ROLLBACK
Redirected to http://10.112.64.1:3000/issue_statuses/list

Perhaps this only happens with PostgreSQL.


journals

Could you try to reuse the update SQL line in a postgresql terminal, please?

UPDATE issue_statuses SET position = (position - 1) WHERE (1 = 1 AND position > 8)

I'm rather sure that the problem is (position -1) where position should be already replaced by the old position value. Trying the exact line confirm that Postgresql can't reuse a referential value during an Update command.

Thank you.
--------------------------------------------------------------------------------
No, the problem is not with that statement. If you check the log above you see that the error is with the next statement:

UPDATE issue_statuses SET "is_closed" = 'f', "name" = 'klklkl', "position" = NULL, "is_default" = 'f' WHERE "id" = 11

Just to confirm that:

redmine=# UPDATE issue_statuses SET position = (position - 1) WHERE (1 = 1 AND position > 8);
UPDATE 0
redmine=# UPDATE issue_statuses SET "is_closed" = 'f', "name" = 'klklkl', "position" = NULL, "is_default" = 'f' WHERE "id" = 11;
ERROR: null value in column "position" violates not-null constraint
redmine=#

--------------------------------------------------------------------------------
A bit more of info on this. The rake db:migrate command run without errors, and my schema is in the version 86 as expected:

<pre>
redmine=# SELECT * from schema_info ;
version
---------
86
(1 row)
</pre>

So i think that migration 76 is not working properly with postgres. If we check table issue_statuses, we get:

<pre>
redmine=# \d issue_statuses
Table "public.issue_statuses"
Column | Type | Modifiers
------------+-----------------------+-------------------------------------------------------------
id | integer | not null default nextval('issue_statuses_id_seq'::regclass)
name | character varying(30) | not null default ''::character varying
is_closed | boolean | not null default false
is_default | boolean | not null default false
position | integer | not null default 1
Indexes:
"issue_statuses_pkey" PRIMARY KEY, btree (id)
</pre>

I have the last version of the postgres adapter and I'm running PostgreSQL 8.2.4:

postgres (0.7.9.2008.01.28, 0.7.1)
Ruby extension library providing an API to PostgreSQL

--------------------------------------------------------------------------------
There was a bug on a few migrations. Some not null constraints were not removed with Postgresql.
This is fixed in r1140 and ported in 0.6 stable branch.

You can checkout the @trunk@ or @branches/0.6-stable@, but you'll have to rerun the migration from your 0.5 database copy.
I hope you will enjoy the new features :-)

--------------------------------------------------------------------------------
One more thing, you need Rails 2.0. Not null constraint deletion doesn't seem to be handled in previous versions of the activerecord postgresql adapter.
--------------------------------------------------------------------------------

--------------------------------------------------------------------------------
This still doesn't work on MySQL. I even changed the status on all issues to something other than the one I want to delete, and it still didn't work: "Unable to delete issue status".
--------------------------------------------------------------------------------
After further investigation, it seems as though the status initially named "Closed" (the name can be changed) *cannot* be deleted. I swapped names with a created status, and then I could delete it. Is it really necessary that this status needs to be special (i.e. cannot be deleted)?
--------------------------------------------------------------------------------
Please don't assign ticket to already released versions.
--------------------------------------------------------------------------------
There is no special behaviour for the "Closed" status.
Please open a new ticket with the information requested in [[SubmittingBugs]] and the exact steps to reproduce if this problem still occurs.
--------------------------------------------------------------------------------

Admin Redmine さんが3年以上前に更新

  • 対象バージョン0.7_1 にセット

他の形式にエクスポート: Atom PDF

いいね!0
いいね!0