Re: "reverse" (?) UPSERT -- how to ?

From: Karsten Hilbert <Karsten(dot)Hilbert(at)gmx(dot)net>
To: Greg Sabino Mullane <htamfids(at)gmail(dot)com>
Cc: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: "reverse" (?) UPSERT -- how to ?
Date: 2024-02-17 18:25:11
Message-ID: ZdD6B1DphHk9TIps@hermes.hilbert.loc
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Karsten Hilbert 2024-02-17 18:29:32 Re: "reverse" (?) UPSERT -- how to ?
Previous Message Tom Lane 2024-02-17 18:25:08 Re: Version 6 binaries for RHEL 7