Postgresql Stored Procedure Select Statement Syntax