On 14 December 2011 15:10, Merlin Moncure <mmoncure@gmail.com> wrote:
> As to the wider point I'm wondering why you can't layer your API on
> top of existing facilities (tables, notifications, etc). PGQ (have you
> seen that?) does this and it's an absolute marvel. Meaning, I bet you
> could do this with an 'all sql (or plpgsql)' implementation. That's a
> good thing -- C code significantly raises the bar in terms of putting
> your code in the hands of people who might be interested in using it.
Well I was interested in the idea of using the NOTIFY payload somehow
for high performance (it's not backed by a table that gets fsynced and
needs to be vacuumed etc, and it delivers data to clients without an
extra round trip), and I guess also really like the idea of streams
being first class objects in a kind of StreamSQL-lite language
extension.
But I've been playing around with Robert's suggestion, and I realised
that I can dress up the foo_read and foo_write functions (probably
written in pure plpgsql) with a VIEW so that I can INSERT and SELECT
tuples, and to be able to join it against other tables. Here's what I
have working so far:
https://github.com/macdice/pg_stream/blob/master/hack.sql
I guess at this point this becomes off topic for pgsql-hackers.
Thanks all for the pointers and ideas.
PGQ looks interesting, I'll check it out.