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

From: mgainty(at)hotmail(dot)com
To: "Alban Hertroys" <dalroi(at)solfertje(dot)student(dot)utwente(dot)nl>
Cc: "pgsql-general General" <pgsql-general(at)postgresql(dot)org>
Subject: Re: ISO something like "#if 0 ... #endif" for SQL code
Date: 2008-03-10 22:40:49
Message-ID: BLU136-DAV114A0719A4563F2C623C9EAE0E0@phx.gbl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

/*
* Inside SQL statement place Obligatory top post Comment here
*/
Bedankt
Martin-

----- Original Message -----
Wrom: MKHJYFMYXOEAIJJPHSCRTNHGSWZIDREXCAXZOWCONEUQZAAFXISHJE
To: "Kynn Jones" <kynnjo(at)gmail(dot)com>
Cc: "pgsql-general General" <pgsql-general(at)postgresql(dot)org>
Sent: Monday, March 10, 2008 12:55 PM
Subject: Re: [GENERAL] ISO something like "#if 0 ... #endif" for SQL code

> On Mar 10, 2008, at 4:50 PM, Kynn Jones wrote:
>
> > Hi! When it comes to programming SQL, my newbie approach is to
> > write my code in a file test.sql, which I test from within psql by
> > using
> >
> > my_db=> \i /some/path/test.sql
> >
> > ...and (once I'm satisfied with the code) copy and paste it to a
> > different file that has the SQL I've written so far for the project.
> >
> > It's a rather cumbersome system, all the more so because I don't
> > have a convenient way to comment out large chunks of code (which
> > may include C-style comments).
> >
> > 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.
>
> Alban Hertroys
>
> --
> If you can't see the forest for the trees,
> cut the trees and you'll see there is no forest.
>
>
> !DSPAM:737,47d573f5233091666920879!
>
>
>
> --
> Sent via pgsql-general mailing list (pgsql-general(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-general
>

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Scott Marlowe 2008-03-10 22:46:42 Re: php pg_connect fails, pgsql works
Previous Message Greg Smith 2008-03-10 21:58:59 Re: php pg_connect fails, pgsql works