Skip to content

RESPONSE_NULL_HANDLING

Control how NULL results are returned in responses.

Keywords

response_null_handling, response_null

Syntax

response_null <mode>
response_null_handling <mode>

Values

ValueDescription
empty_stringNULL returned as empty string ""
null_literalNULL returned as JSON null
204_no_contentNULL returns HTTP 204 No Content

Examples

Return Empty String for NULL

sql
comment on function get_value(_id int) is
'HTTP GET
response_null empty_string';

If result is NULL → Response body: ""

Return 204 for NULL

sql
comment on function find_record(_id int) is
'HTTP GET
response_null 204_no_content';

If result is NULL → HTTP 204 with no body

Return JSON null

sql
comment on function get_optional(_key text) is
'HTTP GET
response_null null_literal';

If result is NULL → Response body: null

Released under the MIT License.