Re: SELECTing from a function where i don't want the results

Поиск
Список
Период
Сортировка
От David G. Johnston
Тема Re: SELECTing from a function where i don't want the results
Дата
Msg-id CAKFQuwZUVRomU-ca1SDF2oSLg-vaNoXG6ckxkrmD5Pzp=L1-QA@mail.gmail.com
обсуждение исходный текст
Ответ на SELECTing from a function where i don't want the results  (Wells Oliver <wells.oliver@gmail.com>)
Ответы Re: SELECTing from a function where i don't want the results  (Wells Oliver <wells.oliver@gmail.com>)
Список pgsql-admin
On Tuesday, July 7, 2020, Wells Oliver <wells.oliver@gmail.com> wrote:
Vanilla SQL script calls a plpgsql function to delete some number of rows from three tables:

SELECT mydelete(r) FROM sometable;

Where sometable contains maybe 100+ records. This causes the results from the function (integer of number of rows removed) to be displayed in the output, like you'd kinda expect with a SELECT call, except I don't want to see it all, I just want the function quietly executed and rows removed.

Can I accomplish this?


Pure SQL, no, you cannot just ignore the output.  You can perform post-processing (via CTE/WITH) to reduce how much is printed (aggregates). If you are using psql you can send it to /dev/null.  You could use a DO block and (kinda) ignore the result (SQL) and/or stick it into a throw-away variable (plpgsql).

David J.

В списке pgsql-admin по дате отправления:

Предыдущее
От: Wells Oliver
Дата:
Сообщение: Re: SELECTing from a function where i don't want the results
Следующее
От: Wells Oliver
Дата:
Сообщение: Re: SELECTing from a function where i don't want the results