Re: Stored Procedure to Delete Rows and Return Count

Поиск
Список
Период
Сортировка
От David G. Johnston
Тема Re: Stored Procedure to Delete Rows and Return Count
Дата
Msg-id CAKFQuwbwoXZn4MOdj7nCVwFZDo1GJz2xdP2eDJA+5mBwq5-e-A@mail.gmail.com
обсуждение исходный текст
Ответ на Stored Procedure to Delete Rows and Return Count  ("Dave Bolt" <dave@davebolt.co.uk>)
Список pgsql-sql
On Wednesday, August 29, 2018, Dave Bolt <dave@davebolt.co.uk> wrote:

I am (unfortunately) using PG 8.4

Then writable cte (with) is not an optibn for you.  That requires version 9.1 ROs later.

with d as (delete from foo where id=$1 RETURNING *)

select count(*)


You would have to write “from d” to get that to work but as above the delete only works in 9.1+

I would expect “get diagnostics var = row_count” (something like that) to work after executing delete by itself.  Might want to read more recent docs since the 8.4 seems to not cover this as thoroughly.


David J.

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

Предыдущее
От: "Jonathan S. Katz"
Дата:
Сообщение: Re: Stored Procedure to Delete Rows and Return Count
Следующее
От: "Dave Bolt"
Дата:
Сообщение: RE: Stored Procedure to Delete Rows and Return Count