views:

117

answers:

1

I am looking for something similar to MySQL Proxy. The purpose is to modify incoming queries on the server. I am not looking for alternative ways to achieve the same. My best guess at the moment is to modify GridSQL, but this adds complexity and it takes time. I have asked this question before in a vastly different way and got no relevant results, so I deleted that question and added this one.

Edit: It is important that the client can continue to utilize the PostgreSQL protocol, so the package I am looking for needs to communicate using it.

+1  A: 

You might take a look at sqlrelay which has the ability to route and filter queries.

http://sqlrelay.sourceforge.net/sqlrelay/router.html

If you want to rewrite the queries I think sqlrelay falls short.

You might otherwise look into PostgreSQL's rules, which can be used to substitute or rewrite queries:

http://www.postgresql.org/docs/8.4/interactive/rules.html

John P
I want to rewrite, so sqlrelay cannot be used. Select rules (equivalent of views) cannot rewrite queries except in very limitet ways. I will give you a vote up for your suggestions.
David
Rules aren't just for select. They can be placed as a part of any of the major queries on a table( SELECT, INSERT, UPDATE, or DELETE ). Since PostgreSQL doesn't offer a "MERGE" or "ON DUPLICATE KEY", I solved the issue using a rule: http://tinyurl.com/ko-psql-table (this is an output from pgadmin, you'll need to search for "create rule").
Christopher W. Allen-Poole