Re: WARNING: could not open statistics file "pg_stat_tmp/global.stat": Operation not permitted

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Perry Smith <pedz(at)easesoftware(dot)com>
Cc: pgsql-general list <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: WARNING: could not open statistics file "pg_stat_tmp/global.stat": Operation not permitted
Date: 2022-09-09 03:42:50
Message-ID: 12702.1662694970@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Perry Smith <pedz(at)easesoftware(dot)com> writes:
> From within the container, files which I assume are created by
> PostgreSQL are ending up being owned by root rather than Postgres.

If it looks that way from *inside* the container, that's not good
--- wouldn't that prevent Postgres from reading the files?

> The reason I’m sending this note to the general list is to ask how bad
> is this error? Some “solutions” are to make the pg_stat_tmp directory
> internal to the image and that somehow resolves the issue but I don’t
> think anyone really understands why and things like that bother me. But
> I’m also curious if that appears to be a viable solution. The result
> will be that when the Postgres is stopped and the container exited, the
> next time Postgres starts back up, the pg_stat_tmp directory will be
> gone. Is that ok?

pg_stat_tmp exists specifically because it holds only temporary files,
cf

https://www.postgresql.org/docs/devel/storage-file-layout.html

It's explicitly cleared out during server start.

The only reason to put it outside the data directory is to make it
*less* persistent than the rest of PG's files, say by putting it
on a RAM disk. You sound like you've set it up to be *more*
persistent (ie outside the container not inside), which surely is
exactly backwards.

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Mladen Gogala 2022-09-09 04:03:33 Re: WARNING: could not open statistics file "pg_stat_tmp/global.stat": Operation not permitted
Previous Message Perry Smith 2022-09-09 03:05:36 WARNING: could not open statistics file "pg_stat_tmp/global.stat": Operation not permitted