123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148 |
- # Copyright Materialize, Inc. and contributors. All rights reserved.
- #
- # Use of this software is governed by the Business Source License
- # included in the LICENSE file at the root of this repository.
- #
- # As of the Change Date specified in that file, in accordance with
- # the Business Source License, use of this software will be governed
- # by the Apache License, Version 2.0.
- mode cockroach
- query T
- show search_path
- ----
- public
- statement ok
- SET search_path = foo
- query T
- show search_path
- ----
- foo
- statement ok
- SET search_path = 'foo'
- query T
- show search_path
- ----
- foo
- statement ok
- SET search_path = 'ba r', foo, 'x, y', "a, b"
- query T
- show search_path
- ----
- "ba r", foo, "x, y", "a, b"
- query T
- SELECT current_schema()
- ----
- NULL
- query T
- SELECT current_schemas(false)
- ----
- {}
- query T
- SELECT current_schemas(true)
- ----
- {mz_catalog,pg_catalog}
- # Ensure both `current_schemas` and `current_schema` work when the specified
- # cluster is invalid.
- statement ok
- SET cluster = noexist
- query T
- SELECT current_schema()
- ----
- NULL
- query T
- SELECT current_schemas(false)
- ----
- {}
- query T
- SELECT current_schemas(true)
- ----
- {mz_catalog,pg_catalog}
- statement ok
- SET cluster = quickstart
- statement error no valid schema selected
- CREATE TABLE t (i INT)
- statement error no valid schema selected
- SHOW SOURCES;
- statement error no valid schema selected
- SHOW SINKS;
- statement error no valid schema selected
- SHOW INDEXES;
- statement ok
- CREATE SCHEMA foo
- ----
- query T
- SELECT current_schema()
- ----
- foo
- query T
- SELECT current_schemas(false)
- ----
- {foo}
- query T
- SELECT current_schemas(true)
- ----
- {mz_catalog,pg_catalog,foo}
- statement ok
- CREATE TABLE t (i INT)
- query T
- SELECT count(*) from t
- ----
- 0
- statement ok
- SET search_path = pg_catalog
- query T
- show search_path
- ----
- pg_catalog
- query T
- SELECT current_schema()
- ----
- pg_catalog
- query T
- SELECT current_schemas(true)
- ----
- {mz_catalog,pg_catalog}
- query T
- SELECT current_schemas(false)
- ----
- {pg_catalog}
- query TT
- SELECT id, name FROM mz_schemas WHERE name = 'mz_catalog' OR name = 'pg_catalog' OR name = 'mz_internal' OR name = 'information_schema';
- ----
- s1 mz_catalog
- s2 pg_catalog
- s4 mz_internal
- s5 information_schema
|