pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Jan Lentfer <Jan.Lentfer@web.de>
To: pgsql-sql@postgresql.org
Subject: Re: Job control in sql
Date: Fri, 25 May 2012 14:52:43 +0200
Message-ID: <879f6ef6940b25a63a82d87dc0c530c3@neslonek.homeunix.org> (raw)
In-Reply-To: <4FBF4293.4090902@krap.dk>
References: <4FBF4293.4090902@krap.dk>

On Fri, 25 May 2012 10:28:03 +0200, Svenne Krap wrote:
[...]
>  The problem is that a later run of run_jobs() will not see the
> job_begun has been set by a prior run (that is unfinished - as all
> queries from the plpgsql-function runs in a single, huge 
> transaction).
>
>
>  My intitial idea was to set the isolation level to "read 
> uncommitted"
> while doing the is-somebody-else-running-lookup, but I cannot change
> that in the plpgsql function (it complains that the session has to be
> empty - even when I have run nothing before it).
>
>  Any ideas on how to solve the issue?

Add a sort of status table where you insert your unique job identifer 
at the start of the function and remove it in the end? As seperate 
transactions of course.

Jan


-- 
professional: http://www.oscar-consult.de
private: http://neslonek.homeunix.org/drupal/



view thread (7+ messages)  latest in thread

Message-ID: <879f6ef6940b25a63a82d87dc0c530c3@neslonek.homeunix.org>
Permalink:  ../879f6ef6940b25a63a82d87dc0c530c3@neslonek.homeunix.org/
Also on:    postgresql.org/message-id/879f6ef6940b25a63a82d87dc0c530c3@neslonek.homeunix.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: Jan.Lentfer@web.de
  Subject: Re: Job control in sql
  In-Reply-To: <879f6ef6940b25a63a82d87dc0c530c3@neslonek.homeunix.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox