Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gyNEG-0003bk-7F for pgsql-hackers@arkaria.postgresql.org; Mon, 25 Feb 2019 20:52:00 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1gyNEE-0005Tb-OB for pgsql-hackers@arkaria.postgresql.org; Mon, 25 Feb 2019 20:51:58 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gyNEE-0005T7-Cy for pgsql-hackers@lists.postgresql.org; Mon, 25 Feb 2019 20:51:58 +0000 Received: from out2-smtp.messagingengine.com ([66.111.4.26]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gyNEB-0007eS-Jz for pgsql-hackers@postgresql.org; Mon, 25 Feb 2019 20:51:57 +0000 Received: from compute7.internal (compute7.nyi.internal [10.202.2.47]) by mailout.nyi.internal (Postfix) with ESMTP id E1F6A23382; Mon, 25 Feb 2019 15:51:54 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute7.internal (MEProxy); Mon, 25 Feb 2019 15:51:54 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm2; bh=K5js5/2nrQtOD7CAEmAb8W/JCby+8ESN48dl4Bg+M eI=; b=78PxKpJkqvVyIc9nU1Ms86uZ1MGaPx1RZyyLHqYtiQvPv5WibMf8F/imZ hj71yPh8NuzHoQ4AYugrC6R0SAqngYLLfdJCBNAsTTWZFEJvE/ezn+xZBoYgL4fL In0BKRPxVg+XK7QgvmBZZY6fQUuslzq4/BPaGMpAtIjr2f8nlQl0/3vuHj6Ovf42 JaReLaxhLUDsMH6shSQqA9YXAj67gUeR3DlvlSsNqw0Ul1i4hoK0svAn+g5+srsY ICZMXKvPnVfyxaaRa/u6VJkUpEGKmSiCyPQtTsj0GQVyRHI6BBFmV+cRVzVvP8wQ SmADl15hD/j7HhIqa7wuph3PU4dDg== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedutddrudejgddugeegucdltddurdegtdelrddttd dmucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfquhht necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpefuvfhfhfhokffffgggjggtgfesthejredttdefheenucfhrhhomheprfgv thgvrhcugfhishgvnhhtrhgruhhtuceophgvthgvrhdrvghishgvnhhtrhgruhhtsedvnh guqhhurggurhgrnhhtrdgtohhmqeenucffohhmrghinhepvdhnughquhgrughrrghnthdr tghomhenucfkphepleefrddvgeefrddukeekrdduvddvnecurfgrrhgrmhepmhgrihhlfh hrohhmpehpvghtvghrrdgvihhsvghnthhrrghuthesvdhnughquhgrughrrghnthdrtgho mhenucevlhhushhtvghrufhiiigvpedt X-ME-Proxy: Received: from april.pezone.net (p5df3bc7a.dip0.t-ipconnect.de [93.243.188.122]) by mail.messagingengine.com (Postfix) with ESMTPA id 0576910331; Mon, 25 Feb 2019 15:51:52 -0500 (EST) Subject: Re: [HACKERS] generated columns To: Michael Paquier , Pavel Stehule References: <20180202022532.GA84623@paquier.xyz> <050e663d-d915-f61b-af96-5a09c10ade02@2ndquadrant.com> <79e4de23-52e3-2c45-9ba0-5f6932f590aa@2ndquadrant.com> <28574501540912440@iva5-750e13568e4d.qloud-c.yandex.net> <2ddd0bfa-0fcd-35ec-266c-f03cf72fc581@2ndquadrant.com> <26129f50-cf47-2013-8f9b-e7a98853aa69@2ndquadrant.com> <20190115071359.GF1433@paquier.xyz> Cc: pgsql-hackers , Sergei Kornilov , Michael Paquier , Jaime Casanova From: Peter Eisentraut Openpgp: preference=signencrypt Autocrypt: addr=peter.eisentraut@2ndquadrant.com; prefer-encrypt=mutual; keydata= xsFNBFUUt6kBEADZd9NNTBJbHmAXXJgPGOdd6Q73l80oifIVgn2tRxP9dYkCfTlo/yLqbKTl JNqTcyM6XrJDnB2sMEUGYCewYZXl+9C4bBJWyNqcEI1ae9u71vEq/fknFLArJ+2wN+f7QuRx Q8d94ZJAiJQ5g3fNk2HVeedCQCKP5dCzU+ZLt2dbsx1PDZLjTO9gf+JswWuGFb5wY5PZVM5V hq66Xk7ZJzHuARacza2RT7J2fkMmQBY+kr7L98Perb0GhafnlhXB0PvUB+N3xpmggMfwuhTu BngS/G/r3GvemxJuFxouw8xsMqrsfdksJXA2gLXYtwRCssdPV3PO0rlD9twqDo8URfIJ5fb6 1g/MV8aTOKjg3Q8MpJPtkwJqN4o3PvbwYdedeFnOVkkYAJdu/aX1v1BeCBDu7Hy3sF52scD3 pQbyQSl9vUDpTLarASAxNbAV0NRJE8dp4vfW6AH1ccryGiFqw/czPK/iN0+MT8wsjAW6WW4w hvjm5UPA1KTwi3ZT8eT5uycuH7QpuNk7LnGGXQ6KaRALFywzkr0A0V0AvFNa+l4wstMaXaB6 dmMXyF0/hfryqyOeu1gAdq4q0/PNC2dPgb/6uoh4eMjN6A5GXcprilhz5DulmsilY21hfSoU S64ODed96pKhprsOxjZiDRsN1QM5MwB+uwVWUNfsX7fIxE0BrwARAQABzSdQZXRlciBFaXNl bnRyYXV0IDxwZXRlckBlaXNlbnRyYXV0Lm9yZz7CwXoEEwEIACQCGwMFCwkIBwMFFQoJCAsF FgIDAQACHgECF4AFAlUUuKQCGQEACgkQoZ8SQ+xBJp8llw//RbGoXnF72FZTlOFsnNyxnWbF vViPCfdAlZl1GGK9OYCvV1dp/956HuhB0wpaGQHiBmQfOPJf/jLOPjXFYm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/LDKhLRFsuQsnJJ3331 RjCzpHPZG5/p5KR1RHiAXa0p/DW5lXyq21hS3kjDlleoHqOxCN/cy0Jgz7qLDq1vZoCl67Sy RAH60c2Xu4may9SVltmot0OzWVHdrfS+85FQGp9580DaeLio7YMFKy2bfEvwQJ/c9xD2QPB+ oSb3V8ueSznXBG5+dyfOsZFRPxceA0wA2rSWZSjxLdKxvyGTj9vsCjaDu13rABEBAAHCwV8E GAEIAAkFAlUUt6kCGwwACgkQoZ8SQ+xBJp+HJhAAxmSTsC5y7p9Zu+nnLpucv/h88oEx985e qWeXzQiwM3pfRZS+PdTH9TyzHK0KOgKoAiubk0vt+BrT91D9d0G5kVQaTctAErGBoMkTaZJT XVEcNphiPzysdSqvprjojMp1y7rG8AP+Xd6m0rE1LRnkRRm8HyI8vdXsuLQPITGWXDLMjaNq AOV3BUnzkgtjMuIYw7SCr+12ZOb5dEKvaG4kjC4kaJ/TLbuBhVANcXkC90yp0AOZLs/cB1Dj OAXno/RUUruJ3r27a+pFv768UAi9QWcdw58yPxreMNMLqAgsS9oTHwHfGNWcB2dJ4UW+GMLJ hTf9TjQ2f+N/sIx5XMQ9pYw6CAJMK29qPx6/ZayrPxf22EXf0D3zTwIEZgwfSkynFVwV25L7 awQq60fifdMYheSxq7GbhpsixmcD+e161cCmLIt75YDt5bQ0B1yf7EmxG8n7pGZAOM6LoNsU fkSldba5XVwh8LuN5mK0nQBELGW6Os4TDq4REggLpfcvFC215zpuo0iCGnmE/Bns4nowqUSP u4tkWL+nxW4qgv8wo8HJ52jd79EJ8iqfIBoidBfy9AIUiEUApGQzWPu6yWcI8fY0rN5D+tc+ Yw1Zt6Mm+huYJpgCRsTcfzEcahnBn521CWcWvhW1ff3KFileFMtNmnBBhMncmRKHphtTKEpN 3jI= Organization: 2ndQuadrant Message-ID: <039d8e26-af6a-9658-2188-33c201f16690@2ndquadrant.com> Date: Mon, 25 Feb 2019 21:51:52 +0100 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <20190115071359.GF1433@paquier.xyz> Content-Type: text/plain; charset=windows-1252 Content-Language: en-US Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 2019-01-15 08:13, Michael Paquier wrote: >>> Ah, the volatility checking needs some improvements. I'll address that >>> in the next patch version. >> >> ok > > The same problem happens for stored and virtual columns. This is fixed in v8. > It would be nice to add a test with composite types, say something > like: > =# create type double_int as (a int, b int); > CREATE TYPE > =# create table double_tab (a int, > b double_int GENERATED ALWAYS AS ((a * 2, a * 3)) stored, > c double_int GENERATED ALWAYS AS ((a * 4, a * 5)) virtual); > CREATE TABLE > =# insert into double_tab values (1), (6); > INSERT 0 2 > =# select * from double_tab ; > a | b | c > ---+---------+--------- > 1 | (2,3) | (4,5) > 6 | (12,18) | (24,30) > (2 rows) I added that. > + bool has_generated_stored; > + bool has_generated_virtual; > } TupleConstr; > Could have been more simple to use a char as representation here. Seems confusing if both apply at the same time. > Using NULL as generation expression results in a crash when selecting > the relation created: > =# CREATE TABLE gtest_err_1 (a int PRIMARY KEY, b int GENERATED ALWAYS > AS (NULL)); > CREATE TABLE > =# select * from gtest_err_1; > server closed the connection unexpectedly This is fixed in v8. > + The view column_column_usage identifies all > generated > "column_column_usage" is redundant. Could it be possible to come up > with a better name? This is specified in the SQL stnadard. > When testing a bulk INSERT into a table which has a stored generated > column, memory keeps growing in size linearly, which does not seem > normal to me. This was a silly coding error. It's fixed in v8. > +/* > + * Thin wrapper around libpq to obtain server version. > + */ > +static int > +libpqrcv_server_version(WalReceiverConn *conn) > This should be introduced in separate patch in my opinion (needed > afterwards for logirep). Yes, it could be committed separately. > What about the catalog representation of attgenerated? Would it merge > with attidentity & co? Or not? I think the way it is now seems best. The other options that were discussed are also plausible, but that the discussions did not reveal any overwhelming arguments for a a change. -- Peter Eisentraut http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services