diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2020-04-07 15:57:58 -0400 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2020-04-07 15:57:58 -0400 |
commit | 26a944cf29ba67bb49f42656dd2be98fe2485f5f (patch) | |
tree | d234713a62696aeb655b27b3c5756588809fa588 /doc/src | |
parent | 9c74ceb20b991f786f71666d4b4d557d2744a567 (diff) | |
download | postgresql-26a944cf29ba67bb49f42656dd2be98fe2485f5f.tar.gz postgresql-26a944cf29ba67bb49f42656dd2be98fe2485f5f.zip |
Adjust bytea get_bit/set_bit to use int8 not int4 for bit numbering.
Since the existing bit number argument can't exceed INT32_MAX, it's
not possible for these functions to manipulate bits beyond the first
256MB of a bytea value. Lift that restriction by redeclaring the
bit number arguments as int8 (which requires a catversion bump,
hence is not back-patchable).
The similarly-named functions for bit/varbit don't really have a
problem because we restrict those types to at most VARBITMAXLEN bits;
hence leave them alone.
While here, extend the encode/decode functions in utils/adt/encode.c
to allow dealing with values wider than 1GB. This is not a live bug
or restriction in current usage, because no input could be more than
1GB, and since none of the encoders can expand a string more than 4X,
the result size couldn't overflow uint32. But it might be desirable
to support more in future, so make the input length values size_t
and the potential-output-length values uint64.
Also add some test cases to improve the miserable code coverage
of these functions.
Movead Li, editorialized some by me; also reviewed by Ashutosh Bapat
Discussion: https://postgr.es/m/20200312115135445367128@highgo.ca
Diffstat (limited to 'doc/src')
-rw-r--r-- | doc/src/sgml/func.sgml | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/doc/src/sgml/func.sgml b/doc/src/sgml/func.sgml index cc4a7bf8dfa..a38387b8c60 100644 --- a/doc/src/sgml/func.sgml +++ b/doc/src/sgml/func.sgml @@ -2905,7 +2905,7 @@ SELECT format('Testing %3$s, %2$s, %s', 'one', 'two', 'three'); <indexterm> <primary>get_bit</primary> </indexterm> - <literal><function>get_bit(<parameter>bytes</parameter> <type>bytea</type>, <parameter>offset</parameter> <type>int</type>)</function></literal> + <literal><function>get_bit(<parameter>bytes</parameter> <type>bytea</type>, <parameter>offset</parameter> <type>bigint</type>)</function></literal> </entry> <entry><type>int</type></entry> <entry> @@ -2990,7 +2990,7 @@ SELECT format('Testing %3$s, %2$s, %s', 'one', 'two', 'three'); <primary>set_bit</primary> </indexterm> <literal><function>set_bit(<parameter>bytes</parameter> <type>bytea</type>, - <parameter>offset</parameter> <type>int</type>, + <parameter>offset</parameter> <type>bigint</type>, <parameter>newvalue</parameter> <type>int</type>)</function></literal> </entry> <entry><type>bytea</type></entry> |