Skip site navigation (1) Skip section navigation (2)

Re: Proposal: associative arrays for plpgsql (concept)

From: David Fetter <david(at)fetter(dot)org>
To: Pavel Stehule <stehule(at)kix(dot)fsv(dot)cvut(dot)cz>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Proposal: associative arrays for plpgsql (concept)
Date: 2005-06-29 17:07:10
Message-ID: 20050629170710.GD12689@fetter.org (view raw or flat)
Thread:
Lists: pgsql-hackers
On Wed, Jun 29, 2005 at 05:59:26PM +0200, Pavel Stehule wrote:
> Hello
> 
> 	The concept is from Oracle 9i, but with some changes.
> 
> http://www.oracle-10g.de/oracle_10g_documentation/appdev.101/b10807/05_colls.htm#i35672
> 
> Associative arrays are any arrays with index. Will be created 
> 
> DECLARE 
>   x varchar[] INDEX BY VARCHAR = '{}'; -- some format, haven't idea
> 
> then I can use anywhere x[key];
> 
> two enhancing FOR cycle:
> 
>   -- iteration over all values
>   FOR i IN VALUES OF x LOOP -- x array or associative array
>   END LOOP;
> 
>   -- iteration over all keys
>   FOR i IN INDICIES OF x LOOP -- x associatice array
>     x[i]
>   END LOOP;
> 
> new functions:
> 
> exists(x, key);
> delete(x, key);
> 
> index is accessable only from PL/pgSQL. Associative arrays can be spec 
> PostgreSQL type or clasic arrays with hash index. 
> 
> Comments, notes? 
> 
> Regards
> Pavel Stehule

I'm all in favor of having associative arrays as a 1st-class data type
in PostgreSQL.  How much harder would it be to make these generally
available vs. tied to one particular language?

Cheers,
D
-- 
David Fetter david(at)fetter(dot)org http://fetter.org/
phone: +1 510 893 6100   mobile: +1 415 235 3778

Remember to vote!

In response to

Responses

pgsql-hackers by date

Next:From: Pavel StehuleDate: 2005-06-29 17:12:16
Subject: problem with plpgsql
Previous:From: Jonah H. HarrisDate: 2005-06-29 16:40:16
Subject: Re: Bytecode and virtual machine

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group