Re: Custom text type for title text

From: Fabrízio de Royes Mello <fabriziomello(at)gmail(dot)com>
To: Daniel Heath <daniel(at)heath(dot)cc>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Custom text type for title text
Date: 2019-01-03 22:47:27
Message-ID: CAFcNs+q9FZhe=GBm3Rp4SJa335_j4XpUV3GwL-1s46NZ1bG08w@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Em qui, 3 de jan de 2019 às 20:22, Daniel Heath <daniel(at)heath(dot)cc> escreveu:

> Hi All,
>
> I've frequently seen an issue in applications which store titles (eg of
> books, events, user profiles) where duplicate values are not properly
> vetted.
>
> The 'citext' type is helpful here, but I'd be keen to go further.
>
> I propose a 'titletext' type, which has the following properties when
> compared for equality:
> * Case insensitivity (like 'citext')
> * Only considers characters in [:alnum:] (that is, ignores spaces,
> punctuation, etc)
>
> This would be useful for a range of situations where it's important to
> avoid entering duplicate values.
>
> Given the discussion at
> https://www.postgresql.org/message-id/CAKFQuwY9u14TqG8Yzj%3DfAB0tydvvtK7ibgFEx3tegbPWsGjJpg%40mail.gmail.com
> <https://www.postgresql.org/message-id/CAKFQuwY9u14TqG8Yzj=fAB0tydvvtK7ibgFEx3tegbPWsGjJpg@mail.gmail.com> I'd
> lean towards making this type not automatically coerce to text (to avoid
> surprising behaviour when comparing text to titletext).
>
> Is a suitable patch likely to be accepted?
>

> You don’t need touch the core to do that. Just implement it as an
extension and share throught some channel like pgxn.org.

Note that citext also is an extension and released as a contrib module.

Regards,

--
Fabrízio de Royes Mello Timbira - http://www.timbira.com.br/
PostgreSQL: Consultoria, Desenvolvimento, Suporte 24x7 e Treinamento

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tomas Vondra 2019-01-03 22:48:34 Re: Delay locking partitions during query execution
Previous Message Daniel Heath 2019-01-03 22:22:27 Custom text type for title text