Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1asUps-0004kP-Ul for pgsql-hackers@arkaria.postgresql.org; Tue, 19 Apr 2016 12:32:57 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1asUpr-0000c3-Qn for pgsql-hackers@arkaria.postgresql.org; Tue, 19 Apr 2016 12:32:55 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1asUpr-0000bx-0o for pgsql-hackers@postgresql.org; Tue, 19 Apr 2016 12:32:55 +0000 Received: from newmail.postgrespro.ru ([93.174.131.138] helo=mail.postgrespro.ru) by makus.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1asUpn-00081G-Ma for pgsql-hackers@postgresql.org; Tue, 19 Apr 2016 12:32:53 +0000 Received: from localhost (localhost [127.0.0.1]) by mail.postgrespro.ru (Postfix) with ESMTP id A6F2321C7E0F; Tue, 19 Apr 2016 15:32:49 +0300 (MSK) Received: from mail.postgrespro.ru ([127.0.0.1]) by localhost (mail.postgrespro.ru [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id EFr_QogZvxh3; Tue, 19 Apr 2016 15:32:47 +0300 (MSK) Received: from fujitsu (unknown [192.168.27.1]) by mail.postgrespro.ru (Postfix) with ESMTPSA id DC58F21C7B4B; Tue, 19 Apr 2016 15:32:47 +0300 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=postgrespro.ru; s=mail; t=1461069167; bh=DlU4x54n+eblP6G7N6O7Fx20rgmPOD8+JtZOF7/5zVs=; h=Date:From:To:Cc:Subject:In-Reply-To:References; b=ZE48CHNraFdqo1VvM+TLwNghs0yk0rXi85E6eve+w6A/8kpbRY9DLSwLZ1WE8z87s SX78Dn0qLi7k0bnSmqDpSq61sN4/pioc6XvAyLYlCp8Y8omYjAvuu3QoMNqrvaK6Kc gJE9r+SBN3ol51kmcUScN61B/lJbyMt370qYGojI= Date: Tue, 19 Apr 2016 15:32:07 +0300 From: Aleksander Alekseev To: Simon Riggs Cc: Tom Lane , Craig Ringer , Arcadiy Ivanov , PostgreSQL Hackers Subject: Re: Parser extensions (maybe for 10?) Message-ID: <20160419153207.2170759e@fujitsu> In-Reply-To: References: <570C7B5A.9070309@gmail.com> <5688.1460437831@sss.pgh.pa.us> <6998.1460440319@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Pg-Spam-Score: -3.0 (---) 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 > As Tom says, we can't easily break it down into multiple co-operating > pieces, so lets forget that as unworkable. I'm sorry but didn't I just demonstrate the opposite? If so it's very easy to prove - give a counterexample. As I understand approach I described handles cases named by Tom just fine. In fact the idea of transforming ASTs (a.k.a metaprogramming) is successfully used by programmers for about 50 years now. (As a side note - I'm not a native English speaker but I believe such type of logic is known as "argument from authority".) > What is possible is a whole new grammar... for example if we imagine > > SET client_language_path = 'foo, postgresql' > > Works similar to search_path, but not userset. We try to parse > incoming statements against the foo parser first, if that fails we > try postgresql. The default setting would be simply 'postgresql', so > no match -> syntax error. > > We could make that easier by making the postgresql parser a plugin > itself. So to produce a new one you just copy the files, modify them > as needed then insert a new record into pg_language as an extension. > I think its not an extension but a replacement of a grammar. This approach implies that every extension implements a parser from scratch. Not sure if anyone will do it in practice to change SQL syntax a little bit. I'm not telling that such a feature will be completely worthless. But why not to make a step further and not to implement plugable protocols? E.g. make PostgreSQL compatible with MySQL and/or MongoDB? Or maybe implement SQL dialect that forbids implicit type conversion. Or add build-in connection pooling mechanism. I wonder though if all of this could already be implemented as an extension without any changes in PostgreSQL core. -- Best regards, Aleksander Alekseev http://eax.me/ -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers