On  December 24, 2016 9:52 PM Craig Ringer
[mailto:craig.rin...@2ndquadrant.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
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
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()
Does this seem like an approach that would meet your "Very fast"
Ian Lewis (www.mstarlabs.com)

Reply via email to