Re: Add contrib/pg_logicalsnapinspect

Bertrand Drouvot <bertranddrouvot.pg@gmail.com>

From: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>
To: Peter Eisentraut <peter@eisentraut.org>
Cc: Peter Smith <smithpb2250@gmail.com>, shveta malik <shveta.malik@gmail.com>, Amit Kapila <amit.kapila16@gmail.com>, Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>, pgsql-hackers@lists.postgresql.org
Date: 2024-09-25T17:29:09Z
Lists: pgsql-hackers

Commits

Same data as JSON: GET /api/v1/messages/:b64id/commits the thread's linked commits as JSON, with link sources. API reference →
  1. Fix indentation issue

  2. pg_logicalinspect: Stabilize isolation tests.

  3. Add contrib/pg_logicalinspect.

  4. Move SnapBuild and SnapBuildOnDisk structs to snapshot_internal.h.

Attachments

Hi,

On Wed, Sep 25, 2024 at 04:04:43PM +0200, Peter Eisentraut wrote:
> Is there a reason for this elaborate error handling:

Thanks for looking at it!

> +	fd = OpenTransientFile(path, O_RDONLY | PG_BINARY);
> +
> +	if (fd < 0 && errno == ENOENT)
> +		ereport(ERROR,
> +				errmsg("file \"%s\" does not exist", path));
> +	else if (fd < 0)
> +		ereport(ERROR,
> +				(errcode_for_file_access(),
> +				 errmsg("could not open file \"%s\": %m", path)));
> 
> Couldn't you just use the second branch for all errno's?

Yeah, I think it comes from copying/pasting from SnapBuildRestore() too "quickly".
v10 attached uses the second branch only.

Regards,

-- 
Bertrand Drouvot
PostgreSQL Contributors Team
RDS Open Source Databases
Amazon Web Services: https://aws.amazon.com