Re: Error while executing initdb...

From: David Rowley <david(dot)rowley(at)2ndquadrant(dot)com>
To: Rajib Deb <Rajib_Deb(at)infosys(dot)com>
Cc: Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Error while executing initdb...
Date: 2018-12-31 13:04:13
Message-ID: CAKJS1f8uZyPQL9n-1oi7ME3zBXU43_dGAA_N3aOW3BVAo=7g9Q@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, 31 Dec 2018 at 17:43, Rajib Deb <Rajib_Deb(at)infosys(dot)com> wrote:
>
> Dear All
> I put a printf statement in the "main.c" code and built it. Later when I tried to execute INITDB, I got the following error
>
> The program "postgres" was found by xxxx but was not the same version as initdb.Check your installation
>
> After some analysis, I figured out that this error is being generated because "ret" code from "PG_CTL.c" is returning a non zero return code while it is comparing the line and versionstr in "exec.c". It looks like while reading the line in "pipe_read_line" method, it is concatenating the printf statement with the postgres version(postgres (PostgreSQL)xxxxx).
>
> I thought this probably is a defect and maybe the buffer needs to be flushed out before reading it in "pipe_read_line" method. Before doing further investigation and putting a possible fix, I thought to check with this group if it is worth putting the effort.

From looking at the code, it appears what happens is that
find_other_exec() calls "postgres -V" and reads the first line of the
output, so probably what's going on is you're printing out your
additional line even when postgres is called with -V or --version...
Would it not be easier just not to do that?

--
David Rowley http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Pavel Stehule 2018-12-31 13:23:44 Re: [HACKERS] proposal: schema variables
Previous Message Kohei KaiGai 2018-12-31 12:17:54 Re: add_partial_path() may remove dominated path but still in use