Writer Directives

The directives that are processed by the PostGIS writer are listed below. The suffixes shown are prefixed by the current <WriterKeyword>_ in a mapping file. By default, the <WriterKeyword> for the PostGIS writer is POSTGIS_OUT.

DATASET/DATABASE, HOST, PORT, USER_NAME, PASSWORD

These directives operate in the same manner as they do for the PostGIS reader.

START_TRANSACTION

This statement tells the PostGIS writer module when to start actually writing features into the database.

The PostGIS writer does not write any features until the feature number of features are skipped, and then it begins writing the following features. Normally, the value specified is zero – a non-zero value is only specified when a data load operation is being resumed after failing partway through.

Required/Optional

Optional

Mapping File Syntax

POSTGIS_OUT_START_TRANSACTION 0

Workbench Parameter

Starting Feature

TRANSACTION_INTERVAL

This directive determines the number of features that FME will place in each transaction before a transaction is committed to the database.

If the POSTGIS_OUT_TRANSACTION_INTERVAL statement is not specified, then a value of 1000 is used as the transaction interval.

Required/Optional

Optional

Mapping File Syntax

POSTGIS_OUT_TRANSACTION_INTERVAL 2000

Workbench Parameter: Features Per Transaction

BULK_COPY

This statement tells the PostGIS writer module to insert data into the database using either SQL INSERT statements or the SQL COPY command. The default option is the bulk copy using the COPY command, which yields the best performance.

Required/Optional

Optional

Mapping File Syntax

POSTGIS_OUT_BULK_COPY YES

Note: The bulk delimiter escaping has improved, and therefore it is no longer necessary as a backup measure. However, if individual inserts are desired, this option can be set to NO.

Workbench Parameter

Bulk Copy Insert

WRITER_MODE

This directive informs the PostGIS writer which SQL operations will be performed by default by this writer.

This operation can be set to INSERT, UPDATE or DELETE. The default writer-level value for this operation can be overwritten at the feature type or table level. The corresponding feature type DEF parameter name is called POSTGIS_MODE. It has the same valid options as the writer-level mode, as well as the value INHERIT_FROM_WRITER (which causes the writer-level mode to be inherited by the feature type as the default for features contained in that table).

This operation can also be set for individual features, using the fme_db_operation attribute. Note that when WRITER_MODE is set to INSERT, all features are inserted unless otherwise set for UPDATE or DELETE.

Required/Optional

Optional

Mapping File Syntax

POSTGIS_OUT_WRITER_MODE INSERT

If this directive is not specified, then a value of INSERT is given.

Workbench Parameter

Writer Mode

Note: For more information on this directive, see the Database Writer Mode.

GENERIC_GEOMETRY

This directive applies at generation time, not at translation time.

The default value of NO indicates that we want the previous behavior of creating geometrically constrained spatial columns on the destination tables. For example, a POINT spatial table would be restricted only to points.

Now we have the option to create generic or non-geometrically constrained spatial columns. This means you can insert multiple geometry types into one table. Specifically the spatial column is created to have the generic type GEOMETRY and there are no constraints placed on the geometry types allowed.

Required/Optional

Optional

If the POSTGIS_OUT_GENERIC_GEOMETRY statement is not specified, then a value of NO is given.

Mapping File Syntax

POSTGIS_OUT_GENERIC_GEOMETRY YES

SPATIAL_COLUMN_TYPE

The default value of geometry creates planar (geometry) spatial columns on the destination tables by default. Setting its value to geography, however, would create geodetic (geography) spatial columns. This value can also be set specifically for individual feature types.

Note: This directive applies only at workspace or mapping file generation time.

Required/Optional

Optional

SPATIAL_COLUMN_NAME

The default value of geom creates a spatial column with the name “geom” on the destination tables by default. This value can also be set specifically for individual feature types.

Note: This directive applies only at workspace or mapping file generation time.