How to identify tables which contains a particular text in Bamboo Postgres SQL DB

Platform Notice: Data Center Only - This article only applies to Atlassian products on the Data Center platform.

Note that this KB was created for the Data Center version of the product. Data Center KBs for non-Data-Center-specific features may also work for Server versions of the product, however they have not been tested. Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.

*Except Fisheye and Crucible

Summary

The steps outlined on this article are provided AS-IS. This means we've had reports of them working for some customers — under certain circumstances — yet are not officially supported, nor can we guarantee they'll work for your specific scenario.

You may follow through and validate them on your own non-prod environments prior to production or fall back to supported alternatives if they don't work out.

We also invite you to reach out to our Community for matters that fall beyond Atlassian's scope of support!

This knowledge base article provides a PostgreSQL DB query using which you can identify the tables where a particular text is mentioned.

Environment

Tested on Bamboo 9.2.11 and PostgreSQL DB.

Solution

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 with found_rows as ( select format('%I.%I', table_schema, table_name) as table_name, query_to_xml(format('select to_jsonb(t) as table_row from %I.%I as t where t::text like ''%%sample_text%%'' ', table_schema, table_name), true, false, '') as table_rows from information_schema.tables where table_schema = 'public' ) select table_name, x.table_row from found_rows f left join xmltable('//table/row' passing table_rows columns table_row text path 'table_row') as x on true

ℹ️ Please replace sample_text with the exact text which you want to search.

ℹ️ By default table_schema = 'public', if it's different for your DB, please replace this.

As this is a generic DB query it can be used on other product Databases too, but this has not been extensively tested outside Bamboo.

Updated on April 8, 2025

Still need help?

The Atlassian Community is here for you.