pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Jeff Davis <pgsql@j-davis.com>
To: Andreas Karlsson <andreas@proxel.se>
To: Peter Eisentraut <peter@eisentraut.org>
To: pgsql-hackers@postgresql.org
Subject: Re: tiny step toward threading: reduce dependence on setlocale()
Date: Tue, 03 Sep 2024 22:04:23 -0700
Message-ID: <82cc9fa110254fdf3b87aed9edd79de4a655fbdc.camel@j-davis.com> (raw)
In-Reply-To: <60929555-4709-40a7-b136-bcb44cff5a3c@proxel.se>
References: <2228884bb1f1a02614b39f71a90c94d2cc8a3a2f.camel@j-davis.com>
	<239b7ef6ce058c6b1c77b3a0cfcc70c1cd8968b1.camel@j-davis.com>
	<f1935bc481438c9d86c2e0ac537b1c110d41a00a.camel@j-davis.com>
	<cfd9eb85-c52a-4ec9-a90e-a5e4de56e57d@eisentraut.org>
	<56af65bde2190cc5ee20c807be7b7bdcda54f40c.camel@j-davis.com>
	<468dd1fb-20f5-4213-bc70-d1388ccf28fa@proxel.se>
	<59ea4275d75829a055fc55d8fe139eb85764cf2b.camel@j-davis.com>
	<ece40520-ca74-4b22-8463-f48215854511@proxel.se>
	<de1f1788-93bb-45cc-bef8-6f27119b2f3e@eisentraut.org>
	<89475ee5487d795124f4e25118ea8f1853edb8cb.camel@j-davis.com>
	<23cc1f3cfcdbdd3b2d3bb956d57ae422aa9d0b9e.camel@j-davis.com>
	<cfe99144-e1a3-458b-93c6-09b2eac1746e@eisentraut.org>
	<96d51fbb8b6f338a210cee97abb63c0162bcb781.camel@j-davis.com>
	<69c2a864-846f-4309-bd5a-aaa1c34f9a11@proxel.se>
	<96a559be83329bc66074a3925ebcfa8ceb16dfc5.camel@j-davis.com>
	<60929555-4709-40a7-b136-bcb44cff5a3c@proxel.se>

On Wed, 2024-08-28 at 18:43 +0200, Andreas Karlsson wrote:
> On 8/15/24 12:55 AM, Jeff Davis wrote:
> > This overlaps a bit with what Peter already proposed here:
> > 
> > https://www.postgresql.org/message-id/4f562d84-87f4-44dc-8946-01d6c437936f%40eisentraut.org
> > 
> > right?
> 
> Maybe I am missing something but not as far as I can see. It is
> related 
> but I do not see any overlap.

v2-0002:

Oh, I see, pattern_char_isalpha() only has one caller, and it never
passes a NULL for pg_locale_t, so my complaint doesn't affect your
patch. This is about ready, then.

> > > 0003-Remove-dubious-check-against-default-locale.patch
> > > 
> > > This patch removes a check against DEFAULT_COLLATION_OID which I
> > > thought
> > > looked really dubious. Shouldn't this just be a simple check for
> > > if
> > > the
> > > locale is deterministic? Since we know we have a valid locale
> > > that
> > > should be enough, right?
> > 
> > Looks good to me. The code was correct in the sense that the
> > default
> > collation is always deterministic, but (a) Peter is working on non-
> > deterministic default collations; and (b) it was a redundant check.
> 
> Suspected so.
> 
> I have attached a set of rebased patches with an added assert. Maybe
> I 
> should start a new thread though.

v2-0001:

* There was a performance regression for repeated lookups, such as a "t
< 'xyz'" predicate. I committed 12d3345c0d (to remember the last
collation lookup), which will prevent that regression.

* This patch may change the handling of collation oid 0, and I'm not
sure whether that was intentional or not. lc_collate_is_c(0) returned
false, whereas pg_newlocale_from_collation(0)->collate_is_c raised
Assert or threw an cache lookup error. I'm not sure if this is an
actual problem, but looking at the callers, they should be more
defensive if they expect a collation oid of 0 to work at all.

* The comment in lc_collate_is_c() said that it returned false with the
idea that the caller would throw a useful error, and I think that
comment has been wrong for a while. If it returns false, the caller is
expected to call pg_newlocale_from_collation(), which would Assert on a
debug build. Should we remove that Assert, too, so that it will
consistently throw a cache lookup failure?

Regards,
	Jeff Davis






view thread (33+ messages)  latest in thread

Message-ID: <82cc9fa110254fdf3b87aed9edd79de4a655fbdc.camel@j-davis.com>
Permalink:  ../82cc9fa110254fdf3b87aed9edd79de4a655fbdc.camel@j-davis.com/
Also on:    postgresql.org/message-id/82cc9fa110254fdf3b87aed9edd79de4a655fbdc.camel@j-davis.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-hackers@postgresql.org
  Cc: pgsql@j-davis.com, andreas@proxel.se, peter@eisentraut.org
  Subject: Re: tiny step toward threading: reduce dependence on setlocale()
  In-Reply-To: <82cc9fa110254fdf3b87aed9edd79de4a655fbdc.camel@j-davis.com>
  References: <2228884bb1f1a02614b39f71a90c94d2cc8a3a2f.camel@j-davis.com> <239b7ef6ce058c6b1c77b3a0cfcc70c1cd8968b1.camel@j-davis.com> <f1935bc481438c9d86c2e0ac537b1c110d41a00a.camel@j-davis.com> <cfd9eb85-c52a-4ec9-a90e-a5e4de56e57d@eisentraut.org> <56af65bde2190cc5ee20c807be7b7bdcda54f40c.camel@j-davis.com> <468dd1fb-20f5-4213-bc70-d1388ccf28fa@proxel.se> <59ea4275d75829a055fc55d8fe139eb85764cf2b.camel@j-davis.com> <ece40520-ca74-4b22-8463-f48215854511@proxel.se> <de1f1788-93bb-45cc-bef8-6f27119b2f3e@eisentraut.org> <89475ee5487d795124f4e25118ea8f1853edb8cb.camel@j-davis.com> <23cc1f3cfcdbdd3b2d3bb956d57ae422aa9d0b9e.camel@j-davis.com> <cfe99144-e1a3-458b-93c6-09b2eac1746e@eisentraut.org> <96d51fbb8b6f338a210cee97abb63c0162bcb781.camel@j-davis.com> <69c2a864-846f-4309-bd5a-aaa1c34f9a11@proxel.se> <96a559be83329bc66074a3925ebcfa8ceb16dfc5.camel@j-davis.com> <60929555-4709-40a7-b136-bcb44cff5a3c@proxel.se> <82cc9fa110254fdf3b87aed9edd79de4a655fbdc.camel@j-davis.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox