On Fri, 2007-05-25 at 13:45 -0400, Alvaro Herrera wrote:
> Robert Fitzpatrick wrote:
> 
> > But still, how would I reference all fields using the pl/perl? Can I
> > specify column numbers versus names as in '$_TD->{new}{1}' for the first
> > column and loop or something? For instance, I would like to be able to
> > say if any NEW column has a single asterisk only, set it to '%%%'.
> 
> Well, do a foreach ($_TD->{new}) or foreach (keys $_TD->{new}) (not sure
> of the exact syntax but if you're used to Perl you can figure it out).
> 

You gotta love pgsql, took a bit, but done...

foreach $i (keys %{$_TD->{new}}) {
    if (${$_TD->{new}}{$i} eq '*') {
        ${$_TD->{new}}{$i} = '%%%';
    } else {
        ${$_TD->{new}}{$i} =~ s/\*/\%/g;
    }
}
return  "MODIFY";

-- 
Robert


---------------------------(end of broadcast)---------------------------
TIP 5: don't forget to increase your free space map settings

Reply via email to