Changing server ID in JIRA

DanielG
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 2, 2013

Hi,


I follow this documentation:

https://confluence.atlassian.com/display/JIRAKB/Changing+Server+ID+for+Test+Installations

I put this query on my database in JIRA, with ID that I want:

UPDATE propertystring SET propertyvalue = '<ID>' where id = (select id from propertystring where id in (select id from propertyentry where PROPERTY_KEY='jira.sid.key'));

But return this error:
ERROR 1093 (HY000): You can't specify target table 'propertystring' for update in FROM clause
Can anybody help me ?
I can't change my server ID of my JIRA :(

Thanks!

5 answers

1 accepted

5 votes
Answer accepted
DanielG
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 3, 2013

Finally, this was the sentence SQL that I used to change my Server ID on JIRA:

UPDATE propertystring SET propertyvalue = 'XXXX-XXXX-XXXX-XXXX' where id= XXXX

You have to search which ID you have to change with query:

select * from propertystring where id in (select id from propertyentry where PROPERTY_KEY='jira.sid.key');

0 votes
Mikhail T January 21, 2014

MySQL does not allow modifying tables, that are mentioned in subqueries of the UPDATE. So rephrase your update to avoid subqueries. Something like (untested):

UPDATE propertystring, propertyentry SET propertyvalue = 'XXXX-XXXX-XXXX-XXXX' WHERE propertstring.id=propertyentry.id AND propertyentry.PROPERTY_KEY='jira.sid.key'

Test the query with SELECT instead of UPDATE. Yes, you can list multiple tables in UPDATE even if you are only modifying some of them...

0 votes
Timothy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 2, 2013

Your SQL query must be wrong and may need the extra schemas/domain included with the table name. Fix it.

DanielG
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 2, 2013

I test:

select * from propertystring where id in (select id from propertyentry where PROPERTY_KEY='jira.sid.key');

And works, return:

ID | property value
10006 | XXXX-XXXX-XXXX-XXXX

I test this:


UPDATE propertystring SET propertyvalue = 'XXXX-XXXX-XXXX-XXXX' where id in (select id from propertystring where id in (select id from propertyentry where PROPERTY_KEY='jira.sid.key'));

And not works... I get the same error... why??

Robert Mota August 7, 2014

Hi,

Why to put in addition "select id from propertystring where id..."

Is it not simpliest as below ?

UPDATE propertystring SET propertyvalue = 'XXXX-XXXX-XXXX-XXXX' 
where id in (
select id from propertyentry
where PROPERTY_KEY='jira.sid.key'
);

Best regards

0 votes
Bhushan Nagaraj
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 2, 2013
UPDATE propertystring SET propertyvalue = 'XXXX-XXXX-XXXX-XXXX' where id in (select id from propertystring where id in (select id from propertyentry where PROPERTY_KEY='jira.sid.key'));

DanielG
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 2, 2013

Don't work for me. I still get the same error...

0 votes
Zul NS _Atlassian_
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
June 2, 2013

Need someone who is good in MSSQL on this. Quick search lead me to this and this link.

Suggest an answer

Log in or Sign up to answer