David Rowley aa8e50320c Fix Assert failure in WITH RECURSIVE UNION queries
If the non-recursive part of a recursive CTE ended up using
TTSOpsBufferHeapTuple as the table slot type, then a duplicate value
could cause an Assert failure in CheckOpSlotCompatibility() when
checking the hash table for the duplicate value.  The expected slot type
for the deform step was TTSOpsMinimalTuple so the Assert failed when the
TTSOpsBufferHeapTuple slot was used.

This is a long-standing bug which we likely didn't notice because it
seems much more likely that the non-recursive term would have required
projection and used a TTSOpsVirtual slot, which CheckOpSlotCompatibility
is ok with.

There doesn't seem to be any harm done here other than the Assert
failure.  Both TTSOpsMinimalTuple and TTSOpsBufferHeapTuple slot types
require tuple deformation, so the EEOP_*_FETCHSOME ExprState step would
have properly existed in the ExprState.

The solution is to pass NULL for the ExecBuildGroupingEqual's 'lops'
parameter.  This means the ExprState's EEOP_*_FETCHSOME step won't
expect a fixed slot type.  This makes CheckOpSlotCompatibility() happy as
no checking is performed when the ExprEvalStep is not expecting a fixed
slot type.

Reported-by: Richard Guo
Reviewed-by: Tom Lane
Discussion: https://postgr.es/m/CAMbWs4-8U9q2LAtf8+ghV11zeUReA3AmrYkxzBEv0vKnDxwkKA@mail.gmail.com
Backpatch-through: 13, all supported versions
2025-02-25 19:35:46 +00:00
2025-02-07 16:53:29 +00:00
2025-02-18 08:23:36 +00:00
2024-09-25 20:45:09 +01:00
2019-12-18 09:13:13 +01:00
2025-01-07 20:43:59 +00:00
2020-02-10 20:47:50 +01:00
2025-01-07 20:43:59 +00:00

Percona Server for PostgreSQL

Percona Server for PostgreSQL is a free, enhanced, fully compatible, open source, drop-in replacement for the PostgreSQL Database Management System with enterprise-grade features. It requires no changes to PostgreSQL applications or code.

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 Percona Server for PostgreSQL can be found at https://docs.percona.com/postgresql/17/. In particular, information about building PostgreSQL from the source code can be found at https://docs.percona.com/postgresql/17/installing.html.

Submit a bug report or a feature request

If you find a bug in Percona Server for PostgreSQL, you can submit a report to the project's Jira issue tracker

As a general rule of thumb, please try to create a bug report that is:

Reproducible - include the steps on how to reproduce the issue

Specific - include as much detail as possible, such as which version, which environment, etc.

Unique - do not duplicate existing tickets

Scoped to a single issue - only one issue per report

Description
he World's Most Advanced Open Source Relational Database.
Readme 744 MiB
Languages
C 85.3%
PLpgSQL 6%
Perl 4.4%
Yacc 1.2%
Meson 0.7%
Other 2.2%