Subject: Conditional Tables Feature on PostGresSQL

From: "Sanchari Biswas (Shrina)" <[email-masked]>
Date: Fri, 22 Oct 2021 12:34:58 -0400

Hello,

Is there any existing feature that enables the use of conditional tables on PostGreSQL, specifically the usage of variables, and implementing those variables in our (complex) queries?

Thanks,
Sanchari.

---

From: Aditya Toshniwal <[email-masked]>
Date: Mon, 25 Oct 2021 09:41:13 +0530

Hi Sanchari,

You can use the query tool to write anonymous blocks. Else, can you please
explain with an example what exactly is the requirement ?

On Fri, Oct 22, 2021 at 10:05 PM Sanchari Biswas (Shrina) <
[email-masked]> wrote:

> Hello,
>
> Is there any existing feature that enables the use of conditional tables
> on PostGreSQL, specifically the usage of variables, and implementing those
> variables in our (complex) queries?
>
> Thanks,
> Sanchari.
>
>

-- 
Thanks,
Aditya Toshniwal
pgAdmin Hacker | Software Architect | *edbpostgres.com*
<http://edbpostgres.com>
"Don't Complain about Heat, Plant a TREE"

---

From: Sanchari Biswas <[email-masked]>
Date: Mon, 25 Oct 2021 00:30:24 -0400

Hi Aditya,

Can we use variables in any column and then have (Boolean) constraints over
the variables?
Eg. x as a variable value and then corresponding condition (x ≠ 5 || x ≠
10).
So that this condition is satisfied when queried with values of column
(with variable x) other than the above two and the condition converts to
actual constant values, and returns tuples with that actual value.

Thanks,
Sanchari.

---

From: Aditya Toshniwal <[email-masked]>
Date: Mon, 25 Oct 2021 10:22:48 +0530

Hi Sanchari,

I'm not sure if PostgreSQL provides such a feature, but the closest I can
relate it is to generated columns where you can put the expression to be
evaluated. It doesn't allow variables but you can use other columns in
expresssion - https://www.postgresql.org/docs/12/ddl-generated-columns.html

On Mon, Oct 25, 2021 at 10:00 AM Sanchari Biswas <[email-masked]>
wrote:

> Hi Aditya,
>
> Can we use variables in any column and then have (Boolean) constraints
> over the variables?
>> You can use the query tool to write anonymous blocks. Else, can you
>> please explain with an example what exactly is the requirement ?
>>