Re: RETURNING clause: how to specifiy column indexes?

From: Kris Jurka <books(at)ejurka(dot)com>
To: Ken Johanson <pg-user(at)kensystem(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: RETURNING clause: how to specifiy column indexes?
Date: 2007-12-14 02:08:38
Message-ID: Pine.BSO.4.64.0712132104040.22816@leary.csoft.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-jdbc

On Thu, 13 Dec 2007, Ken Johanson wrote:

> Here is the query I will call to the get the name of columns by ordinal
> position. Do you see any compatibility drivers will older server versions, or
> other issues?
>
> SELECT column_name
> FROM information_schema.columns
> WHERE table_catalog=? AND table_schema=? AND table_name=?
> ORDER BY ordinal_position
>

Using pg_catalog tables is better than using information_schema because of
the way permissions work. For information_schema you must be the table
owner, while people who only have permissions to access a table will most
likely be able to read pg_catalog.

Kris Jurka

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Ow Mun Heng 2007-12-14 03:13:40 HouseKeeping and vacuum Questions
Previous Message Tom Lane 2007-12-14 02:05:43 Re: plpgsql trigger coredumps instance

Browse pgsql-jdbc by date

  From Date Subject
Next Message Ken Johanson 2007-12-14 04:14:51 Re: RETURNING clause: how to specifiy column indexes?
Previous Message Ken Johanson 2007-12-14 02:02:37 Re: Synthesize support for Statement.getGeneratedKeys()?