Re: CHECKPOINT unlogged data - Mailing list pgsql-hackers

From Dilip Kumar
Subject Re: CHECKPOINT unlogged data
Date
Msg-id CAFiTN-staR+Thi8=0cFebN=pGSFUK8CEiS9qWHWGReSdkCPkgQ@mail.gmail.com
Whole thread Raw
In response to Re: CHECKPOINT unlogged data  (Dilip Kumar <dilipbalaut@gmail.com>)
Responses Re: CHECKPOINT unlogged data
List pgsql-hackers
On Thu, Jul 10, 2025 at 9:55 AM Dilip Kumar <dilipbalaut@gmail.com> wrote:
>
> On Thu, Jul 10, 2025 at 9:31 AM Fujii Masao <masao.fujii@oss.nttdata.com> wrote:
> >
> >
> >
> > On 2025/07/10 4:26, Nathan Bossart wrote:
> > > Here is what I have staged for commit, which I'm planning to do on Friday.
> >
> > Thanks for updating the patches!
> >
> > Regarding the 0005 patch:
> >
> > -                       COMPLETE_WITH("MODE");
> > +                       COMPLETE_WITH("MODE, FLUSH_UNLOGGED");
> >
> > Shouldn't that be:
> >
> >      COMPLETE_WITH("MODE", "FLUSH_UNLOGGED");
> >
> > IOW, the two options should be separate strings, so it needs
> > double quotes around each.
>
> I agree that it makes more sense to treat them as 2 separate strings.

I was just playing around with the wrong mode seems error code is not
correct, see below example

postgres[906701]=# CHECKPOINT ( MODE wrong);

2025-07-10 05:00:41.644 UTC [906701] ERROR:  unrecognized MODE option
"mode" at character 14

2025-07-10 05:00:41.644 UTC [906701] STATEMENT:  CHECKPOINT ( MODE wrong);

ERROR:  42601: unrecognized MODE option "mode"

LINE 1: CHECKPOINT ( MODE wrong);

IMHO the error should be "unrecognized MODE option "wrong" not the "mode" ?

While looking at the code it seems problem is here instead if
'opt->defname' we should use 'mode' variable.

+ else if (strcmp(mode, "fast") != 0)
+ ereport(ERROR,
+ (errcode(ERRCODE_SYNTAX_ERROR),
+ errmsg("unrecognized MODE option \"%s\"", opt->defname),
+ parser_errposition(pstate, opt->location)));


--
Regards,
Dilip Kumar
Google



pgsql-hackers by date:

Previous
From: Thomas Munro
Date:
Subject: Re: Windows question: when is LC_MESSAGES defined?
Next
From: Steve Lau
Date:
Subject: Replace remaining getpwuid() calls with getpwuid_r()?