Forum OpenACS Q&A: Response to Locking a table inside a PL/PgSQL or PL/Tcl function

I tried a test case of this a while back with the same results that you are seeing.  I think that I've seen this question come up on the pg hackers list before, so you might want to search their archives.  I'm pretty sure that it is broken.