Does anybody know a way that one could query physically deleted Work Items ( Settings -> Delete ) that are still linked to other Work Items ?

My case :

I have 500 WIs that may still have links to other WIs that have been physically deleted. I need to remove those links but i fail to see any way to do this. Looking in WIs XMLs does not give out any info that it would be linked to a deleted Work Items.

I just happened to see this question because I have the exact same problem. I have work items with links to deleted items. I want to find those links to remove them.

it would be a great idea to make search queries possible like this:- find all work items which are linked to work items of type xyz- find all work items which are linked to work items in status obsolete- find all work items which are linked to work items that cannot be resolved (e.g. deleted)- find all work items which are linked to work items of a specific project

Maybe somebody knows how to write an SQL query that solves this problem?

Does anybody know a way that one could query physically deleted Work Items ( Settings -> Delete ) that are still linked to other Work Items ?

You mean those kind of 'null ' work items of which the ID has an italic font in Polarion and a white suqre as icon?If yes, I would try to find them with an SQL query. I think those deleted items have nothing left then their internal primary key and their work item id, so looking for items which have those two values but all the others null (or at least pick a few vital ones like 'created' or 'project') is my first guess.

You have two possibilities how to do that:

1.) SQL query through a wiki page, see the thread SQL query example for workitems in a plan in which I have basically described everything important for executing SQL queries in Polarion, along with the database scheme. This is a convenient way because you do need to set up external access to the Postgre SQL database of your Polarion installation but as far as I know your possibilities are limited their, queries like the one I provide for Jürgen are not possibility in this case as the query result does not represent directly a work item, user, plan or anything else.

2.) Ask your Sysadmin for external access to the Postegre SQL database of your Polarion. If it works you can install then a Postgre SQL client (I recommend pgAdmin 3, not pgAdmin 4 because it is damn slow, at least onmy machine) and then access the database and query whatever you want. The Polarion documentation (scroll down a bit to the section "Database") contains an instruction for how to do establish the external connection.

BEWARE: If you find any instruction for how to access a H2 database of your Polarion installation on your server, then forget this because it is outdated, H2 is not used by Polarion anymore, only PostGre SQL.

Jürgen wrote:- find all work items which are linked to work items of type xyz

I can help you with this one because I have it prepared at my disposal, the other ones you have to find out by yourself. I recommend to run this in a Postgre SQL client like pgAdmin 3. Before you can do that however, the external connection to the Postgre DB of the Polarion installation on your server must be established, like I mentioned in bullet point 2.) before.

Remove ghost links to deleted Work Items. Optionally also to Work Items in "Obsolete" status.

Define the query for the selection of source Work Items. All links starting from a source Work Item and ending to a deleted inexistent, or in "Obsolete" status, destination Work Item, are removed.\\ \\\\