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 1lovwA-0008IF-D9 for pgsql-general@arkaria.postgresql.org; Thu, 03 Jun 2021 22:35: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 1lovw9-0002Mh-8V for pgsql-general@arkaria.postgresql.org; Thu, 03 Jun 2021 22:35:37 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lovw8-0002MU-VE for pgsql-general@lists.postgresql.org; Thu, 03 Jun 2021 22:35:36 +0000 Received: from mail-pf1-x42d.google.com ([2607:f8b0:4864:20::42d]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1lovw5-0008Fq-Rk for pgsql-general@lists.postgresql.org; Thu, 03 Jun 2021 22:35:35 +0000 Received: by mail-pf1-x42d.google.com with SMTP id k15so6003385pfp.6 for ; Thu, 03 Jun 2021 15:35:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yugabyte.com; s=google; h=from:message-id:mime-version:subject:date:in-reply-to:cc:to :references; bh=LzhTP3l7BEasAcD4JLQWlqotak0zXlOLxeg27kXb6Jk=; b=kBPpev0rqrp/Z7t0LLE7sry/sdkZshEBjt8dnPCAnWbgbuxIBP5YxsVr5nxjLroqxG CeWdX2lL1DAG/UmLIETh125kIWgcpU4VpDQYZKBWTLT5bLij6Xaivewh8Qy11NMxKuSj hlc81EIeJPy02R9A9OL0pJGqAUL67A+p9q/w0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:message-id:mime-version:subject:date :in-reply-to:cc:to:references; bh=LzhTP3l7BEasAcD4JLQWlqotak0zXlOLxeg27kXb6Jk=; b=U+q5iQ7rff8qsfzNe9aV31hVJMSvtDQ1XwEm3iHVFE0qgASGlhLokZHFk44iSnBzpK Q/iHVCTsee+FH/b2NYSHqfB2bJQ43vbPnGfLirY+BIswoea2xqZrJ031WHRkiQ0tObHq dgj04kKiTieKLZgFk7T4YwBdDX0cjPvUFmLrZqcBf1HR4SKzMDl3wvIr83L4INBKJBc5 tgJfBK4uDwQjc1iM8O+GWgrkFlIRAraJfRW03HjMHvAWdoMDHlLKSul2hAZv7FOWcGoJ WbpUszYrAuTXTXsQSZSypYsd8YWAZ0ThF2DlHRYVZUZ0qTT2a+4pfYk2wLBcKPyZPIMk RQBw== X-Gm-Message-State: AOAM5326fzJriSvJJJsMCJPC0NJt/7pi0pNqqGq3VquT7JNKWUpR0HWx 5k/KnjPg1G52nLO4XynOrmMNFg== X-Google-Smtp-Source: ABdhPJzp2eg0AAsFnVG4XzI9261Ovsd/5gjrLmGkWuSn98Fd/4Cjs63SrRrMuAZjcauj4na07UOFRw== X-Received: by 2002:a63:ef4c:: with SMTP id c12mr1668532pgk.441.1622759731399; Thu, 03 Jun 2021 15:35:31 -0700 (PDT) Received: from smtpclient.apple ([2601:646:101:7fda:9ccc:107d:4ed1:5714]) by smtp.gmail.com with ESMTPSA id c21sm86038pfi.44.2021.06.03.15.35.30 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 03 Jun 2021 15:35:31 -0700 (PDT) From: Bryn Llewellyn Message-Id: <83EF1ADC-64CF-4404-9F02-C6C9051F968E@yugabyte.com> Content-Type: multipart/alternative; boundary="Apple-Mail=_F418FA79-9D62-43AF-84D4-AB4C08C983CA" Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.100.0.2.22\)) Subject: inner subprograms ... Was: syntax question Date: Thu, 3 Jun 2021 15:35:29 -0700 In-Reply-To: <20210603193444.GD22019@momjian.us> Cc: pgsql-general list To: Bruce Momjian References: <20210603190108.GC22019@momjian.us> <49061.1622748075@sss.pgh.pa.us> <20210603193444.GD22019@momjian.us> X-Mailer: Apple Mail (2.3654.100.0.2.22) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --Apple-Mail=_F418FA79-9D62-43AF-84D4-AB4C08C983CA Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 > bruce@momjian.us wrote: >=20 > Oh, I thought he wanted to declare a function inside the function that = could be called only by that function, like private functions in Oracle = packages can do. Yes, you can create a function that defines a function = that can be called later. I guess you could also create a function that = _conditionally_ creates a function that it can call itself too. My = point is that you can't create a function that has function scope =E2=80=94= they all have schema scope. I=E2=80=99ve heard that EDB=E2=80=99s version of PostgreSQL supports = inner subprograms (declared and defined within a DECLARE section) to any = depth of nesting=E2=80=94and packages too. Is this true? I worked at Oracle HQ for the longest time. Not a day goes by, when I = need to write PL/pgSQL code, that I don=E2=80=99t miss these two = constructs. I wish that (a future version of) vanilla PG could bring = support for them.= --Apple-Mail=_F418FA79-9D62-43AF-84D4-AB4C08C983CA Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=utf-8
bruce@momjian.us wrote:

Oh, I thought he wanted to declare a function inside the = function that could be called only by that function, like private = functions in Oracle packages can do.  Yes, you can create = a function that defines a function that can be called later. =  I guess you could also create a function = that _conditionally_ creates a function that it can call itself = too.  My point is that you can't create a function = that has function scope =E2=80=94 they all have schema = scope.

I=E2=80=99= ve heard that EDB=E2=80=99s version of PostgreSQL supports inner = subprograms (declared and defined within a DECLARE section) to any depth = of nesting=E2=80=94and packages too. Is this true?

I worked at Oracle HQ = for the longest time. Not a day goes by, when I need to write PL/pgSQL = code, that I don=E2=80=99t miss these two constructs. I wish that (a = future version of) vanilla PG could bring support for = them.
= --Apple-Mail=_F418FA79-9D62-43AF-84D4-AB4C08C983CA--