I'm not able to reproduce your problem. Could you give me more information about how your calling the psql function. Is it called from within a .tcl script, a transaction or a pl/pgsql function? Could you post what's in cr_items and the cr_revisions tables? Also, if you could create a test script that reproduces the problem that would be great.