Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1haK2Z-0003ea-HJ for pgsql-bugs@arkaria.postgresql.org; Mon, 10 Jun 2019 13:08:47 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1haK2X-0007Zg-A7 for pgsql-bugs@arkaria.postgresql.org; Mon, 10 Jun 2019 13:08:45 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1haK2W-0007ZZ-Sl for pgsql-bugs@lists.postgresql.org; Mon, 10 Jun 2019 13:08:45 +0000 Received: from mail-qt1-x843.google.com ([2607:f8b0:4864:20::843]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1haK2T-00009m-Uq for pgsql-bugs@lists.postgresql.org; Mon, 10 Jun 2019 13:08:44 +0000 Received: by mail-qt1-x843.google.com with SMTP id a15so10439892qtn.7 for ; Mon, 10 Jun 2019 06:08:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=2ndquadrant-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:mime-version:content-disposition :content-transfer-encoding:in-reply-to:user-agent; bh=PnKw9n6YV0zJnKdpifabeTZUgdZo1pDz5YiAXCvoHI0=; b=kuFjREYaprNyjRuQNY/ML/A0XLE6CzwsvkVOCUiLQCEyUwXV2giW80abMZGLr6XS/M rtBjVlskMQ7ZYJRLf+j5oGFTe8ag/zBbch2D5RTrzFKF848HhHeSWmx60DAxsbEgWUgS 2Zx1AFy6uDhIXcgw4tmv5QfVxbC62rLedeaeC+VVfSHK8H+c/Cxx5UASyUpgj1snYSlN 34+gEUh0WAYegCo/+npcmPRqDv+mzsjfWr/iVWxjH7fJ+90R64a2dmJwGFRlT88nI1x8 KCMROseX1RMUNy14T8jmfWbDdKTSFOSr/X4/uJ2kXwB6qTbjDKU0z7IgPqLqhnqPMEcW OlJA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=PnKw9n6YV0zJnKdpifabeTZUgdZo1pDz5YiAXCvoHI0=; b=a94glZqCd7c7E58ruThzjTMB/V/OTFNtFM97fRkJJI0zWzZP0se0vE+g1fdZTi0Lj7 QQDEzDTGbtWjNdCs0X1S4WwSuZrFcsQq4u1HNDymDMavErNQgryWudnnUaGDYwR0cXQP 8RHuWlv+Qbt2Y9QfedNHWhZ4Zv7mMl+4krjWrdCTwTkoVhLROQc+6PAB04qPaot4Z7H8 MU9Svn0x89cpakcs/07WPf5v0vXPVhfGXzb/CnDCIjHmAz7ByuBuY2hJ3FZITEkH1gJw lstIL6Y4vvh2RVAXNA12SlI+BDGVqZRtuSKCfL9TN5u4Oy7srP6m9iggyS/8vf/208oK g2Rg== X-Gm-Message-State: APjAAAUUZzylahThrK26XQP9sfZxtk0bOgrUPpI9v7MqcPX9HwS7K8X1 pxKX55mOlyDTaIDwDJOkoCGmI7SG8zdYPQ== X-Google-Smtp-Source: APXvYqyNHjF++EnNiLGRb+J6wcmxcPtXrmoW/bqk+4E/JhfP1xdPVMHOn3Hjk2EW7Y3eHqrSeffQAA== X-Received: by 2002:ad4:43e3:: with SMTP id f3mr14432872qvu.108.1560172118794; Mon, 10 Jun 2019 06:08:38 -0700 (PDT) Received: from nimloth.alvh.no-ip.org ([177.154.145.102]) by smtp.gmail.com with ESMTPSA id f25sm1478033qta.81.2019.06.10.06.08.37 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 10 Jun 2019 06:08:38 -0700 (PDT) Received: by nimloth.alvh.no-ip.org (Postfix, from userid 1000) id CAFBD12040A; Mon, 10 Jun 2019 08:55:27 -0400 (-04) Date: Mon, 10 Jun 2019 08:55:27 -0400 From: Alvaro Herrera To: Daniel Gustafsson Cc: Michael Paquier , clemens@ladisch.de, PostgreSQL mailing lists Subject: Re: BUG #15833: defining a comment on a domain constraint fails with wrong OID Message-ID: <20190610125527.GA30133@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <03D5C161-2624-4131-9BFF-16BF1D0CA1F2@yesql.se> User-Agent: Mutt/1.9.4 (2018-02-28) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 2019-Jun-10, Daniel Gustafsson wrote: > +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, -1 on this approach. Having this ownercheck function return the owning object ID seems way too strange. I'd rather not have the new ownercheck function, and instead do a syscache search to obtain the type OID in check_object_ownership, then do pg_type_ownercheck. I'm not even sure that pg_domain_constraint_ownercheck makes a lot of sense in itself, since it's never the constraint that requires an owner check. -- Álvaro Herrera https://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services