Re: How to redirect output from PostgreSQL pg_recvlogical to a file or a pipe?
От | David Ventimiglia |
---|---|
Тема | Re: How to redirect output from PostgreSQL pg_recvlogical to a file or a pipe? |
Дата | |
Msg-id | CADE7j6gP9tR3y_RbanUNx8RNK2Qro_XD_iLSsN4pCM9FQ8DHJg@mail.gmail.com обсуждение исходный текст |
Ответ на | How to redirect output from PostgreSQL pg_recvlogical to a file or a pipe? (David Ventimiglia <davidaventimiglia@hasura.io>) |
Ответы |
Re: How to redirect output from PostgreSQL pg_recvlogical to a file or a pipe?
(Adrian Klaver <adrian.klaver@aklaver.com>)
|
Список | pgsql-general |
try use the following syntax (yes, with a 2 before the greater sign)pg_recvlogical -d postgres --slot test --start -f - 2>> sample.jsonlAtteJRBMEl vie, 12 ene 2024 a las 16:35, David Ventimiglia (<davidaventimiglia@hasura.io>) escribió:Hello! How do I redirect logical decoding output from the PostgreSQL CLI tool
pg_recvlogical
either to a file or to another command via a pipe? I ask because when I try the obvious, no output is recorded or sent:pg_recvlogical -d postgres --slot test --start -f - >> sample.jsonl
Lest there be any confusion, I already created the slot in an earlier step. Moreover, I can verify that if I omit the output redirection
>> sample
then it does work, insofar as it emits the expected change events when I perform DML in another terminal window. When I include the redirection (or alternatively, set up a pipeline), then nothing happens.Note that I am aware of the option to pass a filename to the -f switch to write to a file. That works, but it's not what I'm after because it doesn't help update my mental model of how this is supposed to work. Based on my current (flawed) mental model built up from command line experience with other tools, this should work. I should be able to send the output to stdout and then redirect it to a file. It surprises me that I cannot.
Anyway, thanks!
Best,
David
В списке pgsql-general по дате отправления:
Предыдущее
От: Adrian KlaverДата:
Сообщение: Re: How to redirect output from PostgreSQL pg_recvlogical to a file or a pipe?