how to generate a list of distinct scalar values from a column which type is array

From: "Sergio Andreozzi" <sergio(dot)andreozzi(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: how to generate a list of distinct scalar values from a column which type is array
Date: 2007-02-22 11:38:50
Message-ID: 2cfc7c940702220338h3eb4ec97p8cd759cb7a36d775@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-sql

Dear all,

given a column which type is for instance varchar(20)[], is it possible via
SQL to generate the list of distinct scalar values?

e.g.:
col1
row 1: (aaa, bb, c)
row 2: (dddd, eeee)
row 3: (aaa, eeee)

the query should return:

aaa
bb
c
dddd
eeee

if not, I guess the approach is to use stored procedure. Any code
snippet/suggestion?

Thanks, Sergio

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message A. Kretschmer 2007-02-22 12:28:01 Re: how to generate a list of distinct scalar values from a column which type is array
Previous Message A. Kretschmer 2007-02-22 11:27:25 Re: Esay question, about the numeric format

Browse pgsql-sql by date

  From Date Subject
Next Message T E Schmitz 2007-02-22 11:46:52 pg_dump fails (timestamp out of range)
Previous Message A. Kretschmer 2007-02-22 11:27:25 Re: Esay question, about the numeric format