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 1jjsGu-0002QT-P5 for pgsql-hackers@arkaria.postgresql.org; Fri, 12 Jun 2020 22:35:36 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jjsGs-0008Oq-6f for pgsql-hackers@arkaria.postgresql.org; Fri, 12 Jun 2020 22:35:34 +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 1jjsGr-0008Oj-St for pgsql-hackers@lists.postgresql.org; Fri, 12 Jun 2020 22:35:34 +0000 Received: from mail-ot1-x32a.google.com ([2607:f8b0:4864:20::32a]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1jjsGp-0004q2-3H for pgsql-hackers@lists.postgresql.org; Fri, 12 Jun 2020 22:35:33 +0000 Received: by mail-ot1-x32a.google.com with SMTP id 69so8610271otv.2 for ; Fri, 12 Jun 2020 15:35:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=2ndquadrant-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=HYlei/LHUe1bpaZ+XMo/PxN2dodZTaNPVOx71gggGqU=; b=OLayGTDGQg4wRsGaP+tsXquSuohyW/ZNXCDHgnTNH+HBnTHdW75VcBgOXs5X/NN8Ts SIkgIQOAsLVSBGyN+ToQmvAI3kj8YJ0GuHrWvcA6HO3WF95KNFQ8L2r8cdpsGX9jALp5 RQmbZAhkvlQk5sYDtJAa7QWul7RjWkhly+m064cZ+hFbrpSWNqwxZiUyO1omRKfssu3B nJvZEYtqjAcmVs/M5Q0MIl11n8UCkYdJU8h4/Vt0X+NPeIdebqXovlFnWv9jItiT0sm0 Bdbkxp+OwE8To2RTMSywbdvAH3xdrgqOi/4rf/ES6ty5YT/b4DSOjiufVJkDTGNiLqQG pqeA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=HYlei/LHUe1bpaZ+XMo/PxN2dodZTaNPVOx71gggGqU=; b=D5zBhKGIHaIyNgrzIBF2njuEbVIpMJO4mJFE2CoOy8b+rkVQdBIQ2+zuv40HGIsVx8 b/73DfIr89622qyck+gaoov5LY8ygM46YenJhVOtzE2v5mcYQNowGEO84AT4wYkOGdta z3107OukJ8nQgRcKZCwd7StgtAkL8NPvG7V00HCmEDsVnNytV4YR4tsvM7pQ8QdNKjTU Oy1quBIUQRotpSTb7Ch5/L65kRJib/2LUvlScQM9JWk9eK75CzMp6sL6Rlg6PTiVD+r8 tlrxj1DGdCKjjbztdWMW+QRxGQzoFlmqOGAXMgm96dUB0BjFaCCV1PUNcWbJOosajoF4 tz2w== X-Gm-Message-State: AOAM531uHSAvpDPD91hhuedzkZYmjI31sGHOozQzl7DXPZJj+bfulCzw ucgLQ0KU2A5idvdjeRhdr+5kY842c4M= X-Google-Smtp-Source: ABdhPJznTv8TGOztxaI3COm/aM33mu5VDGxO5+wAEVG6+88SUOetUUNJAPh8NTl27FbmBdaSk71dHw== X-Received: by 2002:a9d:4503:: with SMTP id w3mr12078816ote.38.1592001328841; Fri, 12 Jun 2020 15:35:28 -0700 (PDT) Received: from 2ndQuadrant.com (c-67-169-212-172.hsd1.or.comcast.net. [67.169.212.172]) by smtp.gmail.com with ESMTPSA id v79sm1675781oia.29.2020.06.12.15.35.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Jun 2020 15:35:28 -0700 (PDT) Date: Fri, 12 Jun 2020 15:35:25 -0700 From: Mark Wong To: Tom Lane Cc: pgsql-hackers@lists.postgresql.org Subject: Re: doc examples for pghandler Message-ID: <20200612223525.GB3327@2ndQuadrant.com> References: <20200612172648.GA3327@2ndQuadrant.com> <776992.1591989020@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <776992.1591989020@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On Fri, Jun 12, 2020 at 03:10:20PM -0400, Tom Lane wrote: > 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. I do have the code examples in a repo. [1] The 0.4 directory consists of everything the examples show. It would be easy enough to adapt that for contrib, and move some of the content from the doc patch into that. Then touch up the handler chapter to reference the contrib module. Does that sound more useful? [1] https://gitlab.com/markwkm/yappl -- Mark Wong 2ndQuadrant - PostgreSQL Solutions for the Enterprise https://www.2ndQuadrant.com/