Re: proposal: schema variables

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: Wolfgang Walther <walther(at)technowledgy(dot)de>
Cc: Dmitry Dolgov <9erthalion6(at)gmail(dot)com>, Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>, Erik Rijkers <er(at)xs4all(dot)nl>, Michael Paquier <michael(at)paquier(dot)xyz>, Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>, DUVAL REMI <REMI(dot)DUVAL(at)cheops(dot)fr>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: proposal: schema variables
Date: 2024-11-16 15:36:19
Message-ID: CAFj8pRCeh3u9rSqq0me52iik9+pNUvYeb8OgbuFxJArrb4VDjA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-performance

so 16. 11. 2024 v 15:56 odesílatel Wolfgang Walther <walther(at)technowledgy(dot)de>
napsal:

> Dmitry Dolgov:
> > This sounds to me like an argument against allowing name clashing between
> > variables and tables. It makes even more sense, since session variables
> are in
> > many ways similar to tables.
>
> +1
>

It doesn't help too much, because the unique tuple (schema, name), and
there is a search path.

Secondly, the pg_class is not good enough for description of scalar
variables, and enhancing pg_class for scalar variables can be messy.

>
> My mental model of a session variable is similar to a single-row,
> optionally global temporary, table.
>
> Is there any substantial difference that I am not aware of?
>

What I know, the variables are used as query parameters, not as relations -
Oracle, DB2, MSSQL, MySQL, ...

semantically, yes - it is a global temporary object, but it can be scalar
or composite value - it is not row.

(global (temp)) table can hold 0, 1 or more rows (and rows are always
composite of 0..n fields). The variable holds a value of some type.
Proposed session variables are like plpgsql variables (only with different
scope). In Postgres there is a difference between a scalar variable and
composite variable with one field.

Regards

Pavel

> Best,
>
> Wolfgang
>

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Pavel Stehule 2024-11-16 15:41:10 Re: proposal: schema variables
Previous Message Wolfgang Walther 2024-11-16 14:56:53 Re: proposal: schema variables

Browse pgsql-performance by date

  From Date Subject
Next Message Pavel Stehule 2024-11-16 15:41:10 Re: proposal: schema variables
Previous Message Wolfgang Walther 2024-11-16 14:56:53 Re: proposal: schema variables