Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hw41T-0003ze-Ts for pgsql-general@arkaria.postgresql.org; Fri, 09 Aug 2019 12:29:32 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hw41S-0005VY-48 for pgsql-general@arkaria.postgresql.org; Fri, 09 Aug 2019 12:29:30 +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_SHA1:256) (Exim 4.89) (envelope-from ) id 1hw41R-0005VR-Qz for pgsql-general@lists.postgresql.org; Fri, 09 Aug 2019 12:29:29 +0000 Received: from evolu-s.it ([94.23.66.144] helo=smtp.evolu-s.it) by magus.postgresql.org with smtp (Exim 4.89) (envelope-from ) id 1hw41P-0005HX-QI for pgsql-general@postgresql.org; Fri, 09 Aug 2019 12:29:29 +0000 Received: from [192.168.1.131] ([79.6.30.247]) by smtp.evolu-s.it ; Fri, 9 Aug 2019 14:29:23 +0200 To: PostgreSQL mailing lists From: Moreno Andreo Subject: Updating 3-table dataset Message-ID: <70caca24-0f9e-e9e6-56d0-2be96e6d9be8@evolu-s.it> Date: Fri, 9 Aug 2019 14:29:29 +0200 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15; format=flowed Content-Transfer-Encoding: 8bit Content-Language: it List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Hi all,     I don't know if that's the heat burning my brain but I can't find a solution to what seemed a simple operation to me. I have 3 tables create table t_all { id uuid, ref_id uuid     (FK to t_ana.id) }; create table t_ana { id uuid, code text }; create table t_app { id uuid, code text    (subset of t_ana.code) } I need to update t_all set t_all.id = t_app.id having t_ana.code in t_app.code (I wrote it in some kind of meta-sql but I hope it's clear) I tried to create a view but I need an INSTEAD OF trigger, since it spreads among 3 tables so I hope there's some faster path to achieve the solution.... Thanks Moreno