Redshift Function Return Table Postgresql