From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Ron <ronljohnsonjr(at)gmail(dot)com> |
Cc: | Thiemo Kellner <thiemo(at)gelassene-pferde(dot)biz>, pgsql-general(at)lists(dot)postgresql(dot)org |
Subject: | Re: Conditional compilation |
Date: | 2023-11-12 15:58:09 |
Message-ID: | 1741396.1699804689@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Ron <ronljohnsonjr(at)gmail(dot)com> writes:
> On 11/12/23 09:32, Thiemo Kellner wrote:
>> Does PostgreSQL have something like Oracle's conditional compilation? This
>> is sort of an if then statement that gets evaluated on
>> compilation/installation time of PL/SQL code. If the condition is met, the
>> code until the $END gets compiled. It is even possible to switch on/off
>> parts of single statements. I suppose it is sort of a preprocessor that
>> removes the code part from $IF until $END if the condition is not met.
> Pl/PgSQL is an interpreted language; there is no compilation. At
> creation/installation, it just (I think) does syntax checks; it definitely
> doesn't care if a table exists or not.
Yeah. You can get at least some of the effect of this by just writing
if-statements. The non-executed chunks of code still have to be
grammatically valid SQL, but they don't ever reach parse analysis
so nothing happens beyond minimal syntax checking.
If that's not enough, what you'll want to look at is using EXECUTE
to execute dynamically-constructed SQL.
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | Thiemo Kellner | 2023-11-12 16:47:19 | Re: Conditional compilation |
Previous Message | Ron | 2023-11-12 15:37:47 | Re: Conditional compilation |