Re: Add more sanity checks around callers of changeDependencyFor()
Heikki Linnakangas <hlinnaka@iki.fi>
From: Heikki Linnakangas <hlinnaka@iki.fi>
To: Michael Paquier <michael@paquier.xyz>,
Postgres hackers <pgsql-hackers@lists.postgresql.org>
Date: 2023-06-29T07:06:35Z
Lists: pgsql-hackers
Attachments
- fail-to-change-schema-dep-test.patch (text/x-patch) patch
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)
Commits
Same data as JSON:
GET /api/v1/messages/:b64id/commits
the thread's linked commits as JSON, with link sources.
API reference →
-
Add more sanity checks with callers of changeDependencyFor()
- 9b286858e3ab 17.0 landed
-
Fix ALTER EXTENSION SET SCHEMA with objects outside an extension's schema
- 914e72e6e8d3 11.21 landed
- 02021f1b2f65 12.16 landed
- f5b075adcf4c 13.12 landed
- 235e716bc24d 14.9 landed
- d1e0f408cbe2 15.4 landed
- 55c95f24cd7c 16.0 landed
- bd5ddbe8666a 17.0 landed