Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@deart2k
Copy link
Member

@deart2k deart2k commented Aug 19, 2019

No description provided.

deart2k and others added 2 commits August 19, 2019 11:51
in gp_distribution_policy relation for inherited tables in GP5X
(GP6X is ok).
Query planes with GPORCA caused segmentation fault because of
out of range column numbers and postgres optimizer simply
returned error before current patch. For example:

create table ta (a int) distributed randomly;
create table tb (a int, b int) inherits (ta) distributed by (b);

set optimizer=on;
insert into tb values(0, 0);
-- Segmentation fault

set optimizer=off;
insert into tb values(0, 0);
-- ERROR: no tlist entry for key 3 (cdbmutate.c:1484)

select attrnums from gp_distribution_policy where localoid = 'tb'::regclass;
 attrnums
----------
{3}
(1 row)

Also a check for setting non-hashable distribution key from a
parent table in an inherited one didn't work.

create table tc (a point) distributed randomly;
create table td (b int) inherits (tc) distributed by (a);

select * from td;
ERROR:  could not find mergejoinable = operator for type 600 (pathkeys.c:1174)

Co-authored-by: Vasiliy Ivanov <[email protected]>

Reviewed-by: Georgios Kokolatos <[email protected]>
@deart2k deart2k requested review from darthunix and dursegov August 19, 2019 10:02
@deart2k deart2k merged commit 72e1d20 into adb-5.x Aug 19, 2019
RekGRpth pushed a commit that referenced this pull request Dec 3, 2025
Prior to 3ce2e6a, querying pg_locks (or using pg_lock_status()),
approximately 75% of backend memory allocations for resulting tuples weren't
registered with Vmtracker or Resource Group Control. This memory would also
leak if the query was cancelled or failed.

This happened because CdbDispatchCommand(), which was previously used by
pg_locks, called libpq to obtain the results that were allocated as PQresult
structures with bare malloc(), even on the server side.

This patch fixes both untracked memory issues by enforcing Vmtracker routines
for PGresult allocations on the server-side.

Including postgres.h in frontend code causes several errcode-related macro
redefinition warnings. They are now un-definined first.

Recursive errors due to mishandled OOM errors are addressed in c4e1085.
This PR also adds an additional set of tests, building on top of the said
commit.

Ticket: ADBDEV-7691
@Stolb27 Stolb27 deleted the adb-5x-forrevert branch December 11, 2025 09:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants