agora inbox for pljava-dev@postgresql.org  
help / color / mirror / Atom feed
Subject: [Pljava-dev] Cancelling trigger operation
Date: Mon, 23 Oct 2006 10:02:42 +0200
Message-ID: <003601c6f679$9e1af3c0$1e03a8c0@fhrbek> (raw)
References: <449f4cf70610180438x3c928febw693667dae457e841@mail.gmail.com>
	<45367CD0.8090202@tada.se>

Hi Thomas,

when a trigger function is written in pl/pgsql, you can decide to cancel the 
operation in a trigger(defined as "before event") by returning null instead 
of "new", e.g.

create function cancelling_trigger() returns trigger as
'
begin
  if new.num < 0 then
    -- cancel operation for negative numbers
    return null;
  else
    -- continue
    -- do something...
    return new;
  end if;
end
' language 'plpgsql';

Is there any way to do the same in pljava? I can't see it now, since the 
trigger functions are mapped to static java methods with no return values 
(void):

public static void cancellingTrigger(TriggerData td) throws SQLException {
  if (td.getNew().getInt("num") < 0) {
    //Cancel operation - HOW???
  }
  else {
    //Continue
    //do something...
  }
}

Filip





view thread (6+ messages)  latest in thread

Message-ID: <003601c6f679$9e1af3c0$1e03a8c0@fhrbek>
Permalink:  ../003601c6f679$9e1af3c0$1e03a8c0@fhrbek/
Also on:    postgresql.org/message-id/003601c6f679$9e1af3c0$1e03a8c0@fhrbek

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: pljava-dev@postgresql.org
  Subject: Re: [Pljava-dev] Cancelling trigger operation
  In-Reply-To: <003601c6f679$9e1af3c0$1e03a8c0@fhrbek>

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

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