Re: Patch to implement pg_current_logfile() function

From: "Karl O(dot) Pinc" <kop(at)meme(dot)com>
To: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
Cc: Gilles Darold <gilles(dot)darold(at)dalibo(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Patch to implement pg_current_logfile() function
Date: 2017-01-18 16:11:20
Message-ID: 20170118101120.6bdb07a0@slate.meme.com
Views: Raw Message | Whole Thread | Download mbox
Thread:
Lists: pgsql-hackers

On Wed, 18 Jan 2017 13:26:46 +0900
Michael Paquier <michael(dot)paquier(at)gmail(dot)com> wrote:

> On Wed, Jan 18, 2017 at 11:36 AM, Karl O. Pinc <kop(at)meme(dot)com> wrote:
> > On Wed, 18 Jan 2017 11:08:25 +0900
> > Michael Paquier <michael(dot)paquier(at)gmail(dot)com> wrote:
> >
> >> Our ideas rather map here, ERRCODE_INTERNAL_ERROR would be adapted
> >> for this situation. Do any of you want to give it a shot or should
> >> I?

> What do you think about that?
> + log_filepath = strchr(lbuffer, ' ');
> + if (log_filepath == NULL)
> + {
> + /*
> + * Corrupted data found, return NULL to the caller and
> still
> + * inform him on the situation.
> + */
> + ereport(WARNING,
> + (ERRCODE_INTERNAL_ERROR,
> + errmsg("corrupted data found in \"%s\"",
> + LOG_METAINFO_DATAFILE)));
> + break;
> + }

You must write

errcode(ERRCODE_INTERNAL_ERROR)

instead of just

ERRCODE_INTERNAL_ERROR

If you don't you get back 01000 for the error code.
Test by using psql with '\set VERBOSITY verbose'.

v26 patch attached which fixes this.

Regards,

Karl <kop(at)meme(dot)com>
Free Software: "You don't pay back, you pay forward."
-- Robert A. Heinlein

Attachment Content-Type Size
patch_pg_current_logfile-v26.diff text/x-patch 15.3 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2017-01-18 16:12:13 Re: move collation import to backend
Previous Message Robert Haas 2017-01-18 15:57:16 Re: Parallel Index Scans