Re: Patch to fix write after end of array in hashed agg initialization

From: Andrew Gierth <andrew(at)tao11(dot)riddles(dot)org(dot)uk>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Andres Freund <andres(at)anarazel(dot)de>, Colm McHugh <colm(dot)mchugh(at)gmail(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Patch to fix write after end of array in hashed agg initialization
Date: 2019-05-23 10:44:20
Message-ID: 87woihbgqw.fsf@news-spur.riddles.org.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

>>>>> "Andrew" == Andrew Gierth <andrew(at)tao11(dot)riddles(dot)org(dot)uk> writes:

Andrew> My inclination is to fix this in the planner rather than the
Andrew> executor; there seems no good reason to actually hash a
Andrew> duplicate column more than once.

I take this back; I don't believe it's possible to eliminate duplicates
in all cases. Consider (a,b) IN (select c,c from...), where a,b,c are
different types; I don't think we can assume that (a=c) and (b=c)
cross-type comparisons will necessarily induce the same hash function on
c, and so we might legitimately need to keep it duplicated.

So I'm going with a simpler method of ensuring the array is adequately
sized at execution time and not touching the planner at all. Draft patch
is attached, will commit it later.

--
Andrew (irc:RhodiumToad)

Attachment Content-Type Size
hashfix.patch text/x-patch 4.2 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Simon Riggs 2019-05-23 11:36:09 Re: Read-only access to temp tables for 2PC transactions
Previous Message Mohamed DIA 2019-05-23 10:09:52 Re: Create function using quote_literal issues