pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Michael Paquier <michael.paquier@gmail.com>
To: Robert Haas <robertmhaas@gmail.com>
Cc: amul sul <sulamul@gmail.com>
Cc: Andreas Seltenreich <seltenreich@gmx.de>
Cc: pgsql-hackers@postgresql.org <pgsql-hackers@postgresql.org>
Subject: Re: [COMMITTERS] pgsql: Add hash partitioning.
Date: Tue, 14 Nov 2017 09:32:51 +0900
Message-ID: <CAB7nPqQ9k-W85T7JeFDJ1CESaDRaMPxhWkJ3s0Me++gh==PFcw@mail.gmail.com> (raw)
In-Reply-To: <CA+TgmoZ+gy=sj-=o=85FzNvy49-a3-rR2ziiaxFDuWFgMzMASg@mail.gmail.com>
References: <E1eCvxb-0002YO-84@gemulon.postgresql.org>
	<871sl4sdrv.fsf@ansel.ydns.eu>
	<CAAJ_b95Bbn=O+u3cGAH3az9mYjUVm66iJvoeZSAUxFTq0HETPA@mail.gmail.com>
	<CAAJ_b95BrqX+nLne5djaa0=OtvYSjJGn6VzgMBXB5M3ySMv1Zg@mail.gmail.com>
	<CA+TgmoZ+gy=sj-=o=85FzNvy49-a3-rR2ziiaxFDuWFgMzMASg@mail.gmail.com>

On Tue, Nov 14, 2017 at 3:59 AM, Robert Haas <robertmhaas@gmail.com> wrote:
> On Mon, Nov 13, 2017 at 3:24 AM, amul sul <sulamul@gmail.com> wrote:
>> Updated patch attached -- Adjusted code comment to survive against pgindent.
>
> That's not the right fix, or at least it's not complete.  You
> shouldn't call PG_GETARG_...(n) until you've verified that
> PG_ARGISNULL(n) returns false.
>
> Also, I don't think moving the heap_open() earlier helps anything, but
> you do need to replace Assert(key->partnatts == nkeys) with an
> ereport() -- or just return false, but I think ereport() is probably
> better.  Otherwise someone calling satisfies_hash_function() with a
> wrong number of arguments for the partitioned table can cause an
> assertion failure, which is bad.

Yeah, this patch needs more work. There is no need to do much efforts
on HEAD to crash it:
=# create table aa (a int);
CREATE TABLE
=# select satisfies_hash_partition('aa'::regclass, 0, NULL, 'po');
server closed the connection unexpectedly
    This probably means the server terminated abnormally
    before or while processing the request.

Could you add regression tests calling directly this function?

elog() can also be triggered easily, which should not happen with
user-callable functions:
=# select satisfies_hash_partition(0, 0, NULL, 'po');
ERROR:  XX000: could not open relation with OID 0

Thanks,
-- 
Michael




view thread (10+ messages)  latest in thread

Message-ID: <CAB7nPqQ9k-W85T7JeFDJ1CESaDRaMPxhWkJ3s0Me++gh==PFcw@mail.gmail.com>
Permalink:  ../CAB7nPqQ9k-W85T7JeFDJ1CESaDRaMPxhWkJ3s0Me++gh==PFcw@mail.gmail.com/
Also on:    postgresql.org/message-id/CAB7nPqQ9k-W85T7JeFDJ1CESaDRaMPxhWkJ3s0Me++gh==PFcw@mail.gmail.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-committers@postgresql.org
  Cc: michael.paquier@gmail.com, robertmhaas@gmail.com, sulamul@gmail.com, seltenreich@gmx.de, pgsql-hackers@postgresql.org
  Subject: Re: [COMMITTERS] pgsql: Add hash partitioning.
  In-Reply-To: <CAB7nPqQ9k-W85T7JeFDJ1CESaDRaMPxhWkJ3s0Me++gh==PFcw@mail.gmail.com>
  References: <E1eCvxb-0002YO-84@gemulon.postgresql.org> <871sl4sdrv.fsf@ansel.ydns.eu> <CAAJ_b95Bbn=O+u3cGAH3az9mYjUVm66iJvoeZSAUxFTq0HETPA@mail.gmail.com> <CAAJ_b95BrqX+nLne5djaa0=OtvYSjJGn6VzgMBXB5M3ySMv1Zg@mail.gmail.com> <CA+TgmoZ+gy=sj-=o=85FzNvy49-a3-rR2ziiaxFDuWFgMzMASg@mail.gmail.com> <CAB7nPqQ9k-W85T7JeFDJ1CESaDRaMPxhWkJ3s0Me++gh==PFcw@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox