Re: Re: A bug when use get_bit() function for a long bytea string - Mailing list pgsql-hackers

From movead.li@highgo.ca
Subject Re: Re: A bug when use get_bit() function for a long bytea string
Date
Msg-id 20200313111842791351178@highgo.ca
Whole thread Raw
In response to A bug when use get_bit() function for a long bytea string  ("movead.li@highgo.ca" <movead.li@highgo.ca>)
Responses Re: Re: A bug when use get_bit() function for a long bytea string  (Ashutosh Bapat <ashutosh.bapat@2ndquadrant.com>)
List pgsql-hackers
Thanks for the reply.

>Why have you used size? Shouldn't we use int64?
Yes, thanks for the point, I have changed the patch.
 
>If get_bit()/set_bit() accept the second argument as int32, it can not
>be used to set bits whose number does not fit 32 bits. I think we need
>to change the type of the second argument as well.
Because int32 can cover the length of bytea that PostgreSQL support,
and I have decided to follow your next point 'not use 64bit int for len',
so I think the second argument can keep int32.

>Also, I think declaring len to be int is fine since 1G would fit an
>int, but what does not fit is len * 8, when performing that
>calculation, we have to widen the result. So, instead of changing the
>datatype of len, it might be better to perform the calculation as
>(int64)len * 8. If we use int64, we could also use INT64_FORMAT
>instead of using %ld.
Have followed and changed the patch.
 
>Since this is a bug it shouldn't wait another commitfest, but still
>add this patch to the commitfest so that it's not forgotten.
Will do.


Highgo Software (Canada/China/Pakistan)
URL : www.highgo.ca
EMAIL: mailto:movead(dot)li(at)highgo(dot)ca
Attachment

pgsql-hackers by date:

Previous
From: Andres Freund
Date:
Subject: Re: shared-memory based stats collector
Next
From: David Rowley
Date:
Subject: Re: [PATCH] Erase the distinctClause if the result is unique by definition