[postgis-devel] Re: PostGIS datastore creation

Chris Hodgson chodgson at refractions.net
Wed Sep 20 10:13:35 PDT 2006


Greg and Mark, while I think your ideas certainly have merit, I don't 
think they address the main problem - the FDO client needs to be able to 
create a new database using ONLY the SQL connection to the server. The 
FDO client knows nothing of the Platform, OS, or even version of postgis 
that is installed on the server. We can't even use a standard postgis 
stored procedure on the postgres side because if we don't have a spatial 
database yet, none of the postgis stored procedures would be installed.

However an alternative option to the template GIS database might be to 
create a "global" stored procedure to install postgis into the current 
database, and put that into the template1 or template0 DB... but I think 
I still like the template GIS database plan better.

As far as actually "creating" the template GIS database, that can only 
sensibly be done as part of the actual postgis install process, as you 
need to know where the postgis.sql file is located, have read access to 
it, have admin access on the database, etc.

One possible issue I see is that the template GIS database name must be 
unique AND standardized. While this doesn't seem like an unreasonable 
requirement, consider the possibility of multiple different versions of 
postgis installed on one postgresql server. AFAIK, this is currently 
possible using separate databases for each postgis version, and I think 
it isn't a completely unreasonable thing to do, especially during a 
Postgis upgrade/migration. However, I expect FDO won't have a mechanism 
for selecting which version of postgis you want to use for your new 
database, and the only reasonable thing to assume is to use the newest 
version... so perhaps we can safely ignore this situation by making the 
assumption that the newest version of postgis installed will have 
overwritten any previous template GIS database.

I vote for "template_postgis" as the standardized name.

Chris


Mark Cave-Ayland wrote:
> Maybe another option would be create a small C program called
> "postgis_install" that could do the install for you. For example:
> 
> 	postgis_install [-h host] [-p port] [-U user] -f lwpostgis.sql
> 
> The program could work something like this:
> 
> 	- Check for the existence of the template_gis database. If it
> 	doesn't exist, connect to the template1/postgres database,
> 	issue CREATE DATABASE template_gis and disconnect.
> 
> 	- Connect to the template_gis database and simply read in all
> 	commands from the file specified by -f (this would also work
> 	for loading spatial_ref_sys.sql into the template_gis database).
> 
> Since the program is written in C, it would work across all platforms
> and would also have the advantage of being able to install on both
> remote and local servers. It would also mean the installation
> instructions would be consistent across all platforms, rather than
> having different sets of instructions for Win32/Unix-based OS.
> 
> 
> Kind regards,
> 
> Mark.
> 
> 
> _______________________________________________
> postgis-devel mailing list
> postgis-devel at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-devel




More information about the postgis-devel mailing list