Introducing our new eBook: "Best Practices for Optimizing Postgres Query Performance"Download Now

U113: Invalid value

Category: Application / User Errors
SQLSTATE: 22007 and 22023 (Class 22 — Data Exception: invalid_datetime_format and invalid_parameter_value)
Urgency: low

Example Postgres Log Output:

ERROR: invalid value "string" for "YYYY"
DETAIL: Value must be an integer.
STATEMENT: SELECT to_timestamp($1, 'YYYY-mm-DD')
ERROR: invalid value for parameter "synchronous_commit": "foobar"
HINT: Available values: local, remote_write, remote_apply, on, off.
STATEMENT: ALTER SUBSCRIPTION testsub_foo SET (synchronous_commit = foobar);


The data being passed in is not a valid option for the function call thats being made, or the Postgres configuration setting that is being set.

On functions like to_timestamp you would typically see this error in development when passing bad input, but if your application has insufficient sanitization from user input this may also occur in production.

If this error occurs on a configuration setting its likely a DBA adjusting something and making a typing error.

Recommended Action:

If failure is with a function on a production system, review application code for input sanitization, so only valid data gets passed to the database.

Learn More:

No additional resources available.

Couldn't find what you were looking for or want to talk about something specific?
Start a conversation with us →