pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Greg Sabino Mullane <greg@endpoint.com>
To: pgsql-bugs@postgresql.org
Subject: 9.1 plperlu bug with null rows in trigger hash
Date: Mon, 23 May 2011 16:59:32 -0400
Message-ID: <20110523205931.GM4253@core.home> (raw)

I've not been able to duplicate this in a standalone script yet, 
but in the guts of Bucardo is a trigger function called validate_goat() 
that is giving this error on 9.1 HEAD, but not on previous versions:

"Failed to add table "public.pgbench_tellers": DBD::Pg::st execute 
failed: ERROR:  Modification of non-creatable hash value attempted, 
subscript "pkey" at line 4."

I was able to simplify the function to just this and still produce 
the error:

CREATE OR REPLACE FUNCTION bucardo.validate_goat()
RETURNS TRIGGER
LANGUAGE plperlu
AS
$bc$

my $new = $_TD->{new};
$new->{pkey} = 'foobar';

return 'MODIFY';

$bc$;

It's used like this:

CREATE TRIGGER validate_goat
  BEFORE INSERT OR UPDATE ON bucardo.goat
  FOR EACH ROW EXECUTE PROCEDURE bucardo.validate_goat();

The goat table has many text fields, of which one is 
pkey. Setting it to any of those other columns will cause the error. 
However, setting it to a text field that is NOT NULL DEFAULT will 
*not* produce the error, so obviously something is setting 
$_TD->{new}{somecol} to undef in the wrong way. I'm baffled as 
to why I cannot reproduce it standalone, but wanted to get the 
bug out there so I don't forget about it and in case anyone 
wants to take a swing at it. Some Googling suggests it might 
be because we are using &PL_sv_undef instead of a proper 
newSV(0).

-- 
Greg Sabino Mullane greg@endpoint.com
End Point Corporation
PGP Key: 0x14964AC8

view thread (8+ messages)  latest in thread

Message-ID: <20110523205931.GM4253@core.home>
Permalink:  ../20110523205931.GM4253@core.home/
Also on:    postgresql.org/message-id/20110523205931.GM4253@core.home

 · 

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: greg@endpoint.com
  Subject: Re: 9.1 plperlu bug with null rows in trigger hash
  In-Reply-To: <20110523205931.GM4253@core.home>
  References: <20110523205931.GM4253@core.home>

* 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