From: PG Bug reporting form <noreply@postgresql.org>
To: pgsql-bugs@lists.postgresql.org
Cc: amovitz@bncpu.com
Subject: BUG #16403: set_bit function does not have expected effect
Date: Wed, 29 Apr 2020 21:50:53 +0000
Message-ID: <16403-c4ad1c176b130a5b@postgresql.org> (raw)
The following bug has been logged on the website:
Bug reference: 16403
Logged by: Alex Movitz
Email address: amovitz@bncpu.com
PostgreSQL version: 11.0
Operating system: Linux
Description:
Input:
SELECT set_bit('\x00000000'::bytea, 0, 1);
Expected Output:
'\x00000001' or '\x80000000'
Actual Output:
'\x01000000'
Input:
SELECT set_bit('\x00000000'::bytea, 8, 1);
Expected Output:
'\x00000100' or '\x00800000'
Actual Output:
'\x00010000'
Issue:
set_bit function changes the right-most bit of the byte, but with
little-endian byte order. This is confusing to any use case where setting a
bit in a BYTEA in a specific position. To iterate through the bits within
the BYTEA, one must have nested loops which set bits within byte boundaries.
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-bugs@postgresql.org
Cc: noreply@postgresql.org, pgsql-bugs@lists.postgresql.org, amovitz@bncpu.com
Subject: Re: BUG #16403: set_bit function does not have expected effect
In-Reply-To: <16403-c4ad1c176b130a5b@postgresql.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox