Re: relation OID in ReorderBufferToastReplace error message
Jeremy Schneider <schnjere@amazon.com>
From: Jeremy Schneider <schnjere@amazon.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: PostgreSQL-development <pgsql-hackers@postgresql.org>
Date: 2021-07-03T01:57:37Z
Lists: pgsql-hackers
On 7/1/21 20:44, Tom Lane wrote: > 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. Works for me. Anything in the error message is quickly and easily visible to users, without attaching debuggers or decoding WAL. A lot of PostgreSQL users won't know how to do the advanced troubleshooting, but knowing the table name might give a clue for better identifying SQL that might have been related, and could help produce better bug reports to the mailing lists in the future. Related to that, I do think it could be useful to backpatch this - we know that users are hitting this error on older versions. Even though it's most likely that the speculative insert decoding memory leak bug will address the problem, this update still seems low-risk and useful to me just in the off-chance that someone hits the error again. > (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?) Agreed not to tackle that in this thread; I wouldn't want to slow down the simple tweak that could be useful. -Jeremy diff --git a/src/backend/replication/logical/reorderbuffer.c b/src/backend/replication/logical/reorderbuffer.c index b8c5e2a44e..6a3a35d05d 100644 --- a/src/backend/replication/logical/reorderbuffer.c +++ b/src/backend/replication/logical/reorderbuffer.c @@ -4625,8 +4625,8 @@ ReorderBufferToastReplace(ReorderBuffer *rb, ReorderBufferTXN *txn, toast_rel = RelationIdGetRelation(relation->rd_rel->reltoastrelid); if (!RelationIsValid(toast_rel)) - elog(ERROR, "could not open relation with OID %u", - relation->rd_rel->reltoastrelid); + elog(ERROR, "could not open toast relation with OID %u (base relation \"%s\")", + relation->rd_rel->reltoastrelid, relation->rd_rel->relname); toast_desc = RelationGetDescr(toast_rel); -- Jeremy Schneider Database Engineer Amazon Web Services
Commits
-
Back-patch "Add parent table name in an error in reorderbuffer.c."
- 4d3147070545 9.6.24 landed
- 13e52d7c5533 10.19 landed
- d61cdad0b524 11.14 landed
- 4048fc458175 12.9 landed
- 23469b867ac0 13.5 landed
- 9e84f6a72133 14.1 landed
-
Add parent table name in an error in reorderbuffer.c.
- 5e77625b260a 15.0 landed
-
Fix reorder buffer memory accounting for toast changes.
- df3640e5293d 15.0 cited
-
Add logical change details to logical replication worker errcontext.
- abc0910e2e0a 15.0 cited
-
Fix toast rewrites in logical decoding.
- 29b590547028 15.0 cited
-
Add error codes to some corruption log messages
- fd6ec93bf890 13.0 cited