Re: ISO something like "#if 0 ... #endif" for SQL code

From: Harald Fuchs <hari(dot)fuchs(at)googlemail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: ISO something like "#if 0 ... #endif" for SQL code
Date: 2008-03-10 19:03:03
Message-ID: pur6ei2yhk.fsf@srv.protecting.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

In article <DD18D9BB-C92D-4B4B-9829-54AC88152B0E(at)solfertje(dot)student(dot)utwente(dot)nl>,
Alban Hertroys <dalroi(at)solfertje(dot)student(dot)utwente(dot)nl> writes:

>> I'm thinking of something like the trick of surrounding C code with
>> pairs of #if 0 and #endif, which effectively comments out code,
>> even when it contains /* C-style comments */.
>>
>> Is there some similar trick for SQL code?

> I have been playing with the idea of using cpp to pre-process such
> files, and maybe even put them in a Makefile. I don't think there's
> any reason that wouldn't be possible with SQL files. Added bonus, you
> can use macros in your SQL, for things like environment paths (for
> including other SQL files for example) etc.

If it's OK to preprocess SQL, you could also use the M4 macro
processor which comes with every decent operating system (i.e. Unix).

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Kynn Jones 2008-03-10 20:07:41 Trigger to run @ connection time?
Previous Message Webb Sprague 2008-03-10 18:12:26 Re: how do you write aggregate function