how to generate a list of distinct scalar values from a column which type is array - Mailing list pgsql-general

From Sergio Andreozzi
Subject how to generate a list of distinct scalar values from a column which type is array
Date
Msg-id 2cfc7c940702220338h3eb4ec97p8cd759cb7a36d775@mail.gmail.com
Whole thread Raw
Responses Re: how to generate a list of distinct scalar values from a column which type is array  (David Fetter <david@fetter.org>)
List pgsql-general
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

pgsql-general by date:

Previous
From: "A. Kretschmer"
Date:
Subject: Re: Esay question, about the numeric format
Next
From: Russ Brown
Date:
Subject: Re: postgresql vs mysql