Re: searching a value in a variable/field in all tables in a schema

From: Ruiqiang Chen <chenrq2005(at)gmail(dot)com>
To: david(dot)g(dot)johnston(at)gmail(dot)com
Cc: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: searching a value in a variable/field in all tables in a schema
Date: 2018-08-31 01:02:29
Message-ID: CA+yjgPR0v24o+_cjD-3ukQSXgsEWWog6amQ-ssjUnnUFfVERVQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Thanks!

On Thu, Aug 30, 2018 at 4:51 PM David G. Johnston <
david(dot)g(dot)johnston(at)gmail(dot)com> wrote:

> On Thu, Aug 30, 2018 at 1:44 PM, Ruiqiang Chen <chenrq2005(at)gmail(dot)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.
>
>

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tim Cross 2018-08-31 03:04:30 Re: Ways to deal with large amount of columns;
Previous Message a 2018-08-31 00:47:36 Re: Ways to deal with large amount of columns;