Search Postgresql Archives

Re: Robust ways for checking allowed values in a column

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

 



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@xxxxxxxxx> wrote:
On Tue, Jan 25, 2022 at 6:56 AM Shaozhong SHI <shishaozhong@xxxxxxxxx> 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')

[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