Re: extract psql meta-commands into library?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Catherine Devlin <catherine(dot)devlin(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: extract psql meta-commands into library?
Date: 2014-03-06 17:09:26
Message-ID: 27478.1394125766@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Catherine Devlin <catherine(dot)devlin(at)gmail(dot)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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Israel Brewster 2014-03-06 17:33:45 Re: Mysterious DB reset
Previous Message hubert depesz lubaczewski 2014-03-06 17:03:54 Re: 9.1.11 - many backends in "semtimedop" syscall