-
-
Notifications
You must be signed in to change notification settings - Fork 239
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adding a Regclass
type
#1773
Comments
It’s useful, that’s for sure. Perhaps we can extend PgRelation with a ZST to denote the desired lock mode? that probably requires some attention. |
Hm. That certainly sounds plausible! |
There was an extended conversation which got into the deep philosophy of how pgrx should handle arguments. It is... mostly out of scope for this issue. However, we kind of think the answer is that our current implementation is useful but not necessarily desirable because of its implicitness. There's other reasons to want a regclass (which is basically an OID, as discussed), and the only reason PgRelation is our current translation for it is that previously there was an assumption that you would always want to take a lock on the relation if you had it as an argument. So we're going to drop support for PgRelation for now. This issue will remain open as we are going to want to add a semi-proper Regclass type. |
Regclass
type
In pgrx 0.11, if someone passes a
regclass
(which is an OID... so, a u32, really) to a function, we automatically take a lock on relevant relation and do some things that Postgres hints are maybe not sound because we aren't really checking. This is because we are synthesizing thePgRelation
type from that OID.Previous issue
Is this behavior
The absence of its ArgAbi impl was reported as a bug in #1769. Omitting it was not intentional, but I attempted to do a cursory review of the implications of taking the type as an argument and found it surprising.
We've determined this is probably okay despite the comment, but that it's not necessarily desirable. We've selected this implicit LOCKMODE argument which may be okay for many uses but is not really a selection we should be making for you, and there are other reasons for wanting a Regclass that don't have to do with "immediately lock it".
The text was updated successfully, but these errors were encountered: