Thursday, January 6, 2011

What's next..

PL/pgSQL is basically a language for writing functions. You cannot just inline a PL/pgSQL statement into a query wherever.  You define functions, and then use those functions to enhance queries, or to perform automated actions as triggers.

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:

  1. How to structure a function; what are the minimum set of parts.
  2. How to update or insert a record with a PL function call.
  3. How to return a simple calculated value
  4. How to return a few selected records, with and without enhancing calculations
  5. How to return generated data as if they were a set of records
  6. How to return summaries of selected data
  7. How to write adaptive functions, that change their return sets based on what tables they are used on.
  8. 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.

1 comment:

  1. Well, in 9.0 you can (kindof) inline PL/pgSQL thanks to "DO" -