New hook after raw parsing, before analyze

From: David Beck <dbeck(at)starschema(dot)net>
To: "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: New hook after raw parsing, before analyze
Date: 2014-02-13 10:01:00
Message-ID: 5468125F-1AB4-4F29-94FC-15AEF0506E9A@starschema.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hello Hackers,

I work on a foreign data wrapper for a legacy system. I generally find the hook system very useful and flexible way to extend Postgres.
The post parse analyze hook almost fits what I need, but I have a few use cases where I would need to tap right into the parsed queries but before any catalog based validation is done.
Please find the attached trivial patch for this new hook.

One of the use cases I have is this:

I have table like data structures in the source system for the FDW I work on.
These tables are sometimes too big and the source system is able to filter and join them with limitations, thus it is not optimal to transfer the data to Postgres.
At the same time I want the users to think in terms of the original tables.

The idea is to rewrite the SQL queries like this:

“SELECT * FROM tableA a, tableB b WHERE a.id=b.id AND a.col1=1234 AND b.col2=987”

to:

“SELECT * FROM fdw_tableA_tableB ab WHERE ab.col1=1234 AND ab.col2=987”

This rewritten query would be handled by the FDW table that I previously added to the catalog.

The reason I want this new hook is that I don’t want tableA and tableB to be in the catalog.

Looking forward to hear your thoughts, opinions, comments.

Best regards, David

Attachment Content-Type Size
post_raw_parse.diff application/octet-stream 1.4 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2014-02-13 10:35:35 Re: Performance Improvement by reducing WAL for Update Operation
Previous Message Greg Stark 2014-02-13 09:59:48 Re: Recovery inconsistencies, standby much larger than primary