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 1qEljx-0003j1-HR for pgsql-hackers@arkaria.postgresql.org; Thu, 29 Jun 2023 07:06:54 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1qEljv-00050k-OU for pgsql-hackers@arkaria.postgresql.org; Thu, 29 Jun 2023 07:06:51 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1qEljv-00050a-C6 for pgsql-hackers@lists.postgresql.org; Thu, 29 Jun 2023 07:06:51 +0000 Received: from lahtoruutu.iki.fi ([2a0b:5c81:1c1::37]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qEljn-0013PM-NR for pgsql-hackers@lists.postgresql.org; Thu, 29 Jun 2023 07:06:50 +0000 Received: from [192.168.10.13] (93-132-172.internethome.cytanet.com.cy [93.109.132.172]) (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 4Qs8d966Lyz49Q1g; Thu, 29 Jun 2023 10:06:37 +0300 (EEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=iki.fi; s=lahtoruutu; t=1688022398; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=b23WKdQdhDhLIyVHCtULD/VaVuY+cQM3rZFYv0SXoWA=; b=UwzL8Z83EUV71zmkWF04I/9Kjn0yRERlkRYllC/wuy4bxyI8epi0o2S85NlGbBRfzR8E4t 6cx4mIEFE/S60Sb9Ix+w/NfOH0n0KfGwaShqjHbOZ7ku3Chz7KblSZUyYp2iylQ60Sar8b FQafz8CzSTWhqLEekrZhgwezi9hz0IyLvyQ/sO01bhLxbMdR5ou984KfjTEBf9E0CjSngo GObz1+9sWFpuXG/MKcXK6Wx4qDjdKW7Jd56eudgFZzMrgfdYE6GzYnHgvGgLtBwXTKCPju qpd+ZsT9DO9vcoRG3V4BECM80ZEsmzSsaiPmgWHUepQipxdXgd2Q3EZ80wXU7A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=iki.fi; s=lahtoruutu; t=1688022398; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=b23WKdQdhDhLIyVHCtULD/VaVuY+cQM3rZFYv0SXoWA=; b=JRt6BFUdcQvOddeunvnB9zkhzWLPz0xR3FY8FFQfFmgS/lCp814iJJfG25aP+1Z4HMf4E6 J5/RC2pSW3Klqgw4ASH7VqaBePa/NjL0sACi10HFCyddMhWXtBYW8sUGhYoJUmvVr4bF1o NuPHY1UCqan+6hy3vhI4h+2wZOxoN+cqBkpFPccE2jdsaSPMF3bSq+vD3URvifMn4aJl4Q 0nxLhwXAq1Zb9pGA1TPxKktIcjNQypCr0U300QkCf+sbbyEqkY/iGrPfMXwbdlI2pOWtRe bauuO9ekyd1WCpt/QDERMXp10bf9YJkvGzloT/LUz82l+iP+GCyzHXxA7TsmpQ== ARC-Authentication-Results: i=1; ORIGINATING; auth=pass smtp.auth=hlinnaka smtp.mailfrom=hlinnaka@iki.fi ARC-Seal: i=1; s=lahtoruutu; d=iki.fi; t=1688022398; a=rsa-sha256; cv=none; b=G9KUD0Z0UlqYMd76vSnpTnF5kzV25DxNq6EbN3HZw/0kruvTB/EGzUAPKxsMm3mA1LE+tt Th/ym8zAiEMZPM4eXU0EzhOC9RebFOz9ky3naee21MQ7QrSHNfRp7HjUuKLMfBiix7e/M0 CEMtjivROJhoig0Vg5edGaIRDovQk5yRWvxuA019wcG1pUurgZAgayA9K/zDRD+5Srr4OS /GA2bKAf9COayxTb9eqHJGrgEFrXHwRigwJUHSbMpoxM02wzfFih/Sn2N8NjXAFaBZAsu5 Y9YNC6JfPZfM61N9tO1UMopAKwfG7gywkBoPGR3iczsUCJqymx8Z3Ld+rf/Pxg== Content-Type: multipart/mixed; boundary="------------kn6NUTFT4hiMVeoTab2jeqct" Message-ID: <20eea594-a05b-4c31-491b-007b6fceef28@iki.fi> Date: Thu, 29 Jun 2023 10:06:35 +0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.11.0 Subject: Re: Add more sanity checks around callers of changeDependencyFor() Content-Language: en-US To: Michael Paquier , Postgres hackers References: From: Heikki Linnakangas In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk This is a multi-part message in MIME format. --------------kn6NUTFT4hiMVeoTab2jeqct Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 29/06/2023 02:36, Michael Paquier wrote: > Hi all, > > While working on a different patch, I have noted three code paths that > call changeDependencyFor() but don't check that they do not return > errors. In all the three cases (support function, extension/schema > and object/schema), it seems to me that only one dependency update is > expected. Makes sense. > /* update dependencies to point to the new schema */ Suggest: "update dependency ..." in singular, as there should be only one. > if (changeDependencyFor(ExtensionRelationId, extensionOid, > NamespaceRelationId, oldNspOid, nspOid) != 1) > elog(ERROR, "failed to change schema dependency for extension %s", > NameStr(extForm->extname)); The error messages like "failed to change schema dependency for extension" don't conform to the usual error message style. "could not change schema dependency for extension" would be more conformant. I see that you copy-pasted that from existing messages, and we have a bunch of other "failed to" messages in the repository too, so I'm OK with leaving it as it is for now. Or maybe change the wording of all the changeDependencyFor() callers now, and consider all the other "failed to" messages separately later. If changeDependencyFor() returns >= 2, the message is a bit misleading. That's what the existing callers did too, so maybe that's fine. I can hit the above error with the attached test case. That seems wrong, although I don't know if it means that the check is wrong or it exposed a long-standing bug. -- Heikki Linnakangas Neon (https://neon.tech) --------------kn6NUTFT4hiMVeoTab2jeqct Content-Type: text/x-patch; charset=UTF-8; name="fail-to-change-schema-dep-test.patch" Content-Disposition: attachment; filename="fail-to-change-schema-dep-test.patch" Content-Transfer-Encoding: base64 ZGlmZiAtLWdpdCBhL3NyYy90ZXN0L21vZHVsZXMvdGVzdF9leHRlbnNpb25zL3NxbC90ZXN0 X2V4dGVuc2lvbnMuc3FsIGIvc3JjL3Rlc3QvbW9kdWxlcy90ZXN0X2V4dGVuc2lvbnMvc3Fs L3Rlc3RfZXh0ZW5zaW9ucy5zcWwKaW5kZXggZjQ5NDdlN2RhNi4uYjZiOGQ5ZDMxZiAxMDA2 NDQKLS0tIGEvc3JjL3Rlc3QvbW9kdWxlcy90ZXN0X2V4dGVuc2lvbnMvc3FsL3Rlc3RfZXh0 ZW5zaW9ucy5zcWwKKysrIGIvc3JjL3Rlc3QvbW9kdWxlcy90ZXN0X2V4dGVuc2lvbnMvc3Fs L3Rlc3RfZXh0ZW5zaW9ucy5zcWwKQEAgLTIxMCw2ICsyMTAsMTcgQEAgQUxURVIgRVhURU5T SU9OIHRlc3RfZXh0X2NpbmUgVVBEQVRFIFRPICcxLjEnOwogCiBcZHgrIHRlc3RfZXh0X2Np bmUKIAorCistLQorQ1JFQVRFIFNDSEVNQSB0ZXN0X2Z1bmNfZGVwMTsKK0NSRUFURSBTQ0hF TUEgdGVzdF9mdW5jX2RlcDI7CitDUkVBVEUgRVhURU5TSU9OIHRlc3RfZXh0X3JlcV9zY2hl bWExIFNDSEVNQSB0ZXN0X2Z1bmNfZGVwMTsKK0FMVEVSIEZVTkNUSU9OIHRlc3RfZnVuY19k ZXAxLmRlcF9yZXExKCkgU0VUIFNDSEVNQSB0ZXN0X2Z1bmNfZGVwMjsKKworQUxURVIgRVhU RU5TSU9OIHRlc3RfZXh0X3JlcV9zY2hlbWExIFNFVCBTQ0hFTUEgdGVzdF9mdW5jX2RlcDI7 CisKK0RST1AgRVhURU5TSU9OIHRlc3RfZXh0X3JlcV9zY2hlbWExIENBU0NBREU7CisKIC0t CiAtLSBUZXN0IEBleHRzY2hlbWE6ZXh0bmFtZUAgc3ludGF4IGFuZCBub19yZWxvY2F0ZSBv cHRpb24KIC0tCg== --------------kn6NUTFT4hiMVeoTab2jeqct--