On Mon, Apr 01, 2013 at 12:06:25AM +0200, Enke, Dr., Michael wrote: > I have to find out if a column ( i = 0, ..., tupdesc->natts-1 ) is part of a primary key > but for performance reasons I do not want to execute another query via SPI. > Is this possible? Simpler and probably even faster approach would be to do catalog lookup via SPI and then cache the result. The trick here is to get cache invalidation right, so on any table change cache is refreshed. You can use PgQ triggers as example: https://github.com/markokr/skytools/blob/master/sql/pgq/triggers/common.c It implements various unrelated features, but basics are in find_table_info() which loads cached data and relcache_reset_cb() which invalidates. -- marko -- Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general