Received: from malur.postgresql.org ([2a02:16a8:dc51::56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fj1l5-0000vo-5n for pgsql-hackers@arkaria.postgresql.org; Fri, 27 Jul 2018 12:22:11 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1fj1l2-000222-Sk for pgsql-hackers@arkaria.postgresql.org; Fri, 27 Jul 2018 12:22:08 +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.89) (envelope-from ) id 1fj1l2-00021t-DF for pgsql-hackers@lists.postgresql.org; Fri, 27 Jul 2018 12:22:08 +0000 Received: from mail-qt0-f177.google.com ([209.85.216.177]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1fj1kv-0005AK-Ha for pgsql-hackers@postgresql.org; Fri, 27 Jul 2018 12:22:07 +0000 Received: by mail-qt0-f177.google.com with SMTP id y19-v6so4785563qto.5 for ; Fri, 27 Jul 2018 05:22:00 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:reply-to:subject:to:cc:references:from :organization:message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=kT5qtoihltbJnhfT2gUF61J0Pjwrzxsuwq4uKFW25wE=; b=mCD6iVcwBzCniLGhfKcQSk3ZCqxvXbSRDAQgqZFUD/+Ci9mIKS4p+GZ9r+eMSQ8aHZ zORuNnZnqv/TtZrxTP4YQJ46A5ssnth0U6sq+fTupIRJglURpBwvputq1o2N57Dj9ES0 5sBi2bVD2fs7kK71rd94tfjCo4LE5nQSv3unQNpSy/Lvs0z+xTK/jMElj9xsAnVGr/jO 4U+UsZ4Y60W5h6CQwjtxgO147Wl2AcWwaVllqLPUqiyHnAqMDf7vJGBIwebnfF0MjZda q5K2VYAKVnRvZyqX/hczJFpwJd/lEOSI5kNBc1qOuRZFfHfzaFHBC0YlxU6994k/IGRM bAMw== X-Gm-Message-State: AOUpUlEsN8pOD6g7mDrnxH+XRnM64ni3EDAfiazTMEu5aWWfEFBZhTSq 11lTd6al5AwLSswlMr2uKBWeiRoVxl4= X-Google-Smtp-Source: AAOMgpf3Q/IwnKxoQnd971P5FYIt6NHv5vsN3i5hFYCQw+MIK6PrI7/PLojcHdNtVEfPS+1/J/7hBw== X-Received: by 2002:ac8:1834:: with SMTP id q49-v6mr5945516qtj.223.1532694120132; Fri, 27 Jul 2018 05:22:00 -0700 (PDT) Received: from localhost.localdomain (c-24-61-8-151.hsd1.ma.comcast.net. [24.61.8.151]) by smtp.gmail.com with ESMTPSA id v192-v6sm2919625qkb.0.2018.07.27.05.21.58 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 27 Jul 2018 05:21:58 -0700 (PDT) Reply-To: jesper.pedersen@redhat.com Subject: Re: partition tree inspection functions To: Amit Langote Cc: Michael Paquier , Jeevan Ladhe , Pg Hackers References: <8d00e51a-9a51-ad02-d53e-ba6bf50b2e52@lab.ntt.co.jp> <5a560c9c-3722-1914-f34b-1de0ff3310d1@lab.ntt.co.jp> <20180627121615.GF2667@paquier.xyz> <45e28062-976d-45bf-56f8-9746f551da02@lab.ntt.co.jp> <20180628034341.GH11054@paquier.xyz> <6baeb45a-6222-6b88-342d-37fc7d3cf89a@lab.ntt.co.jp> <4f4a2518-6c62-5463-6ac2-1241ae9d6041@redhat.com> <38183355-ea7c-9443-0c38-6124fcf5f38b@redhat.com> <5686970f-b4e8-bbe5-9109-b97763714c19@lab.ntt.co.jp> <3273a7af-3aca-eb86-cedb-f7b28be00831@lab.ntt.co.jp> <2780ebf9-99ae-b433-2d0c-dbca2995956a@redhat.com> <9f371b71-7b4f-b51c-323c-ca62c4a4ffed@lab.ntt.co.jp> From: Jesper Pedersen Organization: Red Hat Message-ID: Date: Fri, 27 Jul 2018 08:21:57 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <9f371b71-7b4f-b51c-323c-ca62c4a4ffed@lab.ntt.co.jp> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Hi Amit, On 07/26/2018 10:33 PM, Amit Langote wrote: > Optional parameter sounds good, so made it get_partition_level(regclass [ > , regclass ]) in the updated patch. Although, adding that argument is not > without possible surprises its result might evoke. Like, what happens if > you try to find the level of the root table by passing a leaf partition > oid for the root table argument, or pass a totally unrelated table for the > root table argument. For now, I've made the function return 0 for such cases. > As 0 is a valid return value for root nodes I think we should use -1 instead for these cases. Otherwise looks good. Best regards, Jesper