Creating a read/write virtual table?

From: Ben Martin <monkeyiq(at)users(dot)sourceforge(dot)net>
To: pgsql-general(at)postgresql(dot)org
Subject: Creating a read/write virtual table?
Date: 2010-04-12 03:34:06
Message-ID: 1271043246.23273.101.camel@sam.localdomain
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi,
I'm the author of the libferris virtual filesystem. Last year I
created the ability to expose a ferris filesystem as a virtual table in
SQLite [1] and would like to do much the same for PostgreSQL if
possible.

I was digging into where to get the whole libferris-as-vtable thing to
happen with pg:
http://www.postgresql.org/docs/8.4/static/xfunc-c.html
it strikes me that in the returning sets part:
http://www.postgresql.org/docs/8.4/static/xfunc-c.html#XFUNC-C-RETURN-SET
I might be able to prod the tupledesc that is generated by
get_call_result_type() to work out what should be returned.

There are two major drawbacks to this approach:
1) This is run as the postgres user on the server
2) This is read only.

In my SQLite vtable both of the above restrictions don't apply. To
mitigate (1) I was hopeful that there was a way to get the connection to
PG on the server to fork/setuid ala how one can setup apache to run web
responses as linux uids. Given the difference between \copy and COPY
(client/server fs access) I don't know if such a restriction is easy to
lift.

I think using a function restricts the results to being read only.
Perhaps having a second function that allows updates to be processed
separately.

Any pointers / suggestions on how to do this sort of thing with
postgresql would be wonderful. Please CC any such replies as I'm not
currently on list.

[1]
http://ldn.linuxfoundation.org/article/libferris-and-sqlite-a-powerful-combination-part-1
https://ldn.linuxfoundation.org/node/26821

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Craig Ringer 2010-04-12 05:15:45 Re: Creating a read/write virtual table?
Previous Message ckarthic 2010-04-11 20:44:02 Displaying the output of a query over a web interface.