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-07 18:06:56
Message-ID: 19298.1394215616@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 just looked into describe.c, but it was virtually my first look at C
> in 15 years and I'm pretty intimidated.

It's ugly and messy even to someone who does C every day, so don't feel bad.

> Come to think of it, I really like the idea of moving the query
> execution and presentation of results out into plpgsql functions in
> template0; then it would be super-easy for applications to utilize
> them.

That sort of thing has been discussed before, and rejected every time.
Pavel noted a couple of practical reasons against it, but the really big
picture is that there's not much agreement about exactly what views
applications might want to see, if they don't want to look directly at
the catalogs nor at the standardized information_schema views.

A new client-side library would have that issue too of course, but at
least it's relatively easy to ignore such a library if it doesn't do
exactly what you want. Also, since such a library could offer support for
older server versions too, it would have a much better chance of getting
significant uptake in less than several years.

> Alternately, I may just give up and write my own, freestanding,
> approximate implementation of the meta-commands with no effort to
> actually replace the native one. It could still be useful to
> application developers if they find out about it.

Yeah. I'm not entirely convinced that you'd want to be bug-compatible
with the psql commands anyway. There's a lot of details in there that
are legacy decisions and/or tuned for manual use rather than
programmatic use.

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Israel Brewster 2014-03-07 18:50:47 Re: Mysterious DB reset
Previous Message Pavel Stehule 2014-03-07 15:50:05 Re: extract psql meta-commands into library?