I might of missed this in the porting guide, but when you are porting functions/procedures and you don't care about the result of a function call (e.g. ported procedure call), then you need to call the function by using "PERFORM" in place of "SELECT" or by selecting or returning into a dummy variable. Otherwise, you'll get something like:
openacs4=# i tst.sql
DROP
CREATE
psql:tst.sql:15: NOTICE: inside tsta
psql:tst.sql:15: ERROR: unexpected SELECT query in exec_stmt_execsql()