With enough trickery you can even implement it using postgres wire protocol, I guess, so it'll be transparent.