Re: [PATCH] - Provide robust alternatives for replace_string
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Alvaro Herrera <alvherre@2ndquadrant.com>
Cc: Georgios <gkokolatos@protonmail.com>, Asim Praveen <pasim@vmware.com>,
PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2020-09-05T22:42:16Z
Lists: pgsql-hackers
Attachments
- v5-0001-use-stringinfo-for-replace_string.patch (text/x-diff) patch v5-0001
Alvaro Herrera <alvherre@2ndquadrant.com> 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. However, I'd already grown a bit dissatisfied with exposing only that API, because the code 8f8154a50 added to hba.c couldn't use pg_get_line either, and had to duplicate the logic. So the attached revised patch splits pg_get_line into two pieces, one with the existing char * API and one that appends to a caller-provided StringInfo. (hba.c needs the append-rather-than-reset behavior, and it might be useful elsewhere too.) While here, I couldn't resist getting rid of ecpg_filter()'s hard-wired line length limit too. This version looks committable to me, though perhaps someone has further thoughts? regards, tom lane
Commits
-
Refactor pg_get_line() to expose an alternative StringInfo-based API.
- 8e3c58e6e459 14.0 landed
-
Remove arbitrary line length limits in pg_regress (plain and ECPG).
- 784b1ba1a2b9 14.0 landed
-
Remove arbitrary restrictions on password length.
- 67a472d71c98 14.0 cited