From: David G. Johnston <david.g.johnston@gmail.com>
To: Rui DeSousa <rui@crazybean.net>
Cc: raf <raf@raf.org>
Cc: pgsql-admin@lists.postgresql.org <pgsql-admin@lists.postgresql.org>
Subject: Re: PostgreSQL CHARACTER VARYING vs CHARACTER VARYING (Length)
Date: Tue, 28 Apr 2020 21:34:10 -0700
Message-ID: <CAKFQuwbH0sB8Rc0LMV77fUkP9c-foqEfzCCDLSusTfaG933Jvw@mail.gmail.com> (raw)
In-Reply-To: <D9F0D7D1-9D46-4B9B-8B62-EE139159F62E@crazybean.net>
References: <CAOasRJYCUwMYdd=BL29TupW_iCbvM3YRM01YTB_WYSUEays3CA@mail.gmail.com>
<CAKhGwmB_C4a1XVrzYsr3CFmUxegZyvsC=7QtzkW6TP27J5G31w@mail.gmail.com>
<20200428234332.7nkyomr2unlez6p5@raf.org>
<8EC9D082-B541-435F-9EE3-3ED14AA3C2D1@crazybean.net>
<20200429022928.fywdmiuc6oqpmgtc@raf.org>
<D9F0D7D1-9D46-4B9B-8B62-EE139159F62E@crazybean.net>
On Tuesday, April 28, 2020, Rui DeSousa <rui@crazybean.net> wrote:
>
> Arbitrarily? What’s a cusip, vin, ssn? Why would you put a btree index on
> a text field? Because it’s not.
>
> What you’re advocating is a NoSQL design — defer your schema design.
> Letting the application code littered in multiple places elsewhere define
> what a cusip, etc. is.
>
>
All of those would be defined as PKs somewhere with a constraint that
limits not only their length but also allowable characters so you don’t get
something like !@#$%^&*( as a valid ssn of length 9. A domain is probably
even better though has implementation trade-offs.
A length constraint by itself is insufficient in those examples, which are
still arbitrary though the decision is outside the control of the modeler.
If the supplied values are external, which they likely are, the system
under design should probably just define the values loosely and accept
whatever the source system provides as-is.
David J.
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-admin@postgresql.org
Cc: david.g.johnston@gmail.com, rui@crazybean.net, raf@raf.org
Subject: Re: PostgreSQL CHARACTER VARYING vs CHARACTER VARYING (Length)
In-Reply-To: <CAKFQuwbH0sB8Rc0LMV77fUkP9c-foqEfzCCDLSusTfaG933Jvw@mail.gmail.com>
References: <CAOasRJYCUwMYdd=BL29TupW_iCbvM3YRM01YTB_WYSUEays3CA@mail.gmail.com> <CAKhGwmB_C4a1XVrzYsr3CFmUxegZyvsC=7QtzkW6TP27J5G31w@mail.gmail.com> <20200428234332.7nkyomr2unlez6p5@raf.org> <8EC9D082-B541-435F-9EE3-3ED14AA3C2D1@crazybean.net> <20200429022928.fywdmiuc6oqpmgtc@raf.org> <D9F0D7D1-9D46-4B9B-8B62-EE139159F62E@crazybean.net> <CAKFQuwbH0sB8Rc0LMV77fUkP9c-foqEfzCCDLSusTfaG933Jvw@mail.gmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox