Re: Hide exposed impl detail of wchar.c - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Hide exposed impl detail of wchar.c
Date
Msg-id 447609.1700174996@sss.pgh.pa.us
Whole thread Raw
In response to Hide exposed impl detail of wchar.c  (Jubilee Young <workingjubilee@gmail.com>)
List pgsql-hackers
Jubilee Young <workingjubilee@gmail.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



pgsql-hackers by date:

Previous
From: Andrei Zubkov
Date:
Subject: Re: [PATCH] Tracking statements entry timestamp in pg_stat_statements
Next
From: Nathan Bossart
Date:
Subject: Re: Hide exposed impl detail of wchar.c