Skip site navigation (1) Skip section navigation (2)

Re: array indizes in SQL

From: Hans-Peter Oeri <hp(at)oeri(dot)ch>
To: Rodrigo De León <rdeleonp(at)gmail(dot)com>
Cc: ListaPostgre <pgsql-novice(at)postgresql(dot)org>
Subject: Re: array indizes in SQL
Date: 2007-11-12 14:45:46
Message-ID: 4738671A.6000306@oeri.ch (view raw or flat)
Thread:
Lists: pgsql-novice
Hi!

Rodrigo De León wrote:
>> Is there a better way to "decompose" an array? (that I didn't find)
>>     
>
> SELECT a.attname AS "primarykey"
> FROM pg_catalog.pg_attribute AS a,
>      pg_catalog.pg_constraint AS o
> WHERE a.attnum = ANY (o.conkey)
> AND   a.attrelid = o.conrelid
> AND   o.contype = 'p'
> AND   o.conrelid = CAST ( ? AS regclass)
> ORDER BY a.attnum ASC
>   
Thanks for your input... However, you're ignoring the index field order
- which might differ from attribute order. At least some querys need
'correct' index orders, like foreign key (field) relations: the field at
index position 2 in table a relates to the field at index position 2 in
table b.

HPO

In response to

Responses

pgsql-novice by date

Next:From: Rodrigo De LeónDate: 2007-11-12 16:40:29
Subject: Re: array indizes in SQL
Previous:From: Rodrigo De LeónDate: 2007-11-12 13:48:58
Subject: Re: array indizes in SQL

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group