Output filter for psql - Mailing list pgsql-hackers

From D'Arcy J.M. Cain
Subject Output filter for psql
Date
Msg-id 20090108172204.c114e71e.darcy@druid.net
Whole thread Raw
Responses Re: Output filter for psql  ("D'Arcy J.M. Cain" <darcy@druid.net>)
List pgsql-hackers
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.


pgsql-hackers by date:

Previous
From: Andrew Dunstan
Date:
Subject: Constraint docs
Next
From: Tom Lane
Date:
Subject: Re: Improving compressibility of WAL files