>> On Thu, Sep 7, 2017 at 3:28 PM wrote:
>>
>> > Example query
>> > select a.col1, case when a.col2 > 0 then a.col3 else b.xcol1 end as mycol3
>> > from a left join b on
>> > Expected response
>> > col1 mycol3
>> >
>>
>> This may be overkill, but works:
>>
>> postgres=# \copy (select 1 as
On 9/7/2017 12:18 AM, haman...@t-online.de wrote:
is there a simple way to retrieve column names from a query - basically the way
psql adds
column headings when I do a select?
if you're using libpq to do your queries, PQfname(*result,
column_number) returns the name of that column number.
t
Hi Hamman:
On Thu, Sep 7, 2017 at 3:17 PM, wrote:
> I would like to do something like
> \copy (select heading(select my query here)) to /tmp/heading_testfile1
It's already been pointed out, you can do something using CSV copy
with headers ( Why headers are not allowed in other formats rema
On Thu, Sep 7, 2017 at 3:28 PM wrote:
> Example query
> select a.col1, case when a.col2 > 0 then a.col3 else b.xcol1 end as mycol3
> from a left join b on
> Expected response
> col1 mycol3
>
This may be overkill, but works:
postgres=# \copy (select 1 as foo, 2 as bar limit 0) to stdout wit
>> SELECT table_name, column_name
>> FROM information_schema.columns
>> WHERE table_name = 'your_name';
>>
>> - Original Message -From: hamann w To:
>> pgsql-general@postgresql.orgSent: Thu, 07 Sep 2017 07:18:12 -
>> (UTC)Sub
>> On Thu, Sep 7, 2017 at 9:18 AM, wrote:
>> > is there a simple way to retrieve column names from a query - basically
>> > the way psql adds
>> > column headings when I do a select?
>>
>> How do you do the query? I mean, JDBC, PERL? After all psql is just a
>> C program doing a query using l
SELECT table_name, column_name
FROM information_schema.columns
WHERE table_name = 'your_name';
- Original Message -From: hamann w To:
pgsql-general@postgresql.orgSent: Thu, 07 Sep 2017 07:18:12 - (UTC)Subject:
[GENERAL] column names query
Hi,
is there a simple way t
On Thu, Sep 7, 2017 at 9:18 AM, wrote:
> is there a simple way to retrieve column names from a query - basically the
> way psql adds
> column headings when I do a select?
How do you do the query? I mean, JDBC, PERL? After all psql is just a
C program doing a query using libpq and can do it, we
Hi,
is there a simple way to retrieve column names from a query - basically the way
psql adds
column headings when I do a select?
Best regards
Wolfgang Hamann
--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.o