postgresql/contrib
Heikki Linnakangas bcbbd070d4 seg: Fix seg_out() to preserve the upper boundary's certainty indicator
When printing the upper boundary of a seg interval, seg_out() decided
whether to emit the certainty indicator ('<', '>' or '~') by testing the
upper indicator (u_ext) for '<' and '>', but mistakenly tested the lower
indicator (l_ext) for '~'.  This is a copy-and-paste slip from the
symmetric code that prints the lower boundary a few lines above.

The consequences for valid input were:

  * A '~' on the upper boundary was dropped on output, e.g.
    '1.5 .. ~2.5'::seg printed as '1.5 .. 2.5'.

  * When the lower boundary carried '~' but the upper boundary had no
    indicator, the wrong test matched and sprintf(p, "%c", seg->u_ext)
    wrote a NUL byte (u_ext == '\0'), which truncated the result string
    and silently lost the entire upper boundary, e.g.
    '~6.5 .. 8.5'::seg printed as '~6.5 .. '.

Certainty indicators are documented to be preserved on output (they are
ignored by the operators, but kept as comments), so this broke the
input/output round-trip for the affected values.

The bug has existed since seg was added.  It went unnoticed because the
existing regression tests only exercised certainty indicators on
single-point segs, which are printed by a different branch of seg_out().
Add tests that place indicators on both boundaries of an interval.

