From: Karsten Hilbert <Karsten.Hilbert@gmx.net>
To: Greg Sabino Mullane <htamfids@gmail.com>
Cc: pgsql-general@lists.postgresql.org
Subject: Re: "reverse" (?) UPSERT -- how to ?
Date: Sat, 17 Feb 2024 19:25:11 +0100
Message-ID: <ZdD6B1DphHk9TIps@hermes.hilbert.loc> (raw)
In-Reply-To: <CAKAnmmL2o6eLMu11voLJ8rAH15Hj9O1joKN2Kt8S3YV3WmHiTQ@mail.gmail.com>
References: <ZdDPpWxB6IH_Dx1b@hermes.hilbert.loc>
<CAKAnmmL2o6eLMu11voLJ8rAH15Hj9O1joKN2Kt8S3YV3WmHiTQ@mail.gmail.com>
Am Sat, Feb 17, 2024 at 11:54:05AM -0500 schrieb Greg Sabino Mullane:
> > There will be a view giving rows for
> > each detail row enriched with master table data
> > UNION ALL
> > rows for each master row that does not have any detail row with
> > detail table columns NULLed
> >
>
> A better way to do that is to just use a LEFT JOIN.
+1 except that I've got use for both parts of the UNION on
their own (they are both views themselves involving a bunch
of joins with yet other tables, 4 or 5 each or so ;-)
Thanks,
Karsten
--
GPG 40BE 5B0E C98E 1713 AFA6 5BC0 3BEA AC80 7D4F C89B
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: Karsten.Hilbert@gmx.net, htamfids@gmail.com
Subject: Re: "reverse" (?) UPSERT -- how to ?
In-Reply-To: <ZdD6B1DphHk9TIps@hermes.hilbert.loc>
References: <ZdDPpWxB6IH_Dx1b@hermes.hilbert.loc> <CAKAnmmL2o6eLMu11voLJ8rAH15Hj9O1joKN2Kt8S3YV3WmHiTQ@mail.gmail.com> <ZdD6B1DphHk9TIps@hermes.hilbert.loc>
* 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