pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Michael Paquier <michael@paquier.xyz>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Fix handling of COMMENT for domain constraints
Date: Wed, 12 Jun 2019 02:35:31 +0000
Message-ID: <E1hat6p-0000EV-3o@gemulon.postgresql.org> (raw)

Fix handling of COMMENT for domain constraints

For a non-superuser, changing a comment on a domain constraint was
leading to a cache lookup failure as the code tried to perform the
ownership lookup on the constraint OID itself, thinking that it was a
type, but this check needs to happen on the type the domain constraint
relies on.  As the type a domain constraint relies on can be guessed
directly based on the constraint OID, first fetch its type OID and
perform the ownership on it.

This is broken since 7eca575, which has split the handling of comments
for table constraints and domain constraints, so back-patch down to
9.5.

Reported-by: Clemens Ladisch
Author: Daniel Gustafsson, Michael Paquier
Reviewed-by: Álvaro Herrera
Discussion: https://postgr.es/m/15833-808e11904835d26f@postgresql.org
Backpatch-through: 9.5

Branch
------
REL_11_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/fa5f3a4bcca7c222b4ab5a6aba27373aea49a2ec

Modified Files
--------------
src/backend/catalog/objectaddress.c        | 24 +++++++++++++++++++++++-
src/test/regress/input/constraints.source  | 15 +++++++++++++++
src/test/regress/output/constraints.source | 14 ++++++++++++++
3 files changed, 52 insertions(+), 1 deletion(-)



view thread (5+ messages)  latest in thread

Message-ID: <E1hat6p-0000EV-3o@gemulon.postgresql.org>
Permalink:  ../E1hat6p-0000EV-3o@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1hat6p-0000EV-3o@gemulon.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-committers@postgresql.org
  Cc: michael@paquier.xyz
  Subject: Re: pgsql: Fix handling of COMMENT for domain constraints
  In-Reply-To: <E1hat6p-0000EV-3o@gemulon.postgresql.org>
  References: <E1hat6p-0000EV-3o@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox