Re: Consequence of changes to CTE's in 12

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: Steve Baldwin <steve(dot)baldwin(at)gmail(dot)com>
Cc: "pgsql-generallists(dot)postgresql(dot)org" <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: Consequence of changes to CTE's in 12
Date: 2021-02-12 00:23:46
Message-ID: CAKFQuwa4QJ=LiPuSseooEfYpUoxZs=98koAAFPMfO2po7tXikg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Thu, Feb 11, 2021 at 5:07 PM Steve Baldwin <steve(dot)baldwin(at)gmail(dot)com>
wrote:

> My 'dilemma' is that this functionality is packaged and the database it is
> bundled into could be running on a pre-12 version or 12+. Is there any way
> I can rewrite my view to achieve the same outcome (i.e. only creating 0 or
> 1 advisory locks) regardless of the server version? I realise I could have
> two installation scripts but if it is installed into a pre-12 DB and that
> DB is subsequently upgraded to 12+, my behaviour is broken.
>

Pretty sure you will need to choose a location in which to make the
installation behave version-dependently. Within PostgreSQL itself that
would be most easily done by writing a pl/pgsql function that conditionally
adds the MATERIALIZED indicator on the textual representation of the query
before executing it. You can hide that function call within a view if
desired.

David J.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2021-02-12 00:35:58 Re: Consequence of changes to CTE's in 12
Previous Message Michael Lewis 2021-02-12 00:23:45 Re: Consequence of changes to CTE's in 12