mirror of
https://git.postgresql.org/git/postgresql.git
synced 2025-01-12 18:34:36 +08:00
replace use of predefined perl vars $a and $b with $x and $y - per Greg Sabino Mullane
This commit is contained in:
parent
a33fadfd6d
commit
48f3d77858
@ -1,5 +1,5 @@
|
||||
<!--
|
||||
$PostgreSQL: pgsql/doc/src/sgml/plperl.sgml,v 2.46 2005/10/12 14:28:33 momjian Exp $
|
||||
$PostgreSQL: pgsql/doc/src/sgml/plperl.sgml,v 2.47 2005/10/18 22:53:54 adunstan Exp $
|
||||
-->
|
||||
|
||||
<chapter id="plperl">
|
||||
@ -118,14 +118,14 @@ $$ LANGUAGE plperl;
|
||||
|
||||
<programlisting>
|
||||
CREATE FUNCTION perl_max (integer, integer) RETURNS integer AS $$
|
||||
my ($a,$b) = @_;
|
||||
if (! defined $a) {
|
||||
if (! defined $b) { return undef; }
|
||||
return $b;
|
||||
my ($x,$y) = @_;
|
||||
if (! defined $x) {
|
||||
if (! defined $y) { return undef; }
|
||||
return $y;
|
||||
}
|
||||
if (! defined $b) { return $a; }
|
||||
if ($a > $b) { return $a; }
|
||||
return $b;
|
||||
if (! defined $y) { return $x; }
|
||||
if ($x > $y) { return $x; }
|
||||
return $y;
|
||||
$$ LANGUAGE plperl;
|
||||
</programlisting>
|
||||
As shown above, to return an SQL null value from a PL/Perl
|
||||
|
Loading…
Reference in New Issue
Block a user