SELECT raises exception in PL/pgSQL function

The manual:

Sometimes it is useful to evaluate an expression or SELECT query but
discard the result, for example when calling a function that has
side-effects but no useful result value. To do this in PL/pgSQL, use
the PERFORM statement:

PERFORM query;

Unless you assign the result, replace

SELECT 1;

with

PERFORM 1;

Leave a Comment