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 1nJYOt-000257-VA for pgsql-hackers@arkaria.postgresql.org; Mon, 14 Feb 2022 10:16:07 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1nJYOs-0005or-1R for pgsql-hackers@arkaria.postgresql.org; Mon, 14 Feb 2022 10:16:06 +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 1nJYOr-0005oh-Ly for pgsql-hackers@lists.postgresql.org; Mon, 14 Feb 2022 10:16:05 +0000 Received: from out5-smtp.messagingengine.com ([66.111.4.29]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nJYOn-0003un-0P for pgsql-hackers@postgresql.org; Mon, 14 Feb 2022 10:16:04 +0000 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id C6F645C01FE for ; Mon, 14 Feb 2022 05:15:59 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Mon, 14 Feb 2022 05:15:59 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:date:from:from:in-reply-to:in-reply-to:message-id :mime-version:references:reply-to:sender:subject:subject:to:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm2; bh=xkAtWGYBPFmQOHthsPJhOH++tZbWpktVSjnHnz41cls=; b=cDcVRG+j FREfNDSvkblnCGOpQ9VYmbnaw+2Y155lTALFS6tOpUhzPi9qRXV//lyKlXh8vI0W L8zwbey+mbjOPmSsp7htbLpHKSXDZ1b5B13UhWAXAmTdoOIqcUPx6UuxWG2ORo9n vvhB0LquPdkeBnT8+a59CGIX6KoJiWxbhjkxfq7rc6+HeNVHhE9JLjvDKXX4xirL RGDBQfHLJ4OMAFyGH2J+0CE0rlHkQ9uBiTl1sFhYw4bu5NEHx1IaOscF+Ll4AMBe anuTCaEwZxzwOHORVLgFiZXOoFjP8UXPSNEjQiyF3gRUMYb1lgpb/KDjsqBRDuNZ 0yRQ9DDg/DboZg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvvddrjedvgddtlecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecunecujfgurhepkfffgggfuffhvfhfjggtgfesthekre dttdefjeenucfhrhhomheprfgvthgvrhcugfhishgvnhhtrhgruhhtuceophgvthgvrhdr vghishgvnhhtrhgruhhtsegvnhhtvghrphhrihhsvggusgdrtghomheqnecuggftrfgrth htvghrnhepveevhfeijeejkedtvdejtdduiefggeekhedvgeevleeifedtjeduheejleeg tdetnecuffhomhgrihhnpehpohhsthhgrhgvshhqlhdrohhrghenucevlhhushhtvghruf hiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehpvghtvghrrdgvihhsvghnthhr rghuthesvghnthgvrhhprhhishgvuggsrdgtohhm X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA for ; Mon, 14 Feb 2022 05:15:58 -0500 (EST) Message-ID: <812ea8eb-6827-ba32-6ec0-6714f7ffa5dd@enterprisedb.com> Date: Mon, 14 Feb 2022 11:15:57 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:91.0) Gecko/20100101 Thunderbird/91.6.0 Subject: Re: automatically generating node support functions Content-Language: en-US From: Peter Eisentraut To: pgsql-hackers References: <2f876203-7142-fa71-6d22-6ce00eb26869@enterprisedb.com> <50fedc80-4104-bdc8-d777-04f030fc550f@dunslane.net> <7848b872-7a10-67b2-b55f-7c9c475ae863@enterprisedb.com> <40a2e977-98ba-0c01-af6c-9dfb39e864ba@enterprisedb.com> In-Reply-To: <40a2e977-98ba-0c01-af6c-9dfb39e864ba@enterprisedb.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk What do people think about this patch now? I have received some feedback on several small technical issues, which have all been fixed. This patch has been around for several commit fests now and AFAICT, nothing has broken it. This is just to indicate that the parsing isn't as flimsy as one might fear. One thing thing that is waiting behind this patch is that you currently cannot put utility commands into parse-time SQL functions, because there is no full out/read support for those. This patch would fix that problem. (There is a little bit of additional work necessary, but I have that mostly worked out in a separate branch.) On 24.01.22 16:15, Peter Eisentraut wrote: > Rebased patch to resolve some merge conflicts > > On 29.12.21 12:08, Peter Eisentraut wrote: >> On 12.10.21 15:52, Andrew Dunstan wrote: >>> I haven't been through the whole thing, but I did notice this: the >>> comment stripping code looks rather fragile. I think it would blow up if >>> there were a continuation line not starting with  qr/\s*\*/. It's a lot >>> simpler and more robust to do this if you slurp the file in whole. >>> Here's what we do in the buildfarm code: >>> >>>      my $src = file_contents($_); >>>      # strip C comments >>>      # We used to use the recipe in perlfaq6 but there is actually no >>> point. >>>      # We don't need to keep the quoted string values anyway, and >>>      # on some platforms the complex regex causes perl to barf and >>> crash. >>>      $src =~ s{/\*.*?\*/}{}gs; >>> >>> After you've done that splitting it into lines is pretty simple. >> >> Here is an updated patch, with some general rebasing, and the above >> improvement.  It now also generates #include lines necessary in >> copyfuncs etc. to pull in all the node types it operates on. >> >> Further, I have looked more into the "metadata" approach discussed in >> [0].  It's pretty easy to generate that kind of output from the data >> structures my script produces.  You just loop over all the node types >> and print stuff and keep a few counters.  I don't plan to work on that >> at this time, but I just wanted to point out that if people wanted to >> move into that direction, my patch wouldn't be in the way. >> >> >> [0]: >> https://www.postgresql.org/message-id/flat/20190828234136.fk2ndqtld3onfrrp%40alap3.anarazel.de >>