Updating 3-table dataset

From: Moreno Andreo <moreno(dot)andreo(at)evolu-s(dot)it>
To: PostgreSQL mailing lists <pgsql-general(at)postgresql(dot)org>
Subject: Updating 3-table dataset
Date: 2019-08-09 12:29:29
Message-ID: 70caca24-0f9e-e9e6-56d0-2be96e6d9be8@evolu-s.it
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

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

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Олег Самойлов 2019-08-09 13:56:07 PostgreSQL lock file
Previous Message Paolo Saudin 2019-08-09 12:28:07 Re: Recomended front ends?