blob: b8fa6f707ae3923734554fce4bc8f4ecb277dfa6 [file] [log] [blame]
-- Licensed to the Apache Software Foundation (ASF) under one
-- or more contributor license agreements. See the NOTICE file
-- distributed with this work for additional information
-- regarding copyright ownership. The ASF licenses this file
-- to you under the Apache License, Version 2.0 (the
-- "License"); you may not use this file except in compliance
-- with the License. You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing,
-- software distributed under the License is distributed on an
-- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-- KIND, either express or implied. See the License for the
-- specific language governing permissions and limitations
-- under the License.
--
-- --------------------------------------------------------------------
--
-- cdb_schema.sql
--
-- Define mpp administrative schema and several SQL functions to aid
-- in maintaining the mpp administrative schema.
--
-- This is version 2 of the schema.
--
-- TODO Error checking is rudimentary and needs improvment.
--
--
-- --------------------------------------------------------------------
SET log_min_messages = WARNING;
-------------------------------------------------------------------
-- database
-------------------------------------------------------------------
CREATE OR REPLACE VIEW gp_pgdatabase AS
SELECT *
FROM gp_pgdatabase() AS L(dbid smallint, isprimary boolean, content smallint, valid boolean, definedprimary boolean);
GRANT SELECT ON gp_pgdatabase TO PUBLIC;
------------------------------------------------------------------
-- distributed transaction related
------------------------------------------------------------------
CREATE OR REPLACE VIEW gp_distributed_xacts AS
SELECT *
FROM gp_distributed_xacts() AS L(distributed_xid xid, distributed_id text, state text, gp_session_id int, xmin_distributed_snapshot xid);
GRANT SELECT ON gp_distributed_xacts TO PUBLIC;
CREATE OR REPLACE VIEW gp_transaction_log AS
SELECT *
FROM gp_transaction_log() AS L(segment_id smallint, dbid smallint, transaction xid, status text);
GRANT SELECT ON gp_transaction_log TO PUBLIC;
CREATE OR REPLACE VIEW gp_distributed_log AS
SELECT *
FROM gp_distributed_log() AS L(segment_id smallint, dbid smallint, distributed_xid xid, distributed_id text, status text, local_transaction xid);
GRANT SELECT ON gp_distributed_log TO PUBLIC;
------------------------------------------------------------------
-- plpgsql is created by default in 3.4, but it is still a "user" language,
-- rather than an "internal" language.
------------------------------------------------------------------
CREATE LANGUAGE plpgsql;
--ALTER RESOURCE QUEUE pg_default WITH (priority=medium, memory_limit='-1');
--ALTER RESOURCE QUEUE pg_default WITH (memory_limit='-1');
CREATE SCHEMA hawq_toolkit;
RESET log_min_messages;