Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kWyRS-00036y-05 for pgsql-hackers@arkaria.postgresql.org; Mon, 26 Oct 2020 09:05:27 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1kWyRP-0003W5-N3 for pgsql-hackers@arkaria.postgresql.org; Mon, 26 Oct 2020 09:05:23 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kWyRP-0003Vy-CR for pgsql-hackers@lists.postgresql.org; Mon, 26 Oct 2020 09:05:23 +0000 Received: from lahtoruutu.iki.fi ([2a0b:5c81:1c1::37]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kWyRI-0006qb-4g for pgsql-hackers@postgresql.org; Mon, 26 Oct 2020 09:05:22 +0000 Received: from [192.168.1.113] (dsl-hkibng22-54faa4-119.dhcp.inet.fi [84.250.164.119]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: hlinnaka) by lahtoruutu.iki.fi (Postfix) with ESMTPSA id C6D7B1B001A5; Mon, 26 Oct 2020 11:05:11 +0200 (EET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=iki.fi; s=lahtoruutu; t=1603703111; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=sFt03uqLdi1bnZ9xjtg6qXK8NnduoRmANSJU2fqxOgQ=; b=aQdpkYL022wLM7X6WFFuism8gl4cOFrM4nsCp9MszY0IbY5gOI4HBIZOVhem7u73d6rnW3 iIZ2jHeolZpATq8VfpIa9s9iRkJFjLNcOBF3Q3r4LbFplaXik+vtiZ+lV/i0a0mVQi4JUM ocsQIRkzs4DDMmUAHTU3n/tWGSdsPE6/9blFOCZdNkkI2cKrlcwrIIw+7WtDnDYTpE77fN AxsaDAVjXLpB47mZUFVroshq9wuKpfAccaYvZdacOL1CREQ6nlWiXgc/3cDNrpALAu2oUj XtVMkhdCha7bC2wJCCELCKE1beHD9xQqGFqkuQP25L2T5jPK6aLz1zfNHVoHEA== Subject: Re: select_common_typmod To: Peter Eisentraut , pgsql-hackers References: <97df3af9-8b5e-fb7f-a029-3eb7e80d7af9@2ndquadrant.com> From: Heikki Linnakangas Message-ID: <3152222d-4792-d75b-46a8-de22ebb0de31@iki.fi> Date: Mon, 26 Oct 2020 11:05:11 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.3.1 MIME-Version: 1.0 In-Reply-To: <97df3af9-8b5e-fb7f-a029-3eb7e80d7af9@2ndquadrant.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=iki.fi; s=lahtoruutu; t=1603703111; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=sFt03uqLdi1bnZ9xjtg6qXK8NnduoRmANSJU2fqxOgQ=; b=i9Y+5oWDHsf4s8g33yHZosTxUf/T2Yl062aTnwiVj/68S2bW3mu8fYQCDynCkKpOtMldTv 43RwPqQ/oy28JZYjS5Z8tEmFe2TI/k7u/5vTLQA7cj7zN1yaeXuGCNjATEa5Yy8/dObAXC /6WJm+kaiV7qrhvyusn6YojtGFELEgw/8TKN4pZyB4A7EAAnTy4nnGl6tRSR8HjYkWN8Mx wvkFtFLp3po56g/pHr5H5M/llM2KrbFIlvymgyOedYtEUfLna4qcEoB7HBreWXpOJWDK2r UAmANrxPMY+W9qa92S56CyZXU4ehQ41PccyrjWm+a68AfLo77d0ONJUGfVsv0w== ARC-Seal: i=1; s=lahtoruutu; d=iki.fi; t=1603703111; a=rsa-sha256; cv=none; b=iAQFtjOWiXr6ZRt0Y5xj3T6dKgi62qU/Z0eRMF0OeT10cLrbEvyZP/tJvSwVrJjQjQyxIX umjAH52kTbvfBtP/HtU99cfuqr3uKtbjxZRFcPRtmxr6A7yTem6geZMm9TtZR8DnfCc4wB RNFP+EB5/MBo7kbdAKaw9G9QMYuU82g9XnPmg0sjxebDiz5NBEbbVvL8dZ/3ULqPEJjA5+ SwPAhTEK/NAXhDGOevbq3rWufD9KYbKTfduMwMk9EJgGGo1PNr8lnAXrlej3uSb75BsZKh ujuGAyNad4t1fJNRxcxQfbvH+PYwjchDRXLQiwgh54FqIyH4/nI0nVK0yFVvyQ== ARC-Authentication-Results: i=1; ORIGINATING; auth=pass smtp.auth=hlinnaka smtp.mailfrom=hlinnaka@iki.fi List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 20/10/2020 11:58, Peter Eisentraut wrote: > While working on another patch, I figured adding a > select_common_typmod() to go along with select_common_type() and > select_common_collation() would be handy. Typmods were previously > combined using hand-coded logic in several places, and not at all in > other places. The logic in select_common_typmod() isn't very exciting, > but it makes the code more compact and readable in a few locations, and > in the future we can perhaps do more complicated things if desired. Makes sense. > There might have been a tiny bug in transformValuesClause() because > while consolidating the typmods it does not take into account whether > the types are actually the same (as more correctly done in > transformSetOperationTree() and buildMergedJoinVar()). Hmm, it seems so, but I could not come up with a test case to reach that codepath. I think you'd need to create two types in the same typcategory, but with different and incompatible typmod formats. The patch also adds typmod resolution for hypothetical ordered-set aggregate arguments. I couldn't come up with a test case that would tickle that codepath either, but it seems like a sensible change. You might want to mention it in the commit message though. - Heikki