Re: Getting column names/types from select query?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Wesley Aptekar-Cassels" <me(at)wesleyac(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Getting column names/types from select query?
Date: 2021-01-20 16:46:06
Message-ID: 715370.1611161166@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

"Wesley Aptekar-Cassels" <me(at)wesleyac(dot)com> writes:
> I am interested in figuring out how to get the names and types of the
> columns from an arbitrary query.

Where do you need this information? Usually the easiest way is to
prepare (plan) the query and then extract metadata, for instance
PQprepare and PQdescribePrepared if using libpq.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2021-01-20 16:50:14 Re: Odd, intermittent failure in contrib/pageinspect
Previous Message Dian M Fay 2021-01-20 16:34:16 Re: [HACKERS] [PATCH] Generic type subscripting