Re: [PATCH] Add Windows support for backtrace_functions (MSVC only)

From: "Euler Taveira" <euler(at)eulerto(dot)com>
To: Álvaro Herrera <alvherre(at)kurilemu(dot)de>
Cc: "Bryan Green" <dbryan(dot)green(at)gmail(dot)com>, "Michael Paquier" <michael(at)paquier(dot)xyz>, "Jakub Wartak" <jakub(dot)wartak(at)enterprisedb(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [PATCH] Add Windows support for backtrace_functions (MSVC only)
Date: 2025-10-29 12:53:16
Message-ID: f1fccfa6-0c52-4084-aee5-f2a9a80c9898@app.fastmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Oct 28, 2025, at 1:51 PM, Álvaro Herrera wrote:
> On 2025-Oct-27, Euler Taveira wrote:
>
>> On Mon, Oct 27, 2025, at 2:58 PM, Bryan Green wrote:
>> > Thanks for even glancing at this. I did not add any regression
>> > tests because the output goes to the server log and not the client.
>>
>> Since Michael said WIN32-specific tests and mentioned log pattern, he is
>> referring to TAP tests. You can add src/test/modules/test_backtrace that
>> exercises this code path.
>
> Hmm, are we really sure this is necessary?
>

Good question. We are testing an external API. Maybe a test in this thread is
enough to convince someone that the code is correct.

>> I didn't test your patch but I'm wondering if we could add an
>> abstraction here. I mean invent pg_backtrace() and
>> pg_backtrace_symbols() that maps to the current functions (Unix-like).
>
> Do we really need this? I don't think we're going to add support for
> backtraces anywhere else any time soon, so this looks premature. What
> other programs do you think we have where this would be useful? I have
> a really hard time imagining that things like psql and pg_dump would be
> improved by having backtrace-reporting support. And if we have a single
> place in the code using a facility, then ISTM the platform-specific code
> can live there with no damage.
>

It was just a suggestion; not a requirement. As you said it would avoid rework
in the future if or when someone decides to use this code in other parts of the
software. I wouldn't propose this change if I knew it was complicated to have a
simple and clean abstraction.

--
Euler Taveira
EDB https://www.enterprisedb.com/

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Heikki Linnakangas 2025-10-29 13:05:27 Re: LISTEN/NOTIFY bug: VACUUM sets frozenxid past a xid in async queue
Previous Message Robert Haas 2025-10-29 12:47:45 Re: apply_scanjoin_target_to_paths and partitionwise join