pg_catalog_class.slt 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  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. mode cockroach
  10. statement ok
  11. CREATE TABLE a (b int);
  12. statement ok
  13. CREATE DATABASE other
  14. statement ok
  15. CREATE TABLE other.public.foo (a int)
  16. statement ok
  17. CREATE TABLE other.public.bar (a int)
  18. # Normal table
  19. query TIIIIBTTIBBBBTBBI
  20. SELECT relname, reloftype, relam, reltablespace, reltoastrelid, relhasindex, relpersistence, relkind, relchecks,
  21. relhasrules, relhastriggers, relrowsecurity, relforcerowsecurity, relreplident, relispartition, relhasoids, reltuples
  22. FROM pg_catalog.pg_class
  23. WHERE relname = 'a';
  24. ----
  25. a 0 0 0 0 false p r 0 false false false false d false false -1
  26. statement ok
  27. CREATE DEFAULT INDEX ON a
  28. # Default index on a
  29. query IIIIBTTIBBBBTBB
  30. SELECT reloftype, relam, reltablespace, reltoastrelid, relhasindex, relpersistence, relkind, relchecks,
  31. relhasrules, relhastriggers, relrowsecurity, relforcerowsecurity, relreplident, relispartition, relhasoids
  32. FROM pg_catalog.pg_class
  33. WHERE relname = (SELECT name FROM mz_indexes WHERE on_id = (SELECT id FROM mz_objects WHERE name = 'a'));
  34. ----
  35. 0 0 0 0 false p i 0 false false false false d false false
  36. # Test that pg_class is restricted to the current database, but includes items
  37. # in ambient schemas (in this case, pg_class itself).
  38. query T
  39. SELECT relname FROM pg_catalog.pg_class WHERE relname IN ('a', 'foo', 'bar', 'pg_class') ORDER BY 1
  40. ----
  41. a
  42. pg_class
  43. statement ok
  44. SET database = other
  45. query T
  46. SELECT relname FROM pg_catalog.pg_class WHERE relname IN ('a', 'foo', 'bar', 'pg_class') ORDER BY 1
  47. ----
  48. bar
  49. foo
  50. pg_class
  51. query TT
  52. SELECT min(relchecks), max(relchecks) FROM pg_catalog.pg_class
  53. ----
  54. 0 0