Extending PostgreSQL with a Domain-Specific Language (DSL) -Development - Mailing list pgsql-hackers

From Tom Mercha
Subject Extending PostgreSQL with a Domain-Specific Language (DSL) -Development
Date
Msg-id AM6PR04MB554457D6A1CA6EFFB96C9F8EF4F50@AM6PR04MB5544.eurprd04.prod.outlook.com
Whole thread Raw
Responses Re: Extending PostgreSQL with a Domain-Specific Language (DSL) -Development  (Tomas Vondra <tomas.vondra@2ndquadrant.com>)
List pgsql-hackers
Dear Hackers

I am interested in implementing my own Domain Specific Language (DSL) using PostgreSQL internals. Originally, the plan was not to use PostgreSQL and I had developed a grammar and used ANTLRv4 for parser work and general early development.

Initially, I was hoping for a scenario where I could have PostgreSQL's parser to change grammar (e.g. SET parser_language=SQL vs. SET parser_language=myDSL) in which case my ANTLRv4 project would override the PostgreSQL parser module. I guess another direction that my project could take is to extend PostgreSQL's SQL parser to factor in my DSL keywords and requirements.

To make matters more complicated, this version of ANTLR does not support code generation to C, but it does support generation to C++. Integrating the generated C++ code requires making it friendly to PostgreSQL e.g. using Plain Old Data Structures as described here https://www.postgresql.org/docs/9.0/extend-cpp.html, which seems to be suggesting to me that I may be using the wrong approach towards my goal.

I would be grateful if anyone could provide any general advice or pointers regarding my approach, for example regarding development effort, so that the development with PostgreSQL internals can be smooth and of a high quality. Maybe somebody has come across another DSL attempt which used PostgreSQL and that I could follow as a reference?

Thanks in advance.

Best,
Tom


Virus-free. www.avg.com

pgsql-hackers by date:

Previous
From: Peter Eisentraut
Date:
Subject: Re: make libpq documentation navigable between functions
Next
From: Thomas Munro
Date:
Subject: Re: Add client connection check during the execution of the query