Selecting from table into an array var - Mailing list pgsql-general

From Postgres User
Subject Selecting from table into an array var
Date
Msg-id b88c3460912181714v4917dd8ck8170f22e716cccc1@mail.gmail.com
Whole thread Raw
Responses Re: Selecting from table into an array var
List pgsql-general
Hi,

I'm trying to write a very simple function statement to select a
single integer field from a table and save it into an int array. For
some reason I can't seem to find the correct syntax:

CREATE TABLE sample (
    id  integer
);

and then within a function:

my_array int[];
my_array = SELECT ARRAY(id) FROM sample;


This syntax and variations of it don't work.  Can anyone show me the
correct approach?

pgsql-general by date:

Previous
From: Alex -
Date:
Subject: Re: PL/Perl Performance Problems
Next
From: Pavel Stehule
Date:
Subject: Re: Selecting from table into an array var