Re: searching a value in a variable/field in all tables in a schema - Mailing list pgsql-general

From Ruiqiang Chen
Subject Re: searching a value in a variable/field in all tables in a schema
Date
Msg-id CA+yjgPR0v24o+_cjD-3ukQSXgsEWWog6amQ-ssjUnnUFfVERVQ@mail.gmail.com
Whole thread Raw
In response to Re: searching a value in a variable/field in all tables in a schema  ("David G. Johnston" <david.g.johnston@gmail.com>)
List pgsql-general
Thanks! 

On Thu, Aug 30, 2018 at 4:51 PM David G. Johnston <david.g.johnston@gmail.com> wrote:
On Thu, Aug 30, 2018 at 1:44 PM, Ruiqiang Chen <chenrq2005@gmail.com> wrote:

Does anyone have experience of searching a value in a variable/field in all tables in a schema? 

 
SELECT 'Tbl1'::text AS loc, fld
FROM schema.tbl1
WHERE fld = 'value'
[UNION ALL
SELECT 'Tbl2'::text AS loc, fld
FROM schema.tbl2
WHERE fld = 'value'
...]

David J.

pgsql-general by date:

Previous
From: "a"
Date:
Subject: Re: Ways to deal with large amount of columns;
Next
From: Tim Cross
Date:
Subject: Re: Ways to deal with large amount of columns;