[postgis-devel] lwpostgis.sql.inc.c?

Mark Cave-Ayland mark.cave-ayland at siriusit.co.uk
Mon Jul 21 09:52:53 PDT 2008


Obe, Regina wrote:
> Why does the trunk lwgeom/lwpostgis.sql.in.c  not called
> lwpostgis.sql.in
> 
> Its screwing up the color coding on my editor.  In the branch versions
> it was named lwpostgis.sql.in
> 
> I see we did split things out into sqlmm.sql.in etc, but that doesn't
> seem to explain this choice of naming.
> 
> Thanks,
> Regina


Hi Regina,

The reason for this is that the PostgreSQL PGXS build system takes an 
input file called <foo>.sql.in, runs it through sed to substitute the 
path to the actual module, and stores the result as <foo>.sql. This file 
is then copied to the correct contrib/ directory as part of "make install".

In order to allow PostGIS to generate the correct SQL for multiple 
versions of PostgreSQL, we also need to run the output file through the 
C preprocessor beforehand. So the overall process now looks like this:


i) lwpostgis.sql.in.c is run through the C pre-processor CPP to produce
lwpostgis.sql.in

ii) lwpostgis.sql.in is run through sed by the PostgreSQL PGXS build 
system to produce the final lwpostgis.sql


Note that I used .c to make it obvious that the file is run through CPP 
(plus it uses various macro subsitutions with respect to function types 
such as IMMUTABLE, VOLATILE etc.) rather than being pure SQL. I can't 
say that I've ever run in syntax highlighting problems, but I suspect 
even an SQL syntax highlighter would fail due to the macros involved.


HTH,

Mark.

-- 
Mark Cave-Ayland
Sirius Corporation - The Open Source Experts
http://www.siriusit.co.uk
T: +44 870 608 0063



More information about the postgis-devel mailing list