Re: PostgreSQL reference coffee mug

2021-07-26 Thread Pavel Stehule
po 26. 7. 2021 v 8:56 odesílatel Matthias Apitz  napsal:

>
> Hello,
>
> Nearly 20 years ago, I ordered some 50 vi-reference coffee mugs like this
> one here (not exactly the same, but to give you an idea):
>
> https://www.getdigital.eu/vi-reference-mug.html
>
> for our vi-lovers in-house and the admins of our customers.
>
> I'd like to do the same now with a reference mug for PostgreSQL, for
> example with the most important Meta-commands, sys tables, etc.
> I have nearby a copy shop which would produce it based on a JPEG file.
>
> Before designing our own, I wanted to ask here if such a beast exists
> already or, if not, maybe even a Reference Card in PDF or JPEG to use it
> as a
> starting point.
>
> Thanks in advance for any hints.
>

I have this in czech language - maybe google translator
https://translate.google.com/ helps

https://postgres.cz/files/tahak_postgresql-13.pdf

Regards

Pavel


> matthias
>
> --
> Matthias Apitz, ✉ g...@unixarea.de, http://www.unixarea.de/
> +49-176-38902045
> Public GnuPG key: http://www.unixarea.de/key.pub
>
>
>


Re: Obsolete or dead serverconnections after reboot

2021-07-26 Thread WR

Hello Ninad Shah,

Thank you for clarification.
The state of the mentioned connections was "Idle" in pg_stat_activity.

Now on my Laptops the shutdown of the postgres-service works too.

I had to switch off the "Schnellstart" (in english something like "fast 
start" or "fast boot"), which can be found under Settings > System > 
Energy Options > Behavior when pushing the Power-Button / Closing the 
Computer


There in the lower part of the dialog "Settings for Shutdown"

The Option is then disabled first, but can be enabled with a link in the 
upper Part of the dialog.


(Dont ask me why it is so complicated, and what this Option has to do 
with the Power Button / closing the Display, it affects every kind of 
shutdown)


Thanks you for your help.
Wolfgang



Am 23.07.2021 um 16:31 schrieb Ninad Shah:
Just to make it clear, "idle in transaction" and "idle" are different 
terms. "Idle in transaction" refers to connections that are waiting for 
either commit or rollback.


Additionally, this could be a bug as well. However, it's difficult to 
conclude at this stage. You may report this to postgresql-bugs group.



Regards,
Ninad Shah

On Fri, 23 Jul 2021 at 17:25, WR > wrote:


Hello,

unfortunately, it's my companys choice of OS.
In private life I'm riding the penguin.

One last thing: I have 2 Laptops, where the shutdown doesn't work, and
one VirtualBox machine where it works like a charm. Maybe it has
something to do with the power management.

As a workaround I set the value
idle_in_transaction_session_timeout
to 5min. So the server kills this idle connections from before the
power
cycle (and all others too) after 5 minutes.

Thank you, guys

(PS.: still no answer from EDB)

Am 22.07.2021 um 16:51 schrieb Ninad Shah:
 > Factually, Windows itself has a number of issues. Hence, it is
always
 > suggested to use Linux with it.
 >
 > It can be explored further by querying the table from which
 > pg_stat_activity gathers data.
 >
 >
 > Regards,
 > Ninad Shah
 >
 >
 > On Thu, 22 Jul 2021 at 12:51, WR mailto:wolle...@freenet.de>
 > >> wrote:
 >
 >     Hello Ninad Shah,
 >
 >     I think, nobody holds the connections, because the state is
idle. But
 >     I'm not shure what means: the connection is idle.
 >
 >     One interesting fact was: when I dont stop the psql
commandline on the
 >     client (and dont start another query, wht ends up in a connection
 >     reset,
 >     while the server is down), psql uses the same connection
after reboot
 >     and the state goes from idle back to active.
 >
 >     So there are two questions: what will happen to idle
connctions after a
 >     while, if the client doesnt exist anymore.
 >     And is this desired behavior, the the postgres-Server-Service
does
 >     not a
 >     shutdown on reboot on windows. (seem my mail to Vijaykumar Jain)
 >
 >     Thanks you, Greeting from germany,
 >     Wolfgang
 >
 >     Am 21.07.2021 um 16:10 schrieb Ninad Shah:
 >      > Hello,
 >      >
 >      > Would you be able to verify the process trees for those
PIDs on
 >     Windows?
 >      > You may be able to see who holds the connections?
 >      >
 >      >
 >      > Regards,
 >      > Ninad Shah
 >      >
 >      > On Wed, 21 Jul 2021 at 19:15, WR mailto:wolle...@freenet.de>
 >     >
 >      > 
      >
 >      >     Hello Vijaykumar Jain,
 >      >
 >      >     thank you for fast answer, today I'm not able to
access the
 >     hardware,
 >      >     I'll be back tomorrow and will do the required tests.
 >      >
 >      >     Wolfgang
 >      >
 >      >     Am 21.07.2021 um 15:14 schrieb Vijaykumar Jain:
 >      >      > select pg_stat_reset();
 >      >      >
 >      >      > Can you run above function, to check if stats are
reset and
 >      >     things are
 >      >      > fine without a pg restart?
 >      >      > I not able to understand how new connection stats
are added,
 >      >     along with
 >      >      > old stale states, if I assume stats collector
process is
 >     having
 >      >     issues ,
 >      >      > or the stats folder is corrupt etc.
 >      >      > That would also mean, all table stats would be off
or not
 >     updated
 >      >     too?
 >      >      > Is that so? Or analyse works fine on tables without
a restart?
 >      >      >
 >      >      > On Wed, Jul 21, 2021, 6:27 PM Vi

Re: PostgreSQL reference coffee mug

2021-07-26 Thread Rob Sargent


> On Jul 26, 2021, at 1:06 AM, Pavel Stehule  wrote:
> 
> 
> 
>> Thanks in advance for any hints.
> 
> I have this in czech language - maybe google translator 
> https://translate.google.com/ helps
> 
> https://postgres.cz/files/tahak_postgresql-13.pdf
> 
> Regards
> 
> Pavel
>> 
>> 
I could definitely use a mug large enough to hold all that. 

>> 


Re: PostgreSQL reference coffee mug

2021-07-26 Thread Pavel Stehule
po 26. 7. 2021 v 13:44 odesílatel Rob Sargent 
napsal:

>
>
> On Jul 26, 2021, at 1:06 AM, Pavel Stehule 
> wrote:
>
> 
>
> Thanks in advance for any hints.
>>
>
> I have this in czech language - maybe google translator
> https://translate.google.com/ helps
>
> https://postgres.cz/files/tahak_postgresql-13.pdf
>
> Regards
>
> Pavel
>
>>
>>
>> I could definitely use a mug large enough to hold all that. \
>

:-)


