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 1l4Q8C-0004ye-2X for pgsql-bugs@arkaria.postgresql.org; Tue, 26 Jan 2021 15:19:48 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1l4Q8A-0001cb-U8 for pgsql-bugs@arkaria.postgresql.org; Tue, 26 Jan 2021 15:19:46 +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 1l4Q8A-0001cU-OA for pgsql-bugs@lists.postgresql.org; Tue, 26 Jan 2021 15:19:46 +0000 Received: from mail2.code-sourcery.de ([138.201.66.53]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1l4Q84-0006Yg-Lr for pgsql-bugs@lists.postgresql.org; Tue, 26 Jan 2021 15:19:46 +0000 Received: from [192.168.188.22] (dynamic-095-112-026-239.95.112.pool.telefonica.de [95.112.26.239]) by mail2.code-sourcery.de (Postfix) with ESMTPSA id 4D7E91FC76 for ; Tue, 26 Jan 2021 16:19:39 +0100 (CET) Subject: Re: Assignment to composite type variable fails inside function but running query separately yields correct type & value ? To: PostgreSQL mailing lists References: <4446d7d8-08a3-03d6-3f46-ac80239dbfb9@code-sourcery.de> From: Tobias Gierke Message-ID: <81bf6542-4a06-9abc-a0d3-a95bc0da2200@code-sourcery.de> Date: Tue, 26 Jan 2021 16:19:37 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.6.1 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/alternative; boundary="------------9E624F9B20FA2C764718EE95" Content-Language: en-US List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk This is a multi-part message in MIME format. --------------9E624F9B20FA2C764718EE95 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Thanks for the hint & sorry for the noise, it's working now ! > On Tue, Jan 26, 2021 at 5:56 AM Tobias Gierke > > wrote: > > voip$#         SELECT (t1.a_major, t1.a_minor )::version_num INTO > _myid > > Bug or feature ? > > > Feature.  The first column of the select result gets placed into the > first field of _myid, the second column of the select result gets > placed into the second field of _myid.  This is how assignment to > row-typed variables (and record-typed too) works in pl/pgsql. > > David J. --------------9E624F9B20FA2C764718EE95 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: 8bit Thanks for the hint & sorry for the noise, it's working now !

On Tue, Jan 26, 2021 at 5:56 AM Tobias Gierke <tobias.gierke@code-sourcery.de> wrote:
voip$#         SELECT (t1.a_major, t1.a_minor )::version_num INTO _myid

Bug or feature ?


Feature.  The first column of the select result gets placed into the first field of _myid, the second column of the select result gets placed into the second field of _myid.  This is how assignment to row-typed variables (and record-typed too) works in pl/pgsql.

David J.
--------------9E624F9B20FA2C764718EE95--