$names = ["a", "b"];
$null_fields = [("a", NULL), ("b", NULL)];
$pg_fields = [("a", 1p), ("b", 2p)];

SELECT 
  SpreadMembers($null_fields, $names),
  SpreadMembers($pg_fields, $names)
;