Recursive Parent-Child Function Bottom Up

2021-07-26 Thread Avi Weinberg
Hi,

I would like to populate the children_ids column with all the ids of the 
children recursively (+ grandchildren etc.)
If I do it top-bottom I will end up doing extra work since there is no need to 
go all levels down if I can just compute my IMMEDIATE children "children_ids" 
and just concatenate all their lists.

I looked at 
https://stackoverflow.com/questions/41376655/how-can-i-traverse-a-tree-bottom-up-to-calculate-a-weighted-average-of-node-va
But was not able to get it to work on my case.

Your assistance is most welcome!


create table tree(id int primary key, parent int, children_ids text);
insert into tree (id, parent) values
(273,   0),
(274,  273),
(275,  273),
(277,  273),
(278,  277),
(280,  275),
(281,  280),
(282,  281),
(283,  282),
(284,  282),
(285,  282),
(286,  282),
(287,  282),
(288,  282),
(289,  282),
(290,  281),
(291,  290),
(292,  290),
(293,  290),
(294,  290),
(295,  290);
IMPORTANT - This email and any attachments is intended for the above named 
addressee(s), and may contain information which is confidential or privileged. 
If you are not the intended recipient, please inform the sender immediately and 
delete this email: you should not copy or use this e-mail for any purpose nor 
disclose its contents to any person.


Re: Why does VACUUM FULL pg_class sometimes wait for ShareLock on another transaction after getting AccessExclusiveLock on pg_class?

2021-07-26 Thread Marcin Barczynski
On Fri, Jul 23, 2021 at 4:46 PM Ninad Shah  wrote:

> Question 1 : What's a need to perform a VACUUM FULL operation on pg_class?
>

Workload requires many temp tables which cause huge bloat on pg_class - it
sometimes has more than 2 GB.


> Question 2 : Ideally, a VACUUM FULL operation seeks an exclusive lock on a
> table, while I can see it waiting for a shared lock here. Why? (Not asking
> you)
>

