Cool! I am also working on it in our company, we implemented postgres wire protocol based on cratedb code and integrated it with calcite. CrateDB has a really good implementation of Postgres wire protocol and I tried to push them to make a separate library https://github.com/crate/crate/issues/12002
At the moment I am trying to emulate pg_catalog schema using calcite and it is painful. Calcite can't handle many things yet. For example, psql sends the following sql on the `\dt+` command: SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, c.relhasoids, c.relispartition, pg_catalog.array_to_string(c.reloptions || array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', '), c.reltablespace, CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, c.relpersistence, c.relreplident FROM pg_catalog.pg_class c LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid) WHERE c.oid = '1' 4-5 tasks were created in calcite JIRA only for this query. There are many others queries that should work ) Maybe when we will finish emulating pg_catalog we will open-source the code of the integration calcite with Postgres wire protocol. On Sun, May 8, 2022 at 12:21 AM Gavin Ray <[email protected]> wrote: > A while ago I saw a mention on the mailing list of someone interested in > making > Calcite speak Postgres' wire protocol, so all existing tools/client > libraries > could interface with it. > > I couldn't find anything on the internet for this -- either for Calcite,or > surprisingly even a JVM toolkit for building wire protocol services (empty > interfaces) > > Spent the last few weekends hacking on this, just today got a prototype to > a > point where I can query Calcite from psql > > Thought I'd share here in case others are interested, here's a video demo > and repo: > > https://twitter.com/GavinRayDev/status/1523048629883514881 > https://github.com/GavinRay97/PgProtoKt >
