Обсуждение: Bypassing SQL lexer and parser

Поиск
Список
Период
Сортировка

Bypassing SQL lexer and parser

От
Данила Поярков
Дата:
Hello!

What is the best starting point to PostgreSQL internal APIs for operating directly with the storage (performing basic
INSERTs,UPDATEs, SELECTs and simple JOINs by hand)? I'm looking for something similar to MySQL Cluster NDB API or
InnoDBinternal API (the late HailDB and Embedded InnoDB).
 

Does the PostgreSQL support any other type of plugins/extensions other than FDW and custom data types? I mean, is it
possibleto start another daemon within Postgres without slightly modifying the main codebase?
 

In case you are wondering why could anyone need something like that: I'm looking for a way to implement a small subset
ofHTSQL (see [http://htsql.org/], of course not with the whole HTTP protocol) natively in one of popular RDBMS without
extraURL-to-SQL conversion. Yes, I know that a lot of hard work was done for making query plans, optimizing etc. but
I'mstill really wish to do this for some very specific needs. I'm not going to completely replace the SQL and thus will
behappy to do those manipulations on a SQL 2008-compliant DBMS.
 

Thanks in advance,
dannote



Re: Bypassing SQL lexer and parser

От
Guillaume Lelarge
Дата:
<p dir="ltr">Le 6 juil. 2015 7:16 PM, "Данила Поярков" <<a href="mailto:dev@dannote.net">dev@dannote.net</a>> a
écrit :<br/> ><br /> > Hello!<br /> ><br /> > What is the best starting point to PostgreSQL internal APIs
foroperating directly with the storage (performing basic INSERTs, UPDATEs, SELECTs and simple JOINs by hand)? I'm
lookingfor something similar to MySQL Cluster NDB API or InnoDB internal API (the late HailDB and Embedded InnoDB).<br
/>><br /> > Does the PostgreSQL support any other type of plugins/extensions other than FDW and custom data
types?I mean, is it possible to start another daemon within Postgres without slightly modifying the main codebase?<br
/>><p dir="ltr">That sounds a lot like a background worker.<p dir="ltr">> In case you are wondering why could
anyoneneed something like that: I'm looking for a way to implement a small subset of HTSQL (see [<a
href="http://htsql.org/">http://htsql.org/</a>],of course not with the whole HTTP protocol) natively in one of popular
RDBMSwithout extra URL-to-SQL conversion. Yes, I know that a lot of hard work was done for making query plans,
optimizingetc. but I'm still really wish to do this for some very specific needs. I'm not going to completely replace
theSQL and thus will be happy to do those manipulations on a SQL 2008-compliant DBMS.<br /> ><p dir="ltr">Good luck
withthat :-) <br /><p dir="ltr">-- <br /> Guillaume 

Re: Bypassing SQL lexer and parser

От
Jim Nasby
Дата:
On 7/6/15 12:14 PM, Данила Поярков wrote:
> Hello!
>
> What is the best starting point to PostgreSQL internal APIs for operating directly with the storage (performing basic
INSERTs,UPDATEs, SELECTs and simple JOINs by hand)? I'm looking for something similar to MySQL Cluster NDB API or
InnoDBinternal API (the late HailDB and Embedded InnoDB).
 

There is support for plugging into the parser and executor, so that 
might be a possibility, but...

> Does the PostgreSQL support any other type of plugins/extensions other than FDW and custom data types? I mean, is it
possibleto start another daemon within Postgres without slightly modifying the main codebase?
 
>
> In case you are wondering why could anyone need something like that: I'm looking for a way to implement a small
subsetof HTSQL (see [http://htsql.org/], of course not with the whole HTTP protocol) natively in one of popular RDBMS
withoutextra URL-to-SQL conversion. Yes, I know that a lot of hard work was done for making query plans, optimizing
etc.but I'm still really wish to do this for some very specific needs. I'm not going to completely replace the SQL and
thuswill be happy to do those manipulations on a SQL 2008-compliant DBMS.
 

AFAIK HTSQL is very happy producing SQL; why not just let it hand SQL to 
Postgres (which it already does...)

Have you by chance talked to Clark or Kirill about this?
-- 
Jim Nasby, Data Architect, Blue Treble Consulting, Austin TX
Data in Trouble? Get it in Treble! http://BlueTreble.com



Re: Bypassing SQL lexer and parser

От
Данила Поярков
Дата:
<div>06.07.2015, 20:28, "Guillaume Lelarge" <guillaume@lelarge.info>:</div><div>> That sounds a lot like a
backgroundworker.</div><div>Thank a lot! That's exactly what I was looking for.</div><div> </div><div>07.07.2015,
03:29,"Jim Nasby" <Jim.Nasby@BlueTreble.com>:<br />> There is support for plugging into the parser and
executor,so that<br />> might be a possibility, but...</div><div>For now, it's the key question as I didn't find
anythinglike that in PostreSQL docs. There are some good samples of implementing custom background workers but all them
useprepared stetements via SPI.</div><div> </div><div>> AFAIK HTSQL is very happy producing SQL; why not just let it
handSQL to <br />> Postgres (which it already does...)</div><div>Yes, they both work like a charm but HTSQL is
implementedin Python which adds some extra overhead.<br /><br />> Have you by chance talked to Clark or Kirill about
this?<br/>Not yet. I'm not currently going to follow all the HTSQL specs (at least at the starting point), just will
usethem as reference.</div>