That's my question. I expected that once VACUUM FULL gets exclusive lock,
it can finish. But that's not the case with pg_class.


>
> Additionally, The situation you have described should be termed a
> "deadlock". Do you see any transaction getting rolled back?
>
>
> Regards,
> Ninad Shah
>
> On Fri, 23 Jul 2021 at 11:39, Marcin Barczynski <
> mbarczyn...@starfishstorage.com> wrote:
>
>> On Thu, Jul 22, 2021 at 5:08 PM Marcin Barczynski <
>> mbarczyn...@starfishstorage.com> wrote:
>>
>>> On Thu, Jul 22, 2021 at 3:51 PM Laurenz Albe 
>>> wrote:
>>> >
>>> > On Thu, 2021-07-22 at 12:55 +0200, Marcin Barczynski wrote:
>>> > > There was a long-running transaction consisting of two queries:
>>> > >
>>> > > CREATE TEMPORARY TABLE abc AS SELECT * FROM def_view;
>>> > > INSERT INTO xyz_table SELECT * FROM abc;
>>> > >
>>> > > When I ran VACUUM FULL pg_class, it waited for ShareLock on that
>>> transaction:
>>> >
>>> > There must have been something else using "pg_class", since the above
>>> > won't take any permament locks on "pg_class", nor should it block
>>> VACUUM.
>>>
>>>
>>> Thanks for your reply. I dugged a bit deeper, and it turned out that
>>> VACUUM FULL hung in heapam_index_build_range_scan.
>>> It's PostgreSQL 13.3. Comments around heapam_handler.c:1482:
>>>
>>
>> What's more, running VACUUM FULL pg_class sometimes causes a deadlock
>> with transactions using temp tables. For example:
>>
>> DETAIL:  Process 6703 waits for ShareLock on transaction 108850229;
>> blocked by process 6591.
>> Process 6591 waits for AccessShareLock on relation 1259 of
>> database 16517; blocked by process 6703.
>> Process 6703: VACUUM (FULL, VERBOSE, ANALYZE) pg_class
>> Process 6591: SELECT * FROM stored_procedure()
>>
>> Isn't it a bug?
>> Is there any way to safely run VACUUM FULL pg_class?
>> My workload involves lots of temp tables, and I need to get rid of the
>> bloat regularly.
>>
>> --
>> Regards,
>> Marcin Barczynski
>>
>

-- 

*Marcin Barczyński* | *Senior Software Engineer * |

mbarczyn...@starfishstorage.com | http://www.starfishstorage.com


Re: Recursive Parent-Child Function Bottom Up

2021-07-26 Thread Rob Sargent

On 7/26/21 9:19 AM, Avi Weinberg wrote:


Hi,

I would like to populate the children_ids column with all the ids of 
the children recursively (+ grandchildren etc.)


If I do it top-bottom I will end up doing extra work since there is no 
need to go all levels down if I can just compute my IMMEDIATE children 
"children_ids" and just concatenate all their lists.


I looked at 
https://stackoverflow.com/questions/41376655/how-can-i-traverse-a-tree-bottom-up-to-calculate-a-weighted-average-of-node-va 



But was not able to get it to work on my case.

Your assistance is most welcome!

create table tree(id int primary key, parent int, children_ids text);

insert into tree (id, parent) values

(273, 0),

(274,  273),

(275,  273),

(277,  273),

(278,  277),

(280,  275),

(281,  280),

(282,  281),

(283,  282),

(284,  282),

(285,  282),

(286,  282),

(287,  282),

(288,  282),

(289,  282),

(290,  281),

(291,  290),

(292,  290),

(293,  290),

(294,  290),

(295,  290);

IMPORTANT - This email and any attachments is intended for the above 
named addressee(s), and may contain information which is confidential 
or privileged. If you are not the intended recipient, please inform 
the sender immediately and delete this email: you should not copy or 
use this e-mail for any purpose nor disclose its contents to any person. 
I'm sorry, what output format are you looking for?  Perhaps an array of 
all descendants for each founder? (founder int, descendants int[]).   I 
recommend a null for no-known-parent rather than zero.  Or just founder 
int, descendant int? With or without sub-trees?




Re: Recursive Parent-Child Function Bottom Up

2021-07-26 Thread Rob Sargent

