public inbox for [email protected]
help / color / mirror / Atom feedSubject: [Pljava-dev] conditional SQL in DDR, and a testing idea
Date: Sun, 20 Sep 2015 10:04:42 -0400
Message-ID: <[email protected]> (raw)
This started out as a simple idea about building a jar with
SQL code in the DDR that would be specific to PG version or
other conditions on the backend.
_If_targeting 9.0+ there is the DO statement and PL/pgsql is
there by default, so you _could_ just write stuff in the DDR
in the form:
DO LANGUAGE 'plpgsql' $$
IF whatever_condition_is_needed THEN
stuff
END IF;
$$
but I had been thinking of older versions, or not wanting to care
whether plpgsql is there, and I thought of this:
The DDR syntax already allows you to mark some SQL as implementation-
specific, using
BEGIN some-impl
... SQL ...
END some-impl
Right now, SQLDeploymentDescriptor doesn't do anything with that except
throw away any commands where some-impl isn't PostgreSQL (they're not
even read into the array), and execute the ones with no impl, or impl of
PostgreSQL.
That satisfies the standard, but how about if it read _all_ of them in,
and we had a new GUC variable like pljava.implementortags. Some code in
an untagged part of the DDR could do:
SELECT CASE WHEN check_for_93()
THEN SET LOCAL pljava.implementortags TO ...append PostgreSQL-9.3...
END
adding PostgreSQL-9.3 to the list, and if SQLDeploymentDescriptor.install
rechecks the variable after each command, then from that point it would
include all commands tagged
BEGIN PostgreSQL-9.3
... stuff ...
END PostgreSQL-9.3
and as you could make up any arbitrary tags, you could test for and
enable BEGIN PostgreSQL-with-feature-X ...
or bug-Y or whatever made sense in your case.
next installment: turning the same simple idea into part of a better
integration-testing story ....
-Chap
view thread (4+ messages) latest in thread
reply
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 using the --to and --cc options:
reply via email
To: [email protected]
Subject: Re: [Pljava-dev] conditional SQL in DDR, and a testing idea
In-Reply-To: <[email protected]>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox