mirror of https://github.com/citusdata/citus.git
Use cstore namespace instead of pg_catalog.
parent
10fd94a9e3
commit
35a52a6fe1
|
@ -3,6 +3,8 @@
|
||||||
-- complain if script is sourced in psql, rather than via CREATE EXTENSION
|
-- complain if script is sourced in psql, rather than via CREATE EXTENSION
|
||||||
\echo Use "CREATE EXTENSION cstore_fdw" to load this file. \quit
|
\echo Use "CREATE EXTENSION cstore_fdw" to load this file. \quit
|
||||||
|
|
||||||
|
CREATE SCHEMA cstore;
|
||||||
|
|
||||||
CREATE FUNCTION cstore_fdw_handler()
|
CREATE FUNCTION cstore_fdw_handler()
|
||||||
RETURNS fdw_handler
|
RETURNS fdw_handler
|
||||||
AS 'MODULE_PATHNAME'
|
AS 'MODULE_PATHNAME'
|
||||||
|
@ -58,7 +60,7 @@ CREATE EVENT TRIGGER cstore_drop_event
|
||||||
ON SQL_DROP
|
ON SQL_DROP
|
||||||
EXECUTE PROCEDURE cstore_drop_trigger();
|
EXECUTE PROCEDURE cstore_drop_trigger();
|
||||||
|
|
||||||
CREATE TABLE cstore_tables (
|
CREATE TABLE cstore.cstore_tables (
|
||||||
relid oid NOT NULL,
|
relid oid NOT NULL,
|
||||||
block_row_count int NOT NULL,
|
block_row_count int NOT NULL,
|
||||||
version_major bigint NOT NULL,
|
version_major bigint NOT NULL,
|
||||||
|
@ -66,21 +68,17 @@ CREATE TABLE cstore_tables (
|
||||||
PRIMARY KEY (relid)
|
PRIMARY KEY (relid)
|
||||||
) WITH (user_catalog_table = true);
|
) WITH (user_catalog_table = true);
|
||||||
|
|
||||||
ALTER TABLE cstore_tables SET SCHEMA pg_catalog;
|
CREATE TABLE cstore.cstore_stripes (
|
||||||
|
|
||||||
CREATE TABLE cstore_stripes (
|
|
||||||
relid oid NOT NULL,
|
relid oid NOT NULL,
|
||||||
stripe bigint NOT NULL,
|
stripe bigint NOT NULL,
|
||||||
file_offset bigint NOT NULL,
|
file_offset bigint NOT NULL,
|
||||||
skiplist_length bigint NOT NULL,
|
skiplist_length bigint NOT NULL,
|
||||||
data_length bigint NOT NULL,
|
data_length bigint NOT NULL,
|
||||||
PRIMARY KEY (relid, stripe),
|
PRIMARY KEY (relid, stripe),
|
||||||
FOREIGN KEY (relid) REFERENCES cstore_tables(relid) ON DELETE CASCADE INITIALLY DEFERRED
|
FOREIGN KEY (relid) REFERENCES cstore.cstore_tables(relid) ON DELETE CASCADE INITIALLY DEFERRED
|
||||||
) WITH (user_catalog_table = true);
|
) WITH (user_catalog_table = true);
|
||||||
|
|
||||||
ALTER TABLE cstore_stripes SET SCHEMA pg_catalog;
|
CREATE TABLE cstore.cstore_stripe_attr (
|
||||||
|
|
||||||
CREATE TABLE cstore_stripe_attr (
|
|
||||||
relid oid NOT NULL,
|
relid oid NOT NULL,
|
||||||
stripe bigint NOT NULL,
|
stripe bigint NOT NULL,
|
||||||
attr int NOT NULL,
|
attr int NOT NULL,
|
||||||
|
@ -88,7 +86,5 @@ CREATE TABLE cstore_stripe_attr (
|
||||||
value_size bigint NOT NULL,
|
value_size bigint NOT NULL,
|
||||||
skiplist_size bigint NOT NULL,
|
skiplist_size bigint NOT NULL,
|
||||||
PRIMARY KEY (relid, stripe, attr),
|
PRIMARY KEY (relid, stripe, attr),
|
||||||
FOREIGN KEY (relid, stripe) REFERENCES cstore_stripes(relid, stripe) ON DELETE CASCADE INITIALLY DEFERRED
|
FOREIGN KEY (relid, stripe) REFERENCES cstore.cstore_stripes(relid, stripe) ON DELETE CASCADE INITIALLY DEFERRED
|
||||||
) WITH (user_catalog_table = true);
|
) WITH (user_catalog_table = true);
|
||||||
|
|
||||||
ALTER TABLE cstore_stripe_attr SET SCHEMA pg_catalog;
|
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
#include "catalog/pg_namespace.h"
|
#include "catalog/pg_namespace.h"
|
||||||
#include "catalog/pg_collation.h"
|
#include "catalog/pg_collation.h"
|
||||||
#include "catalog/pg_type.h"
|
#include "catalog/pg_type.h"
|
||||||
|
#include "catalog/namespace.h"
|
||||||
#include "commands/defrem.h"
|
#include "commands/defrem.h"
|
||||||
#include "commands/trigger.h"
|
#include "commands/trigger.h"
|
||||||
#include "executor/executor.h"
|
#include "executor/executor.h"
|
||||||
|
@ -45,6 +46,7 @@ static Oid CStoreStripesRelationId(void);
|
||||||
static Oid CStoreStripesIndexRelationId(void);
|
static Oid CStoreStripesIndexRelationId(void);
|
||||||
static Oid CStoreTablesRelationId(void);
|
static Oid CStoreTablesRelationId(void);
|
||||||
static Oid CStoreTablesIndexRelationId(void);
|
static Oid CStoreTablesIndexRelationId(void);
|
||||||
|
static Oid CStoreNamespaceId(void);
|
||||||
static void InsertStripeAttrRow(Oid relid, uint64 stripe, AttrNumber attr,
|
static void InsertStripeAttrRow(Oid relid, uint64 stripe, AttrNumber attr,
|
||||||
uint64 existsSize, uint64 valuesSize,
|
uint64 existsSize, uint64 valuesSize,
|
||||||
uint64 skiplistSize);
|
uint64 skiplistSize);
|
||||||
|
@ -494,7 +496,7 @@ ReadStripeFooter(Oid relid, uint64 stripe, int relationColumnCount)
|
||||||
static Oid
|
static Oid
|
||||||
CStoreStripeAttrRelationId(void)
|
CStoreStripeAttrRelationId(void)
|
||||||
{
|
{
|
||||||
return get_relname_relid("cstore_stripe_attr", PG_CATALOG_NAMESPACE);
|
return get_relname_relid("cstore_stripe_attr", CStoreNamespaceId());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -505,7 +507,7 @@ CStoreStripeAttrRelationId(void)
|
||||||
static Oid
|
static Oid
|
||||||
CStoreStripeAttrIndexRelationId(void)
|
CStoreStripeAttrIndexRelationId(void)
|
||||||
{
|
{
|
||||||
return get_relname_relid("cstore_stripe_attr_pkey", PG_CATALOG_NAMESPACE);
|
return get_relname_relid("cstore_stripe_attr_pkey", CStoreNamespaceId());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -516,7 +518,7 @@ CStoreStripeAttrIndexRelationId(void)
|
||||||
static Oid
|
static Oid
|
||||||
CStoreStripesRelationId(void)
|
CStoreStripesRelationId(void)
|
||||||
{
|
{
|
||||||
return get_relname_relid("cstore_stripes", PG_CATALOG_NAMESPACE);
|
return get_relname_relid("cstore_stripes", CStoreNamespaceId());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -527,7 +529,7 @@ CStoreStripesRelationId(void)
|
||||||
static Oid
|
static Oid
|
||||||
CStoreStripesIndexRelationId(void)
|
CStoreStripesIndexRelationId(void)
|
||||||
{
|
{
|
||||||
return get_relname_relid("cstore_stripes_pkey", PG_CATALOG_NAMESPACE);
|
return get_relname_relid("cstore_stripes_pkey", CStoreNamespaceId());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -538,7 +540,7 @@ CStoreStripesIndexRelationId(void)
|
||||||
static Oid
|
static Oid
|
||||||
CStoreTablesRelationId(void)
|
CStoreTablesRelationId(void)
|
||||||
{
|
{
|
||||||
return get_relname_relid("cstore_tables", PG_CATALOG_NAMESPACE);
|
return get_relname_relid("cstore_tables", CStoreNamespaceId());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -549,5 +551,12 @@ CStoreTablesRelationId(void)
|
||||||
static Oid
|
static Oid
|
||||||
CStoreTablesIndexRelationId(void)
|
CStoreTablesIndexRelationId(void)
|
||||||
{
|
{
|
||||||
return get_relname_relid("cstore_tables_pkey", PG_CATALOG_NAMESPACE);
|
return get_relname_relid("cstore_tables_pkey", CStoreNamespaceId());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static Oid
|
||||||
|
CStoreNamespaceId(void)
|
||||||
|
{
|
||||||
|
return get_namespace_oid("cstore", false);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue