Re: Simple question about running a function. - Mailing list pgsql-novice

From David G. Johnston
Subject Re: Simple question about running a function.
Date
Msg-id CAKFQuwYvFhfuLiAfjef-nB-abrY12bgr4oD0we=vMkjNmoT81g@mail.gmail.com
Whole thread Raw
In response to Re: Simple question about running a function.  (SQL Padawan <sql_padawan@protonmail.com>)
Responses Re: Simple question about running a function.
List pgsql-novice
On Fri, Nov 26, 2021 at 10:37 AM SQL Padawan <sql_padawan@protonmail.com> wrote:


It's something to do with output - SELECT obviously returns something, whereas INSERT doesn't - but that's not strictly true. It returns success or failure?

SELECT returns a result set (table), Insert doesn't
    INSERT INTO tab VALUES (100) RETURNING *;

Unless you use RETURNING...


How do I tell psql/PL/pgSQL that I want to suppress the output for
the test?

By doing exactly what the error message told you.  Use PERFORM instead of SELECT...on the exact query whose output you wish to ignore, not an indirect caller.

David J.

pgsql-novice by date:

Previous
From: "David G. Johnston"
Date:
Subject: Re: Simple question about running a function.
Next
From: SQL Padawan
Date:
Subject: Re: Simple question about running a function.