Troubleshooting
Approaches
If the service isn’t behaving as expected, there are a few approaches you can use to determine the issue.
HTTP Response
The service indicates the status of reponses using standard HTTP status codes, along with text messages. See the API section for details of status codes and their meanings.
HTTP status codes and headers returned in service responses can be displayed by querying them with a command-line utility like curl:
curl -I http://localhost:9000/home.json
Alternatively, most web browsers provide a debugger which can display detailed response information.
Service Logging
The service outputs logging information to the console. By default, the log level is set to show errors and warnings only. Running the service with debug level logging will provide more information about request processing. This can include the actual SQL emitted to the database, SQL errors, and timing of queries and responses.
To invoke debug mode, run the server with the --debug
command-line parameter:
./pg_featureserv --debug
You can also turn on debug logging in the configuration file:
Debug = true
or via the environment:
export PGFS_SERVER_DEBUG=true
SQL Logging
The debug
mode of the server logs the SQL that is being emitted to the database.
If you have access to the database that the service is querying, it can
be useful to try manually executing the SQL.
This can provide more detailed database error reporting.
For issues involving access permissions, it may be useful to connect as the same user that the service is using.
To delve more deeply into the SQL that is being run on the database, you can turn on statement logging in PostgreSQL by editing the postgresql.conf
file for your database and restarting.
Common Problems
Table not published
If a table/view is not published as expected, check the following:
- ensure that the table geometry column has full metadata.
This can be checked by displaying the table definition using
\d tablename
, or by querying the geometry metadata views. In particular, note that recent versions of theAddGeometryColumn()
method do not update this metadata and will not be discovered by thepg_featureserv
catalog query. - ensure that the table is visible to the service user. Table privileges can be checked using the following query:
SELECT grantee, table_catalog, privilege_type, table_schema, table_name
FROM information_schema.table_privileges
WHERE table_name = 'tablename'
ORDER BY grantee, table_schema, table_name;
Too few query result features
If a query result contains fewer features than expected,
the limit=N
query parameter may need to be specified, or the limit increased.
If increasing this parameter has no effect, the query result size may be exceeding
the LimitMax
configuration parameter.
Bug reporting
If you find an issue, it can be reported on the GitHub issue tracker:
When reporting an issue, please provide the software version being used. This can be obtained from the service log, or by running:
./pg_featureserv --version