From: | Daniel Gustafsson <daniel(at)yesql(dot)se> |
---|---|
To: | Andres Freund <andres(at)anarazel(dot)de> |
Cc: | PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>, Noah Misch <noah(at)leadboat(dot)com> |
Subject: | Re: BackgroundPsql swallowing errors on windows |
Date: | 2025-02-14 12:35:40 |
Message-ID: | 064E43BD-B2EA-4992-97BA-3F9EB3CF2640@yesql.se |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
> On 13 Feb 2025, at 18:39, Andres Freund <andres(at)anarazel(dot)de> wrote:
> The banner being the same between queries made it hard to understand if a
> banner that appeared in the output was from the current query or a past
> query. Therefore I added a counter to it.
+ my $banner = "background_psql: QUERY_SEPARATOR $query_cnt";
+ my $banner_match = qr/(^|\n)$banner\r?\n/;
+ $self->{stdin} .= "$query\n;\n\\echo $banner\n\\warn $banner\n";
+ pump_until(
+ $self->{run}, $self->{timeout},
+ \$self->{stdout}, qr/$banner_match/);
Won't this allow "QUERY_SEPARATOR 11" to match against "QUERY_SEPARATOR 1"?
It's probably only of academic interest but appending an end-of-banner
character like "_" or something after the query counter should fix that.
> For debugging I added a "note" that shows stdout/stderr after executing the
> query, I think it may be worth keeping that, but I'm not sure.
I think it could be worth it, +1 for keeping it until it's beeb proven a
problem somewhere.
> This was a rather painful exercise.
I have no trouble believing that.
--
Daniel Gustafsson
From | Date | Subject | |
---|---|---|---|
Next Message | Andrew Dunstan | 2025-02-14 13:14:45 | Re: BackgroundPsql swallowing errors on windows |
Previous Message | Ranier Vilela | 2025-02-14 12:17:09 | Re: pg17.3 PQescapeIdentifier() ignores len |