Hi All;
I am using PostModern for PostGIS databases, and need to periodically
VACUUM and/or ANALYZE the database. I ended up writing SQL ops for
VACUUM and ANALYZE. There are some caveats which I mention in case
their behavior should be changed and/or they should be rewritten to be
more elegant. I am torn between embarrassment at the attached code
and my desire to contribute to PostModern (which I find so useful).
Obviously, I chose to brave embarrassment. In any event, advice,
suggestions, and feedback are welcomed (in decreasing order).
(1) The syntax I use does not follow the SQL spec. Instead of:
VACUUM FREEZE
VACUUM FULL FREEZE VERBOSE table0 column0 column1
I respectively do:
(:vacuum :freeze)
(:vacuum 'table0 'column0 'column1 :full :freeze :verbose)
Please advise if this is the Wrong Thing to do, and if so, which
arg-processing macros/helpers I should be using instead of the one I
have perhaps, er, misused.
(2) The split-on-keywords mechanism seems to enforce order of optional
SQL arguments (i.e., FREEZE must precede VERBOSE). I am not sure that
is either necessary or acceptable, or I am missing something.
(3) The argument-sniffing at the end of the split-on-keywords is ugly.
It sniffs the args to see if there are (non-keyword)table/column
optional SQL arguments (implying a list of table, and optionally
columns), and only sticks in a (:vars ...) if there are any.
-jm
--
--- John Morrison
--- john.nmi.morrison(a)gmail.com