Pluggable Parser - Mailing list pgsql-hackers
From | Rajeev rastogi |
---|---|
Subject | Pluggable Parser |
Date | |
Msg-id | BF2827DCCE55594C8D7A8F7FFD3AB77159878C2A@szxeml521-mbs.china.huawei.com Whole thread Raw |
Responses |
Re: Pluggable Parser
|
List | pgsql-hackers |
<div class="WordSection1"><p class="MsoNormal"><b><u>What is Pluggable Parser</u></b>:<p class="MsoNormal" style="text-indent:36.0pt">Itis an option for users to select a different kind of parser to evaluate PostgreSQL for theirbusiness logic without much manual effort. <p class="MsoNormal"> <p class="MsoNormal"><b><u>Why do we need?</u></b><pclass="MsoNormal" style="margin-left:21.0pt">As of now migration from other databases to PostgreSQL requiresmanual effort of translating SQL & PL/SQL to PostgreSQL equivalent SQL queries. Because of this manual effortin converting scripts, migration to PostgreSQL considered to be very slow and sometime de-motivating also. So ifwe allow to plug different database syntaxes with PostgreSQL, then it will be one of the strong motivating result for manyDBAs to try PostgreSQL.<p class="MsoNormal" style="margin-left:21.0pt"> <p class="MsoNormal"><b><u>How to Do?</u></b><pclass="MsoNormal" style="margin-left:36.0pt">This can be realized by supporting new SQL/Stored procedures syntaxesin the parser corresponding to each other database syntax and plug the one needs to be evaluated by putting the corresponding“so” file in “dynamic_library_path”. Default will be PostgreSQL syntax.<p class="MsoNormal" style="margin-left:36.0pt"> <pclass="MsoNormal" style="margin-left:36.0pt">Parser Interface:<p class="MsoNormal" style="margin-left:21.0pt;text-indent:21.0pt">/*Hook for plugins to get control in Parser */<p class="MsoNormal" style="margin-left:21.0pt;text-indent:21.0pt">typedefList * (*parser_hook_type) const char *str);<p class="MsoNormal" style="margin-left:21.0pt;text-indent:21.0pt">parser_hook_typeparser_hook = NULL;<p class="MsoNormal" style="margin-left:21.0pt;text-indent:21.0pt">externPGDLLIMPORT parser_hook_type parser_hook;<p class="MsoNormal" style="margin-left:21.0pt;text-indent:21.0pt"> <pclass="MsoNormal" style="margin-left:36.0pt">Make the parser entry pointas function pointer (“raw_parser”); which can be loaded based on parser type. The parse_hook will be initialized withproper function during shared library loading, which is done only during server startup. By this way it can be ensuredas only one parser which is provided by the user is used in the PostgreSQL.<p class="MsoNormal"> <pclass="MsoNormal"> Each Database syntax related parser can be implemented as part of contrib module to keepit separate from the core code.<p class="MsoNormal"> <p class="MsoNormal">To start with, I am planning to (For 2015-06commitFest):<p class="MsoListParagraph" style="margin-left:54.0pt;text-indent:-18.0pt;mso-list:l0 level1 lfo1"><spanstyle="mso-list:Ignore">1.<span style="font:7.0pt "Times New Roman""> </span></span>Support infrastructureto allow plugging.<p class="MsoListParagraph" style="margin-left:54.0pt;text-indent:-18.0pt;mso-list:l0 level1lfo1"><span style="mso-list:Ignore">2.<span style="font:7.0pt "Times New Roman""> </span></span>Support of ORACLESQL query syntaxes.<p class="MsoListParagraph" style="margin-left:54.0pt"> <p class="MsoNormal">Please let me knowif community will be interested in this or if there were already any discussion about this in past?<p class="MsoNormal"> <pclass="MsoNormal">Please provide your opinion/suggestion. <p class="MsoNormal"> <pclass="MsoNormal"><i><span style="color:black">Thanks and Regards,</span></i><p class="MsoNormal"><i>KumarRajeev Rastogi<span style="color:black"> </span></i></div>
pgsql-hackers by date: