Re: Anonymous Code Blocks as Lambdas?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Andrew Dunstan <andrew(at)dunslane(dot)net>
Cc: "David E(dot) Wheeler" <david(at)kineticode(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Anonymous Code Blocks as Lambdas?
Date: 2009-10-26 20:21:05
Message-ID: 15170.1256588465@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Andrew Dunstan <andrew(at)dunslane(dot)net> writes:
> David E. Wheeler wrote:
>> Very excited about the new `DO` command in 8.5a2. I read through the
>> patch review thread and found that, like me, Dim had expected it to
>> behave more like a lambda than a simple command.

> It was discussed and rejected, at least for now. See earlier discussion.

A lambda facility would require being able to pass arguments and return
results, which we intentionally left out of DO to keep it simple. By
the time you add all that notation, it's far from clear that you
shouldn't just define a function.

Also, DO is (intended to be) optimized for execute-once behavior.
A lambda block inside a query shouldn't assume that. So it would not be
the same facility from either a syntax or an implementation standpoint.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Josh Berkus 2009-10-26 20:30:00 Re: Proposal: String key space for advisory locks
Previous Message Pavel Stehule 2009-10-26 20:16:25 Re: Anonymous Code Blocks as Lambdas?