Skip to content
Written with Claude

VOID

Also known as

void_result (with or without @ prefix)

Force an endpoint to return 204 No Content instead of a JSON response. All statements are executed for side effects only.

Available since version 3.12.0.

Syntax

code
@void
@void_result

Examples

Multi-Command Side Effects

Useful when all statements are side-effect-only (e.g., set_config calls followed by a DO block):

sql
sql
/* HTTP POST
@void
@param $1 message_text text
@param $2 _user_id text = null
*/
select set_config('app.message', $1, true);
select set_config('app.user_id', $2, true);
do $$ begin
    insert into messages (user_id, text)
    values (current_setting('app.user_id')::int, current_setting('app.message'));
end; $$;

Without @void, this returns {"result1":"...","result2":"...","result3":-1}. With @void, it returns 204 No Content.

This eliminates the need to add @skip to every individual statement.

Single-Command Void

Also works on single-command endpoints:

sql
sql
-- HTTP POST
-- @void
-- @param $1 key text
-- @param $2 value text
select set_config($1, $2, true);

Function Endpoints

Works on function and procedure endpoints too:

sql
sql
comment on function process_data(int) is '
HTTP POST
void
';

Behavior

  • All statements are executed normally via ExecuteNonQuery
  • The response status is 204 No Content with an empty body
  • No JSON wrapping, no result keys, no rows-affected counts
  • Works on all endpoint types: functions, procedures, and SQL file endpoints
  • For multi-command SQL files, all statements execute sequentially — if any fails, the request fails
  • The Describe step still runs at startup — use @returns void instead if the statement would fail Describe

Comments