--- src/backend/access/transam/slru.c 2013-11-23 12:36:07.000000000 -0500 +++ src/backend/access/transam/slru.c 2013-11-23 12:38:43.000000000 -0500 @@ -58,6 +58,8 @@ #include "storage/shmem.h" #include "miscadmin.h" +#include +#include "google/coredumper.h" #define SlruFileName(ctl, path, seg) \ snprintf(path, MAXPGPATH, "%s/%04X", (ctl)->Dir, seg) @@ -876,6 +878,18 @@ SlruReportIOError(SlruCtl ctl, int pagen switch (slru_errcause) { case SLRU_OPEN_FAILED: + { + pg_time_t stamp_time = (pg_time_t) time(NULL); + char timebuf[128]; + char buf[128]; + + pg_strftime(timebuf, sizeof(timebuf), + "%Y-%m-%d.%H:%M:%S.%Z", + pg_localtime(&stamp_time, log_timezone)); + sprintf(buf, "/var/log/pgsql/core.%d.%s", getpid(), timebuf); + WriteCoreDump(buf); + } + ereport(ERROR, (errcode_for_file_access(), errmsg("could not access status of transaction %u", xid), --- src/backend/Makefile 2013-11-23 12:56:25.000000000 -0500 +++ src/backend/Makefile 2013-11-23 12:56:45.000000000 -0500 @@ -54,7 +54,7 @@ ifneq ($(PORTNAME), win32) ifneq ($(PORTNAME), aix) postgres: $(OBJS) - $(CC) $(CFLAGS) $(LDFLAGS) $(LDFLAGS_EX) $(export_dynamic) $(call expand_subsys,$^) $(LIBS) -o $@ + $(CC) $(CFLAGS) $(LDFLAGS) $(LDFLAGS_EX) $(export_dynamic) $(call expand_subsys,$^) $(LIBS) -lcoredumper -o $@ endif endif