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 1jjp4O-0003IZ-4t for pgsql-hackers@arkaria.postgresql.org; Fri, 12 Jun 2020 19:10:28 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jjp4M-0002yr-ON for pgsql-hackers@arkaria.postgresql.org; Fri, 12 Jun 2020 19:10:26 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jjp4M-0002yk-HS for pgsql-hackers@lists.postgresql.org; Fri, 12 Jun 2020 19:10:26 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jjp4K-0002z5-Ay for pgsql-hackers@lists.postgresql.org; Fri, 12 Jun 2020 19:10:26 +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 05CJAKvX776994; Fri, 12 Jun 2020 15:10:20 -0400 From: Tom Lane To: Mark Wong cc: pgsql-hackers@lists.postgresql.org Subject: Re: doc examples for pghandler In-reply-to: <20200612172648.GA3327@2ndQuadrant.com> References: <20200612172648.GA3327@2ndQuadrant.com> Comments: In-reply-to Mark Wong message dated "Fri, 12 Jun 2020 10:26:48 -0700" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <776991.1591989020.1@sss.pgh.pa.us> Date: Fri, 12 Jun 2020 15:10:20 -0400 Message-ID: <776992.1591989020@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Mark Wong writes: > Would some additional procedure language handler code examples in the > documentation be good to add? I've put some together in the attached > patch, and can log it to a future commitfest if people think it would > be a good addition. Hmm. The existing doc examples are really pretty laughable, because there's such a large gap between the offered skeleton and a workable handler. So I agree it'd be nice to do better, but I'm suspicious of having large chunks of sample code in the docs --- that's a maintenance problem, if only because we likely won't notice when we break it. Also, if somebody is hoping to copy-and-paste such code, it isn't that nice to work from if it's embedded in SGML. I wonder if it'd be possible to adapt what you have here into some tiny contrib module that doesn't do very much useful, but can at least be tested to see that it compiles; moreover it could be copied verbatim to serve as a starting point for a new PL. regards, tom lane