more updates for pg_sql, some not well-tested