From: Moreno Andreo <moreno.andreo@evolu-s.it>
To: PostgreSQL mailing lists <pgsql-general@postgresql.org>
Subject: Updating 3-table dataset
Date: Fri, 9 Aug 2019 14:29:29 +0200
Message-ID: <70caca24-0f9e-e9e6-56d0-2be96e6d9be8@evolu-s.it> (raw)
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: moreno.andreo@evolu-s.it
Subject: Re: Updating 3-table dataset
In-Reply-To: <70caca24-0f9e-e9e6-56d0-2be96e6d9be8@evolu-s.it>
References: <70caca24-0f9e-e9e6-56d0-2be96e6d9be8@evolu-s.it>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox