Re: Refer to n'th field of a table?

From: Shridhar Daithankar <shridhar(at)frodo(dot)hserus(dot)net>
To: "Wei Wang" <ww220(at)cam(dot)ac(dot)uk>
Cc: "pgsql" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Refer to n'th field of a table?
Date: 2004-02-19 14:43:30
Message-ID: 200402192013.30718.shridhar@frodo.hserus.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Thursday 19 February 2004 19:22, Wei Wang wrote:
> Hi,
>
> Sorry for asking the dynamic command question without thoroughly reading
> the documentation first.
> Thanks a lot for your reply, Richard. ;-)
>
> Now this may be a naive SQL question:
> Is there any way to refer to the nth field of a table? For example, when I
> already know the schema of
> a table( I know it's first field is integer, second and third are text),
> but don't know the field names,
> is there any way to simply refer to the field by it's position in the table
> rather than it's field name?

It is possible if you use libpq i.e. C API to access database. You can access
the field value either by name or number.

> Also the same question goes with a record(row)?

Yes. With C API it is possible.

Check
http://www.postgresql.org/docs/7.4/static/libpq-exec.html#LIBPQ-EXEC-SELECT-INFO

Shridhar

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Alex 2004-02-19 14:58:43 VACUUM Question
Previous Message Wei Wang 2004-02-19 13:52:11 Refer to n'th field of a table?