On 7/26/21 9:19 AM, Avi Weinberg wrote:


Hi,

I would like to populate the children_ids column with all the ids of 
the children recursively (+ grandchildren etc.)


If I do it top-bottom I will end up doing extra work since there is no 
need to go all levels down if I can just compute my IMMEDIATE children 
"children_ids" and just concatenate all their lists.


I looked at 
https://stackoverflow.com/questions/41376655/how-can-i-traverse-a-tree-bottom-up-to-calculate-a-weighted-average-of-node-va 



But was not able to get it to work on my case.

Your assistance is most welcome!

create table tree(id int primary key, parent int, children_ids text);

insert into tree (id, parent) values

(273, 0),

(274,  273),

(275,  273),

(277,  273),

(278,  277),

(280,  275),

(281,  280),

(282,  281),

(283,  282),

(284,  282),

(285,  282),

(286,  282),

(287,  282),

(288,  282),

(289,  282),

(290,  281),

(291,  290),

(292,  290),

(293,  290),

(294,  290),

(295,  290);

IMPORTANT - This email and any attachments is intended for the above 
named addressee(s), and may contain information which is confidential 
or privileged. If you are not the intended recipient, please inform 
the sender immediately and delete this email: you should not copy or 
use this e-mail for any purpose nor disclose its contents to any person. 

oops, didn't see the third column in the create table statement.



Re: Recursive Parent-Child Function Bottom Up

2021-07-26 Thread Alban Hertroys


> On 26 Jul 2021, at 17:19, Avi Weinberg  wrote:
> 
> Hi,
>  
> I would like to populate the children_ids column with all the ids of the 
> children recursively (+ grandchildren etc.)
> If I do it top-bottom I will end up doing extra work since there is no need 
> to go all levels down if I can just compute my IMMEDIATE children 
> "children_ids" and just concatenate all their lists. 

(…)

> create table tree(id int primary key, parent int, children_ids text);
> insert into tree (id, parent) values
> (273,   0),
> (274,  273),
> (275,  273),
> (277,  273),
> (278,  277),
> (280,  275),
> (281,  280),
> (282,  281),
> (283,  282),
> (284,  282),
> (285,  282),
> (286,  282),
> (287,  282),
> (288,  282),
> (289,  282),
> (290,  281),
> (291,  290),
> (292,  290),
> (293,  290),
> (294,  290),
> (295,  290);

First you need to figure out what your starting set of nodes is, and since 
you’re going to go bottom-up, those are your leaf nodes. Without any indicators 
for that though, you’ll have to determine that from a sub-query.

Something like this:

