No description
Find a file
David Rowley 5db9367e51 Fix UNION planner datatype issue
66c0185a3 gave the planner the ability to have union child queries
provide the union planner with pre-sorted input so that UNION queries
could be more efficiently implemented using Merge Append.

That commit overlooked checking that the UNION target list and the union
child target list's types all match.  In some corner cases, this could
result in the planner producing sorts using the sort operator of the
top-level UNION's target list type rather than of the union child's
target list's type.  The implications of this range from silently
working correctly, despite using the wrong sort operator all the way up
to a segmentation fault.

Here we fix by adjusting the planner so it makes no attempt to have the
subquery produce pre-sorted results when the data type of the UNION
target list and the types from the subquery target list don't match
exactly.

Backpatch to 17, where 66c0185a3 was introduced.

Reported-by: Jason Smith <dqetool@126.com>
Diagnosed-by: Tom Lane <tgl@sss.pgh.pa.us>
Bug: 18764
Discussion: https://postgr.es/m/18764-63ad667ea26e877a%40postgresql.org
Backpatch-through: 17
2025-01-10 14:31:31 +13:00
config jit: Remove {llvm-config,clang}-N configure probes. 2024-05-16 13:58:25 +12:00
contrib Restore smgrtruncate() prototype in back-branches. 2025-01-08 10:43:40 +13:00
doc Document strange jsonb sort order for empty top level arrays 2025-01-03 10:28:58 -05:00
src Fix UNION planner datatype issue 2025-01-10 14:31:31 +13:00
.cirrus.star Remove duplicate words in docs and code comments. 2023-10-09 09:18:47 +05:30
.cirrus.tasks.yml ci: Fix cached MacPorts installation management 2024-11-27 11:30:00 -05:00
.cirrus.yml ci: Make compute resources for CI configurable 2023-08-23 15:15:28 -07:00
.dir-locals.el Make Emacs perl-mode indent more like perltidy. 2019-01-13 11:32:31 -08:00
.editorconfig Add .editorconfig 2019-12-18 09:13:13 +01:00
.git-blame-ignore-revs Add commit 7229ebe011df to .git-blame-ignore-revs. 2024-09-14 20:17:30 +02:00
.gitattributes Exclude LLVM files from whitespace checks 2024-11-27 11:09:27 +01:00
.gitignore Update top-level .gitignore. 2022-12-04 15:23:00 -05:00
aclocal.m4 autoconf: Move export_dynamic determination to configure 2022-12-06 18:55:28 -08:00
configure Update configure probes for CFLAGS needed for ARM CRC instructions. 2024-11-25 12:50:17 -05:00
configure.ac Update configure probes for CFLAGS needed for ARM CRC instructions. 2024-11-25 12:50:17 -05:00
COPYRIGHT Update copyright for 2025 2025-01-01 11:21:54 -05:00
GNUmakefile.in Allow selecting the git revision to be packaged by "make dist". 2024-05-03 11:08:50 -04:00
HISTORY Canonicalize some URLs 2020-02-10 20:47:50 +01:00
Makefile Adapt REL_17_STABLE to its new status as a stable branch 2024-07-01 08:05:35 +09:00
meson.build Clean up <stdbool.h> reference in meson.build. 2024-11-26 11:31:55 +13:00
meson_options.txt Allow selecting the git revision to be packaged by "make dist". 2024-05-03 11:08:50 -04:00
README.md Adapt REL_17_STABLE to its new status as a stable branch 2024-07-01 08:05:35 +09:00

PostgreSQL Database Management System

This directory contains the source code distribution of the PostgreSQL database management system.

PostgreSQL is an advanced object-relational database management system that supports an extended subset of the SQL standard, including transactions, foreign keys, subqueries, triggers, user-defined types and functions. This distribution also contains C language bindings.

Copyright and license information can be found in the file COPYRIGHT.

General documentation about this version of PostgreSQL can be found at https://www.postgresql.org/docs/17/. In particular, information about building PostgreSQL from the source code can be found at https://www.postgresql.org/docs/17/installation.html.

The latest version of this software, and related software, may be obtained at https://www.postgresql.org/download/. For more information look at our web site located at https://www.postgresql.org/.