Parser Hook

From: Jim Mlodgenski <jimmy76(at)gmail(dot)com>
To: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Parser Hook
Date: 2021-02-22 16:20:54
Message-ID: CAB_5SReoPJAPO26Z8+WN6ugfBb2UDc3c21rRz9=BziBmCaph5Q@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

As Jan mentioned in his thread about a pluggable wire protocol [0], AWS is
working on a set of extensions for Babelfish. The intention is to not
necessarily have it as a single monolithic extension, but be possible for
people to use pieces of it as they need when they are migrating to
PostgreSQL. Some may just need the functions or data types. Others may need
the stored procedure language. Many times when enterprises are migrating
databases, they have satellite applications that they may not be able to
change or they are on a different schedules than the main application so
the database still needs to support some of the old syntax. A common need
in these situations is the parser.

Attached is a patch to place a hook at the top of the parser to allow for a
pluggable parser. It is modeled after the planner_hook [1]. To test the
hook, I have also attached a simple proof of concept that wraps the parser
in a TRY/CATCH block to catch any parse errors. That could potentially help
a class of users who are sensitive to parse errors ending up in the logs
and leaking PII data or passwords.

-- Jim
-- Amazon Web Services

[0] -
https://www.postgresql.org/message-id/flat/CAGBW59d5SjLyJLt-jwNv%2BoP6esbD8SCB%3D%3D%3D11WVe5%3DdOHLQ5wQ%40mail.gmail.com
[1] -
https://www.postgresql.org/message-id/flat/27516.1180053940%40sss.pgh.pa.us

Attachment Content-Type Size
parser_hook.patch application/octet-stream 1.7 KB
quiet_parser.c application/octet-stream 681 bytes

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2021-02-22 16:29:35 Re: computing dT from an interval
Previous Message David Fetter 2021-02-22 16:19:01 Re: Extensibility of the PostgreSQL wire protocol