pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Rob Sargent <robjsargent@gmail.com>
To: pgsql-general@lists.postgresql.org
Subject: Re: Robust ways for checking allowed values in a column
Date: Tue, 25 Jan 2022 09:40:53 -0700
Message-ID: <7bcf6809-a959-5224-93db-645d15cd4359@gmail.com> (raw)
In-Reply-To: <CA+i5JwbTugb+J4GO1V_adBEhOK8vbBWdu0f0XTzvytGR72=BQw@mail.gmail.com>
References: <CA+i5JwZ75h=VQN_rc8P5g_1+_boGQ=gv3b_KW-WPc7KR-nUKEQ@mail.gmail.com>
	<CAKFQuwbhKUsPXwPvoPnh2Xv=g748y6UxigCOoNOUY=a7EhEv0Q@mail.gmail.com>
	<CA+i5JwbTugb+J4GO1V_adBEhOK8vbBWdu0f0XTzvytGR72=BQw@mail.gmail.com>

On 1/25/22 09:35, Shaozhong SHI wrote:
> How about adding null as an alteration.
>
> Would this be robust?
>
> Regards,
>
> David
>
> On Tue, 25 Jan 2022 at 14:25, David G. Johnston 
> <david.g.johnston@gmail.com> wrote:
>
>     On Tue, Jan 25, 2022 at 6:56 AM Shaozhong SHI
>     <shishaozhong@gmail.com> wrote:
>
>          select form from mytable  where form ~
>         '^Canal$|^Drain$|^Foreshore$|^inlandRiver$|^Lake$|^lockOrFlightOfLocks$|^Marsh$|^Researvoir$|^Sea$|^tidalRiver$|^Transfer$'
>
>
>     You do not need to repeat the boundary metacharacters on each
>     branch.  You can assert their presence just once and then use
>     parentheses to group the alternations.
>
>     form ~ '^(?Canal|Drain|etc...)$'
>
>     David J.
>

You would need to add form ~ 'expression' or form is null

And a body of held water is a reservoir (no 'a')

view thread (6+ messages)

Message-ID: <7bcf6809-a959-5224-93db-645d15cd4359@gmail.com>
Permalink:  ../7bcf6809-a959-5224-93db-645d15cd4359@gmail.com/
Also on:    postgresql.org/message-id/7bcf6809-a959-5224-93db-645d15cd4359@gmail.com

 · 

reply

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-general@postgresql.org
  Cc: robjsargent@gmail.com
  Subject: Re: Robust ways for checking allowed values in a column
  In-Reply-To: <7bcf6809-a959-5224-93db-645d15cd4359@gmail.com>
  References: <CA+i5JwZ75h=VQN_rc8P5g_1+_boGQ=gv3b_KW-WPc7KR-nUKEQ@mail.gmail.com> <CAKFQuwbhKUsPXwPvoPnh2Xv=g748y6UxigCOoNOUY=a7EhEv0Q@mail.gmail.com> <CA+i5JwbTugb+J4GO1V_adBEhOK8vbBWdu0f0XTzvytGR72=BQw@mail.gmail.com> <7bcf6809-a959-5224-93db-645d15cd4359@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