Databases: PostgreSQL how to return data from anonymous code block?