Re: Anonymous Code Blocks as Lambdas? - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Anonymous Code Blocks as Lambdas?
Date
Msg-id 15170.1256588465@sss.pgh.pa.us
Whole thread Raw
In response to Re: Anonymous Code Blocks as Lambdas?  (Andrew Dunstan <andrew@dunslane.net>)
Responses Re: Anonymous Code Blocks as Lambdas?
List pgsql-hackers
Andrew Dunstan <andrew@dunslane.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


pgsql-hackers by date:

Previous
From: Pavel Stehule
Date:
Subject: Re: Anonymous Code Blocks as Lambdas?
Next
From: Josh Berkus
Date:
Subject: Re: Proposal: String key space for advisory locks