On Tue, Nov 15, 2016 at 7:43 PM, Robert Haas <robertmh...@gmail.com> wrote:

> On Tue, Nov 15, 2016 at 1:30 PM, Magnus Hagander <mag...@hagander.net>
> wrote:
> > On Tue, Nov 15, 2016 at 7:27 PM, Robert Haas <robertmh...@gmail.com>
> wrote:
> >>
> >> On Tue, Nov 15, 2016 at 1:18 PM, Magnus Hagander <mag...@hagander.net>
> >> wrote:
> >> > Is there value in showing which snapshot as well? Something like:
> >> > DETAIL: snapshot <xyz> is too old to access relation <relation>
> >>
> >> IIUC, the granularity is per-block, not per-relation, so that might be
> >> misleading.
> >
> > Does it help to let the user know which number? I'm not really sure what
> I'd
> > do with that information, whereas knowing the relation would be very
> useful.
> >
> > But we could certainly say "snapshot <xyz> is too old to access block
> <nnn>
> > of relation <rel>".
>
> I think it would be better not to include either the snapshot or the
> block number, and just find some way to reword the error message so
> that it mentions which relation was involved without implying that all
> access to the relation would necessarily fail.  For example:
>
> ERROR: snapshot too old
> DETAIL: One or more rows required by this query have already been
> removed from "%s".
>
>
Sounds good to me. I've only really found use for the relation name so far
:)

How about the attached?

And if ppl are OK with it, thoughts on backpatching to 9.6?

-- 
 Magnus Hagander
 Me: http://www.hagander.net/
 Work: http://www.redpill-linpro.com/
diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c
index 58b0a97..04e6450 100644
--- a/src/backend/storage/buffer/bufmgr.c
+++ b/src/backend/storage/buffer/bufmgr.c
@@ -4336,5 +4336,6 @@ TestForOldSnapshot_impl(Snapshot snapshot, Relation relation)
 		&& (snapshot)->whenTaken < GetOldSnapshotThresholdTimestamp())
 		ereport(ERROR,
 				(errcode(ERRCODE_SNAPSHOT_TOO_OLD),
-				 errmsg("snapshot too old")));
+				 errmsg("snapshot too old"),
+				 errdetail("One or more rows required by this query have already been removed from \"%s\"", RelationGetRelationName(relation))));
 }
-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to