Re: Postgres - search for value throughout many tables?

From: Achilleas Mantzios <achill(at)matrix(dot)gatewaynet(dot)com>
To: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: Postgres - search for value throughout many tables?
Date: 2018-08-08 14:33:30
Message-ID: 56aae3f5-3e34-a643-9a08-8ac253b99fb3@matrix.gatewaynet.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

If the num of tables is smallish you could run smth like

select * from (
select table1::text as thecol from table1
UNION select table2::text FROM table2
UNION select table3::text FROM table3
UNION .....
) as qry WHERE thecol ~* 'some pattern';

On 08/08/2018 17:09, czezz wrote:
> Hi everyone,
> I want to aks if anyone knows is there a way to search for specific "value" throughout list of tables OR all tables in databse?
>
> Cheers,
> czezz

--
Achilleas Mantzios
IT DEV Lead
IT DEPT
Dynacom Tankers Mgmt

In response to

Browse pgsql-general by date

  From Date Subject
Next Message czezz 2018-08-08 15:05:45 Odp: Re: Postgres - search for value throughout many tables?
Previous Message David G. Johnston 2018-08-08 14:13:41 Re: Postgres - search for value throughout many tables?