pg_get_indexdef.slt 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. # Copyright Materialize, Inc. and contributors. All rights reserved.
  2. #
  3. # Use of this software is governed by the Business Source License
  4. # included in the LICENSE file at the root of this repository.
  5. #
  6. # As of the Change Date specified in that file, in accordance with
  7. # the Business Source License, use of this software will be governed
  8. # by the Apache License, Version 2.0.
  9. #
  10. # This file is derived from the logic test suite in CockroachDB. The
  11. # original file was retrieved on June 10, 2019 from:
  12. #
  13. # The original source code is subject to the terms of the Apache
  14. # 2.0 license, a copy of which can be found in the LICENSE file at the
  15. # root of this repository.
  16. statement ok
  17. CREATE TABLE a (b text, c int)
  18. statement ok
  19. CREATE INDEX a_ind ON a (c, lower(b))
  20. query T
  21. SELECT pg_get_indexdef((SELECT oid FROM mz_catalog.mz_indexes WHERE name = 'a_ind'));
  22. ----
  23. CREATE INDEX a_ind ON a USING arrangement (c,pg_catalog.lower(b))
  24. query T
  25. SELECT pg_get_indexdef((SELECT oid FROM mz_catalog.mz_indexes WHERE name = 'a_ind'), 0, true);
  26. ----
  27. CREATE INDEX a_ind ON a USING arrangement (c,pg_catalog.lower(b))
  28. query T
  29. SELECT pg_get_indexdef((SELECT oid FROM mz_catalog.mz_indexes WHERE name = 'a_ind'), 1, true);
  30. ----
  31. c
  32. query T
  33. SELECT pg_get_indexdef((SELECT oid FROM mz_catalog.mz_indexes WHERE name = 'a_ind'), 2, true);
  34. ----
  35. pg_catalog.lower(b)
  36. query B
  37. SELECT pg_get_indexdef((SELECT oid FROM mz_catalog.mz_indexes WHERE name = 'a_ind'), 3, true) IS NULL;
  38. ----
  39. true