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 1tJEy0-001hLZ-1s for pgsql-docs@arkaria.postgresql.org; Thu, 05 Dec 2024 16:44:40 +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 1tJExw-007dYv-Q9 for pgsql-docs@arkaria.postgresql.org; Thu, 05 Dec 2024 16:44:38 +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 1tJExw-007dYm-Ig for pgsql-docs@lists.postgresql.org; Thu, 05 Dec 2024 16:44:37 +0000 Received: from momjian.us ([72.94.173.45]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tJExv-001Cpv-3R for pgsql-docs@lists.postgresql.org; Thu, 05 Dec 2024 16:44:36 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=momjian.us; s=2024011501; h=In-Reply-To:Content-Type:MIME-Version:References:Message-ID: Subject:To:From:Date:Sender:Reply-To:Cc:Content-Transfer-Encoding:Content-ID: Content-Description; bh=pAfw02ZmhkSXR5g0tFxSyCu0Rm7GTStdTMGIH/Gdq/o=; b=mrJoC HrDRfW8TLidv243XRAW4lhVwAEnL9kF11V+oCefS0wd7d0vr5OLmVtK3jIMa40tWhOWm1+QJ4aoXj vifs1OnPEsfD+voQlTx9WomlPJDPCal1J8ojcRLZaKYpcLCwExn6eH6ADugzhxfdOB4xkxqURTadS mefDflH7x0Rt4W3kwZjLi8UTDKRUQ1b7tUbFMfrY+g5rkHiCFE84H9XBEvfq4ROuGWaw/K8P0ubi9 HMIjsTAEFyvO13Zixf9FI8jgI2N8Pw7pV8+2r71TO1/dGpKVdxw66mXX3OIzVpCJuINtUZm9djQMh XMRoNBjlsNpNg7YSabooNne5SYDIA==; Received: from bruce by momjian.us with local (Exim 4.96) (envelope-from ) id 1tJExu-002W77-1i; Thu, 05 Dec 2024 11:44:34 -0500 Date: Thu, 5 Dec 2024 11:44:34 -0500 From: Bruce Momjian To: mohamedhussein10445@gmail.com, pgsql-docs@lists.postgresql.org Subject: Re: Formal Syntax of PL/pgSQL Message-ID: References: <173340919600.2556776.5021231474261341976@wrigleys.postgresql.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <173340919600.2556776.5021231474261341976@wrigleys.postgresql.org> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Thu, Dec 5, 2024 at 02:33:16PM +0000, PG Doc comments form wrote: > The following documentation comment has been logged on the website: > > Page: https://www.postgresql.org/docs/17/index.html > Description: > > I am currently working on a project that involves analyzing and building AST > (Abstract Syntax Tree) interfaces for PL/pgSQL in TypeScript. My goal is to > model the entire syntax of PL/pgSQL comprehensively, covering all its > constructs exactly as they are understood syntactically by PostgreSQL when > processing functions or procedures. > > While exploring the official documentation, I noticed that commands like > CREATE TABLE or SELECT are documented with clear and formalized syntax > structures, which are incredibly helpful for developers needing to parse or > programmatically interact with these commands. However, for PL/pgSQL, I > couldn't find a similar consolidated syntax reference. For instance, while > the documentation explains the supported declarations, control structures, > and statements, it lacks a unified formal syntax block that encapsulates the > entire language as PostgreSQL interprets it. > > Would it be possible to provide such a formal syntax reference for PL/pgSQL, > or point me toward an existing resource that captures this? Having access to > a detailed and comprehensive syntax description would be immensely helpful > for projects requiring precise parsing and manipulation of PL/pgSQL code. I doubt it since no one has ever asked for this before, and we usually tell them to look at the plpgsql parser if they want those details. -- Bruce Momjian https://momjian.us EDB https://enterprisedb.com Do not let urgent matters crowd out time for investment in the future.