Skip to content
AI-assisted, verified against source

Changelog v3.4.1 (2025-01-15)

Version 3.4.1 (2025-01-15)

Full Changelog

Configuration Options for Null Handling

Added global configuration options for QueryStringNullHandling and TextResponseNullHandling in appsettings.json.

QueryStringNullHandling

Sets the default behavior for handling NULL values in query string parameters:

  • Ignore (default): No special handling - empty strings stay as empty strings, "null" literal stays as "null" string.
  • EmptyString: Empty query string values are interpreted as NULL values.
  • NullLiteral: Literal string "null" (case insensitive) is interpreted as NULL value.
json
json
{
  "NpgsqlRest": {
    "QueryStringNullHandling": "EmptyString"
  }
}

TextResponseNullHandling

Sets the default behavior for plain text responses when the execution returns NULL from the database:

  • EmptyString (default): Returns an empty string response with status code 200 OK.
  • NullLiteral: Returns a string literal "NULL" with status code 200 OK.
  • NoContent: Returns status code 204 NO CONTENT.
json
json
{
  "NpgsqlRest": {
    "TextResponseNullHandling": "NoContent"
  }
}

Both options can also be overridden per-endpoint using comment annotations:

sql
sql
comment on function my_func(text) is '
query_string_null_handling empty_string
text_response_null_handling no_content
';

Bug Fixes

  • Fixed logging condition in QueryStringNullHandlingHandler that was incorrectly checking TextResponseNullHandling instead of QueryStringNullHandling when determining whether to log annotation changes.
  • Fixed overloaded function resolution not updating the SQL command text. When multiple PostgreSQL functions with the same name but different parameter types (e.g., one with int and one with a custom composite type) were mapped to the same endpoint, selecting an overload based on parameter count would use the wrong SQL expression, causing syntax errors.
  • Fixed error logging to include command parameters. When command execution failed, the error log now includes the request URL and parameter values (when LogCommands and LogCommandParameters are enabled) for easier debugging.

Comments