I will not be covering PL/pgSQL comprehensively, but in terms of what I would find useful to have. Here is a short list of stuff I hope to cover:
- How to structure a function; what are the minimum set of parts.
- How to update or insert a record with a PL function call.
- How to return a simple calculated value
- How to return a few selected records, with and without enhancing calculations
- How to return generated data as if they were a set of records
- How to return summaries of selected data
- How to write adaptive functions, that change their return sets based on what tables they are used on.
- How to create a trigger from a function.
I hope to write a post a week, published on Thursday, but I'm only 4 or 5 weeks in, and am already struggling to keep up, using this outline as a stop-gap post for this week. I hope to have something more substantial for next week, and stay a post or two ahead; we will see how it goes.
Well, in 9.0 you can (kindof) inline PL/pgSQL thanks to "DO" - http://www.depesz.com/index.php/2009/11/01/waiting-for-8-5-do/
ReplyDelete