Re: case statement within insert - Mailing list pgsql-general

From Francisco Olarte
Subject Re: case statement within insert
Date
Msg-id CA+bJJbyi-EXJaZDJNKs49nfEFFGp+ZWyEiW+vFYKaC7szQ_7Sg@mail.gmail.com
Whole thread Raw
In response to case statement within insert  (tango ward <tangoward15@gmail.com>)
List pgsql-general
On Fri, May 25, 2018 at 11:04 AM, tango ward <tangoward15@gmail.com> wrote:
>                                           CASE
>         WHEN code like '%%PE%%' or code like '%%NSTP%%'
>         THEN True
>         ELSE False

I cannot advise you on the %% stuff, which I do not totally understand, but

CASE WHEN condition THEN true ELSE false END

when contition is ( as it should in a CASE ) a boolean expression is a
classic antipattern , just use 'condition' or '(condition)'

Francisco Olarte.


pgsql-general by date:

Previous
From: Adrian Klaver
Date:
Subject: Re: case statement within insert
Next
From: Erlend Sogge Heggen
Date:
Subject: Syndicating PostgreSQL mailing list to Discourse