pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Schneider (AWS), Jeremy <schnjere@amazon.com>
Cc: PostgreSQL-development <pgsql-hackers@postgresql.org>
Subject: Re: relation OID in ReorderBufferToastReplace error message
Date: Thu, 01 Jul 2021 23:44:44 -0400
Message-ID: <777837.1625197484@sss.pgh.pa.us> (raw)
In-Reply-To: <48B6BE63-FE39-45B8-9AD8-819DAAC5877F@amazon.com>
References: <808ed65b-994c-915a-361c-577f088b837f@amazon.com>
	<772142.1625191000@sss.pgh.pa.us>
	<48B6BE63-FE39-45B8-9AD8-819DAAC5877F@amazon.com>

"Schneider (AWS), Jeremy" <schnjere@amazon.com> writes:
>> On Jul 1, 2021, at 18:57, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> But I wonder why
>> print the parent's OID, when we have access to its name.

> Seems like a few people do schema-based multi-tenancy with similarly named relations in different namespaces, so I’d have a preference for OID over an unqualified relation name. Also the error message shows the OID for the toast relation so this is consistent.

Um, well, the reason we're printing the OID for the toast rel is exactly
that we've not been able to resolve an associated relation, so the OID is
the *only* thing that we have.  But we do have the parent rel's relcache
entry at hand.

> Relation name could work too though, especially if the schema was included

I'm definitely -1 on trying to print the schema name, because that would
require an additional catalog fetch.  If we're in this situation at all,
catalog fetches are suspect; we could easily end up hitting an additional
failure that will probably print a *totally* uninformative message.

I understand your point about similarly-named tables in different schemas,
but Postgres' error messages are uniformly unfriendly to that case, and
I'm not seeing a good reason why this one needs to be different.  On the
other side, I think there are good reasons not to print an OID when we
don't have to: there are plenty of situations where you can't readily
trace the OID to anything at all.  For example, if this error showed up
in a buildfarm run, what do you think the odds would be of identifying
which table the OID referred to?  Maybe you could do it given knowledge
that the error could only be referencing one of a few specific tables,
but it'd still be questionable.

So I think the relation name is what to print here.  That's generally
what we do, and there's not much argument for this case to be different.

(I'm not unsympathetic to the idea that printing schema names
would be helpful.  Just that here is not where to start with
that.  Maybe we could consider sucking in the schema name
during relcache entry build, and then print from that copy so we
don't need an additional catalog fetch under error conditions?)

			regards, tom lane





view thread (19+ messages)  latest in thread

Message-ID: <777837.1625197484@sss.pgh.pa.us>
Permalink:  ../777837.1625197484@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/777837.1625197484@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-hackers@postgresql.org
  Cc: tgl@sss.pgh.pa.us, schnjere@amazon.com
  Subject: Re: relation OID in ReorderBufferToastReplace error message
  In-Reply-To: <777837.1625197484@sss.pgh.pa.us>
  References: <808ed65b-994c-915a-361c-577f088b837f@amazon.com> <772142.1625191000@sss.pgh.pa.us> <48B6BE63-FE39-45B8-9AD8-819DAAC5877F@amazon.com> <777837.1625197484@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