Catherine Devlin <catherine.devlin@gmail.com> writes:
> I'd like to provide access to psql's "backslash" meta-commands for
> IPython's %sql magic, as well as some other non-psql tools. When I
> asked about standalone implementations of the meta-commands, Craig
> Ringer suggested that extracting them from psql into a libpsql library
> (which psql would then use) would make that easy for all matter of
> external uses.
> Does this sound doable / of interest?
Hm ... the code in psql's describe.c is not terribly conducive to that.
Parsing of the backslash command, execution of the query/queries, and
presentation of the results is all rather tightly bound up; you'd have
to think about how to decouple those.
If you could do it in a way that didn't result in a quantum jump in
the complexity/unreadability of the code, I think there'd be interest.
regards, tom lane