Nickolay wrote:
Kevin McConnell wrote:
CREATE OR REPLACE FUNCTION public.getmsg() RETURNS integer LANGUAGE
plpgsql
AS $function$
declare
rec record;
begin
for rec in select id from msg where busy =alse order by id loop
update msg set busy =rue where id = rec.id and bus
Andy Colson wrote:
Kevin McConnell wrote:
I think you could also do something roughly similar in a statement by
using a RETURNING clause on the update, such as:
update msg set busy = true where id = (select min(id) from msg where
busy = false) returning *;
I had thought of that, but you'd
Kevin McConnell wrote:
CREATE OR REPLACE FUNCTION public.getmsg() RETURNS integer LANGUAGE plpgsql
AS $function$
declare
rec record;
begin
for rec in select id from msg where busy =alse order by id loop
update msg set busy =rue where id = rec.id and busy = false;
Kevin McConnell wrote:
CREATE OR REPLACE FUNCTION public.getmsg() RETURNS integer LANGUAGE plpgsql
AS $function$
declare
rec record;
begin
for rec in select id from msg where busy = false order by id loop
update msg set busy = true where id = rec.id and busy = false;
> CREATE OR REPLACE FUNCTION public.getmsg() RETURNS integer LANGUAGE plpgsql
> AS $function$
> declare
> rec record;
> begin
> for rec in select id from msg where busy = false order by id loop
> update msg set busy = true where id = rec.id and busy = false;
>
Nickolay wrote:
one important addition: the message cannot be removed from queue table
until it is transmitted, so DELETE is not an option :)
Hi All,
I have a trivial task. There is a table with messages queue, let's say
"msg_queue".
There are a few processes and each of them is taking one mes
one important addition: the message cannot be removed from queue table
until it is transmitted, so DELETE is not an option :)
Hi All,
I have a trivial task. There is a table with messages queue, let's say
"msg_queue".
There are a few processes and each of them is taking one message from
this t
Hi All,
I have a trivial task. There is a table with messages queue, let's say
"msg_queue".
There are a few processes and each of them is taking one message from
this table at a time to transmit into communication channel.
I've done it my way, but I have postgresql's messages about deadlocks
a