Re: Simple question about running a function.

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: SQL Padawan <sql_padawan(at)protonmail(dot)com>
Cc: "pgsql-novice(at)lists(dot)postgresql(dot)org" <pgsql-novice(at)lists(dot)postgresql(dot)org>
Subject: Re: Simple question about running a function.
Date: 2021-11-26 17:43:42
Message-ID: CAKFQuwYvFhfuLiAfjef-nB-abrY12bgr4oD0we=vMkjNmoT81g@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-novice

On Fri, Nov 26, 2021 at 10:37 AM SQL Padawan <sql_padawan(at)protonmail(dot)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.

In response to

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message SQL Padawan 2021-11-26 18:33:01 Re: Simple question about running a function.
Previous Message David G. Johnston 2021-11-26 17:39:51 Re: Simple question about running a function.