Re: bool_plperl transform

From: ilmari(at)ilmari(dot)org (Dagfinn Ilmari Mannsåker )
To: Wao <wao(at)mail(dot)ru>
Cc: Andrew Dunstan <andrew(dot)dunstan(at)2ndquadrant(dot)com>, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: bool_plperl transform
Date: 2020-03-01 22:09:37
Message-ID: 87h7z7wwv2.fsf@wibble.ilmari.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Wao <wao(at)mail(dot)ru> writes:

> +Datum
> +bool_to_plperl(PG_FUNCTION_ARGS)
> +{
> + dTHX;
> + bool in = PG_GETARG_BOOL(0);
> + SV *sv = newSVnv(SvNV(in ? &PL_sv_yes : &PL_sv_no));
> + return PointerGetDatum(sv);
> +}

Why is this only copying the floating point part of the built-in
booleans before returning them? I think this should just return
&PL_sv_yes or &PL_sv_no directly, like boolean expressions in Perl do,
and like what happens for NULL (&PL_sv_undef).

- ilmari
--
"A disappointingly low fraction of the human race is,
at any given time, on fire." - Stig Sandbeck Mathisen

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2020-03-01 22:25:30 Re: Allow to_date() and to_timestamp() to accept localized names
Previous Message Tom Lane 2020-03-01 21:16:59 Re: Commitfest 2020-03 Now in Progress