Author: Ewan Young <kdbase.hack@gmail.com>
Discussion: https://www.postgresql.org/message-id/CAON2xHPYeRRCEVAv8XfE18KsEsEHCiYcJ5fOsoxFuMEfpxF1=g@mail.gmail.com
Backpatch-through: 14
2026-06-11 12:34:32 +03:00
..
amcheck amcheck: Fix snapshot usage in bt_index_parent_check 2026-01-21 18:55:43 +01:00
auth_delay Update copyright for 2024 2024-01-03 20:49:05 -05:00
auto_explain Allow resetting unknown custom GUCs with reserved prefixes. 2025-08-01 16:52:11 -05:00
basebackup_to_shell Update copyright for 2024 2024-01-03 20:49:05 -05:00
basic_archive basic_archive: Allow archive directory to be missing at startup. 2026-03-02 13:12:25 -06:00
bloom Clean up newlines following left parentheses 2024-11-26 17:10:07 +01:00
bool_plperl Update copyright for 2024 2024-01-03 20:49:05 -05:00
btree_gin Update copyright for 2024 2024-01-03 20:49:05 -05:00
btree_gist Replace pg_mblen() with bounds-checked versions. 2026-02-09 12:42:47 +13:00
citext Skip citext_utf8 test on Windows. 2024-05-13 07:55:58 +12:00
cube Update copyright for 2024 2024-01-03 20:49:05 -05:00
dblink Avoid resource leaks when a dblink connection fails. 2025-05-29 10:39:55 -04:00
dict_int Update copyright for 2024 2024-01-03 20:49:05 -05:00
dict_xsyn Replace pg_mblen() with bounds-checked versions. 2026-02-09 12:42:47 +13:00
earthdistance contrib/earthdistance: Use SQL-standard function bodies. 2024-12-14 16:07:18 -05:00
file_fdw Fix bogus ctid requirement for dummy-root partitioned targets 2026-01-23 10:23:22 +09:00
fuzzystrmatch Update copyright for 2024 2024-01-03 20:49:05 -05:00
hstore hstore: Fix NULL pointer dereference with receive function 2026-02-17 08:41:32 +09:00
hstore_plperl Use palloc_array() in a few more places to avoid overflow 2026-05-11 21:28:57 +03:00
hstore_plpython Use palloc_array() in a few more places to avoid overflow 2026-05-11 21:28:57 +03:00
intagg Update copyright for 2024 2024-01-03 20:49:05 -05:00
intarray Fix missed ReleaseVariableStats() in intarray's _int_matchsel(). 2026-05-25 18:15:49 -04:00
isn Update copyright for 2024 2024-01-03 20:49:05 -05:00
jsonb_plperl Update copyright for 2024 2024-01-03 20:49:05 -05:00
jsonb_plpython Update copyright for 2024 2024-01-03 20:49:05 -05:00
lo Repair incorrect handling of AfterTriggerSharedData.ats_modifiedcols. 2025-01-22 11:58:20 -05:00
ltree Re-add regression tests for ltree and intarray 2026-05-15 18:02:49 +09:00
ltree_plpython Update copyright for 2024 2024-01-03 20:49:05 -05:00
oid2name Update copyright for 2024 2024-01-03 20:49:05 -05:00
pageinspect Replace pg_mblen() with bounds-checked versions. 2026-02-09 12:42:47 +13:00
passwordcheck Update copyright for 2024 2024-01-03 20:49:05 -05:00
pg_buffercache Add CHECK_FOR_INTERRUPTS in contrib/pg_buffercache functions. 2025-08-19 12:11:37 -07:00
pg_freespacemap Prevent assertion failure in contrib/pg_freespacemap. 2025-03-27 13:20:23 -04:00
pg_prewarm Allow role created by new test to log in on Windows. 2025-10-18 18:36:21 -04:00
pg_stat_statements Avoid memory leak on error while parsing pg_stat_statements dump file 2026-03-27 12:21:38 +02:00
pg_surgery pg_surgery: Fix off-by-one bug with heap offset 2026-06-06 08:16:41 +09:00
pg_trgm Code coverage for most pg_mblen* calls. 2026-02-09 12:42:59 +13:00
pg_visibility Restore smgrtruncate() prototype in back-branches. 2025-01-08 10:43:40 +13:00
pg_walinspect Update copyright for 2024 2024-01-03 20:49:05 -05:00
pgcrypto pgcrypto: Tweak error message for incorrect session key length 2026-02-16 12:18:30 +09:00
pgrowlocks Update copyright for 2024 2024-01-03 20:49:05 -05:00
pgstattuple pgstattuple: Improve reports generated for indexes (hash, gist, btree) 2025-10-02 11:09:12 +09:00
postgres_fdw postgres_fdw: Fix handling of abort-cleanup-failed connections. 2026-05-05 18:55:03 +09:00
seg seg: Fix seg_out() to preserve the upper boundary's certainty indicator 2026-06-11 12:34:32 +03:00
sepgsql meson: Fix sepgsql installation 2025-01-24 10:26:59 +01:00
spi refint: Remove plan cache. 2026-06-05 12:08:05 -05:00
sslinfo Revert "Add notBefore and notAfter to SSL cert info display" 2024-03-22 22:58:41 +01:00
start-scripts Remove gratuitous references to postmaster program 2023-01-26 10:48:32 +01:00
tablefunc Make contrib/tablefunc crosstab() also check typmod 2024-03-09 17:32:32 -05:00
tcn Update copyright for 2024 2024-01-03 20:49:05 -05:00
test_decoding Fix re-distributing previously distributed invalidation messages during logical decoding. 2025-06-16 17:35:58 -07:00
tsm_system_rows Update copyright for 2024 2024-01-03 20:49:05 -05:00
tsm_system_time Update copyright for 2024 2024-01-03 20:49:05 -05:00
unaccent Replace pg_mblen() with bounds-checked versions. 2026-02-09 12:42:47 +13:00
uuid-ossp Make the order of the header file includes consistent 2024-03-13 15:07:00 +01:00
vacuumlo Update copyright for 2024 2024-01-03 20:49:05 -05:00
xml2 xml2: Fix crash with namespace nodes in xpath_nodeset() 2026-06-11 14:29:24 +09:00
contrib-global.mk Respect TEMP_CONFIG when pg_regress_check and friends are called 2016-02-27 12:28:21 -05:00
Makefile Remove the adminpack contrib extension 2024-03-04 12:39:22 +01:00
meson.build Remove the adminpack contrib extension 2024-03-04 12:39:22 +01:00
README Rename 'gmake' to 'make' in docs and recommended commands 2014-02-12 17:29:19 -05:00

The PostgreSQL contrib tree
---------------------------

This subtree contains porting tools, analysis utilities, and plug-in
features that are not part of the core PostgreSQL system, mainly
because they address a limited audience or are too experimental to be
part of the main source tree.  This does not preclude their
usefulness.

User documentation for each module appears in the main SGML
documentation.

When building from the source distribution, these modules are not
built automatically, unless you build the "world" target.  You can
also build and install them all by running "make all" and "make
install" in this directory; or to build and install just one selected
module, do the same in that module's subdirectory.

Some directories supply new user-defined functions, operators, or
types.  To make use of one of these modules, after you have installed
the code you need to register the new SQL objects in the database
system by executing a CREATE EXTENSION command.  In a fresh database,
you can simply do

    CREATE EXTENSION module_name;

See the PostgreSQL documentation for more information about this
procedure.