Received: from malur.postgresql.org ([2a02:16a8:dc51::56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fnPWy-0008Jo-23 for pgsql-general@arkaria.postgresql.org; Wed, 08 Aug 2018 14:33:44 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1fnPWw-0008OD-59 for pgsql-general@arkaria.postgresql.org; Wed, 08 Aug 2018 14:33:42 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fnPWv-0008O6-TR for pgsql-general@lists.postgresql.org; Wed, 08 Aug 2018 14:33:41 +0000 Received: from hermes.gatewaynet.com ([193.92.121.98]) by magus.postgresql.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1fnPWt-0001ar-0g for pgsql-general@lists.postgresql.org; Wed, 08 Aug 2018 14:33:41 +0000 Received: from smadev.internal.net (pc131.internal.net [10.9.200.131]) by hermes.gatewaynet.com (8.14.3/8.14.3/Debian-9.4) with ESMTP id w78EXV58016189 for ; Wed, 8 Aug 2018 17:33:36 +0300 Received: from smadev.internal.net (smadev [10.9.200.131]) by smadev.internal.net (8.15.2/8.15.2) with ESMTP id w78EXUrB052061 for ; Wed, 8 Aug 2018 17:33:31 +0300 (EEST) (envelope-from achill@matrix.gatewaynet.com) Subject: Re: Postgres - search for value throughout many tables? To: pgsql-general@lists.postgresql.org References: <471629efc8bf4ad99a95379fa98e1a9e@grupawp.pl> From: Achilleas Mantzios Message-ID: <56aae3f5-3e34-a643-9a08-8ac253b99fb3@matrix.gatewaynet.com> Date: Wed, 8 Aug 2018 17:33:30 +0300 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: <471629efc8bf4ad99a95379fa98e1a9e@grupawp.pl> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US X-Virus-Scanned: clamav-milter 0.98.7 at hermes X-Virus-Status: Clean X-Spam-Status: No, score=-25.9 required=5.0 tests=ALL_TRUSTED,DYN_HAM_COORD, DYN_HAM_IT,DYN_HAM_NAUTICAL,DYN_SPAM_SUBJ,TW_QR autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on hermes.gatewaynet.com List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk 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