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 1tCMMl-00HGXV-QG for pgsql-hackers@arkaria.postgresql.org; Sat, 16 Nov 2024 17:13:47 +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 1tCMMj-00FDb2-7a for pgsql-hackers@arkaria.postgresql.org; Sat, 16 Nov 2024 17:13:45 +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 1tCMMi-00FDau-TT for pgsql-hackers@lists.postgresql.org; Sat, 16 Nov 2024 17:13:45 +0000 Received: from dd25110.kasserver.com ([85.13.146.49]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tCMMg-002EJy-N6 for pgsql-hackers@lists.postgresql.org; Sat, 16 Nov 2024 17:13:44 +0000 Received: from [192.168.0.102] (ip-037-201-153-175.um10.pools.vodafone-ip.de [37.201.153.175]) by dd25110.kasserver.com (Postfix) with ESMTPSA id 22C29E1A0204; Sat, 16 Nov 2024 18:13:39 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=technowledgy.de; s=kas202308201259; t=1731777219; bh=gwUdALj6WRq6FzqTSNGejGPjVah+Ys3VZxMPX62Bxgo=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=D6CocVpPOD7iXF5egr8Pdhh3dOF2JlNbNwenjUPsuWVmirx/Me3fdE0KGBTIOQjhb ib7Fd2hZqRRuMzgWrX8bLUIoB+icdPiFAbzxY7RMXo/LMDMvO3Hzya7EaPCUWzmc0d Jzb/0NQxsIXIoWRclo7oeu6oxBM8ZbSTq8yszgxQGsMd5yv71OlCAnfATGH5pudaAV /ytgJmz99I5UFeOmwDKzJoWqORZ2MFmvC8PDYOfRr05LBaQ8HeaemYTdF/4qFXIf// 4Zr+7BGBkE9uou1fADY0pXKGrZRiOKdS95aYFdheHxNq/0g5Vta/UgXWsvw6IRDmoo c9SvZSMvyWakQ== Message-ID: <0e35aece-a138-4ee1-9bb8-92a4a55ff149@technowledgy.de> Date: Sat, 16 Nov 2024 18:13:38 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: proposal: schema variables To: Pavel Stehule Cc: Dmitry Dolgov <9erthalion6@gmail.com>, Laurenz Albe , Erik Rijkers , Michael Paquier , Amit Kapila , DUVAL REMI , PostgreSQL Hackers References: <3chredgnjcmccym2kczawfih226b4ac6co7p6z4jeofevrcosi@mrsxkx2x2c65> <78f3c264-658a-4007-ab79-4cc913fba675@technowledgy.de> From: Wolfgang Walther Content-Language: en-US In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spamd-Bar: + List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Pavel Stehule: > (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. I can store composite values in table columns, too. A table column can either be scalar or composite in that sense. So, maybe rephrase: Single-row, single-column (global (temp)) table = variable. One "cell" of that table. For me, the major difference between a variable and a table is, that the table has 0...n rows and 0...m columns, while the variable has *exactly* one in both cases, not 0 either. I must put tables into FROM, why not those nice mini-tables called variables as well? Because they are potentially scalar, you say! But: I can already put functions returning scalar values into FROM:   SELECT * FROM format('hello'); The function returns a plain string only. I don't know. This just "fits" for me. Or to put it differently: I don't really care whether I have to write "(SELECT variable FROM variable)" instead of just "variable". I don't want session variables for the syntax, I want session variables, because they are **so much better** than custom GUCs. Best, Wolfgang