Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tCKrC-00GcaK-36 for pgsql-hackers@arkaria.postgresql.org; Sat, 16 Nov 2024 15:37:05 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1tCKr8-00Eiiy-Bq for pgsql-hackers@arkaria.postgresql.org; Sat, 16 Nov 2024 15:37:02 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tCKr8-00Eiio-24 for pgsql-hackers@lists.postgresql.org; Sat, 16 Nov 2024 15:37:02 +0000 Received: from mail-yw1-x1136.google.com ([2607:f8b0:4864:20::1136]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1tCKr6-002DYu-77 for pgsql-hackers@lists.postgresql.org; Sat, 16 Nov 2024 15:37:01 +0000 Received: by mail-yw1-x1136.google.com with SMTP id 00721157ae682-6ea339a41f1so14693157b3.2 for ; Sat, 16 Nov 2024 07:36:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1731771419; x=1732376219; darn=lists.postgresql.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=7J/oGNYhlWjEEUsYkQS5d/WktOG/737j3OsR979cnmI=; b=XBpkB+AbrLeYaTMrsXjMAr0ZadbUbHAMgiZNFK9IISAleU7m7f8S6z6sBvuwI2MOo5 C3bLM9xEiyNP3hkPQdccMNEn8N8OtSbG6OLbnALii40J0yTLrsZeOloAtwsrZ8lwcmSS gqhHF6iyBfoykcAU61ca0uI+PqDxVEQdI+XwCwbuLEzlF8vG8jh7i636z7ZzQa22xJTJ Y0nuJGA7TTngiHGgYHRb/6Kcn/0HL9HIL4qBJrZIjzXLSC6e6W8IHHpHoPJ5gIM1ADE3 wlTTYtoAa4AHaBnETCXB2mpihxKHuYrMgyxNR2DFqbm7tn1tRctHtMvNl9iQL71MYo5h 1sYg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731771419; x=1732376219; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=7J/oGNYhlWjEEUsYkQS5d/WktOG/737j3OsR979cnmI=; b=cC7AupWq+/l92DWGvYNh+GmJPxo7J1dkXpjE5B7DT/jgsNQnrCp4/12yQ4wwIX6hfK zpITkhVE5CLpAxn2oLiJogridIIxc4LQeX0yFfX8OAotII3psdJ8KOYLtjcNaEOQTc0g 53sI1YgvZomLPScjhwMv+GOQaATfXGG7bgkag1VhVvVk82aFxPSrHcg3mMYG3KahuwCb 71RhvoHABcEEP9AQGWa9/Y6m3NVk7zuZpVLMnUSSSlkM/OHSRTRE4Nz4FbrJz2YPSiWZ kwPUVvs8qutbQ4vabcKMPAAWSa4Nv8xSPDLEMnp5X9t+2He2Y0jZBfkNUquiXl6y93SP 0HTA== X-Forwarded-Encrypted: i=1; AJvYcCW+6weSEub/DNthx/CXg42FLWCQL/bQgjKAdqCaLg2fsPxpG3hupf87JR3So7SJRiXfFDlYLx7dQhy8PrLn@lists.postgresql.org X-Gm-Message-State: AOJu0YyveDIPfhk4znHXwIkpWHOTH2Spsd9UnKh8lk68aGgDirD7JpPZ he4ObPxbTcbhUR2ijQxjyc61Bi4SH2pE9SP8ovnoUJBgCOA/OpAQkcx5R8bf2u6ApBEqQtOxSOu qIL5Q1yZVfTz5GbP0z+lWZZdUaBQ= X-Google-Smtp-Source: AGHT+IFFgnXlQbbxxq6s3bfJf6X9gSzRe6zy1loOpaebuW+EgfhTgGrMVpBPhjq5vUtcMb5N83G9QeUTXdt+tXEqqZA= X-Received: by 2002:a05:690c:6802:b0:6e3:d76c:9354 with SMTP id 00721157ae682-6ee55c73397mr74403877b3.41.1731771418971; Sat, 16 Nov 2024 07:36:58 -0800 (PST) MIME-Version: 1.0 References: <3chredgnjcmccym2kczawfih226b4ac6co7p6z4jeofevrcosi@mrsxkx2x2c65> <78f3c264-658a-4007-ab79-4cc913fba675@technowledgy.de> In-Reply-To: <78f3c264-658a-4007-ab79-4cc913fba675@technowledgy.de> From: Pavel Stehule Date: Sat, 16 Nov 2024 16:36:19 +0100 Message-ID: Subject: Re: proposal: schema variables To: Wolfgang Walther Cc: Dmitry Dolgov <9erthalion6@gmail.com>, Laurenz Albe , Erik Rijkers , Michael Paquier , Amit Kapila , DUVAL REMI , PostgreSQL Hackers Content-Type: multipart/alternative; boundary="0000000000004295f706270974d4" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --0000000000004295f706270974d4 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable so 16. 11. 2024 v 15:56 odes=C3=ADlatel Wolfgang Walther napsal: > Dmitry Dolgov: > > This sounds to me like an argument against allowing name clashing betwe= en > > 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 > --0000000000004295f706270974d4 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable


=
so 16. 11. 2024 v=C2=A015:56 odes=C3= =ADlatel Wolfgang Walther <wa= lther@technowledgy.de> napsal:
Dmitry Dolgov:
> This sounds to me like an argument against allowing name clashing betw= een
> variables and tables. It makes even more sense, since session variable= s are in
> many ways similar to tables.

+1

It doesn't help too much, becaus= e the unique tuple (schema, name), and there is a search path.
Secondly, the pg_class is not good enough for description of s= calar variables, and enhancing pg_class for scalar variables can be messy.<= br>

=C2=A0

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 parameter= s, not as relations - Oracle, DB2, MSSQL, MySQL, ...

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

(globa= l (temp)) table can hold 0, 1 or more rows (and rows are always composite o= f 0..n fields). The variable holds a value of some type. Proposed session v= ariables are like plpgsql variables (only with different scope). In Postgre= s there is a difference between a scalar variable and composite variable wi= th one field.

Regards

Pavel


Best,

Wolfgang
--0000000000004295f706270974d4--