mktemplate_gis(1)

NAME

mktemplate_gis - Create Postgis template in a PostgreSQL server.

SYNTAX

mktemplate_gis [options]

DESCRIPTION

This program create a template database for working with Postgis geometries.
It requires to be run by root, or by PostgreSQL superuser (DBA), or by the cluster owner, but once the template created, any user with createdb permissions can create a spatial enabled database with createdb.postgis. The privileges on the initial objects in the created databases will be granted to the user defined here (see GRUSER below).
PostgreSQL should be running.

OPTIONS

For default values see below.

--user=<dbowner>
    Creates a database template owned by <dbowner>. If normal user, dbowner will own the template database, else if it's a group or public, dbowner will have full rights to the objects in the template database. The rights granted here will also hols for new databases created from this template, even by non-dba and non-cluster owning users.

Environment variable: GRUSER.

--template=<templatedb>
    Set template name to be <templatedb>

Environment variable: TEMPLATEDB.

--dba=<dba_name>
    DBA is required to perform template database building.

Environment variable: DBAUSER.

--script=<pgis_script>
    pgis_script is the sql script containing the postgis functions for the template database. If no directory name will be given, the script will be taken from /usr/share/postgresql/$CLUSTERVER/contrib.

Environment variable: PGISSCRIPT.

--no-srs
    this argument will suppress loading of the huge spatial_ref_sys in the database template. the table will be created anyway.

Environment variable: NO_SRS=true.

--no-topo
    this argument will suppress loading of the topology functionality in the database template.

Environment variable: NO_TOPO=true.

--help
    Output help information and exit.

ENVIRONMENT

TEMPLATEDB
    If $TEMPLATEDB is set, its value is used as the default template name.

GRUSER
    If $GRUSER is set, its value is used as the default user to own the template. This user will naturally have default rights to databases created with this template.

DBAUSER
    If $DBAUSER is set, its value is used as the default DBA for building the template. Else, the cluster owner and postgres are the next candidates.

PGISSCRIPT
    If $PGISSCRIPT is set, its value is used as the default postgis sql script for the template. If a directory will not be specified, the file will be taken from the default scripts/contrib directory for this postgresql version.

FILES

The environment variables for template_gis creation, removal and usage may be stored in files, as follows:

/etc/default/postgis
    will designate default values for the whole system.

$HOME/.postgis/profile
    will designate the values used by the current user by default. Beware, this is the current SYSTEM user, not the dba or the database owner to become. As those values are more user specific, they supersede the ones in the system default file for the current user.

NOTES

The order of precedence of the variables definition:

1.  Command line options.

2.  Environment variables.

3.  The user specific profile file.

4.  The system wide default file.

The builtin (hardwired) values are not a good choice.

EXAMPLES

To run this program the standard way, you can simply type:

# mktemplate_gis

Alternatively you can specify also a template name to create and the database superuser:

# mktemplate_gis --user=postgres --template=template_postgis

AUTHORS

Alex Bodnaru <alexbodn@012.net.il>
Roberto Boati <roberto.boati@gmail.com>

SEE ALSO

createdb.postgis(1), rmtemplate_gis(1)