William C Brennan <brennan(at)netaxs(dot)com> writes:
> (Of course, I could make a system call, asking Unix to interpret the
> string "psql -l", but I'd like to thing there is a more direct route
> available to me, performing the same call to the Postgresql backend
> that the command "psql -l" must do itself.)
Try "psql -E -l" to see the query psql generates for this purpose;
or to see any other query psql generates on its own.
regards, tom lane