bool_plperl transform

From: Ivan Panchenko <wao(at)mail(dot)ru>
To: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: bool_plperl transform
Date: 2020-02-29 21:55:17
Message-ID: 1583013317.881182688@f390.i.mail.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


Hi,
While using PL/Perl I have found that it obtains boolean arguments from Postgres as ‘t’ and ‘f’, which is extremely inconvenient because ‘f’ is not false from the perl viewpoint.
So the problem is how to convert the SQL booleans into Perl style.
 
There are 3 ways to do this:
* make plperl automatically convert bools into something acceptable for perl. This looks simple, but probably is not acceptable as it breaks compatibility.
* try to make some trick like it is done with arrays, i.e. convert bools into special Perl objects which look like ‘t’ and ‘f’ when treated as text, but are true and false for boolean operations. I am not sure that it is possible and reliable.
* make a transform which transforms bool, like it is done with jsonb. This does not break compatibility and is rather straightforward.
So I propose to take the third way and make such transform. This is very simple, a patch is attached.
Also this patch improves the plperl documentation page, which now has nothing said about the transforms.
 
Regards,
Ivan Panchenko
 
 

Attachment Content-Type Size
bool_plperl_transform_v1.patch application/octet-stream 3.6 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2020-02-29 22:13:19 Re: Allowing ALTER TYPE to change storage strategy
Previous Message Tom Lane 2020-02-29 21:44:23 Re: Broken resetting of subplan hash tables