struct_builtins.sql 523 B

12345678910111213141516
  1. /* postgres can not */
  2. /* kikimr can not */
  3. /* syntax version 1 */
  4. $ad = AsStruct(1 AS a, 4 AS d);
  5. $b = AsStruct(2 AS b);
  6. $c_name = 'c';
  7. SELECT
  8. TryMember($ad, $c_name, "foo") AS c,
  9. TryMember($ad, "d", NULL) AS d,
  10. AddMember($ad, $c_name, 3) AS acd,
  11. ReplaceMember($ad, "a", 5) AS a5,
  12. RemoveMember($ad, 'd') AS a,
  13. ForceRemoveMember($ad, $c_name) AS ad,
  14. ExpandStruct($b, 1 AS a) AS ab,
  15. CombineMembers($ad, $b) AS abd,
  16. FlattenMembers(AsTuple("fo" || "o", $ad), AsTuple("bar", $b)) AS foobar;