Thread

  1. Output filter for psql

    D'Arcy Cain <darcy@druid.net> — 2009-01-08T22:22:04Z

    I have mentioned this as a side issue in another thread.  I thought
    that it would be useful to start a separate thread for this.  Perhaps
    this won't be so difficult to code and we can forget all about the ReST
    discussion.
    
    So, I guess psql should pass XML to the user's filter and simply dump
    its output to the screen.  Is XML the best format?  It would allow us
    to pass meta information.  For example, we could pass the border
    setting so that the filter could change its output based on it.
    
    As for syntax, I'm not sure how difficult it would be to code but I was
    thinking something like this:
    
    \filter <format> <path>
    
    This would create a new format that can be set with pset.  For example:
    
    \filter rest ~/my_filter
    ...
    \pset format rest
    
    I would imagine that the filter command would normally go into
    ~/.psqlrc since it would only be activated by the pset call.
    
    -- 
    D'Arcy J.M. Cain <darcy@druid.net>         |  Democracy is three wolves
    http://www.druid.net/darcy/                |  and a sheep voting on
    +1 416 425 1212     (DoD#0082)    (eNTP)   |  what's for dinner.