Re: Robust ways for checking allowed values in a column

From: Ray O'Donnell <ray(at)rodonnell(dot)ie>
To: Shaozhong SHI <shishaozhong(at)gmail(dot)com>, pgsql-general <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: Robust ways for checking allowed values in a column
Date: 2022-01-25 14:26:44
Message-ID: b832279a-3f4d-19a1-0607-2c22f7b97cf8@rodonnell.ie
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 25/01/2022 13:55, Shaozhong SHI wrote:
> I tried the following:
>
> select form from mytable where form ~
> '^Canal$|^Drain$|^Foreshore$|^inlandRiver$|^Lake$|^lockOrFlightOfLocks$|^Marsh$|^Researvoir$|^Sea$|^tidalRiver$|^Transfer$'
>
> I used ^ and $ to ensure checking of allowed values.
>
> However, 'Backyard' was selected.
>
> Why is that?

Sounds like a candidate for a foreign key relationship.

Ray.

--
Raymond O'Donnell // Galway // Ireland
ray(at)rodonnell(dot)ie

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Julien Rouhaud 2022-01-25 15:33:19 Re: GIN index
Previous Message David G. Johnston 2022-01-25 14:25:04 Re: Robust ways for checking allowed values in a column