search_path.td 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  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. $ set-sql-timeout duration=1s
  10. # Test custom search_paths
  11. > CREATE SCHEMA test1
  12. > CREATE SCHEMA test2
  13. > SET search_path = test1
  14. > CREATE TABLE test1.test_table (a int)
  15. > INSERT INTO test_table VALUES (1)
  16. > SET search_path = test2
  17. # test_table should not be resolvable in test2
  18. ! SELECT * FROM test_table
  19. contains:unknown catalog item 'test_table'
  20. # but still accessible with fully qualified names
  21. > SELECT * FROM test1.test_table
  22. 1
  23. # pg_catalog objects are always resolvable
  24. > SELECT * FROM pg_am
  25. # The temporary schema has priority over regular schemas
  26. > SET search_path = test1
  27. > CREATE TEMP TABLE test_table (a int)
  28. > SELECT * FROM test_table
  29. # No results returned
  30. > SELECT * FROM test1.test_table
  31. 1
  32. > INSERT INTO test_table VALUES (-1)
  33. > SELECT * FROM test_table
  34. -1
  35. > SELECT * FROM test1.test_table
  36. 1