15670430创建于 2020年12月28日历史提交
CREATE TABLE import_src0
(
  c_hashid int,
  c_tinyint  tinyint,
  c_smallint smallint,
  c_int integer,
  c_bigint   bigint,
  c_money    money,
  c_numeric   numeric,
  c_real      real,
  c_double    double precision,
  c_decimal   decimal,
  c_varchar   varchar,
  c_char   char(30),
  c_nvarchar2  nvarchar2,
  c_text text,
  c_timestamp   timestamp with time zone,
  c_timestamptz timestamp without time zone,
  c_date     date,
  c_time     time without time zone,
  c_timetz   time with time zone,
  c_interval  interval,
  c_tinterval   tinterval,
  c_smalldatetime   smalldatetime,
  c_bytea   bytea,
  c_boolean  boolean,
  c_inet inet,
  c_cidr cidr,
  c_bit bit(10),
  c_varbit varbit(10),
  c_oid oid
)
distribute by hash(c_hashid)  
;
CREATE TABLE import_src1
(
  c_hashid int,
  c_tinyint  tinyint,
  c_smallint smallint,
  c_int integer,
  c_bigint   bigint,
  c_money    money,
  c_numeric   numeric,
  c_real      real,
  c_double    double precision,
  c_decimal   decimal,
  c_varchar   varchar,
  c_char   char(30),
  c_nvarchar2  nvarchar2,
  c_text text,
  c_timestamp   timestamp with time zone,
  c_timestamptz timestamp without time zone,
  c_date     date,
  c_time     time without time zone,
  c_timetz   time with time zone,
  c_interval  interval,
  c_tinterval   tinterval,
  c_smalldatetime   smalldatetime,
  c_bytea   bytea,
  c_boolean  boolean,
  c_inet inet,
  c_cidr cidr,
  c_bit bit(10),
  c_varbit varbit(10),
  c_oid oid
)
WITH (ORIENTATION = COLUMN)
distribute by hash(c_hashid)
;
CREATE TABLESPACE ts location '@testtablespace@/tablespace_limit';
COPY import_src0 FROM '@abs_srcdir@/data/cstore_alter_change_plus_update.dat';
COPY import_src1 FROM '@abs_srcdir@/data/cstore_alter_change_plus_update.dat';
CREATE TABLE import_0
(
  c_hashid int,
  c_tinyint  tinyint,
  c_smallint smallint,
  c_int integer,
  c_bigint   bigint,
  c_money    money,
  c_numeric   numeric,
  c_real      real,
  c_double    double precision,
  c_decimal   decimal,
  c_varchar   varchar,
  c_char   char(30),
  c_nvarchar2  nvarchar2,
  c_text text,
  c_timestamp   timestamp with time zone,
  c_timestamptz timestamp without time zone,
  c_date     date,
  c_time     time without time zone,
  c_timetz   time with time zone,
  c_interval  interval,
  c_tinterval   tinterval,
  c_smalldatetime   smalldatetime,
  c_bytea   bytea,
  c_boolean  boolean,
  c_inet inet,
  c_cidr cidr,
  c_bit bit(10),
  c_varbit varbit(10),
  c_oid oid
)
TABLESPACE ts
distribute by hash(c_hashid)
;
CREATE TABLE import_1
(
  c_hashid int,
  c_tinyint  tinyint,
  c_smallint smallint,
  c_int integer,
  c_bigint   bigint,
  c_money    money,
  c_numeric   numeric,
  c_real      real,
  c_double    double precision,
  c_decimal   decimal,
  c_varchar   varchar,
  c_char   char(30),
  c_nvarchar2  nvarchar2,
  c_text text,
  c_timestamp   timestamp with time zone,
  c_timestamptz timestamp without time zone,
  c_date     date,
  c_time     time without time zone,
  c_timetz   time with time zone,
  c_interval  interval,
  c_tinterval   tinterval,
  c_smalldatetime   smalldatetime,
  c_bytea   bytea,
  c_boolean  boolean,
  c_inet inet,
  c_cidr cidr,
  c_bit bit(10),
  c_varbit varbit(10),
  c_oid oid
)
WITH (ORIENTATION = COLUMN)
TABLESPACE ts
distribute by hash(c_hashid)
;
ALTER TABLESPACE ts RESIZE MAXSIZE '5M';
INSERT INTO import_0 SELECT * FROM import_src0;
ERROR:  Insufficient storage space for tablespace "ts"
--?.*
INSERT INTO import_1 SELECT * FROM import_src1;
ERROR:  Insufficient storage space for tablespace "ts"
--?.*
ALTER TABLESPACE ts RESIZE MAXSIZE UNLIMITED;
INSERT INTO import_0 SELECT * FROM import_src0;
INSERT INTO import_1 SELECT * FROM import_src1;
ALTER TABLESPACE ts RESIZE MAXSIZE '1 K';
ALTER TABLESPACE ts RESIZE MAXSIZE '18014398509481983 K';
ERROR:  Invalid value for tablespace maxsize: "18014398509481983 K"
HINT:  Value exceeds max size 9007199254740991 with unit KB
ALTER TABLESPACE ts RESIZE MAXSIZE '0 K';
ERROR:  Invalid value for tablespace maxsize: "0 K"
HINT:  Value is equal to 0
ALTER TABLESPACE ts RESIZE MAXSIZE '18014398509481984 K';
ERROR:  Invalid value for tablespace maxsize: "18014398509481984 K"
HINT:  Value exceeds max size 9007199254740991 with unit KB
ALTER TABLESPACE ts RESIZE MAXSIZE '1 k';
ALTER TABLESPACE ts RESIZE MAXSIZE '18014398509481983 k';
ERROR:  Invalid value for tablespace maxsize: "18014398509481983 k"
HINT:  Value exceeds max size 9007199254740991 with unit KB
ALTER TABLESPACE ts RESIZE MAXSIZE '0 k';
ERROR:  Invalid value for tablespace maxsize: "0 k"
HINT:  Value is equal to 0
ALTER TABLESPACE ts RESIZE MAXSIZE '18014398509481984 k';
ERROR:  Invalid value for tablespace maxsize: "18014398509481984 k"
HINT:  Value exceeds max size 9007199254740991 with unit KB
ALTER TABLESPACE ts RESIZE MAXSIZE '1 M';
ALTER TABLESPACE ts RESIZE MAXSIZE '17592186044415 M';
ERROR:  Invalid value for tablespace maxsize: "17592186044415 M"
HINT:  Value exceeds max size 8796093022207 with unit MB
ALTER TABLESPACE ts RESIZE MAXSIZE '0 M';
ERROR:  Invalid value for tablespace maxsize: "0 M"
HINT:  Value is equal to 0
ALTER TABLESPACE ts RESIZE MAXSIZE '17592186044416 M';
ERROR:  Invalid value for tablespace maxsize: "17592186044416 M"
HINT:  Value exceeds max size 8796093022207 with unit MB
ALTER TABLESPACE ts RESIZE MAXSIZE '1 m';
ALTER TABLESPACE ts RESIZE MAXSIZE '17592186044415 m';
ERROR:  Invalid value for tablespace maxsize: "17592186044415 m"
HINT:  Value exceeds max size 8796093022207 with unit MB
ALTER TABLESPACE ts RESIZE MAXSIZE '0 m';
ERROR:  Invalid value for tablespace maxsize: "0 m"
HINT:  Value is equal to 0
ALTER TABLESPACE ts RESIZE MAXSIZE '17592186044416 m';
ERROR:  Invalid value for tablespace maxsize: "17592186044416 m"
HINT:  Value exceeds max size 8796093022207 with unit MB
ALTER TABLESPACE ts RESIZE MAXSIZE '1 G';
ALTER TABLESPACE ts RESIZE MAXSIZE '17179869183 G';
ERROR:  Invalid value for tablespace maxsize: "17179869183 G"
HINT:  Value exceeds max size 8589934591 with unit GB
ALTER TABLESPACE ts RESIZE MAXSIZE '0 G';
ERROR:  Invalid value for tablespace maxsize: "0 G"
HINT:  Value is equal to 0
ALTER TABLESPACE ts RESIZE MAXSIZE '17179869184 G';
ERROR:  Invalid value for tablespace maxsize: "17179869184 G"
HINT:  Value exceeds max size 8589934591 with unit GB
ALTER TABLESPACE ts RESIZE MAXSIZE '1 g';
ALTER TABLESPACE ts RESIZE MAXSIZE '17179869183 g';
ERROR:  Invalid value for tablespace maxsize: "17179869183 g"
HINT:  Value exceeds max size 8589934591 with unit GB
ALTER TABLESPACE ts RESIZE MAXSIZE '0 g';
ERROR:  Invalid value for tablespace maxsize: "0 g"
HINT:  Value is equal to 0
ALTER TABLESPACE ts RESIZE MAXSIZE '17179869184 g';
ERROR:  Invalid value for tablespace maxsize: "17179869184 g"
HINT:  Value exceeds max size 8589934591 with unit GB
ALTER TABLESPACE ts RESIZE MAXSIZE '1 T';
ALTER TABLESPACE ts RESIZE MAXSIZE '16777215 T';
ERROR:  Invalid value for tablespace maxsize: "16777215 T"
HINT:  Value exceeds max size 8388607 with unit TB
ALTER TABLESPACE ts RESIZE MAXSIZE '0 T';
ERROR:  Invalid value for tablespace maxsize: "0 T"
HINT:  Value is equal to 0
ALTER TABLESPACE ts RESIZE MAXSIZE '16777216 T';
ERROR:  Invalid value for tablespace maxsize: "16777216 T"
HINT:  Value exceeds max size 8388607 with unit TB
ALTER TABLESPACE ts RESIZE MAXSIZE '1 t';
ALTER TABLESPACE ts RESIZE MAXSIZE '16777215 t';
ERROR:  Invalid value for tablespace maxsize: "16777215 t"
HINT:  Value exceeds max size 8388607 with unit TB
ALTER TABLESPACE ts RESIZE MAXSIZE '0 t';
ERROR:  Invalid value for tablespace maxsize: "0 t"
HINT:  Value is equal to 0
ALTER TABLESPACE ts RESIZE MAXSIZE '16777216 t';
ERROR:  Invalid value for tablespace maxsize: "16777216 t"
HINT:  Value exceeds max size 8388607 with unit TB
ALTER TABLESPACE ts RESIZE MAXSIZE '1 P';
ALTER TABLESPACE ts RESIZE MAXSIZE '16383 P';
ERROR:  Invalid value for tablespace maxsize: "16383 P"
HINT:  Value exceeds max size 8191 with unit PB
ALTER TABLESPACE ts RESIZE MAXSIZE '0 P';
ERROR:  Invalid value for tablespace maxsize: "0 P"
HINT:  Value is equal to 0
ALTER TABLESPACE ts RESIZE MAXSIZE '16384 P';
ERROR:  Invalid value for tablespace maxsize: "16384 P"
HINT:  Value exceeds max size 8191 with unit PB
ALTER TABLESPACE ts RESIZE MAXSIZE '1 p';
ALTER TABLESPACE ts RESIZE MAXSIZE '16383 p';
ERROR:  Invalid value for tablespace maxsize: "16383 p"
HINT:  Value exceeds max size 8191 with unit PB
ALTER TABLESPACE ts RESIZE MAXSIZE '0 p';
ERROR:  Invalid value for tablespace maxsize: "0 p"
HINT:  Value is equal to 0
ALTER TABLESPACE ts RESIZE MAXSIZE '16384 p';
ERROR:  Invalid value for tablespace maxsize: "16384 p"
HINT:  Value exceeds max size 8191 with unit PB
ALTER TABLESPACE ts RESIZE MAXSIZE '1 B';
ERROR:  Invalid value for tablespace maxsize: "1 B"
HINT:  Valid units are "k/K", "m/M", "g/G", "t/T", and "p/P".
DROP TABLE import_0;
DROP TABLE import_1;
-- test tablespace for DDL and BTREE INDEX
CREATE TABLESPACE tbs_001 location '@abs_srcdir@/tmp_check/tbs_001' MAXSIZE '50 K';
-- failed because too small tablespace
CREATE TABLE tbs_alter_table_007 ( id int, info int ) with ( ORIENTATION = COLUMN ) TABLESPACE tbs_001
PARTITION BY RANGE (id)
(
    partition p0 values less than (1000),
    partition p1 values less than (2000),
    partition p2 values less than (3000),
    partition p3 values less than (4000),
    partition p4 values less than (5000),
    partition p5 values less than (6000),
    partition p6 values less than (7000),
    partition p7 values less than (8000),
    partition p8 values less than (9000),
    partition p9 values less than (10000)
);
ERROR:  Insufficient storage space for tablespace "tbs_001"
--?.*
CREATE TABLE tbs_alter_table_008 TABLESPACE tbs_001 AS SELECT * FROM import_src0;
ERROR:  Insufficient storage space for tablespace "tbs_001"
--?.*
-- test tablespace for VACUUM FULL
ALTER TABLESPACE tbs_001 RESIZE MAXSIZE '30M';
CREATE TABLE tbs_alter_table_009 TABLESPACE tbs_001 AS SELECT * FROM import_src0;
VACUUM FULL tbs_alter_table_009;
ERROR:  Insufficient storage space for tablespace "tbs_001"
--?.*
DROP TABLE tbs_alter_table_009;
-- test tablespace for CLUSTER
CREATE TABLE tbs_alter_table_010 TABLESPACE tbs_001 AS SELECT * FROM import_src0;
CREATE INDEX idx_tbl010_00 ON tbs_alter_table_010(c_int);
CLUSTER tbs_alter_table_010 USING idx_tbl010_00;
ERROR:  Insufficient storage space for tablespace "tbs_001"
--?.*
DROP INDEX idx_tbl010_00;
DROP TABLE tbs_alter_table_010;
-- test tablespace for ALTER TABLE SET TABLESPACE
CREATE TABLESPACE tbs_002 location '@abs_srcdir@/tmp_check/tbs_002' MAXSIZE '50 K';
CREATE TABLE tbs_alter_table_011 TABLESPACE tbs_001 AS SELECT * FROM import_src0;
ALTER TABLE tbs_alter_table_011 SET TABLESPACE tbs_002;
ERROR:  Insufficient storage space for tablespace "tbs_002"
--?.*
DROP TABLE tbs_alter_table_011;
-- test tablespace for MERGE PARTITION
CREATE TABLE tbs_alter_table_012 ( id int, info text ) tablespace tbs_002
PARTITION BY RANGE (id)
(
    PARTITION p0 values less than (10),
    PARTITION p1 values less than (20)
);
INSERT INTO tbs_alter_table_012 VALUES (1, 'abcdefghijklmnopqrstuvwxyz10233456789');
INSERT INTO tbs_alter_table_012 SELECT * FROM tbs_alter_table_012;
ERROR:  Insufficient storage space for tablespace "tbs_002"
--?.*
ALTER TABLE tbs_alter_table_012 MERGE PARTITIONS p0, p1 INTO PARTITION p2;
ERROR:  Insufficient storage space for tablespace "tbs_002"
--?.*
DROP TABLE tbs_alter_table_012;
-- test tablespace for VM/FSM/BCM extending.
DROP TABLE import_src0;
DROP TABLE import_src1;
DROP TABLESPACE ts;
DROP TABLESPACE tbs_002;
DROP TABLESPACE tbs_001;