Re: extract psql meta-commands into library? - Mailing list pgsql-general

From Tom Lane
Subject Re: extract psql meta-commands into library?
Date
Msg-id 27478.1394125766@sss.pgh.pa.us
Whole thread Raw
In response to extract psql meta-commands into library?  (Catherine Devlin <catherine.devlin@gmail.com>)
Responses Re: extract psql meta-commands into library?  (Catherine Devlin <catherine.devlin@gmail.com>)
List pgsql-general
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


pgsql-general by date:

Previous
From: hubert depesz lubaczewski
Date:
Subject: Re: 9.1.11 - many backends in "semtimedop" syscall
Next
From: Israel Brewster
Date:
Subject: Re: Mysterious DB reset