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 1sQCyO-008SSV-Or for pgsql-general@arkaria.postgresql.org; Sat, 06 Jul 2024 21:29:36 +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 1sQCyM-006aVX-15 for pgsql-general@arkaria.postgresql.org; Sat, 06 Jul 2024 21:29:34 +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 1sQCyL-006aVP-Kq for pgsql-general@lists.postgresql.org; Sat, 06 Jul 2024 21:29:33 +0000 Received: from mail-lf1-x136.google.com ([2a00:1450:4864:20::136]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1sQCyE-000lCz-UD for pgsql-general@postgresql.org; Sat, 06 Jul 2024 21:29:32 +0000 Received: by mail-lf1-x136.google.com with SMTP id 2adb3069b0e04-52e94eaf5efso3116941e87.2 for ; Sat, 06 Jul 2024 14:29:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1720301364; x=1720906164; darn=postgresql.org; h=to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=3y133zvbohLifX52SX2ilx5mXhCgtrNVdcLRzCzviyY=; b=KISJHLdZXbtzCA6Upt4anLH0iDFWGU+F37zAUrDmbOuP3IPhCzpqvssP8irIJL4xm9 BBuiUBgHNkmlVWz1qLXbnmU9q2f2Zo15r8zLUCTQ5oaxwJSsqA4nf7fqWNQjOQIfd0Qu zam0xsHLj5QBY6bqeSdxxtj50TYsuxI81yb5b3ijMGmHl99hUM3DP6njd5YfiWNQrIYQ fxsJuNi4Gp+yLT1OlGrGVD3yDgE+64lO4yQ8LrawAX7FRWoYq/FF7PSqiN2cziQdeAEK bDB+GPjO29hvPV7DXbrjyPFHDEu0a5vyFzJS9xij1eilFNhxCh6AGc5cr0bs2U5FLo28 pBaQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720301364; x=1720906164; h=to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=3y133zvbohLifX52SX2ilx5mXhCgtrNVdcLRzCzviyY=; b=E9OghrPecH9KJUyCHhpbxd3C35X+Kd7EyWr3Wv7rn8fiIfmaeTus/pcB6r8URBoAb8 3b9eTmPgAC4wW8pxftmEcgsJGXCwZRS7XKTa3m1QDXMbgX7vFkcXVM0Ra5Ojtho9Cp8+ vfikXt04xM4Xe8DV3XpOLtJKL5PjIzO8UpycO3s14samZzFH5oZab4tFtkrvPjN60z32 gR+18brsEoYTjRnN4f7FJuyPH8ezieuV1nW5VBAmWVpryoNYL83B5m+9U4caNRy5LSg8 VZzKHZfIGZikP6n0VKkSFOS57/0i8w/f6/yF+QL4tw4BvOrfvDvIcIl1N5K7t0yMbZV/ bteg== X-Gm-Message-State: AOJu0YwpVpL2+pnuEzV6EV6FYoRs3dcWHKEYPIjfSa/KbtYuykFEnmwO INwKYCl94a1OM4qaWfhvyQKNIHKaUd5051DSwctTpZaqRErpof+sDfOJoV0vX0RnrQ+QJObdEJr U7eTyLbfU/R/jYgvZ9NZzZ+gTdMfvdYnd X-Google-Smtp-Source: AGHT+IEGoWyQ64aHtd+CoWFhEsgY27NEciAa0gvjUQueePwAVqW79FCgCwnKzJ1AuKNdwjL2hppf9xWf7ZYpDlXGzlo= X-Received: by 2002:ac2:446f:0:b0:52c:dca7:c9bd with SMTP id 2adb3069b0e04-52ea063e5aamr5192269e87.30.1720301363231; Sat, 06 Jul 2024 14:29:23 -0700 (PDT) MIME-Version: 1.0 From: Michael Nolan Date: Sat, 6 Jul 2024 16:29:12 -0500 Message-ID: Subject: Declaring a field that is also an out parameter in a function To: "pgsql-general@postgresql.org" Content-Type: text/plain; charset="UTF-8" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk In the following short code, the out parameter d3 is also declared, so its value will be null in the output. create or replace function public.test_function(in varchar, in char, in date, ou t d1 text, out d2 integer, out d3 char, out d4 date ) stable as $$ DECLARE wk_intxt alias for $1; wk_inchar alias for $2; wk_indate alias for $3; d3 char; BEGIN d1 := 'foo,bar'; d2 := 15; d3 := 'X'; d4 := current_date; END $$ language 'plpgsql'; Here's what happens in 16.1: psql (16.1) Type "help" for help. uscf=> select test_function('1234','a','2024-01-01') uscf-> \g test_function ---------------------------- ("foo,bar",15,,2024-07-06) (1 row) Shouldn't declaring a field that is also an OUT parameter throw an error? Mike Nolan htfoot@gmail.com