Re: Array manipulation/syntax question

From: Michael Fuhr <mike(at)fuhr(dot)org>
To: Bart Grantham <bart(at)logicworks(dot)net>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Array manipulation/syntax question
Date: 2005-05-10 01:58:34
Message-ID: 20050510015834.GA65179@winnie.fuhr.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Mon, May 09, 2005 at 07:05:18PM -0400, Bart Grantham wrote:
>
> Let me put it this way... how do I do this:
>
> -- my_array is an INT[]
>
> _my_array := select some_column from some_table;

In PostgreSQL 7.4 and later you can use an array constructor:

my_array := ARRAY(SELECT some_column FROM some_table);

See "Array Constructors" in the "Value Expressions" section of the
"SQL Syntax" chapter of the documentation:

http://www.postgresql.org/docs/8.0/interactive/sql-expressions.html#SQL-SYNTAX-ARRAY-CONSTRUCTORS

--
Michael Fuhr
http://www.fuhr.org/~mfuhr/

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Bruce Momjian 2005-05-10 02:20:45 Re: [PERFORM] "Hash index" vs. "b-tree index" (PostgreSQL
Previous Message David Fetter 2005-05-10 01:53:33 Re: Array manipulation/syntax question