with recursive foo (id, parent, children_ids) as (
select id, parent, null::text
  from tree t
 where not exists (
select 1 from tree c where c.parent = t.id
 )
union all
select t.id, t.parent
,   f.id || case f.children_ids when '' then '' else ',’ end || 
f.children_ids
  from foo f
  join tree t on f.parent = t.id
 where f.parent <> 0
;

Regards,

Alban Hertroys
--
If you can't see the forest for the trees,
cut the trees and you'll find there is no forest.





Re: Recursive Parent-Child Function Bottom Up

2021-07-26 Thread Alban Hertroys


> On 26 Jul 2021, at 17:52, Alban Hertroys  wrote:
> Something like this:
> 
> with recursive foo (id, parent, children_ids) as (
>   select id, parent, null::text
> from tree t
>where not exists (
>   select 1 from tree c where c.parent = t.id
>)
>   union all
>   select t.id, t.parent
>   ,   f.id || case f.children_ids when '' then '' else ',’ end || 
> f.children_ids
> from foo f
> join tree t on f.parent = t.id
>where f.parent <> 0
> ;

Almost, the null::text in the initial select should of course be '’ in your 
case, and a unicode quote slipped into the last string of that case statement.

Alban Hertroys
--
If you can't see the forest for the trees,
cut the trees and you'll find there is no forest.





Re: Recursive Parent-Child Function Bottom Up

2021-07-26 Thread Rob Sargent

On 7/26/21 9:55 AM, Alban Hertroys wrote:

On 26 Jul 2021, at 17:52, Alban Hertroys  wrote:
Something like this:

with recursive foo (id, parent, children_ids) as (
select id, parent, null::text
  from tree t
 where not exists (
select 1 from tree c where c.parent = t.id
 )
union all
select t.id, t.parent
,   f.id || case f.children_ids when '' then '' else ',’ end || 
f.children_ids
  from foo f
  join tree t on f.parent = t.id
 where f.parent <> 0
;

Almost, the null::text in the initial select should of course be '’ in your 
case, and a unicode quote slipped into the last string of that case statement.

Alban Hertroys
--
If you can't see the forest for the trees,
cut the trees and you'll find there is no forest.




this might be what you want?
with recursive fulltree (id, parent, children_ids) as (
    select id, parent, id::text as decsendants
      from tree t
     where not exists (
        select 1 from tree c where c.parent = t.id
     )
    union all
    select t.id,
       t.parent,
       f.id  || case f.children_ids when '' then '' else ',' end || 
f.children_ids as descendants

      from fulltree f
      join tree t on f.parent = t.id
      where f.parent != 0
)
select * from fulltree order by parent
;


I do think it breaks when there is more than one zero parent.



Re: Recursive Parent-Child Function Bottom Up

2021-07-26 Thread Rob Sargent

On 7/26/21 9:55 AM, Alban Hertroys wrote:

On 26 Jul 2021, at 17:52, Alban Hertroys  wrote:
Something like this:

with recursive foo (id, parent, children_ids) as (
select id, parent, null::text
  from tree t
 where not exists (
select 1 from tree c where c.parent = t.id
 )
union all
select t.id, t.parent
,   f.id || case f.children_ids when '' then '' else ',’ end || 
f.children_ids
  from foo f
  join tree t on f.parent = t.id
 where f.parent <> 0
;

Almost, the null::text in the initial select should of course be '’ in your 
case, and a unicode quote slipped into the last string of that case statement.

Alban Hertroys
--
If you can't see the forest for the trees,
cut the trees and you'll find there is no forest.




well actually I find this closer to the target.

with recursive kids (founder, firstoff, descendant )
as (select parent as founder, id as firstoff, id::text
 from tree
 where parent = 0
union all
select k.firstoff, t.id, t.id::text
from kids k join tree t on k.firstoff = t.parent
)
select founder, array_agg(descendant) as descendants
from kids group by founder
order by founder;
 founder |   descendants
-+---
   0 | {273}
 273 | {274,275,277}
 275 | {280}
 277 | {278}
 280 | {281}
 281 | {282,290}
 282 | {283,284,285,286,287,288,289}
 290 | {291,292,293,294,295}
(8 rows)





Re: pg_restore (fromuser -> touser)

2021-07-26 Thread Mayan
Thanks for the responses everyone and the reality check of how new features
get in.  I will look into the suggestion by Vijaykumar in more detail and
try it out.

Thanks again,
Mayan

On Sun, Jul 25, 2021 at 10:11 PM David G. Johnston <
david.g.johns...@gmail.com> wrote:

> On Sun, Jul 25, 2021 at 8:02 PM Ganesh Korde 
> wrote:
>
>> You just need to export dump without any privileges. And while restoring
>> dump use the new role.
>>
>
> You should read the body of the original email and not just the subject
> line.  The actual question pertains to schemas - which IIUC are tightly
> linked to roles in other DBs (hence the observed behavior elsewhere) but
> aside from some default search_path stuff are unrelated in PostgreSQL.
>
> David J.
>
>


Logical replication from Rds into on-premise

2021-07-26 Thread Rama Krishnan
Hi all,

I have a postgres server on Aws RDS no i want to replicate the data or
logical replication into the on-premise server. I have gone through DMS
provides the service buy it pricing was high. Do we have any option or
method to achieve this?

Thanks

RamaKrishnan


pg-audit extension

2021-07-26 Thread Olagoke Akinyemi
Hello,

Could someone please, give me a quick guide? I am trying to install pgaudit 
extension on an existing PostgreSQL instance but I want to place it on a 
different this mount. How can i do this? 
Your assistance will be highly appreciated.

Regards,Spago

Re: pg-audit extension

2021-07-26 Thread Ron

On 7/26/21 1:24 PM, Olagoke Akinyemi wrote:

Hello,


Could someone please, give me a quick guide? I am trying to install 
pgaudit extension on an existing PostgreSQL instance but I want to place 
it on a different this mount. How can i do this?


"but I want to place it on a different this mount" is confusing. Did you 
forget a word?


--
Angular momentum makes the world go 'round.


Re: Logical replication from Rds into on-premise

2021-07-26 Thread Cory Nemelka
On Mon, Jul 26, 2021 at 12:06 PM Rama Krishnan  wrote:

> Hi all,
>
> I have a postgres server on Aws RDS no i want to replicate the data or
> logical replication into the on-premise server. I have gone through DMS
> provides the service buy it pricing was high. Do we have any option or
> method to achieve this?
>
> Thanks
>
> RamaKrishnan
>

I would start here:
https://www.postgresql.org/docs/12/sql-createpublication.html

make sure all your tables have primary keys. :D


single-row deadlock

2021-07-26 Thread guntiso

Hi,

After upgrading from PostgreSQL 9.6 to 13 we started to experience 
locking issues once per week or two.

Replacing exclusive table lock with helper table row lock did not help.
Now it seems like a single-row deadlocks can occur, which should not be 
possible (audit_data_lock table contains one row):


blocked_pid,blocking_pid,blocked_statement,current_statement_in_blocking_process,blocked_application,blocking_application
6752,6577,update audit_data_lock set locks_used = locks_used + 1,update 
audit_data_lock set locks_used = locks_used + 1,PostgreSQL JDBC 
Driver,PostgreSQL JDBC Driver
6577,6752,update audit_data_lock set locks_used = locks_used + 1,update 
audit_data_lock set locks_used = locks_used + 1,PostgreSQL JDBC 
Driver,PostgreSQL JDBC Driver


Is this a known issue? It seems like 
https://postgrespro.com/list/thread-id/1231581. Are there any 
workarounds?





Re: pg_restore (fromuser -> touser)

2021-07-26 Thread Ben Madin
Hi - we have had to do such operations quite commonly, if you want to
automate / stream such a change I would suggest that you look into sed. Off
the top of my head, consider something like this:

pg_dump --format=p --schema=schema_a original_database | sed 's/ schema_a./
schema_b./g' | psql new_database

this is presuming a space before the schemaname, and a fullstop between
schema and other elements.

cheers

Ben


On Sat, 24 Jul 2021 at 01:38, Mayan  wrote:

> Hi,
>
>
>
> I had a general question about a feature that we depended on heavily when
> using other RDBMS providers which was the ability to take a schema dump and
> restore it to a different database and a different schema in that database
> (could be to the same database as well).  Basically, there was an option
> on restore to specify a FROMUSER and a TOUSER directive so schema A could
> be restored elsewhere but as schema B.
>
>
>
> I don’t see such an option in Postgres and the only workaround I am aware
> of is to do a plain-text (format=p) and then a crude find/replace to
> replace the old schema name with the new schema name.  I’ve never
> actually tested this to be sure even this would work.  Also, using this
> option will prevent us from parallelizing the import or export, so it’s
> really not something we want to do.
>
>
>
> This would be a really useful feature in my opinion along with the ability
> to maintain parallelization options.
>
>
>
> Are there any such features on the roadmap?  Is my understanding correct
> about the available ways to accomplish this – again, in a practical and
> performant way?
>
>
>
> Thanks,
>
> Mayan
>


-- 

[image: Ausvet Logo] 

Dr Ben Madin

BVMS MVPHMgmt PhD MANZCVS GAICD
Managing Director
Mobile:
+61 448 887 220 <+61448887220>
E-mail:
b...@ausvet.com.au
Website:
www.ausvet.com.au
Skype: benmadin
Address:
5 Shuffrey Street
Fremantle, WA 6160
Australia


Re: pg-audit extension

2021-07-26 Thread Vijaykumar Jain
On Mon, Jul 26, 2021, 11:54 PM Olagoke Akinyemi  wrote:

> Hello,
>
>
> Could someone please, give me a quick guide? I am trying to install
> pgaudit extension on an existing PostgreSQL instance but I want to place it
> on a different this mount. How can i do this?
>
> Are you trying to save pgaudit logs on a different location/ separate
mount?

> pgaudit would log audit stuff to the same log file to which postmaster is
configured to log.
https://www.postgresql.org/docs/14/runtime-config-logging.html

https://github.com/pgaudit/pgaudit/blob/master/README.md

> I can be corrected, but I am not sure you can log to a standalone location
different from postgresql logs.
But if your concern is, if, incase of a crash you would lose your audit
logs, them in my personal opinion, you can either use rsyslog or use
something like filebeat to monitor changes to log file and send changes to
a centralized setup.
If I misunderstood you, ignore my suggestions.