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 1mXxwv-0006gy-Ut for pgsql-general@arkaria.postgresql.org; Wed, 06 Oct 2021 03:50:33 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1mXxwu-0000ZS-2j for pgsql-general@arkaria.postgresql.org; Wed, 06 Oct 2021 03:50:32 +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 1mXxwt-0000Xl-Pf for pgsql-general@lists.postgresql.org; Wed, 06 Oct 2021 03:50:31 +0000 Received: from einhorn.in-berlin.de ([192.109.42.8] helo=einhorn-mail-out.in-berlin.de) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mXxwq-0001Xd-Dz for pgsql-general@lists.postgresql.org; Wed, 06 Oct 2021 03:50:31 +0000 X-Envelope-From: ml@ft-c.de X-Envelope-To: Received: from authenticated.user (localhost [127.0.0.1]) by einhorn.in-berlin.de with ESMTPSA id 1963oQHk026177 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT) for ; Wed, 6 Oct 2021 05:50:26 +0200 Message-ID: <108585f3e84fc2f98e7ab7776d745ca32b7c6dc1.camel@ft-c.de> Subject: type bug? From: ml@ft-c.de Reply-To: ml@ft-c.de To: pgsql-general@lists.postgresql.org Date: Wed, 06 Oct 2021 05:50:25 +0200 Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.40.2 FreeBSD GNOME Team MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hello, there is a bug with types in functions. Here is an example: --drop type  xyz; create type xyz as ( x numeric,  y numeric,  z numeric ); --drop table  test_xyz ; create table test_xyz (  a int,  b xyz, c xyz ); insert into  test_xyz values ( 1,(11.1, 12.3, 14.5 ), (22.2, 22.3, 24.5 ) ) ; --drop  function test_xyz() ; create function test_xyz() returns table ( a xyz, b xyz)  as $$  select b, c from test_xyz ; $$ language sql ; --drop   function test_xyz2() ; create function test_xyz2() returns table ( b xyz)  as $$  select  b from test_xyz  ; $$ language sql ; --drop   function test_xyz3() ; create function test_xyz3() returns table ( b xyz)  as $$ declare   bb xyz;   cc xyz; begin   select b, c into bb, cc from test_xyz ;   return bb ; end;  $$ language plpgsql ; -- ------ select * from test_xyz() ; select * from test_xyz2() ; -- 3 columns, but 1 should be correct? select b from test_xyz2() ; -- error select x from test_xyz2() ; -- never declared column select * from test_xyz3() ; -- compiling error -- ------ (I am not a member of the pg-developer mailinglist. ) Franz