Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eEP9u-0005P9-79 for pgsql-hackers@arkaria.postgresql.org; Tue, 14 Nov 2017 00:32:58 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eEP9t-0003Ee-Kl for pgsql-hackers@arkaria.postgresql.org; Tue, 14 Nov 2017 00:32:57 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1eEP9t-0003EL-9q for pgsql-hackers@lists.postgresql.org; Tue, 14 Nov 2017 00:32:57 +0000 Received: from mail-wm0-x22b.google.com ([2a00:1450:400c:c09::22b]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1eEP9p-0004FS-Sa for pgsql-hackers@postgresql.org; Tue, 14 Nov 2017 00:32:55 +0000 Received: by mail-wm0-x22b.google.com with SMTP id v186so9632333wma.2 for ; Mon, 13 Nov 2017 16:32:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=kB9oTTVzXp+EqgzNTpmr2x6nQWhXEojv3p8rHpddI50=; b=QbciSVhYbqItO4s4h/fEKUl+nyQ2ITRZdyOdrPoWVSY43cWAkiR71COFbLLX80RBYe Z3ZSGJtXdEBzKQANTw4iyj7/Z9qgKA4lkg0ej0XmNY7BWDcmqcONnFhN9oY/ItcpVRta /4qWpmZUjkKACBl/HCNlEzBlR8M39kVFOVFV5qNEFUk8mqyk3oEYLju3ZGNDPJzQn0+Y KGhSJFCJlRWLv/2oxDZ05RaQKzeLL7X+d47ouEyhBi6yNRa/TnfjhKVTYd/Sc1jyS88X pmWvG9F9suf5Y8XLEvDa7iE0sJqHzVOytoGg6/VCB4xL5AJ2XHjF11vlOu2ZlAdXqTfW IiGg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=kB9oTTVzXp+EqgzNTpmr2x6nQWhXEojv3p8rHpddI50=; b=SviV8lSgUlYkXCWNbZzEhwql2M8q04juHc2QFN4yeb5SR4kIR40PIGBC25z1A12UlL VYUvRODt32UvS3sfgDpfGE7hvXbkp++WIMNv25mNIk7HHkDwHm8vp1VHfJWW4RC4Q7b3 sxYe5r+Yai3VY/i7BIyhirHMBkm1t/n39+3YWY5TlEWbl4X9vZUbT4jynVMPdpECXzxc UG4WSal4kGFn4cBxYqWKXnEHW4P2i483wM4wOWOdJuuomXjc7s0jkST+IxCYvfSxYufD ZsNLaiDshsNlSJMvRgfb3/NFncysxQc6UslwHwTeUC4SMtRmfXnibzipTuBfkg/jkx2b AE/w== X-Gm-Message-State: AJaThX5wCZYivXve01lQT5c+I9/RcGyVt+zD6WpBhh6zztCLPjEoTgZL igobdrfpdlEPMujgmx7u4i6jMWSMQs0Re/rZ7+A= X-Google-Smtp-Source: AGs4zMb5c/VPeKMWKjndV+OrV3b/+IIRHQ4gVpi8GtrHOkstWxjiEGTGOaP0Qtk2Qwydm9C3IRRFt3cZCabhCXplLD4= X-Received: by 10.28.169.198 with SMTP id s189mr7068522wme.65.1510619572043; Mon, 13 Nov 2017 16:32:52 -0800 (PST) MIME-Version: 1.0 Received: by 10.223.157.137 with HTTP; Mon, 13 Nov 2017 16:32:51 -0800 (PST) In-Reply-To: References: <871sl4sdrv.fsf@ansel.ydns.eu> From: Michael Paquier Date: Tue, 14 Nov 2017 09:32:51 +0900 Message-ID: Subject: Re: [COMMITTERS] pgsql: Add hash partitioning. To: Robert Haas Cc: amul sul , Andreas Seltenreich , "pgsql-hackers@postgresql.org" Content-Type: text/plain; charset="UTF-8" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On Tue, Nov 14, 2017 at 3:59 AM, Robert Haas wrote: > On Mon, Nov 13, 2017 at 3:24 AM, amul sul 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