Resolving PostgreSQL Error 'Time Zone Not Recognized' in Bold Reports
When executing reports against a PostgreSQL data source, users may encounter the following error:
ERROR: time zone "[TIME ZONE NAME]" not recognized SQL state: 22023
This issue commonly occurs when PostgreSQL functions are provided with Windows time zone names in an unsupported format, such as, “INDIA STANDARD TIME”. As a result, report execution fails and no data is returned.
PostgreSQL time zone recognition is case-sensitive. In some cases, Windows time zone names might be stored in a lookup table in an all-caps format, such as INDIA STANDARD TIME, while PostgreSQL expects the time zone name with proper casing, such as India Standard Time.
How to achieve
To resolve this issue, review and correct the casing of the time zone values passed to PostgreSQL.
-
Identify the incorrect casing: Review the parameter values being passed for time zones. For instance, if you are passing INDIA STANDARD TIME.
-
Correct the casing: Update the parameter value to use the format recognized by PostgreSQL. For example, change
INDIA STANDARD TIMEtoIndia Standard Time. -
Review the PostgreSQL function parameters and update the values where needed.
@ServerTimeZone::TEXT, --'INDIA STANDARD TIME' @UserTimeZone::TEXT, --'INDIA STANDARD TIME'Update them to:
@ServerTimeZone::TEXT, --'India Standard Time' @UserTimeZone::TEXT, --'India Standard Time' -
Verify the change. After updating the parameter values, re-execute the report or query and confirm that the error is resolved.
The time zone not recognized error occurs when PostgreSQL receives a time zone value that does not match the expected format. In most cases, the issue is caused by an incorrectly cased Windows time zone name stored in a parameter or lookup table. Updating the time zone value to the proper format resolves the issue and allows the report to execute successfully.