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

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 (view raw or flat)
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

pgsql-hackers by date

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

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