Andres Freund <andres@anarazel.de> writes:
> On 2023-08-23 17:55:53 -0400, Tom Lane wrote:
>> The trouble with that approach is that in "make installcheck", we
>> don't really want to assume we know what the installed libpq's default
>> connection parameters are. So we don't explicitly know where that
>> libpq will connect.
> Stepping back: I don't think installcheck matters for the concrete use of
> libpq we're discussing - the only time we wait for server startup is the
> non-installcheck case.
Oh, that's an excellent point. So for the immediately proposed use-case,
there's no issue. (We don't have a mode where we try to start a server
using already-installed executables.)
> There are other potential uses for libpq in pg_regress though - I'd e.g. like
> to have a "monitoring" session open, which we could use to detect that the
> server crashed (by waiting for the FD to be become invalid). Where the
> connection default issue could matter more?
Meh. I don't find that idea compelling enough to justify adding
restrictions on what test scenarios will work. It's seldom hard to
tell from the test output whether the server crashed.
> I was wondering if we could create an unambiguous connection info, but that
> seems like it'd be hard to do, without creating cross version hazards.
Hmm, we don't expect the regression test suite to work against other
server versions, so maybe that could be made to work --- that is, we
could run the psql under test and get a full set of connection
parameters out of it? But I'm still not finding this worth the
trouble.
> What's the reason we don't force psql to come from the same build as
> pg_regress?
Because the point of installcheck is to check the installed binaries
--- including the installed psql and libpq.
(Thinks for a bit...) Maybe we should add pg_regress to the installed
fileset, and use that copy not the in-tree copy for installcheck?
Then we could assume it's using the same libpq as psql. IIRC there
have already been suggestions to do that for the benefit of PGXS
testing.
regards, tom lane