Re: Proposal: associative arrays for plpgsql (concept)

From: David Fetter <david(at)fetter(dot)org>
To: Douglas McNaught <doug(at)mcnaught(dot)org>
Cc: Pavel Stehule <stehule(at)kix(dot)fsv(dot)cvut(dot)cz>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Proposal: associative arrays for plpgsql (concept)
Date: 2005-06-29 20:24:37
Message-ID: 20050629202437.GB23647@fetter.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Jun 29, 2005 at 01:20:17PM -0400, Douglas McNaught wrote:
> David Fetter <david(at)fetter(dot)org> writes:
>
> > 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?
>
> We already have them--they're called "tables with primary keys". :)
>
> What's the use-case for these things? Just imitating Oracle?

It would make named function parameters *very* easy to do. :)

SELECT *
FROM foo_func(
a => 2,
b => 5,
c => current_timestamp::timestamp with time zone
);

would be equivalent to

SELECT *
FROM foo_func(
c => current_timestamp::timestamp with time zone,
a => 2,
b => 5
);

and both would Do The Right Thing. It also opens the door to default
parameters for those who want them.

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

Browse pgsql-hackers by date

  From Date Subject
Next Message Simon Riggs 2005-06-29 21:38:28 Re: commit_delay, siblings
Previous Message Tom Lane 2005-06-29 20:16:47 Re: Open items