Re: [PATCH] - Provide robust alternatives for replace_string

2020-09-06 Thread Tom Lane
I wrote: > This version looks committable to me, though perhaps someone has > further thoughts? I looked through this again and pushed it. regards, tom lane

Re: [PATCH] - Provide robust alternatives for replace_string

2020-09-05 Thread Tom Lane
Alvaro Herrera writes: > Note that starting with commit 67a472d71c98 you can use pg_get_line and > not worry about the hard part of this anymore :-) pg_get_line as it stands isn't quite suitable, because it just hands back a "char *" string, not a StringInfo that you can do further processing on.

Re: [PATCH] - Provide robust alternatives for replace_string

2020-09-03 Thread Alvaro Herrera
Note that starting with commit 67a472d71c98 you can use pg_get_line and not worry about the hard part of this anymore :-) -- Álvaro Herrerahttps://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

Re: [PATCH] - Provide robust alternatives for replace_string

2020-08-31 Thread Georgios
‐‐‐ Original Message ‐‐‐ On Wednesday, 19 August 2020 11:07, Georgios wrote: > > > ‐‐‐ Original Message ‐‐‐ > On Friday, 7 August 2020 09:02, Asim Praveen pa...@vmware.com wrote: > > > > On 05-Aug-2020, at 7:01 PM, Alvaro Herrera alvhe...@2ndquadrant.com wrote: > > > On 2020-Aug

Re: [PATCH] - Provide robust alternatives for replace_string

2020-08-19 Thread Georgios
‐‐‐ Original Message ‐‐‐ On Friday, 7 August 2020 09:02, Asim Praveen wrote: > > On 05-Aug-2020, at 7:01 PM, Alvaro Herrera alvhe...@2ndquadrant.com wrote: > > On 2020-Aug-05, Asim Praveen wrote: > > > > > Please find attached a StringInfo based solution to this problem. It > > > uses f

Re: [PATCH] - Provide robust alternatives for replace_string

2020-08-06 Thread Asim Praveen
> On 05-Aug-2020, at 7:01 PM, Alvaro Herrera wrote: > > On 2020-Aug-05, Asim Praveen wrote: > >> Please find attached a StringInfo based solution to this problem. It >> uses fgetln instead of fgets such that a line is read in full, without >> ever splitting it. > > never heard of fgetln, my

Re: [PATCH] - Provide robust alternatives for replace_string

2020-08-05 Thread Alvaro Herrera
On 2020-Aug-05, Asim Praveen wrote: > Please find attached a StringInfo based solution to this problem. It > uses fgetln instead of fgets such that a line is read in full, without > ever splitting it. never heard of fgetln, my system doesn't have a manpage for it, and we don't use it anywhere AF

Re: [PATCH] - Provide robust alternatives for replace_string

2020-08-05 Thread Asim Praveen
> On 03-Aug-2020, at 8:36 PM, Alvaro Herrera wrote: > > On 2020-Aug-03, Asim Praveen wrote: > >> Thank you Alvaro for reviewing the patch! >> >>> On 01-Aug-2020, at 7:22 AM, Alvaro Herrera wrote: >>> >>> What happens if a replacement string happens to be split in the middle >>> by the fgets

Re: [PATCH] - Provide robust alternatives for replace_string

2020-08-04 Thread Asim Praveen
> On 03-Aug-2020, at 8:36 PM, Alvaro Herrera wrote: > > On 2020-Aug-03, Asim Praveen wrote: > >> Thank you Alvaro for reviewing the patch! >> >>> On 01-Aug-2020, at 7:22 AM, Alvaro Herrera wrote: >>> >>> What happens if a replacement string happens to be split in the middle >>> by the fgets

Re: [PATCH] - Provide robust alternatives for replace_string

2020-08-03 Thread Alvaro Herrera
On 2020-Aug-03, Asim Praveen wrote: > Thank you Alvaro for reviewing the patch! > > > On 01-Aug-2020, at 7:22 AM, Alvaro Herrera wrote: > > > > What happens if a replacement string happens to be split in the middle > > by the fgets buffering? I think it'll fail to be replaced. This > > applie

Re: [PATCH] - Provide robust alternatives for replace_string

2020-08-03 Thread Asim Praveen
Thank you Alvaro for reviewing the patch! > On 01-Aug-2020, at 7:22 AM, Alvaro Herrera wrote: > > What happens if a replacement string happens to be split in the middle > by the fgets buffering? I think it'll fail to be replaced. This > applies to both versions. Can a string to be replaced be

Re: [PATCH] - Provide robust alternatives for replace_string

2020-07-31 Thread Alvaro Herrera
What happens if a replacement string happens to be split in the middle by the fgets buffering? I think it'll fail to be replaced. This applies to both versions. In the stringinfo version it seemed to me that using pnstrdup is possible to avoid copying trailing bytes. If you're asking for opinio

[PATCH] - Provide robust alternatives for replace_string

2020-07-31 Thread Georgios
Hi, In our testing framework, backed by pg_regress, there exists the ability to use special strings that can be replaced by environment based ones. Such an example is '@testtablespace@'. The function used for this replacement is replace_string which inline replaces these occurrences in original