# 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 statement ok CREATE TABLE a (b int); statement ok CREATE DATABASE other statement ok CREATE TABLE other.public.foo (a int) statement ok CREATE TABLE other.public.bar (a int) # Normal table query TIIIIBTTIBBBBTBBI SELECT relname, reloftype, relam, reltablespace, reltoastrelid, relhasindex, relpersistence, relkind, relchecks, relhasrules, relhastriggers, relrowsecurity, relforcerowsecurity, relreplident, relispartition, relhasoids, reltuples FROM pg_catalog.pg_class WHERE relname = 'a'; ---- a 0 0 0 0 false p r 0 false false false false d false false -1 statement ok CREATE DEFAULT INDEX ON a # Default index on a query IIIIBTTIBBBBTBB SELECT reloftype, relam, reltablespace, reltoastrelid, relhasindex, relpersistence, relkind, relchecks, relhasrules, relhastriggers, relrowsecurity, relforcerowsecurity, relreplident, relispartition, relhasoids FROM pg_catalog.pg_class WHERE relname = (SELECT name FROM mz_indexes WHERE on_id = (SELECT id FROM mz_objects WHERE name = 'a')); ---- 0 0 0 0 false p i 0 false false false false d false false # Test that pg_class is restricted to the current database, but includes items # in ambient schemas (in this case, pg_class itself). query T SELECT relname FROM pg_catalog.pg_class WHERE relname IN ('a', 'foo', 'bar', 'pg_class') ORDER BY 1 ---- a pg_class statement ok SET database = other query T SELECT relname FROM pg_catalog.pg_class WHERE relname IN ('a', 'foo', 'bar', 'pg_class') ORDER BY 1 ---- bar foo pg_class query TT SELECT min(relchecks), max(relchecks) FROM pg_catalog.pg_class ---- 0 0