Re: pipe_read_line for reading arbitrary strings

2024-03-08 Thread Daniel Gustafsson
> On 8 Mar 2024, at 19:38, Daniel Gustafsson wrote: > >> On 8 Mar 2024, at 18:13, Peter Eisentraut wrote: > >>> Good catch, that's an incorrect copy/paste, it should use ERRCODE_NO_DATA. >> >> Also it shouldn't print %m, was my point. > > Absolutely, I removed that in the patch upthread, it

Re: pipe_read_line for reading arbitrary strings

2024-03-08 Thread Daniel Gustafsson
> On 8 Mar 2024, at 18:13, Peter Eisentraut wrote: >> Good catch, that's an incorrect copy/paste, it should use ERRCODE_NO_DATA. > > Also it shouldn't print %m, was my point. Absolutely, I removed that in the patch upthread, it was clearly wrong. -- Daniel Gustafsson

Re: pipe_read_line for reading arbitrary strings

2024-03-08 Thread Peter Eisentraut
On 06.03.24 10:54, Daniel Gustafsson wrote: On 6 Mar 2024, at 10:07, Peter Eisentraut wrote: On 22.11.23 13:47, Alvaro Herrera wrote: On 2023-Mar-07, Daniel Gustafsson wrote: The attached POC diff replace fgets() with pg_get_line(), which may not be an Ok way to cross the streams (it's

Re: pipe_read_line for reading arbitrary strings

2024-03-06 Thread Daniel Gustafsson
> On 6 Mar 2024, at 11:46, Alvaro Herrera wrote: > > On 2024-Mar-06, Daniel Gustafsson wrote: > >> Good catch, that's an incorrect copy/paste, it should use ERRCODE_NO_DATA. >> I'm >> not convinced that a function to read from a pipe should consider not reading >> anything successful by

Re: pipe_read_line for reading arbitrary strings

2024-03-06 Thread Alvaro Herrera
On 2024-Mar-06, Daniel Gustafsson wrote: > Good catch, that's an incorrect copy/paste, it should use ERRCODE_NO_DATA. > I'm > not convinced that a function to read from a pipe should consider not reading > anything successful by default, output is sort expected here. We could add a > flag

Re: pipe_read_line for reading arbitrary strings

2024-03-06 Thread Daniel Gustafsson
> On 6 Mar 2024, at 10:07, Peter Eisentraut wrote: > > On 22.11.23 13:47, Alvaro Herrera wrote: >> On 2023-Mar-07, Daniel Gustafsson wrote: >>> The attached POC diff replace fgets() with pg_get_line(), which may not be >>> an >>> Ok way to cross the streams (it's clearly not a great fit), but

Re: pipe_read_line for reading arbitrary strings

2024-03-06 Thread Peter Eisentraut
On 22.11.23 13:47, Alvaro Herrera wrote: On 2023-Mar-07, Daniel Gustafsson wrote: The attached POC diff replace fgets() with pg_get_line(), which may not be an Ok way to cross the streams (it's clearly not a great fit), but as a POC it provided a neater interface for reading one-off lines from

Re: pipe_read_line for reading arbitrary strings

2024-02-09 Thread Daniel Gustafsson
The attached v5 is a rebase with no new changes just to get a fresh run in the CFBot before pushing. All review comments have been addressed and the patch has been Ready for Committer for some time, just didn't have time to get to it in the last CF. -- Daniel Gustafsson

Re: pipe_read_line for reading arbitrary strings

2023-11-24 Thread Daniel Gustafsson
> On 22 Nov 2023, at 13:47, Alvaro Herrera wrote: > > On 2023-Mar-07, Daniel Gustafsson wrote: > >> The attached POC diff replace fgets() with pg_get_line(), which may not be an >> Ok way to cross the streams (it's clearly not a great fit), but as a POC it >> provided a neater interface for

Re: pipe_read_line for reading arbitrary strings

2023-11-22 Thread Alvaro Herrera
On 2023-Mar-07, Daniel Gustafsson wrote: > The attached POC diff replace fgets() with pg_get_line(), which may not be an > Ok way to cross the streams (it's clearly not a great fit), but as a POC it > provided a neater interface for reading one-off lines from a pipe IMO. Does > anyone else think

Re: pipe_read_line for reading arbitrary strings

2023-11-22 Thread John Naylor
On Mon, Sep 25, 2023 at 2:55 PM Daniel Gustafsson wrote: > > Fixed, along with commit message wordsmithing in the attached. Unless > objected > to I'll go ahead with this version. +1

Re: pipe_read_line for reading arbitrary strings

2023-09-25 Thread Daniel Gustafsson
> On 4 Jul 2023, at 14:50, Daniel Gustafsson wrote: > >> On 4 Jul 2023, at 13:59, Heikki Linnakangas wrote: >> On 08/03/2023 00:05, Daniel Gustafsson wrote: > >>> If we are going to continue using this for reading $stuff from pipes, maybe >>> we >>> should think about presenting a nicer API

Re: pipe_read_line for reading arbitrary strings

2023-07-04 Thread Daniel Gustafsson
> On 4 Jul 2023, at 13:59, Heikki Linnakangas wrote: > On 08/03/2023 00:05, Daniel Gustafsson wrote: >> If we are going to continue using this for reading $stuff from pipes, maybe >> we >> should think about presenting a nicer API which removes that risk? Returning >> an allocated buffer which

Re: pipe_read_line for reading arbitrary strings

2023-07-04 Thread Heikki Linnakangas
On 08/03/2023 00:05, Daniel Gustafsson wrote: When skimming through pg_rewind during a small review I noticed the use of pipe_read_line for reading arbitrary data from a pipe, the mechanics of which seemed odd. Commit 5b2f4afffe6 refactored find_other_exec() and broke out pipe_read_line() as a

Re: pipe_read_line for reading arbitrary strings

2023-05-17 Thread Daniel Gustafsson
> On 7 Mar 2023, at 23:05, Daniel Gustafsson wrote: > > When skimming through pg_rewind during a small review I noticed the use of > pipe_read_line for reading arbitrary data from a pipe, the mechanics of which > seemed odd. A rebase of this for the CFBot since I realized I had forgotten to add

pipe_read_line for reading arbitrary strings

2023-03-07 Thread Daniel Gustafsson
When skimming through pg_rewind during a small review I noticed the use of pipe_read_line for reading arbitrary data from a pipe, the mechanics of which seemed odd. Commit 5b2f4afffe6 refactored find_other_exec() and broke out pipe_read_line() as a static convenience routine for reading a single