Re: Using a boolean column with IF / THEN - Mailing list pgsql-general

From David G. Johnston
Subject Re: Using a boolean column with IF / THEN
Date
Msg-id CAKFQuwaocJF=3vSsvG3cf4WTQq3vFjcjLWiX4s0WQhy1B46P9A@mail.gmail.com
Whole thread Raw
In response to Using a boolean column with IF / THEN  (Alexander Farber <alexander.farber@gmail.com>)
Responses Re: Using a boolean column with IF / THEN
List pgsql-general

On Saturday, December 5, 2020, Alexander Farber <alexander.farber@gmail.com> wrote:
Good evening,

hopefully my question is not too stupid, but -

in a 13.1 database I have a words_users table with a boolean column:

        -- the user is not allowed to chat or change the motto
        muted         boolean NOT NULL DEFAULT false,

Currently I check the value as follows, but I wonder if this is the best way with PL/pgSQL -


Maybe not “simpler” but for all those checks you could write a single query that pulls out all the data at once into a record variable and test against the columns pf that instead of executing multiple queries.

David J.

pgsql-general by date:

Previous
From: Alexander Farber
Date:
Subject: Using a boolean column with IF / THEN
Next
From: Laurenz Albe
Date:
Subject: Re: Set COLLATE on a session level