Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1h5u1B-0004gw-10 for pgsql-general@arkaria.postgresql.org; Mon, 18 Mar 2019 15:17:37 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1h5u19-0007Sf-Or for pgsql-general@arkaria.postgresql.org; Mon, 18 Mar 2019 15:17:35 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1h5u19-0007S6-5Y for pgsql-general@lists.postgresql.org; Mon, 18 Mar 2019 15:17:35 +0000 Received: from mail-pf1-x42e.google.com ([2607:f8b0:4864:20::42e]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1h5u15-0008Lz-Ur for pgsql-general@lists.postgresql.org; Mon, 18 Mar 2019 15:17:33 +0000 Received: by mail-pf1-x42e.google.com with SMTP id v21so11459521pfm.12 for ; Mon, 18 Mar 2019 08:17:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-language; bh=CO7SvBaSLwIHd1srHfzefNRcp+yIyfQk+7iP+a0u0lk=; b=RJGFTrj2yLWnfwvPXf3hRe1l+TM9NkkbbbXgRa6JC+jgM1pvfeJTzkLcDBuhCisIK2 67zlWNKMuHrBbILCpqavB46gK68SKFHvuVP+gnl5R4+34wM/LMpjtET9lCFie1zu6FNN 6x5Jwf8uJ3AN9mgZZxye8MqYsdJBr95xkxJ0KKuKadd3P0TGqm11jKxDKarHhEZt40U3 F2S1QEgxM5wYultGpM5je9NeBDnvEM1IRZoeNPZb5ZzTVgXX0ygLnBETeNzeBmTCmcGz rQMRIrP5BDhhcuxLTBGUG8KJRXOK1HdcXNiEQjcTN+Ke4eEJ8U0NkXe0Wrt3E8qhVgfb z5TQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language; bh=CO7SvBaSLwIHd1srHfzefNRcp+yIyfQk+7iP+a0u0lk=; b=C0g61jsYaAgefRa5Rr2QJhMzn2viR5+GbBayDuRnVFKU0I9J1hJmuVbP1teLQR4PQ2 6UCK4PCdWkPAlNTZnVWyxRlneIWDd5edPgRFBoHxjYorXk3uGkX0G3+ydoqnECwzLtl9 tiQeM2XKtX+EpH3E9Et2HELiBR6e/WqAs2BMuYxKj0/y5vzP2eKJgROb6ArbJZEf3UEB OD7PKpm5wZsjmnZEuJrU32CPoEfvYazmMnCDOEMosP+xRlGrGomdHlhjj+Y7kAGv2g9e K+4Ei1vdLKYaww3v4P8RjMGmhhhHcW0vi9gp/fj9HSxRJL+oZqOHb5GY4ElPydwCpOec lqKQ== X-Gm-Message-State: APjAAAXoSmSDNvaV5YA+4Gx9mzJ918x125gmsSdrHelRAizhV3WdkY1P 0v+c0KU18MaJ4el9nM2JCH4xw1Hs X-Google-Smtp-Source: APXvYqysQbLKyvAeY+Nu8A23mE7vFonvAweQ8X1Km6qSGYOQsDuw9EZzYqFRmLvuI2ZGp51pRvJjwQ== X-Received: by 2002:a63:c511:: with SMTP id f17mr18109633pgd.202.1552922250257; Mon, 18 Mar 2019 08:17:30 -0700 (PDT) Received: from [10.104.134.14] ([155.100.47.6]) by smtp.gmail.com with ESMTPSA id k22sm14457140pfa.84.2019.03.18.08.17.29 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 18 Mar 2019 08:17:29 -0700 (PDT) Subject: Re: Camel case identifiers and folding To: pgsql-general@lists.postgresql.org References: <1552641160.5846.2.camel@ucll.be> <7D62A9A2-C784-47A9-96BC-5949D0C8348E@gmail.com> <20190316174021.wcpjdoyize6f2gw5@hjp.at> <0536E5C1-A419-43B3-8083-19020439ABE7@gmail.com> <20190316214641.bzyg7o5qv3bolvt4@hjp.at> From: Rob Sargent Message-ID: Date: Mon, 18 Mar 2019 09:17:28 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.5.1 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/alternative; boundary="------------C34391D8042529A0AC469BC4" Content-Language: en-US List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk This is a multi-part message in MIME format. --------------C34391D8042529A0AC469BC4 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit On 3/18/19 5:18 AM, Morris de Oryx wrote: > Sounds like I may have touched a nerve with some. If so, no offense > intended! > > There are cases where case-sensitivity is required or desirable, it > would be silly to argue otherwise. Where you have such cases, then > case-sensitive queries are great. Some RDBMS systems default to > case-sensitive searches, others default to case-blind searches. I'll > take that to mean that either choice has merit, and it's not foolish > to prefer either. I need case-blind searches vanishingly close to 100% > of the time, but other people have different conditions and may find > that they almost never need case-blind searches. I find this extreme > hard to imagine, but find it easy to imagine people who need > case-sensitive searches quite often. > > What I've been thinking about most are user-driven searches on > user-oriented data. Users, at least any user I've ever had, don't want > case-sensitive searches. They also don't care about diacritical > characters, at least in English. I worked for a French company for > many years. Diacritical searches were not always preferred, but > sometimes were. It depends on your user community and their > requirements and norms. Sometimes it comes down to an individual user. > Options are good! I was really just trying to warn someone coming from > a base-blind default about Postgres behavior because, well, it hurts > if you aren't expecting it. That doesn't make Postgres wrong (it's not > that kind of a choice), but it is important to know about. > > I'm new to Postgres (only about a year in), and it's great. But I'm > used to a case-blind search as a default. And, honestly, I can *never* > remember a case when a user asked for a case-sensitive search. Ever. > In 30+ years. Maybe it's just me. Just kidding, it's not just me. If > you're presenting users with a search interface, you can find out by > asking them. Or you can AB test a search UI where there is the option > of case-sensitive/blind searching, but you randomly flip which is the > default. For users, case-sensitive searches are assumed. That's what > Google does. Seriously, Google === Search. It's not a hard test to > run. If you find that with a case-blind search, 30% of user tick the > box to make it case-sensitive, then you've got users that often do > care about case-sensitive search. > > And since it seems to be unclear at a few places in the discussion > above: *It absolutely makes sense to store data in its original form* > and to allow for case-sensitive searches, when required. It would be > very weird to store > > /     Call me back Ishmael, I've gotta go.../ > > and get back anything else, be that > > /     call me back ishmael, i've gotta go... > / > > or > > /     CALL ME BACK ISHMAEL, I'VE GOTTA GO.../ > > As far as I understand it in Postgres, you can: > > * Use something like UPPER or LOWER in Every. Single. Search. > > * Fold text to one case consistently in an index to make searches > case-blind. > > * Use citext. > > * Teach and convince every user to enter and search for data > case-sensitively correctly Every. Single. Time. > > On that last point, good luck. Here's an example, I'm keen on birds. > Do you write it: > > Black-shouldered Kite > Black-Shouldered Kite > > Since you say you're new(ish) to postgres I have to ask have you bumped into the tilde(~) operator for text? And the critical tildeAstersik ( ~* )? --------------C34391D8042529A0AC469BC4 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: 8bit


On 3/18/19 5:18 AM, Morris de Oryx wrote:
Sounds like I may have touched a nerve with some. If so, no offense intended!

There are cases where case-sensitivity is required or desirable, it would be silly to argue otherwise. Where you have such cases, then case-sensitive queries are great. Some RDBMS systems default to case-sensitive searches, others default to case-blind searches. I'll take that to mean that either choice has merit, and it's not foolish to prefer either. I need case-blind searches vanishingly close to 100% of the time, but other people have different conditions and may find that they almost never need case-blind searches. I find this extreme hard to imagine, but find it easy to imagine people who need case-sensitive searches quite often.

What I've been thinking about most are user-driven searches on user-oriented data. Users, at least any user I've ever had, don't want case-sensitive searches. They also don't care about diacritical characters, at least in English. I worked for a French company for many years. Diacritical searches were not always preferred, but sometimes were. It depends on your user community and their requirements and norms. Sometimes it comes down to an individual user. Options are good! I was really just trying to warn someone coming from a base-blind default about Postgres behavior because, well, it hurts if you aren't expecting it. That doesn't make Postgres wrong (it's not that kind of a choice), but it is important to know about.

I'm new to Postgres (only about a year in), and it's great. But I'm used to a case-blind search as a default. And, honestly, I can *never* remember a case when a user asked for a case-sensitive search. Ever. In 30+ years. Maybe it's just me. Just kidding, it's not just me. If you're presenting users with a search interface, you can find out by asking them. Or you can AB test a search UI where there is the option of case-sensitive/blind searching, but you randomly flip which is the default. For users, case-sensitive searches are assumed. That's what Google does. Seriously, Google === Search. It's not a hard test to run. If you find that with a case-blind search, 30% of user tick the box to make it case-sensitive, then you've got users that often do care about case-sensitive search.

And since it seems to be unclear at a few places in the discussion above: It absolutely makes sense to store data in its original form and to allow for case-sensitive searches, when required. It would be very weird to store

     Call me back Ishmael, I've gotta go...

and get back anything else, be that

     call me back ishmael, i've gotta go...

or

     CALL ME BACK ISHMAEL, I'VE GOTTA GO...

As far as I understand it in Postgres, you can:

* Use something like UPPER or LOWER in Every. Single. Search.

* Fold text to one case consistently in an index to make searches case-blind.

* Use citext.

* Teach and convince every user to enter and search for data case-sensitively correctly Every. Single. Time.

On that last point, good luck. Here's an example, I'm keen on birds. Do you write it:

Black-shouldered Kite
Black-Shouldered Kite


Since you say you're new(ish) to postgres I have to ask have you bumped into the tilde(~) operator for text? And the critical tildeAstersik ( ~* )?
--------------C34391D8042529A0AC469BC4--