Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Need help coverting PostgreSQL query to MySQL query from Atlassian document

JWCho November 24, 2020

I'm looking at the document that is called: How to merge two users' content ownership and permissions in Jira

Link: https://confluence.atlassian.com/jirakb/how-to-merge-two-users-content-ownership-and-permissions-in-jira-968659640.html

If you look at Step 4, there are lot of queries that are written in PostgreSQL.

Our company is using MySQL and I'm not sure how to run some of queries in MySQL language.

Here are the queries that I'm struggling with:

update userassociation set source_name = tmp_app_user_migration.new_user_key from tmp_app_user_migration where source_name = tmp_app_user_migration.old_user_key
and sink_node_id not in (select U1.sink_node_id from userassociation U1, userassociation U2 
where U1.source_name = tmp_app_user_migration.old_user_key and U2.source_name = tmp_app_user_migration.new_user_key and
U2.sink_node_id = U1.sink_node_id);

 

update userhistoryitem set username = tmp_app_user_migration.new_user_key from tmp_app_user_migration where username = tmp_app_user_migration.old_user_key
and entityid not in (select U1.entityid from userhistoryitem U1, userhistoryitem U2 
where U1.username = tmp_app_user_migration.old_user_key and U2.username = tmp_app_user_migration.new_user_key
and U2.entityid = U1.entityid and U2.entitytype = U1.entitytype);

 

Can anyone help me with this?

1 answer

0 votes
mogavenasan
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.
January 3, 2021

Hi @JWCho,

Those SQLs looks like they are compatible with MySQL as well, can I know if you are having any errors executing those SQLs?

Thanks,
Moga 

JWCho January 21, 2021

I'm getting syntax error of executing those in MySQL.

I got supported from Atlassian support team so I'm good.

mogavenasan
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.
January 21, 2021

Thanks for the update @JWCho. It would have been helpful if you had provided the syntax error for troubleshooting.

Anyway, glad to know that it's resolved!

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
SERVER
TAGS
AUG Leaders

Atlassian Community Events