Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1aprGS-0004P5-PL for pgsql-hackers@arkaria.postgresql.org; Tue, 12 Apr 2016 05:53:28 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1aprGS-0005hy-8G for pgsql-hackers@arkaria.postgresql.org; Tue, 12 Apr 2016 05:53:28 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1aprF7-0004E3-If for pgsql-hackers@postgresql.org; Tue, 12 Apr 2016 05:52:05 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1aprF3-0000xz-VH for pgsql-hackers@postgresql.org; Tue, 12 Apr 2016 05:52:05 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id u3C5pxLL006999; Tue, 12 Apr 2016 01:51:59 -0400 From: Tom Lane To: Craig Ringer cc: Arcadiy Ivanov , PostgreSQL Hackers Subject: Re: Parser extensions (maybe for 10?) In-reply-to: References: <570C7B5A.9070309@gmail.com> <5688.1460437831@sss.pgh.pa.us> Comments: In-reply-to Craig Ringer message dated "Tue, 12 Apr 2016 13:22:11 +0800" Date: Tue, 12 Apr 2016 01:51:59 -0400 Message-ID: <6998.1460440319@sss.pgh.pa.us> X-Pg-Spam-Score: -2.9 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org Craig Ringer writes: > The other area where there's room for extension without throwing out the > whole thing and rebuilding is handling of new top-level statements. We can > probably dispatch the statement text to a sub-parser provided by an > extension that registers interest in that statement name when we attempt to > parse it and fail. Even then I'm pretty sure it won't be possible to do so > while still allowing multi-statements. I wish we didn't support > multi-statements, but we're fairly stuck with them. Well, as I said, I've been there and done that. Things get sticky when you notice that those "new top-level statements" would like to contain sub-clauses (e.g. arithmetic expressions) that should be defined by the core grammar. And maybe the extension would also like to define additions to the expression grammar, requiring a recursive callback into the extension. It gets very messy very fast. regards, tom lane -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers