From: | Daniel Gustafsson <daniel(at)yesql(dot)se> |
---|---|
To: | Michael Paquier <michael(at)paquier(dot)xyz> |
Cc: | Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, clemens(at)ladisch(dot)de, PostgreSQL mailing lists <pgsql-bugs(at)lists(dot)postgresql(dot)org> |
Subject: | Re: BUG #15833: defining a comment on a domain constraint fails with wrong OID |
Date: | 2019-06-10 10:25:57 |
Message-ID: | 03D5C161-2624-4131-9BFF-16BF1D0CA1F2@yesql.se |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
> On 10 Jun 2019, at 08:28, Michael Paquier <michael(at)paquier(dot)xyz> wrote:
>
> On Fri, Jun 07, 2019 at 02:42:33PM +0900, Michael Paquier wrote:
>> Well, it wouldn't be a problem to do a syscache lookup and then use
>> the type from contypid, no? It seems to me that it would be more
>> consistent to just add a pg_domain_constraint_ownercheck() in aclchk.c
>> as all the syscache lookups happen their for all the other objects
>> types. What do you think?
>
> Attached is what I have in mind. There are already tests at the
> bottom of constraints.source checking for comments on both table and
> domain constraints, so my proposal is to run them with a dedicated
> role. What do you think?
+1 on the approach of the patch, it seems like the simplest approach. A
comment on the check_object_ownership() diff though:
+ if (!pg_domain_constraint_ownercheck(address.objectId, roleid))
+ aclcheck_error_type(ACLCHECK_NOT_OWNER, address.objectId);
This doesn’t work for the errorcase as the address.objectId is the wrong Oid
here as well, the contypid extracted in pg_domain_constraint_ownercheck() is
required. I’ve hacked up your patch to pass it back and that seems to work,
and also added a test for the errorpath. Another option would be to provide a
new aclcheck_error_domain_constraint(), not sure which is best.
cheers ./daniel
Attachment | Content-Type | Size |
---|---|---|
dom-constraint-comments-v2.patch | application/octet-stream | 6.8 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Alvaro Herrera | 2019-06-10 12:55:27 | Re: BUG #15833: defining a comment on a domain constraint fails with wrong OID |
Previous Message | Michael Paquier | 2019-06-10 06:28:55 | Re: BUG #15833: defining a comment on a domain constraint fails with wrong OID |