Re: pgbench more operators & functions

From: Fabien COELHO <coelho(at)cri(dot)ensmp(dot)fr>
To: Jeevan Ladhe <jeevan(dot)ladhe(at)enterprisedb(dot)com>
Cc: PostgreSQL Developers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: pgbench more operators & functions
Date: 2016-09-26 20:10:51
Message-ID: alpine.DEB.2.20.1609262111490.28877@lancre
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


Hello Jeevan,

> I did the review of your patch and here are my views on your patch.

Thanks for this detailed review and debugging!

> Documentation: [...] it be a good idea to have a table of operators
> similar to that of functions. We need not have several columns here like
> description, example etc., but a short table just categorizing the
> operators would be sufficient.

Ok, done.

> Further testing and review:
> ===========================
> 1. Postgres treats '^' as exponentiation rather than XOR, and '#' as XOR.
> Personally, I think it can cause confusion, so it will be better if we can stick
> to the behavior of Postgres mathematical operators.

Ok. I agree to avoid '^'.

> 2. I could not see any tests for bitwise operators in the functions.sql
> file that you have attached.

Indeed. Included in attached version.

> 3. Precedence: [...]

Hmm. I got them all wrong, shame on me! I've followed C rules in the
updated version.

> 5. Sorry, I was not able to understand the "should exist" comment in following
> snippet.
>
> +"xor" { return XOR_OP; } /* should exist */
> +"^^" { return XOR_OP; } /* should exist */

There is no "logical exclusive or" operator in C nor in SQL. I do not see
why not, so I put one...

> 7. You may want to reword following comment: [...] there -> here

Ok, fixed twice.

> 8. [...] if (coerceToBool(&vargs[0])) *retval = vargs[1]; else *retval = vargs[2];

Ok.

Attached is an updated patch & test script.

--
Fabien.

Attachment Content-Type Size
pgbench-more-ops-funcs-3.patch text/x-diff 14.4 KB
functions.sql application/x-sql 917 bytes

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Jeff Janes 2016-09-26 20:16:07 Re: pageinspect: Hash index support
Previous Message Stephen Frost 2016-09-26 20:06:30 Re: Add support for restrictive RLS policies