First plpgsql Script

From: "Van Ingen, Lane" <lvaningen(at)ESNCC(dot)com>
To: <pgsql-novice(at)postgresql(dot)org>
Subject: First plpgsql Script
Date: 2005-05-11 13:53:50
Message-ID: A3FF4275060B76459B5C08A64AE330C805C365@twmail.esncc.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

I am setting up my first trigger, and writing my first plpgsql script.

I am finding that once I read information into a ROWTYPE or RECORD variable, I want to manipulate the
data a bit more before leaving the function. But a lot of the stuff data manipulation features I want to do appear to only be available to SQL statements, rather than being able to apply some functions like what is available in SQL on stored variables.

So far, the only way I have been able to do what I want to do is to select data from a table, assign it to a variable manipulate a little bit, then stuff it into a single temp record table so I can process the data further by applying some more SQL functions against it.

The only plpgsql commands available that I am aware of are assignment commands, loop-related commands, logical tests (if-then-else), and the like. Perhaps I was hoping that plpgsql has more capability than it does. What I was specifically looking for is to be able to do things like date arithmetic, manipulate stored arrays, accumulate totals, etc. against stored variables while assigning the result to yet another stored variable.

Can I do this sort of thing, without having to resort to a different language? Or have I missed something? All of the documentation in the manual (even UDFs) appear to be oriented to using SQL, especially SELECT statements.

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Geoffrey 2005-05-11 13:59:15 Re: Select dump
Previous Message John DeSoi 2005-05-11 13:49:14 Re: [despammed] Select dump