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 1sQDgG-008VIm-0p for pgsql-general@arkaria.postgresql.org; Sat, 06 Jul 2024 22:14:56 +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 1sQDfF-006r8P-SN for pgsql-general@arkaria.postgresql.org; Sat, 06 Jul 2024 22:13:53 +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 1sQDfF-006r8G-HK for pgsql-general@lists.postgresql.org; Sat, 06 Jul 2024 22:13:53 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sQDfD-000lRb-01 for pgsql-general@postgresql.org; Sat, 06 Jul 2024 22:13:52 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 466MDncx577339; Sat, 6 Jul 2024 18:13:49 -0400 From: Tom Lane To: Michael Nolan cc: "pgsql-general@postgresql.org" Subject: Re: Declaring a field that is also an out parameter in a function In-reply-to: References: Comments: In-reply-to Michael Nolan message dated "Sat, 06 Jul 2024 16:29:12 -0500" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <577337.1720304029.1@sss.pgh.pa.us> Date: Sat, 06 Jul 2024 18:13:49 -0400 Message-ID: <577338.1720304029@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Michael Nolan writes: > Shouldn't declaring a field that is also an OUT parameter throw an error? No. The DECLARE is a block nested within the function, and the parameter is declared at function scope. So this is a standard case of an inner declaration masking an outer one. Possibly plpgsql_check can be set to complain about such cases, but they're legal according to the language specification. regards, tom lane