Customizing Postgres Code: New Feature for Selectively Recording Error Messages

April 11, 2017

EnterpriseDB® (EDB™) works closely with its customers to develop new features as they encounter needs unique to their environments. Global organizations are deploying the EDB Postgres Platform across a broader spectrum of workloads as they discover greater value in the enterprise-class performance and scalability features and capabilities. 

In one recent case, an EnterpriseDB customer ported its application to EDB Postgres while the application was still run on other databases as well. This scenario is increasingly common as organizations seek to use EDB Postgres to increase the utility of existing legacy database resources. The customer needed the application to perform identically across all databases because the application relied on generating and identifying errors like duplicate key. However, the customer didn't want EDB Postgres handling the error log file differently from other databases and causing discrepancies. The customer wanted a plugin that allowed them to filter errors  from the log file. In response, EnterpriseDB created the edb_filter_log feature. 

In general, EDB Postgres gives the user the ability to control information sent to the log file. For example, the log_min_messages parameter controls which message levels are written to the server log file. By using this parameter, the user can be selective as to which errors are recorded.

In addition, if the user has a procedure or other program that does not fail on a particular, expected error, users typically want to prevent this error from being recorded in the log file, and thus prevent the growth of the log file with unnecessary error messages.

There is now a feature in EDB Postgres Advanced Server 9.6 that enables the filtering of errors like this from the log file. This feature is called edb_filter_log. Users can configure this in the postgresql.conf file and then set edb_filter_log.errcode to a list of one or more comma-separated error codes. Any messages that match these error codes are not recorded in the log file. For example, to suppress duplicate key violations, you can set edb_filter_log.errcode = '23505'.

This feature is very beneficial in reducing the log file size by avoiding known errors from getting recorded.

For a step-by-step demonstration of the edb_filter_log feature, watch this video

For further information on EDB Postgres, contact us or send an email to

Rajkumar Raghuwanshi is Software Engineer at EnterpriseDB. 


Share this