Re: Cluster wide option to control symbol case folding

From: "Lewis, Ian \(Microstar Laboratories\)" <ilewis(at)mstarlabs(dot)com>
To: "Craig Ringer" <craig(dot)ringer(at)2ndquadrant(dot)com>
Cc: "PostgreSQL Hackers" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Cluster wide option to control symbol case folding
Date: 2016-12-25 07:13:48
Message-ID: ACF85C502E55A143AB9F4ECFE960660A17282E@mailserver2.local.mstarlabs.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On December 24, 2016 9:52 PM Craig Ringer
[mailto:craig(dot)ringer(at)2ndquadrant(dot)com] wrote:
> Personally I can see such an option being ok as an initdb-time setting
or at CREATE DATABASE time. Case folding can know the current db from
global context.
>
> It'd have to be fast though. Very fast.

That seems reasonable. In fact, it is nicer to configure at the database
level, rather than at the cluster level. I did not know it was possible
to tell the database from global context. Since a connection only allows
access to a single database, it makes sense that could be possible.

A check of a single global configuration variable to switch between one
of three handler paths would be very small compared with the
character-by-character checks currently performed by
downcase_identifier(), though, of course, the extra check would not be
free.

However, it would likely be faster to setup up the processing to call
through a global pointer to one of three handler functions. On most
Intel processors, at least, that extra pointer indirection costs little
to nothing. The pointer could be set up during database connect (I do
not know what I am talking about here, but there must be such a process
somewhere).

Presumably, the handler pointer would have to go into the global
database descriptor whatever that is. Or, if you allow use of global
objects for storing information about database scope run-time
configuration, it could just be a function pointer stored with the
handlers. The database initialization processing could call a setup
function when it runs to select the correct handling for its
configuration. The default would be the current downcase_identifier()
handling.

Does this seem like an approach that would meet your "Very fast"
requirement?

Ian Lewis (www.mstarlabs.com)

Browse pgsql-hackers by date

  From Date Subject
Next Message Lewis, Ian (Microstar Laboratories) 2016-12-25 07:16:02 Re: Cluster wide option to control symbol case folding
Previous Message Tom Lane 2016-12-25 06:48:36 Re: Cluster wide option to control symbol case folding