> Hmm, it sure seems like there ought to be an easy way to do this...
Here is the only alternative that I see:
create function column_stacker(text[] columns, text[] types) returns
text
[...]
language 'C' immutable;
the above function stacks the columns together in a single string for
easy range indexing.
create index on t_idx(array[t.a::text, t.b::text, t.c::text],
array['int', 'int', 'char(2)']);
This is a lot more complicated then it sounds but it can be done. The
use of arrays is forced because of limitations in the way pg handles
parameters (no big deal). The real disadvantage here is that it these
indexes don't help with normal queries so every key gets two indexes :(.
I'm just looking for a nudge in the right direction here...if the answer
is GIST, I'll start researching that, etc. The ideal solution for me
would be a smarter planner or a simple C function to get the next record
out of the index (exposed through a UDF).
Everything has to stay generic...the ultimate goal is an ISAM driver for
pg.
Merlin