6.5.2 Postgres Query and SMAP Replies

Postgres SQL query and the smap replies are configured the same way as for mysql module (see section MySQL Query and SMAP Replies). The following is a short summary:

query=template

Define the Postgres query template. The template may reference the following variables:

Variable Meaning
map Name of the map being queried
key Lookup key

Table 6.2: Postgres query template variables

If the database definition lacks the query option, it will attempt to use one from the module statement. If the module statement lacked it as well, an error is reported.

positive-reply=template

Defines a reply to be sent if the query returned a non-empty set of tuples. In addition to the variables described above (see postgres-query-vars), the template may also refer to the column names from the SQL result set.

The default positive-reply is ‘OK’.

negative-reply=template

Defines a reply to be sent if the query returned an empty set of tuples. The template may refer to the variables described in postgres-query-vars.

Default value is ‘NOTFOUND’.

onerror-reply=template

Defines a reply to be sent if an error occurred when executing the query. The template may refer to the variables described in postgres-query-vars.

Default value is ‘NOTFOUND’.