Michael Paquier 606f709e3d Fix memory leak in pgoutput with relation attribute map
pgoutput caches the attribute map of a relation, that is free()'d only
when validating a RelationSyncEntry.  However, this code path is not
taken when calling any of the SQL functions able to do some logical
decoding, like pg_logical_slot_{get,peek}_changes(), leaking some memory
into CacheMemoryContext on repeated calls.

To address this, a relation's attribute map is allocated in
PGOutputData's cachectx, free()'d at the end of the execution of these
SQL functions when logical decoding ends.  This is available down to 15.
v13 and v14 have a similar leak, which will be dealt with later.

Reported-by: Masahiko Sawada
Author: Vignesh C
Reviewed-by: Hou Zhijie
Discussion: https://postgr.es/m/CAD21AoDkAhQVSukOfH3_reuF-j4EU0-HxMqU3dU+bSTxsqT14Q@mail.gmail.com
Discussion: https://postgr.es/m/CALDaNm1hewNAsZ_e6FF52a=9drmkRJxtEPrzCB6-9mkJyeBBqA@mail.gmail.com
Backpatch-through: 15
2025-02-25 19:41:19 +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 743 MiB
Languages
C 85.3%
PLpgSQL 6%
Perl 4.4%
Yacc 1.2%
Meson 0.7%
Other 2.2%