Array extraction

From: veejar <veejar(dot)net(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Array extraction
Date: 2007-03-31 11:05:13
Message-ID: a4c4d7e50703310405j52e24d24hf1294ca642f18bc3@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi!

I have such table:

user_group
---------------------------------
ug_id -> serial primary key
ug_users -> int4[]

For example table has such rows:

ug_id | ug_users
-------+--------------
1 | { 2,5,6 }
2 | { 3,4,9 }

I want to write SQL-query or write user defined function to get such result
(extract array values):

ug_id | ug_users
-------+--------------
1 | 2
1 | 5
1 | 6
2 | 3
2 | 4
2 | 9

Help please to solve this problem.

--
Vadim

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Csaba Kalman 2007-03-31 12:10:50 Re: PANIC: unexpected hash relation size
Previous Message Mikko Partio 2007-03-31 10:41:33 Re: Anyone know where I can get an 8.2.3 binary for ubuntu?