Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jTR5G-0007WF-8R for pgsql-bugs@arkaria.postgresql.org; Tue, 28 Apr 2020 14:19:38 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jTR5F-0007F7-4q for pgsql-bugs@arkaria.postgresql.org; Tue, 28 Apr 2020 14:19:37 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jTR5E-0007F0-Uy for pgsql-bugs@lists.postgresql.org; Tue, 28 Apr 2020 14:19:36 +0000 Received: from forward5-smtp.messagingengine.com ([66.111.4.239]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jTR5B-0002dO-Vw for pgsql-bugs@lists.postgresql.org; Tue, 28 Apr 2020 14:19:36 +0000 Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailforward.nyi.internal (Postfix) with ESMTP id 528301940645; Tue, 28 Apr 2020 10:19:32 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute1.internal (MEProxy); Tue, 28 Apr 2020 10:19:32 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=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=nvGR2fR6vsaMhhOASzg9uO/njgaTEuZW7LUMZEWMW JI=; b=jlzwgKYpIhjLiuNc6HZsjtI9fTZb4VBqSeX0WKTFt+8EalaqItrr9b4qy EJROQ4AylmEkAVYxUJN585H+Yja/D0FmKDM88K3QNGzMq35rxmPdUmOAwZgAGq8m Vt4ymvP+xJrKOREXk9yDNp5wUSkPoOwf2iu+N3xUQL59aXX8SUaM9JyEkmJTYNoh bnNUPlNs+elOKSzjHbKa/GbildFjicrgc0+Xbl2bU6cckLKvJT83dvRdZOXkTA3A 0hufCtIOnkTlOfyXpcPeYat5BHxqrcjmHBhn2+rt/m0mFLAUofWfXi4Noq3Fz6dD DatETsVRhznL9gen7Nw7Q6Znd32WQ== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduhedriedugdejgecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecunecujfgurhepuffvfhfhohfkffgfgggjtgfgsehtje ertddtfeejnecuhfhrohhmpefrvghtvghrucfgihhsvghnthhrrghuthcuoehpvghtvghr rdgvihhsvghnthhrrghuthesvdhnughquhgrughrrghnthdrtghomheqnecuffhomhgrih hnpedvnhguqhhurggurhgrnhhtrdgtohhmnecukfhppeelfedrvdegfedriedrvdeguden ucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehpvghtvg hrrdgvihhsvghnthhrrghuthesvdhnughquhgrughrrghnthdrtghomh X-ME-Proxy: Received: from april.pezone.net (p5df306f1.dip0.t-ipconnect.de [93.243.6.241]) by mail.messagingengine.com (Postfix) with ESMTPA id 6496C3065EB4; Tue, 28 Apr 2020 10:19:31 -0400 (EDT) Subject: Re: BUG #16395: error when selecting generated column in a foreign table To: mario.ab.leonel@gmail.com, pgsql-bugs@lists.postgresql.org References: <16395-2f2e9f72bd22a6d1@postgresql.org> From: Peter Eisentraut Organization: 2ndQuadrant Message-ID: Date: Tue, 28 Apr 2020 16:19:30 +0200 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: <16395-2f2e9f72bd22a6d1@postgresql.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 2020-04-27 16:24, PG Bug reporting form wrote: > -- bd: postgres > CREATE TABLE public.test > ( > id integer NOT NULL, > field1 integer NOT NULL, > field2 character varying COLLATE pg_catalog."default", > CONSTRAINT test_pkey PRIMARY KEY (id) > ); > > -- bd: test > CREATE FOREIGN TABLE public.test( > id integer NULL, > field1 integer NULL, > field2 character varying NULL COLLATE pg_catalog."default", > field_calc integer generated always as (field1 * 2) stored > ) > SERVER fs_postgres; > > test=# SELECT id, field1, field2, field_calc FROM public.test; > ERROR: column "field_calc" does not exist > CONTEXT: remote SQL command: SELECT id, field1, field2, field_calc FROM > public.test Well, your public.test base table does not in fact have a "field_calc" column. You need to add that. Note that these are *stored* generated columns, so the value that is generated by the foreign table on insert is meant to be stored somewhere in the backing store of the foreign table. -- Peter Eisentraut http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services