Cursors are not supported in PL/pgSQL. I don't see a TODO item to fix this. Fixing the syntax to support cursors is easy. The problem then is that PL/pgSQL uses SPI, and SPI does not support cursors. In spi.c there is a bit of code for cursor support, with the comment /* Don't work currently */ Is adding cursor support to SPI a bad idea? Is adding cursor support to PL/pgSQL undesirable? Can anybody sketch the problems which would arise when adding cursor support to SPI? Thanks. Ian