Search Postgresql Archives

Re: A simple question about text fields

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thursday, June 17, 2021, Gavan Schneider <list.pg.gavan@xxxxxxxxxxx> wrote:

My approach is to define such fields as ‘text’ and set a constraint using char_length(). This allows PG to do the business with the text in native form, and only imposes the cost of any length check when the field is updated… best of both worlds.

Those are basically the same world…your alternative probably is strictly worse than varchar(n) because of its novel way of implementing the same functionality.

For most text fields any good constraint is going be done in the form of a regular _expression_, one that at minimum prevents non-printable characters (linefeed and carriage return being obvious examples).

David J.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]

  Powered by Linux