Re: Hide exposed impl detail of wchar.c

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Jubilee Young <workingjubilee(at)gmail(dot)com>
Cc: pgsql-hackers(at)lists(dot)postgresql(dot)org, John Naylor <johncnaylorls(at)gmail(dot)com>
Subject: Re: Hide exposed impl detail of wchar.c
Date: 2023-11-16 22:49:56
Message-ID: 447609.1700174996@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Jubilee Young <workingjubilee(at)gmail(dot)com> writes:
> I have root-caused the exact problem, but the bug is... social, rather
> than technical in nature: people with inadequate options at their
> disposal have implemented increasingly clever educated guesses that
> are increasingly prone to going wrong, rather than just asking anyone
> to help them increase their options. Rather than continuing this
> trend, I figured I would simply start doing things to hopefully draw
> the line here. I will be looking to follow up with the bindgen tools
> that fail to handle this correctly, but it would be nice if this
> stopped shipping in Postgres 16."${PG_NEXT_MINOR}", as pgrx does need
> the definitions in pg_wchar.h to have enough data to correctly
> determine database encoding and preserve certain Rust library
> invariants ("all Rust strings are correctly-formed UTF-8, anything
> else is just a sequence of bytes") without also obliterating
> performance.

It would be nice if you would state your problem straightforwardly,
rather than burying us in irrelevant-to-us details; but apparently
what you are unhappy about is that pg_wchar.h now #include's simd.h.
That evidently stems from commit 121d2d3d7 trying to make
is_valid_ascii() faster.

Currently the only caller of is_valid_ascii() is in wchar.c,
and so we could easily fix this by moving is_valid_ascii()
into wchar.c as your patch proposes. However ... I suppose the
point of having it as a "static inline" in a header file is to
be able to optimize other call sites too. So I wonder if there
used to be some, or this was just somebody's over-eagerness to
expose stuff they thought possibly might be useful. And maybe
more to the point, are we worried about there being other
callers in future? I'm really not sure.

regards, tom lane

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Nathan Bossart 2023-11-16 22:54:02 Re: Hide exposed impl detail of wchar.c
Previous Message Andrei Zubkov 2023-11-16 21:35:46 Re: [PATCH] Tracking statements entry timestamp in pg_stat_statements