Peter Eisentraut <peter_e@gmx.net> writes:
> It might be an option to store the unparsed condition in the system
> catalogs, similar to what is done with the default values (see
> pg_attrdef).
In the long run, I have been thinking that we should eliminate storage
of preparsed expressions in all the system catalogs, and just store the
original source text of rules, default expressions, etc. This would
eliminate one major source of forced initdbs, and it'd make it a lot
easier to behave in a sensible fashion when tables underlying views
change. The additional cost of reparsing when we read the value should
be small (and seldom paid, since we cache all these things anyway).
The major stumbling block is how to extract the source text from the
initial query. What I'd like to do is extend the lexer/parser so that
every parse node includes starting and ending indexes into the original
query string. That would solve this problem and also make it possible
to generate much nicer messages for syntax errors. Isn't likely to get
done for 7.2 though.
In any case, I think Martijn is on the right track for index predicates
for the moment --- the code is designed around storing just the parsed
version, and there's not much point in changing only this part of the
system.
regards, tom lane