pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Louis Battuello <louis.battuello@etasseo.com>
Cc: David G. Johnston <david.g.johnston@gmail.com>
Cc: pgsql-general@postgresql.org <pgsql-general@postgresql.org>
Subject: Re: Foreign Key Validation after Reference Table Ownership Change
Date: Wed, 21 Mar 2018 13:52:41 -0400
Message-ID: <24104.1521654761@sss.pgh.pa.us> (raw)
In-Reply-To: <15ABBD1A-BCD6-400F-8F95-62E295A93C7A@etasseo.com>
References: <CAKFQuwZwsSAkGX+9EYwUH0bZ5eXcJ8UDy=TNc1GpHoi2=Qh_Qw@mail.gmail.com>
	<20180321083033.f495bf0537e129b62c3edf58e37f64ff.23347c6e15.mailapi@email02.godaddy.com>
	<CAKFQuwadYCNkn-q_OMHAVx=sSaTHyPbJLvxZgTo6j8w-FJ9HoA@mail.gmail.com>
	<23491.1521653956@sss.pgh.pa.us>
	<15ABBD1A-BCD6-400F-8F95-62E295A93C7A@etasseo.com>

Louis Battuello <louis.battuello@etasseo.com> writes:
>> The point is you can't resolve a name like "schema_1.something" unless
>> you have USAGE on schema_1.  So the RI-checking query, which is run as
>> the owner of the table, fails at parse time.

> That certainly makes sense for user_2 that owns the reference table and is blocked by not having usage on the reference table’s schema.

> But, user_1 owns both schemas and has usage on both but no longer owns the reference table in one schema. Why is user_1’s insert on the referencing table failing? Is the validation of the FK no longer done as user_1?

Exactly, it's done as the owner of the referencing table.  (I don't recall
whether that's uniformly true for all types of FK-enforcement queries,
but evidently it's true for this case.)

			regards, tom lane




view thread (11+ messages)  latest in thread

Message-ID: <24104.1521654761@sss.pgh.pa.us>
Permalink:  ../24104.1521654761@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/24104.1521654761@sss.pgh.pa.us

 · 

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-general@postgresql.org
  Cc: tgl@sss.pgh.pa.us, louis.battuello@etasseo.com, david.g.johnston@gmail.com
  Subject: Re: Foreign Key Validation after Reference Table Ownership Change
  In-Reply-To: <24104.1521654761@sss.pgh.pa.us>
  References: <CAKFQuwZwsSAkGX+9EYwUH0bZ5eXcJ8UDy=TNc1GpHoi2=Qh_Qw@mail.gmail.com> <20180321083033.f495bf0537e129b62c3edf58e37f64ff.23347c6e15.mailapi@email02.godaddy.com> <CAKFQuwadYCNkn-q_OMHAVx=sSaTHyPbJLvxZgTo6j8w-FJ9HoA@mail.gmail.com> <23491.1521653956@sss.pgh.pa.us> <15ABBD1A-BCD6-400F-8F95-62E295A93C7A@etasseo.com> <24104.1521654761@sss.pgh.pa.us>

* 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