提交 3e1fae2c 编写于 作者: S Shoaib Lari

Migrate storage/aoco_alter/aoco_alter_sql_test tests to ICG.

There is considerable overlap between the aoco_alter/aoco_alter_sql_test tests
and the test/regress/*/uao_dll tests. This is the first commit to move several
of the aoco_alter/aoco_alter_sql_test tests to ICG.

This commit moves alter_ao_table_oid_column.sql and alter_ao_table_oid_row.sql
from sql/uao_ddl directories to sql/uao_col and sql/uao_row directories
respectively.

After this change, the sql/uao_ddl and expected/uao_ddl directories are only
used for generation of intermediate .sql and .out files during the processing of
the --ao-dir option of regress.  Therefore, I added .gitignore files in these
directories.

The bulk_dense_content_rle_compress.sql and small_content_rle_compress_hdr.sql
tests are moved to rle.sql.

Teh table name used in the alter_drop_allcol.source is renamed to avoid conflict
with the same table name used in other tests.

Remove migrated aoco_alter tests from tinc.

Since these tests are part of ICG, so we don't need them in tinc anymore.
上级 18f27a52
......@@ -11248,3 +11248,31 @@ CREATE TABLE rle_co_block_boundary (
WITH (appendonly=true, orientation=column, compresstype=rle_type, compresslevel=3, blocksize=8192)
DISTRIBUTED BY (distcol);
COPY rle_co_block_boundary (distcol, col1) FROM stdin NULL AS 'NULL';
--
-- Bulk dense content header with RLE compression
begin;
create table bulk_rle_tab (a int) with (appendonly=true, orientation=column, compresstype='rle_type', compresslevel=3, checksum=true);
NOTICE: Table doesn't have 'DISTRIBUTED BY' clause -- Using column named 'a' as the Greenplum Database data distribution key for this table.
HINT: The 'DISTRIBUTED BY' clause determines the distribution of data. Make sure column(s) chosen are the optimal data distribution key to minimize skew.
insert into bulk_rle_tab select i/50 from generate_series(1, 1000000)i;
insert into bulk_rle_tab values (1),(1),(1),(1),(1),(1),(2),(2),(2),(2),(2),(2),(2),(33),(3),(3),(3),(1),(8),(19),
(20),(31),(32),(33),(34),(5),(5),(5),(5),(5),(6),(6),(6),(6),(6),(6),(7),(7),(7),(7),(7),(7),(7),(7),
(null),(7),(7),(7),(null),(8),(8),(8),(8),(8),(8),(4),(4),(null),(4),(17),(17),(17),(null),(null),(null);
alter table bulk_rle_tab add column b varchar default 'abc' encoding(blocksize=8192);
insert into bulk_rle_tab values (-1, 'xyz');
update bulk_rle_tab set b = 'green' where a = -1;
commit;
--
-- Small content header with RLE header inside
begin;
create table sml_rle_hdr (a int) with (appendonly=true, orientation=column, compresstype='rle_type');
NOTICE: Table doesn't have 'DISTRIBUTED BY' clause -- Using column named 'a' as the Greenplum Database data distribution key for this table.
HINT: The 'DISTRIBUTED BY' clause determines the distribution of data. Make sure column(s) chosen are the optimal data distribution key to minimize skew.
insert into sml_rle_hdr values (1),(1),(1),(1),(1),(1),(2),(2),(2),(2),(2),(2),(2),(33),(3),(3),(3),(1),(8),(19),
(20),(31),(32),(33),(34),(5),(5),(5),(5),(5),(6),(6),(6),(6),(6),(6),(7),(7),(7),(7),(7),(7),(7),(7),
(null),(7),(7),(7),(null),(8),(8),(8),(8),(8),(8),(4),(4),(null),(4),(17),(17),(17),(null),(null),(null);
alter table sml_rle_hdr add column b float default random();
-- update / insert / select after this operation
insert into sml_rle_hdr values (-1,-1.1);
update sml_rle_hdr set b = b + 10 where a = -1;
commit;
This directory only contains generated files created by running the
./pg_regress --ao-dir=uao_ddl/...
command.
All files in this directory are ignored by .gitignore.
......@@ -139,8 +139,8 @@ test: uaocs_compaction/index_stats
test: uaocs_compaction/index
test: uaocs_compaction/drop_column
test: uao_ddl/alter_ao_table_oid_column uao_ddl/cursor_row uao_ddl/cursor_column uao_ddl/alter_ao_table_statistics_row uao_ddl/analyze_ao_table_every_dml_row uao_ddl/analyze_ao_table_every_dml_column uao_ddl/alter_ao_table_statistics_column uao_ddl/alter_ao_table_setdefault_row uao_ddl/alter_ao_table_index_row uao_ddl/alter_ao_table_owner_column
test: uao_ddl/alter_ao_table_owner_row uao_ddl/alter_ao_table_setstorage_row uao_ddl/alter_ao_table_constraint_row uao_ddl/alter_ao_table_constraint_column uao_ddl/alter_ao_table_index_column uao_ddl/alter_ao_table_oid_row uao_ddl/blocksize_row uao_ddl/compresstype_column uao_ddl/alter_ao_table_setdefault_column uao_ddl/blocksize_column
test: uao_ddl/cursor_row uao_ddl/cursor_column uao_ddl/alter_ao_table_statistics_row uao_ddl/analyze_ao_table_every_dml_row uao_ddl/analyze_ao_table_every_dml_column uao_ddl/alter_ao_table_statistics_column uao_ddl/alter_ao_table_setdefault_row uao_ddl/alter_ao_table_index_row uao_ddl/alter_ao_table_owner_column
test: uao_ddl/alter_ao_table_owner_row uao_ddl/alter_ao_table_setstorage_row uao_ddl/alter_ao_table_constraint_row uao_ddl/alter_ao_table_constraint_column uao_ddl/alter_ao_table_index_column uao_ddl/blocksize_row uao_ddl/compresstype_column uao_ddl/alter_ao_table_setdefault_column uao_ddl/blocksize_column
# Do not add the two uao*_catalog_tables tests to a group that runs
# serializable transactions. They run VACUUM FULL on append-optimized
# tables and assume that no AWAITING_DROP segfiles exist at the end of
......@@ -148,6 +148,12 @@ test: uao_ddl/alter_ao_table_owner_row uao_ddl/alter_ao_table_setstorage_row uao
test: uao_catalog_tables uaocs_catalog_tables uao_ddl/alter_ao_table_setstorage_column uao_ddl/alter_ao_table_col_ddl_row uao_ddl/compresstype_row uao_ddl/alter_ao_table_col_ddl_column uao_ddl/alter_ao_part_tables_splitpartition_row uao_ddl/alter_ao_part_tables_splitpartition_column uao_ddl/create_ao_tables_row uao_ddl/create_ao_table_500cols_row uao_ddl/create_ao_tables_column uao_ddl/alter_ao_part_exch_row
test: uao_ddl/alter_ao_part_exch_column uao_ddl/alter_ao_part_tables_row uao_ddl/create_ao_table_500cols_column uao_ddl/alter_ao_part_tables_column
test: uao_ddl/alter_drop_allcol_row uao_ddl/alter_drop_allcol_column uao_ddl/alter_rollback_row uao_ddl/alter_rollback_column uao_ddl/uao_allalter_row uao_ddl/uao_allalter_column
test: uao_col/alter_ao_table_oid_column
test: uao_row/alter_ao_table_oid_row
# Test psql \du output
test: psql_gpdb_du
......
create schema alter_ao_table_col_ddl_@orientation@;
set search_path="$user",alter_ao_table_col_ddl_@orientation@,public;
SET gp_default_storage_options='orientation=@orientation@';
BEGIN;
CREATE TABLE sto_alt_uao1(
text_col text default 'remove it',
bigint_col bigint,
......@@ -50,3 +52,4 @@ select count(int4_col) = 5 as passed from sto_alt_uao1;
set gp_select_invisible = true;
select count(int4_col) from sto_alt_uao1;
set gp_select_invisible = false;
COMMIT;
......@@ -52,3 +52,13 @@ select count(*) AS only_visi_tups from sto_alt_uao2_constraint;
set gp_select_invisible = true;
select count(*) AS invisi_and_visi_tups from sto_alt_uao2_constraint;
set gp_select_invisible = false;
-- Some negative testing.
alter table sto_alt_uao2_constraint ADD COLUMN added_col10 character varying(35)
default NULL constraint added_col10 NOT NULL;
alter table sto_alt_uao2_constraint ADD COLUMN added_col12 character varying(35)
-- Mask out "by some row" printed by row-oriented AO tables
-- start_matchsubs
-- m/^ERROR: check constraint.*is violated/
-- s/^ERROR: check constraint.*is violated.*/ERROR: check constraint is violated/
-- end_matchsubs
default 'abc' CHECK (added_col12 is NULL);
create schema alter_drop_allcol_@orientation@;
set search_path="$user",alter_drop_allcol_@orientation@,public;
SET gp_default_storage_options='orientation=@orientation@';
--
-- Drop all columns one by one then add new column.
-- Perform VACUUM and SELECT again.
--
BEGIN;
CREATE TABLE alter_drop_allcoll (a INT, b INT, c CHAR(128)) WITH (appendonly=true);
CREATE INDEX alter_drop_allcoll_index ON alter_drop_allcoll(b);
INSERT INTO alter_drop_allcoll SELECT i as a, i as b, 'hello world' as c FROM generate_series(1,5) AS i;
select * from alter_drop_allcoll order by a,b;
ALTER TABLE alter_drop_allcoll DROP COLUMN c;
select count(*) as c from pg_attribute pa, pg_class pc where pa.attrelid = pc.oid and pc.relname='alter_drop_allcoll' and attname='c';
select * from alter_drop_allcoll order by a,b;
ALTER TABLE alter_drop_allcoll DROP COLUMN b;
select count(*) as b from pg_attribute pa, pg_class pc where pa.attrelid = pc.oid and pc.relname='alter_drop_allcoll' and attname='b';
select * from alter_drop_allcoll order by a;
ALTER TABLE alter_drop_allcoll DROP COLUMN a;
select count(*) as a from pg_attribute pa, pg_class pc where pa.attrelid = pc.oid and pc.relname='alter_drop_allcoll' and attname='a';
select * from alter_drop_allcoll;
ALTER TABLE alter_drop_allcoll ADD COLUMN a1 int default 10;
select count(*) as a from pg_attribute pa, pg_class pc where pa.attrelid = pc.oid and pc.relname='alter_drop_allcoll' and attname='a';
select * from alter_drop_allcoll;
COMMIT;
vacuum alter_drop_allcoll;
select * from alter_drop_allcoll;
create schema alter_rollback_@orientation@;
set search_path="$user",alter_rollback_@orientation@,public;
SET gp_default_storage_options='orientation=@orientation@';
--
-- @created 2014-04-14 12:00:00
-- @modified 2014-04-14 12:00:00
-- @tags storage
-- @description AOCO table: Alter add column in a transaction and then rollback the transaction
Drop table if exists myao_rollback;
create table myao_rollback(i int , j int) with (appendonly=true, orientation=column);
-- Add column in a transaction and then rollback the transaction
--
begin;
create table myao_rollback(i int , j int) with (appendonly=true);
insert into myao_rollback select i, i+10 from generate_series(1,2000) i ;
insert into myao_rollback select i, i+10 from generate_series(1,2000) i ;
insert into myao_rollback select i, i+10 from generate_series(1,2000) i ;
insert into myao_rollback select i, i+10 from generate_series(1,2000) i ;
select count(*) from myao_rollback;
\d myao_rollback
commit;
begin transaction;
alter table myao_rollback add column k int default 0;
insert into myao_rollback select i , i + 10, i - 10 from generate_series(1,10) i;
select count(*) from myao_rollback;
\d myao_rollback
rollback;
select count(*) from myao_rollback;
\d myao_rollback
create schema uao_allalter_@orientation@;
set search_path="$user",uao_allalter_@orientation@,public;
SET gp_default_storage_options='orientation=@orientation@';
--
-- alter add all types of columns
--
BEGIN;
set time zone PST8PDT;
CREATE TABLE uao_allalter (
id SERIAL) WITH (appendonly=true) distributed randomly ;
-- Alter all kinds of columns
Alter table uao_allalter ADD COLUMN a1 int default 10;
Alter table uao_allalter ADD COLUMN a2 char(5) default 'asdf';
Alter table uao_allalter ADD COLUMN a3 numeric default 3.14;
Alter table uao_allalter ADD COLUMN a4 boolean DEFAULT false ;
Alter table uao_allalter ADD COLUMN a5 char DEFAULT 'd';
Alter table uao_allalter ADD COLUMN a6 text default 'some default value';
Alter table uao_allalter ADD COLUMN a7 timestamp default '2003-10-21 02:26:11';
Alter table uao_allalter ADD COLUMN a8 character varying(705) default 'asdsdsfdsnfdsnafkndasfdsajfldsjafdsbfjdsbfkdsjf';
Alter table uao_allalter ADD COLUMN a9 bigint default 2342;
Alter table uao_allalter ADD COLUMN a10 date default '1989-11-12';
Alter table uao_allalter ADD COLUMN a11 varchar(600) default 'ksdhfkdshfdshfkjhdskjfhdshflkdshfhdsfkjhds';
Alter table uao_allalter ADD COLUMN a12 text default 'mnsbfsndlsjdflsjasdjhhsafhshfsljlsahfkshalsdkfks';
Alter table uao_allalter ADD COLUMN a13 decimal default 4.123;
Alter table uao_allalter ADD COLUMN a14 real default 23232;
Alter table uao_allalter ADD COLUMN a15 bigint default 2342;
Alter table uao_allalter ADD COLUMN a16 int4 default 2342;
Alter table uao_allalter ADD COLUMN a17 bytea default '0011';
Alter table uao_allalter ADD COLUMN a18 timestamp with time zone default '1995-07-16 01:51:15+1359';
Alter table uao_allalter ADD COLUMN a19 timetz default '1991-12-13 01:51:15';
Alter table uao_allalter ADD COLUMN a20 path default '((6,7),(4,5),(2,1))';
Alter table uao_allalter ADD COLUMN a21 box default '((1,3)(4,6))';
Alter table uao_allalter ADD COLUMN a22 macaddr default '09:00:3b:01:02:03';
Alter table uao_allalter ADD COLUMN a23 interval default '5-7';
Alter table uao_allalter ADD COLUMN a24 character varying(800) default 'jdgfkasdksahkjcskgcksgckdsfkdslfhksagfksajhdjag';
Alter table uao_allalter ADD COLUMN a25 lseg default '((1,2)(2,3))';
Alter table uao_allalter ADD COLUMN a26 point default '(3,4)';
Alter table uao_allalter ADD COLUMN a27 double precision default 12.211;
Alter table uao_allalter ADD COLUMN a28 circle default '((2,3),4)';
Alter table uao_allalter ADD COLUMN a29 int4 default 37;
Alter table uao_allalter ADD COLUMN a30 numeric(8) default 3774;
Alter table uao_allalter ADD COLUMN a31 polygon default '(1,5,4,3)';
Alter table uao_allalter ADD COLUMN a32 date default '1988-02-21';
Alter table uao_allalter ADD COLUMN a33 real default 41114;
Alter table uao_allalter ADD COLUMN a34 money default '$7,222.00';
Alter table uao_allalter ADD COLUMN a35 cidr default '192.167.2';
Alter table uao_allalter ADD COLUMN a36 inet default '126.2.3.4';
Alter table uao_allalter ADD COLUMN a37 time default '10:31:45';
Alter table uao_allalter ADD COLUMN a38 text default 'sdhjfsfksfkjskjfksjfkjsdfkjdshkjfhdsjkfkjsd';
Alter table uao_allalter ADD COLUMN a39 bit default '0';
Alter table uao_allalter ADD COLUMN a40 bit varying(5) default '1';
Alter table uao_allalter ADD COLUMN a41 smallint default 12;
Alter table uao_allalter ADD COLUMN a42 int default 2323;
--
-- Insert data to the table
--
INSERT INTO uao_allalter(a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13,a14,a15,a16,a17,a18,a19,a20,a21,a22,a23,a24,a25,a26,a27,a28,a29,a30,a31,a32,a33,a34,a35,a36,a37,a38,a39,a40,a41,a42) values(generate_series(1,20),'M',2011,'t','a','This is news of today: Deadlock between Republicans and Democrats over how best to reduce the U.S. deficit, and over what period, has blocked an agreement to allow the raising of the $14.3 trillion debt ceiling','2001-12-24 02:26:11','U.S. House of Representatives Speaker John Boehner, the top Republican in Congress who has put forward a deficit reduction plan to be voted on later on Thursday said he had no control over whether his bill would avert a credit downgrade.',generate_series(2490,2505),'2011-10-11','The Republican-controlled House is tentatively scheduled to vote on Boehner proposal this afternoon at around 6 p.m. EDT (2200 GMT). The main Republican vote counter in the House, Kevin McCarthy, would not say if there were enough votes to pass the bill.','WASHINGTON:House Speaker John Boehner says his plan mixing spending cuts in exchange for raising the nations $14.3 trillion debt limit is not perfect but is as large a step that a divided government can take that is doable and signable by President Barack Obama.The Ohio Republican says the measure is an honest and sincere attempt at compromise and was negotiated with Democrats last weekend and that passing it would end the ongoing debt crisis. The plan blends $900 billion-plus in spending cuts with a companion increase in the nations borrowing cap.','1234.56',323453,generate_series(3452,3462),7845,'0011','2005-07-16 01:51:15+1359','2001-12-13 01:51:15','((1,2),(0,3),(2,1))','((2,3)(4,5))','08:00:2b:01:02:03','1-2','Republicans had been working throughout the day Thursday to lock down support for their plan to raise the nations debt ceiling, even as Senate Democrats vowed to swiftly kill it if passed.','((2,3)(4,5))','(6,7)',11.222,'((4,5),7)',32,3214,'(1,0,2,3)','2010-02-21',43564,'$1,000.00','192.168.1','126.1.3.4','12:30:45','Johnson & Johnsons McNeil Consumer Healthcare announced the voluntary dosage reduction today. Labels will carry new dosing instructions this fall.The company says it will cut the maximum dosage of Regular Strength Tylenol and other acetaminophen-containing products in 2012.Acetaminophen is safe when used as directed, says Edwin Kuffner, MD, McNeil vice president of over-the-counter medical affairs. But, when too much is taken, it can cause liver damage.The action is intended to cut the risk of such accidental overdoses, the company says in a news release.','1','0',12,23);
--
--Alter table set distributed by
ALTER table uao_allalter set with ( reorganize='true') distributed by (a1);
-- Create Uncompressed table of same schema definition
CREATE TABLE uao_allalter_uncompr (id SERIAL,a1 int,a2 char(5),a3 numeric,a4 boolean DEFAULT false ,a5 char DEFAULT 'd',a6 text,a7 timestamp,a8 character varying(705),a9 bigint,a10 date,a11 varchar(600),a12 text,a13 decimal,a14 real,a15 bigint,a16 int4 ,a17 bytea,a18 timestamp with time zone,a19 timetz,a20 path,a21 box,a22 macaddr,a23 interval,a24 character varying(800),a25 lseg,a26 point,a27 double precision,a28 circle,a29 int4,a30 numeric(8),a31 polygon,a32 date,a33 real,a34 money,a35 cidr,a36 inet,a37 time,a38 text,a39 bit,a40 bit varying(5),a41 smallint,a42 int) WITH (appendonly=true) distributed randomly;
--
-- Insert to uncompressed table
--
INSERT INTO uao_allalter_uncompr(a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13,a14,a15,a16,a17,a18,a19,a20,a21,a22,a23,a24,a25,a26,a27,a28,a29,a30,a31,a32,a33,a34,a35,a36,a37,a38,a39,a40,a41,a42) values(generate_series(1,20),'M',2011,'t','a','This is news of today: Deadlock between Republicans and Democrats over how best to reduce the U.S. deficit, and over what period, has blocked an agreement to allow the raising of the $14.3 trillion debt ceiling','2001-12-24 02:26:11','U.S. House of Representatives Speaker John Boehner, the top Republican in Congress who has put forward a deficit reduction plan to be voted on later on Thursday said he had no control over whether his bill would avert a credit downgrade.',generate_series(2490,2505),'2011-10-11','The Republican-controlled House is tentatively scheduled to vote on Boehner proposal this afternoon at around 6 p.m. EDT (2200 GMT). The main Republican vote counter in the House, Kevin McCarthy, would not say if there were enough votes to pass the bill.','WASHINGTON:House Speaker John Boehner says his plan mixing spending cuts in exchange for raising the nations $14.3 trillion debt limit is not perfect but is as large a step that a divided government can take that is doable and signable by President Barack Obama.The Ohio Republican says the measure is an honest and sincere attempt at compromise and was negotiated with Democrats last weekend and that passing it would end the ongoing debt crisis. The plan blends $900 billion-plus in spending cuts with a companion increase in the nations borrowing cap.','1234.56',323453,generate_series(3452,3462),7845,'0011','2005-07-16 01:51:15+1359','2001-12-13 01:51:15','((1,2),(0,3),(2,1))','((2,3)(4,5))','08:00:2b:01:02:03','1-2','Republicans had been working throughout the day Thursday to lock down support for their plan to raise the nations debt ceiling, even as Senate Democrats vowed to swiftly kill it if passed.','((2,3)(4,5))','(6,7)',11.222,'((4,5),7)',32,3214,'(1,0,2,3)','2010-02-21',43564,'$1,000.00','192.168.1','126.1.3.4','12:30:45','Johnson & Johnsons McNeil Consumer Healthcare announced the voluntary dosage reduction today. Labels will carry new dosing instructions this fall.The company says it will cut the maximum dosage of Regular Strength Tylenol and other acetaminophen-containing products in 2012.Acetaminophen is safe when used as directed, says Edwin Kuffner, MD, McNeil vice president of over-the-counter medical affairs. But, when too much is taken, it can cause liver damage.The action is intended to cut the risk of such accidental overdoses, the company says in a news release.','1','0',12,23);
--
-- Select number of rows from the uncompressed table
--
SELECT count(*) as count_uncompressed from uao_allalter_uncompr ;
--
-- Select number of rows from the compressed table
--
SELECT count(*) as count_compressed from uao_allalter;
--
-- Select number of rows using a FULL outer join on all the columns of the two tables
-- Count should match with above result if the all the rows uncompressed correctly:
--
Select count(*) as count_join from uao_allalter t1 full outer join uao_allalter_uncompr t2 on t1.id=t2.id and t1.a1=t2.a1 and t1.a2=t2.a2 and t1.a3=t2.a3 and t1.a4=t2.a4 and t1.a5=t2.a5 and t1.a6=t2.a6 and t1.a7=t2.a7 and t1.a8=t2.a8 and t1.a9=t2.a9 and t1.a10=t2.a10 and t1.a11=t2.a11 and t1.a12=t2.a12 and t1.a13=t2.a13 and t1.a14=t2.a14 and t1.a15=t2.a15 and t1.a16=t2.a16 and t1.a17=t2.a17 and t1.a18=t2.a18 and t1.a19=t2.a19 and t1.a22=t2.a22 and t1.a23=t2.a23 and t1.a24=t2.a24 and t1.a27=t2.a27 and t1.a29=t2.a29 and t1.a30=t2.a30 and t1.a32=t2.a32 and t1.a33=t2.a33 and t1.a34=t2.a34 and t1.a35=t2.a35 and t1.a36=t2.a36 and t1.a37=t2.a37 and t1.a38=t2.a38 and t1.a39=t2.a39 and t1.a40=t2.a40 and t1.a41=t2.a41 and t1.a42=t2.a42 ;
--
-- Truncate the table
--
TRUNCATE table uao_allalter;
--
-- Insert data again
--
insert into uao_allalter select * from uao_allalter_uncompr order by a1;
--
-- Select the data: Using the JOIN as mentioned above
--
Select count(*) as count_join from uao_allalter t1 full outer join uao_allalter_uncompr t2 on t1.id=t2.id and t1.a1=t2.a1 and t1.a2=t2.a2 and t1.a3=t2.a3 and t1.a4=t2.a4 and t1.a5=t2.a5 and t1.a6=t2.a6 and t1.a7=t2.a7 and t1.a8=t2.a8 and t1.a9=t2.a9 and t1.a10=t2.a10 and t1.a11=t2.a11 and t1.a12=t2.a12 and t1.a13=t2.a13 and t1.a14=t2.a14 and t1.a15=t2.a15 and t1.a16=t2.a16 and t1.a17=t2.a17 and t1.a18=t2.a18 and t1.a19=t2.a19 and t1.a22=t2.a22 and t1.a23=t2.a23 and t1.a24=t2.a24 and t1.a27=t2.a27 and t1.a29=t2.a29 and t1.a30=t2.a30 and t1.a32=t2.a32 and t1.a33=t2.a33 and t1.a34=t2.a34 and t1.a35=t2.a35 and t1.a36=t2.a36 and t1.a37=t2.a37 and t1.a38=t2.a38 and t1.a39=t2.a39 and t1.a40=t2.a40 and t1.a41=t2.a41 and t1.a42=t2.a42 ;
--Alter table alter type of a column
Alter table uao_allalter Alter column a3 TYPE int4;
--Insert data to the table, select count(*)
Insert into uao_allalter(a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13,a14,a15,a16,a17,a18,a19,a20,a21,a22,a23,a24,a25,a26,a27,a28,a29,a30,a31,a32,a33,a34,a35,a36,a37,a38,a39,a40,a41,a42) select a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13,a14,a15,a16,a17,a18,a19,a20,a21,a22,a23,a24,a25,a26,a27,a28,a29,a30,a31,a32,a33,a34,a35,a36,a37,a38,a39,a40,a41,a42 from uao_allalter where id =10;
Select count(*) from uao_allalter;
--Alter table drop a column
Alter table uao_allalter Drop column a12;
Insert into uao_allalter(a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a13,a14,a15,a16,a17,a18,a19,a20,a21,a22,a23,a24,a25,a26,a27,a28,a29,a30,a31,a32,a33,a34,a35,a36,a37,a38,a39,a40,a41,a42) select a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a13,a14,a15,a16,a17,a18,a19,a20,a21,a22,a23,a24,a25,a26,a27,a28,a29,a30,a31,a32,a33,a34,a35,a36,a37,a38,a39,a40,a41,a42 from uao_allalter where id =10;
Select count(*) from uao_allalter;
--Alter table rename a column
Alter table uao_allalter Rename column a13 TO after_rename_a13;
--Insert data to the table, select count(*)
Insert into uao_allalter(a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,after_rename_a13,a14,a15,a16,a17,a18,a19,a20,a21,a22,a23,a24,a25,a26,a27,a28,a29,a30,a31,a32,a33,a34,a35,a36,a37,a38,a39,a40,a41,a42) select a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,after_rename_a13,a14,a15,a16,a17,a18,a19,a20,a21,a22,a23,a24,a25,a26,a27,a28,a29,a30,a31,a32,a33,a34,a35,a36,a37,a38,a39,a40,a41,a42 from uao_allalter where id =10;
Select count(*) from uao_allalter;
update uao_allalter set a9 = a9 + 10 where a1 = 10;
COMMIT;
create schema alter_ao_table_col_ddl_@orientation@;
set search_path="$user",alter_ao_table_col_ddl_@orientation@,public;
SET gp_default_storage_options='orientation=@orientation@';
BEGIN;
CREATE TABLE sto_alt_uao1(
text_col text default 'remove it',
bigint_col bigint,
......@@ -104,3 +105,4 @@ select count(int4_col) from sto_alt_uao1;
(1 row)
set gp_select_invisible = false;
COMMIT;
......@@ -153,3 +153,15 @@ select count(*) AS invisi_and_visi_tups from sto_alt_uao2_constraint;
(1 row)
set gp_select_invisible = false;
-- Some negative testing.
alter table sto_alt_uao2_constraint ADD COLUMN added_col10 character varying(35)
default NULL constraint added_col10 NOT NULL;
ERROR: column "added_col10" contains null values (seg0 127.0.0.1:25432 pid=30602)
alter table sto_alt_uao2_constraint ADD COLUMN added_col12 character varying(35)
-- Mask out "by some row" printed by row-oriented AO tables
-- start_matchsubs
-- m/^ERROR: check constraint.*is violated/
-- s/^ERROR: check constraint.*is violated.*/ERROR: check constraint is violated/
-- end_matchsubs
default 'abc' CHECK (added_col12 is NULL);
ERROR: check constraint is violated
--
-- @created 2014-05-20 12:00:00
-- @modified 2014-05-20 12:00:00
-- @tags storage
-- @description AOCO table : drop all column one by one then add new col
DROP TABLE IF EXISTS foo;
DROP TABLE
CREATE TABLE foo (a INT, b INT, c CHAR(128)) WITH (appendonly=true, orientation=column);
psql:/path/sql_file:1: NOTICE: Table doesn't have 'DISTRIBUTED BY' clause -- Using column named 'a' as the Greenplum Database data distribution key for this table.
create schema alter_drop_allcol_@orientation@;
set search_path="$user",alter_drop_allcol_@orientation@,public;
SET gp_default_storage_options='orientation=@orientation@';
--
-- Drop all columns one by one then add new column.
-- Perform VACUUM and SELECT again.
--
BEGIN;
CREATE TABLE alter_drop_allcoll (a INT, b INT, c CHAR(128)) WITH (appendonly=true);
NOTICE: Table doesn't have 'DISTRIBUTED BY' clause -- Using column named 'a' as the Greenplum Database data distribution key for this table.
HINT: The 'DISTRIBUTED BY' clause determines the distribution of data. Make sure column(s) chosen are the optimal data distribution key to minimize skew.
CREATE TABLE
CREATE INDEX foo_index ON foo(b);
CREATE INDEX
INSERT INTO foo SELECT i as a, i as b, 'hello world' as c FROM generate_series(1,5) AS i;
INSERT 0 5
select * from foo order by a,b;
CREATE INDEX alter_drop_allcoll_index ON alter_drop_allcoll(b);
INSERT INTO alter_drop_allcoll SELECT i as a, i as b, 'hello world' as c FROM generate_series(1,5) AS i;
select * from alter_drop_allcoll order by a,b;
a | b | c
---+---+----------------------------------------------------------------------------------------------------------------------------------
1 | 1 | hello world
......@@ -23,15 +21,14 @@ select * from foo order by a,b;
5 | 5 | hello world
(5 rows)
ALTER TABLE foo DROP COLUMN c;
ALTER TABLE
select count(*) as c from pg_attribute pa, pg_class pc where pa.attrelid = pc.oid and pc.relname='foo' and attname='c';
ALTER TABLE alter_drop_allcoll DROP COLUMN c;
select count(*) as c from pg_attribute pa, pg_class pc where pa.attrelid = pc.oid and pc.relname='alter_drop_allcoll' and attname='c';
c
---
0
(1 row)
select * from foo order by a,b;
select * from alter_drop_allcoll order by a,b;
a | b
---+---
1 | 1
......@@ -41,15 +38,14 @@ select * from foo order by a,b;
5 | 5
(5 rows)
ALTER TABLE foo DROP COLUMN b;
ALTER TABLE
select count(*) as b from pg_attribute pa, pg_class pc where pa.attrelid = pc.oid and pc.relname='foo' and attname='b';
ALTER TABLE alter_drop_allcoll DROP COLUMN b;
select count(*) as b from pg_attribute pa, pg_class pc where pa.attrelid = pc.oid and pc.relname='alter_drop_allcoll' and attname='b';
b
---
0
(1 row)
select * from foo order by a;
select * from alter_drop_allcoll order by a;
a
---
1
......@@ -59,28 +55,26 @@ select * from foo order by a;
5
(5 rows)
ALTER TABLE foo DROP COLUMN a;
psql:/path/sql_file:1: NOTICE: Dropping a column that is part of the distribution policy forces a NULL distribution policy
ALTER TABLE
select count(*) as a from pg_attribute pa, pg_class pc where pa.attrelid = pc.oid and pc.relname='foo' and attname='a';
ALTER TABLE alter_drop_allcoll DROP COLUMN a;
NOTICE: Dropping a column that is part of the distribution policy forces a NULL distribution policy
select count(*) as a from pg_attribute pa, pg_class pc where pa.attrelid = pc.oid and pc.relname='alter_drop_allcoll' and attname='a';
a
---
0
(1 row)
select * from foo;
select * from alter_drop_allcoll;
--
(5 rows)
ALTER TABLE foo ADD COLUMN a1 int default 10;
ALTER TABLE
select count(*) as a from pg_attribute pa, pg_class pc where pa.attrelid = pc.oid and pc.relname='foo' and attname='a';
ALTER TABLE alter_drop_allcoll ADD COLUMN a1 int default 10;
select count(*) as a from pg_attribute pa, pg_class pc where pa.attrelid = pc.oid and pc.relname='alter_drop_allcoll' and attname='a';
a
---
0
(1 row)
select * from foo;
select * from alter_drop_allcoll;
a1
----
10
......@@ -90,9 +84,9 @@ select * from foo;
10
(5 rows)
vacuum foo;
VACUUM
select * from foo;
COMMIT;
vacuum alter_drop_allcoll;
select * from alter_drop_allcoll;
a1
----
10
......
create schema alter_rollback_@orientation@;
set search_path="$user",alter_rollback_@orientation@,public;
SET gp_default_storage_options='orientation=@orientation@';
--
-- @created 2014-04-14 12:00:00
-- @modified 2014-04-14 12:00:00
-- @tags storage
-- @description AOCO table: Alter add column in a transaction and then rollback the transaction
Drop table if exists myao_rollback;
DROP TABLE
create table myao_rollback(i int , j int) with (appendonly=true, orientation=column);
psql:/path/sql_file:1: NOTICE: Table doesn't have 'DISTRIBUTED BY' clause -- Using column named 'i' as the Greenplum Database data distribution key for this table.
-- Add column in a transaction and then rollback the transaction
--
begin;
create table myao_rollback(i int , j int) with (appendonly=true);
NOTICE: Table doesn't have 'DISTRIBUTED BY' clause -- Using column named 'i' as the Greenplum Database data distribution key for this table.
HINT: The 'DISTRIBUTED BY' clause determines the distribution of data. Make sure column(s) chosen are the optimal data distribution key to minimize skew.
CREATE TABLE
insert into myao_rollback select i, i+10 from generate_series(1,2000) i ;
INSERT 0 2000
insert into myao_rollback select i, i+10 from generate_series(1,2000) i ;
INSERT 0 2000
insert into myao_rollback select i, i+10 from generate_series(1,2000) i ;
INSERT 0 2000
insert into myao_rollback select i, i+10 from generate_series(1,2000) i ;
INSERT 0 2000
select count(*) from myao_rollback;
count
-------
8000
(1 row)
\d myao_rollback
Append-Only Columnar Table "public.myao_rollback"
Column | Type | Modifiers
--------+---------+-----------
i | integer |
j | integer |
Checksum: f
Distributed by: (i)
commit;
begin transaction;
BEGIN
alter table myao_rollback add column k int default 0;
ALTER TABLE
insert into myao_rollback select i , i + 10, i - 10 from generate_series(1,10) i;
INSERT 0 10
select count(*) from myao_rollback;
count
-------
8010
(1 row)
\d myao_rollback
Append-Only Columnar Table "public.myao_rollback"
Column | Type | Modifiers
--------+---------+-----------
i | integer |
j | integer |
k | integer | default 0
Checksum: f
Distributed by: (i)
rollback;
ROLLBACK
select count(*) from myao_rollback;
count
-------
8000
(1 row)
\d myao_rollback
Append-Only Columnar Table "public.myao_rollback"
Column | Type | Modifiers
--------+---------+-----------
i | integer |
j | integer |
Checksum: f
Distributed by: (i)
create schema uao_allalter_@orientation@;
set search_path="$user",uao_allalter_@orientation@,public;
SET gp_default_storage_options='orientation=@orientation@';
--
-- alter add all types of columns
--
BEGIN;
set time zone PST8PDT;
CREATE TABLE uao_allalter (
id SERIAL) WITH (appendonly=true) distributed randomly ;
NOTICE: CREATE TABLE will create implicit sequence "uao_allalter_id_seq" for serial column "uao_allalter.id"
-- Alter all kinds of columns
Alter table uao_allalter ADD COLUMN a1 int default 10;
Alter table uao_allalter ADD COLUMN a2 char(5) default 'asdf';
Alter table uao_allalter ADD COLUMN a3 numeric default 3.14;
Alter table uao_allalter ADD COLUMN a4 boolean DEFAULT false ;
Alter table uao_allalter ADD COLUMN a5 char DEFAULT 'd';
Alter table uao_allalter ADD COLUMN a6 text default 'some default value';
Alter table uao_allalter ADD COLUMN a7 timestamp default '2003-10-21 02:26:11';
Alter table uao_allalter ADD COLUMN a8 character varying(705) default 'asdsdsfdsnfdsnafkndasfdsajfldsjafdsbfjdsbfkdsjf';
Alter table uao_allalter ADD COLUMN a9 bigint default 2342;
Alter table uao_allalter ADD COLUMN a10 date default '1989-11-12';
Alter table uao_allalter ADD COLUMN a11 varchar(600) default 'ksdhfkdshfdshfkjhdskjfhdshflkdshfhdsfkjhds';
Alter table uao_allalter ADD COLUMN a12 text default 'mnsbfsndlsjdflsjasdjhhsafhshfsljlsahfkshalsdkfks';
Alter table uao_allalter ADD COLUMN a13 decimal default 4.123;
Alter table uao_allalter ADD COLUMN a14 real default 23232;
Alter table uao_allalter ADD COLUMN a15 bigint default 2342;
Alter table uao_allalter ADD COLUMN a16 int4 default 2342;
Alter table uao_allalter ADD COLUMN a17 bytea default '0011';
Alter table uao_allalter ADD COLUMN a18 timestamp with time zone default '1995-07-16 01:51:15+1359';
Alter table uao_allalter ADD COLUMN a19 timetz default '1991-12-13 01:51:15';
Alter table uao_allalter ADD COLUMN a20 path default '((6,7),(4,5),(2,1))';
Alter table uao_allalter ADD COLUMN a21 box default '((1,3)(4,6))';
Alter table uao_allalter ADD COLUMN a22 macaddr default '09:00:3b:01:02:03';
Alter table uao_allalter ADD COLUMN a23 interval default '5-7';
Alter table uao_allalter ADD COLUMN a24 character varying(800) default 'jdgfkasdksahkjcskgcksgckdsfkdslfhksagfksajhdjag';
Alter table uao_allalter ADD COLUMN a25 lseg default '((1,2)(2,3))';
Alter table uao_allalter ADD COLUMN a26 point default '(3,4)';
Alter table uao_allalter ADD COLUMN a27 double precision default 12.211;
Alter table uao_allalter ADD COLUMN a28 circle default '((2,3),4)';
Alter table uao_allalter ADD COLUMN a29 int4 default 37;
Alter table uao_allalter ADD COLUMN a30 numeric(8) default 3774;
Alter table uao_allalter ADD COLUMN a31 polygon default '(1,5,4,3)';
Alter table uao_allalter ADD COLUMN a32 date default '1988-02-21';
Alter table uao_allalter ADD COLUMN a33 real default 41114;
Alter table uao_allalter ADD COLUMN a34 money default '$7,222.00';
Alter table uao_allalter ADD COLUMN a35 cidr default '192.167.2';
Alter table uao_allalter ADD COLUMN a36 inet default '126.2.3.4';
Alter table uao_allalter ADD COLUMN a37 time default '10:31:45';
Alter table uao_allalter ADD COLUMN a38 text default 'sdhjfsfksfkjskjfksjfkjsdfkjdshkjfhdsjkfkjsd';
Alter table uao_allalter ADD COLUMN a39 bit default '0';
Alter table uao_allalter ADD COLUMN a40 bit varying(5) default '1';
Alter table uao_allalter ADD COLUMN a41 smallint default 12;
Alter table uao_allalter ADD COLUMN a42 int default 2323;
--
-- Insert data to the table
--
INSERT INTO uao_allalter(a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13,a14,a15,a16,a17,a18,a19,a20,a21,a22,a23,a24,a25,a26,a27,a28,a29,a30,a31,a32,a33,a34,a35,a36,a37,a38,a39,a40,a41,a42) values(generate_series(1,20),'M',2011,'t','a','This is news of today: Deadlock between Republicans and Democrats over how best to reduce the U.S. deficit, and over what period, has blocked an agreement to allow the raising of the $14.3 trillion debt ceiling','2001-12-24 02:26:11','U.S. House of Representatives Speaker John Boehner, the top Republican in Congress who has put forward a deficit reduction plan to be voted on later on Thursday said he had no control over whether his bill would avert a credit downgrade.',generate_series(2490,2505),'2011-10-11','The Republican-controlled House is tentatively scheduled to vote on Boehner proposal this afternoon at around 6 p.m. EDT (2200 GMT). The main Republican vote counter in the House, Kevin McCarthy, would not say if there were enough votes to pass the bill.','WASHINGTON:House Speaker John Boehner says his plan mixing spending cuts in exchange for raising the nations $14.3 trillion debt limit is not perfect but is as large a step that a divided government can take that is doable and signable by President Barack Obama.The Ohio Republican says the measure is an honest and sincere attempt at compromise and was negotiated with Democrats last weekend and that passing it would end the ongoing debt crisis. The plan blends $900 billion-plus in spending cuts with a companion increase in the nations borrowing cap.','1234.56',323453,generate_series(3452,3462),7845,'0011','2005-07-16 01:51:15+1359','2001-12-13 01:51:15','((1,2),(0,3),(2,1))','((2,3)(4,5))','08:00:2b:01:02:03','1-2','Republicans had been working throughout the day Thursday to lock down support for their plan to raise the nations debt ceiling, even as Senate Democrats vowed to swiftly kill it if passed.','((2,3)(4,5))','(6,7)',11.222,'((4,5),7)',32,3214,'(1,0,2,3)','2010-02-21',43564,'$1,000.00','192.168.1','126.1.3.4','12:30:45','Johnson & Johnsons McNeil Consumer Healthcare announced the voluntary dosage reduction today. Labels will carry new dosing instructions this fall.The company says it will cut the maximum dosage of Regular Strength Tylenol and other acetaminophen-containing products in 2012.Acetaminophen is safe when used as directed, says Edwin Kuffner, MD, McNeil vice president of over-the-counter medical affairs. But, when too much is taken, it can cause liver damage.The action is intended to cut the risk of such accidental overdoses, the company says in a news release.','1','0',12,23);
--
--Alter table set distributed by
ALTER table uao_allalter set with ( reorganize='true') distributed by (a1);
-- Create Uncompressed table of same schema definition
CREATE TABLE uao_allalter_uncompr (id SERIAL,a1 int,a2 char(5),a3 numeric,a4 boolean DEFAULT false ,a5 char DEFAULT 'd',a6 text,a7 timestamp,a8 character varying(705),a9 bigint,a10 date,a11 varchar(600),a12 text,a13 decimal,a14 real,a15 bigint,a16 int4 ,a17 bytea,a18 timestamp with time zone,a19 timetz,a20 path,a21 box,a22 macaddr,a23 interval,a24 character varying(800),a25 lseg,a26 point,a27 double precision,a28 circle,a29 int4,a30 numeric(8),a31 polygon,a32 date,a33 real,a34 money,a35 cidr,a36 inet,a37 time,a38 text,a39 bit,a40 bit varying(5),a41 smallint,a42 int) WITH (appendonly=true) distributed randomly;
NOTICE: CREATE TABLE will create implicit sequence "uao_allalter_uncompr_id_seq" for serial column "uao_allalter_uncompr.id"
--
-- Insert to uncompressed table
--
INSERT INTO uao_allalter_uncompr(a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13,a14,a15,a16,a17,a18,a19,a20,a21,a22,a23,a24,a25,a26,a27,a28,a29,a30,a31,a32,a33,a34,a35,a36,a37,a38,a39,a40,a41,a42) values(generate_series(1,20),'M',2011,'t','a','This is news of today: Deadlock between Republicans and Democrats over how best to reduce the U.S. deficit, and over what period, has blocked an agreement to allow the raising of the $14.3 trillion debt ceiling','2001-12-24 02:26:11','U.S. House of Representatives Speaker John Boehner, the top Republican in Congress who has put forward a deficit reduction plan to be voted on later on Thursday said he had no control over whether his bill would avert a credit downgrade.',generate_series(2490,2505),'2011-10-11','The Republican-controlled House is tentatively scheduled to vote on Boehner proposal this afternoon at around 6 p.m. EDT (2200 GMT). The main Republican vote counter in the House, Kevin McCarthy, would not say if there were enough votes to pass the bill.','WASHINGTON:House Speaker John Boehner says his plan mixing spending cuts in exchange for raising the nations $14.3 trillion debt limit is not perfect but is as large a step that a divided government can take that is doable and signable by President Barack Obama.The Ohio Republican says the measure is an honest and sincere attempt at compromise and was negotiated with Democrats last weekend and that passing it would end the ongoing debt crisis. The plan blends $900 billion-plus in spending cuts with a companion increase in the nations borrowing cap.','1234.56',323453,generate_series(3452,3462),7845,'0011','2005-07-16 01:51:15+1359','2001-12-13 01:51:15','((1,2),(0,3),(2,1))','((2,3)(4,5))','08:00:2b:01:02:03','1-2','Republicans had been working throughout the day Thursday to lock down support for their plan to raise the nations debt ceiling, even as Senate Democrats vowed to swiftly kill it if passed.','((2,3)(4,5))','(6,7)',11.222,'((4,5),7)',32,3214,'(1,0,2,3)','2010-02-21',43564,'$1,000.00','192.168.1','126.1.3.4','12:30:45','Johnson & Johnsons McNeil Consumer Healthcare announced the voluntary dosage reduction today. Labels will carry new dosing instructions this fall.The company says it will cut the maximum dosage of Regular Strength Tylenol and other acetaminophen-containing products in 2012.Acetaminophen is safe when used as directed, says Edwin Kuffner, MD, McNeil vice president of over-the-counter medical affairs. But, when too much is taken, it can cause liver damage.The action is intended to cut the risk of such accidental overdoses, the company says in a news release.','1','0',12,23);
--
-- Select number of rows from the uncompressed table
--
SELECT count(*) as count_uncompressed from uao_allalter_uncompr ;
count_uncompressed
--------------------
880
(1 row)
--
-- Select number of rows from the compressed table
--
SELECT count(*) as count_compressed from uao_allalter;
count_compressed
------------------
880
(1 row)
--
-- Select number of rows using a FULL outer join on all the columns of the two tables
-- Count should match with above result if the all the rows uncompressed correctly:
--
Select count(*) as count_join from uao_allalter t1 full outer join uao_allalter_uncompr t2 on t1.id=t2.id and t1.a1=t2.a1 and t1.a2=t2.a2 and t1.a3=t2.a3 and t1.a4=t2.a4 and t1.a5=t2.a5 and t1.a6=t2.a6 and t1.a7=t2.a7 and t1.a8=t2.a8 and t1.a9=t2.a9 and t1.a10=t2.a10 and t1.a11=t2.a11 and t1.a12=t2.a12 and t1.a13=t2.a13 and t1.a14=t2.a14 and t1.a15=t2.a15 and t1.a16=t2.a16 and t1.a17=t2.a17 and t1.a18=t2.a18 and t1.a19=t2.a19 and t1.a22=t2.a22 and t1.a23=t2.a23 and t1.a24=t2.a24 and t1.a27=t2.a27 and t1.a29=t2.a29 and t1.a30=t2.a30 and t1.a32=t2.a32 and t1.a33=t2.a33 and t1.a34=t2.a34 and t1.a35=t2.a35 and t1.a36=t2.a36 and t1.a37=t2.a37 and t1.a38=t2.a38 and t1.a39=t2.a39 and t1.a40=t2.a40 and t1.a41=t2.a41 and t1.a42=t2.a42 ;
count_join
------------
880
(1 row)
--
-- Truncate the table
--
TRUNCATE table uao_allalter;
--
-- Insert data again
--
insert into uao_allalter select * from uao_allalter_uncompr order by a1;
--
-- Select the data: Using the JOIN as mentioned above
--
Select count(*) as count_join from uao_allalter t1 full outer join uao_allalter_uncompr t2 on t1.id=t2.id and t1.a1=t2.a1 and t1.a2=t2.a2 and t1.a3=t2.a3 and t1.a4=t2.a4 and t1.a5=t2.a5 and t1.a6=t2.a6 and t1.a7=t2.a7 and t1.a8=t2.a8 and t1.a9=t2.a9 and t1.a10=t2.a10 and t1.a11=t2.a11 and t1.a12=t2.a12 and t1.a13=t2.a13 and t1.a14=t2.a14 and t1.a15=t2.a15 and t1.a16=t2.a16 and t1.a17=t2.a17 and t1.a18=t2.a18 and t1.a19=t2.a19 and t1.a22=t2.a22 and t1.a23=t2.a23 and t1.a24=t2.a24 and t1.a27=t2.a27 and t1.a29=t2.a29 and t1.a30=t2.a30 and t1.a32=t2.a32 and t1.a33=t2.a33 and t1.a34=t2.a34 and t1.a35=t2.a35 and t1.a36=t2.a36 and t1.a37=t2.a37 and t1.a38=t2.a38 and t1.a39=t2.a39 and t1.a40=t2.a40 and t1.a41=t2.a41 and t1.a42=t2.a42 ;
count_join
------------
880
(1 row)
--Alter table alter type of a column
Alter table uao_allalter Alter column a3 TYPE int4;
--Insert data to the table, select count(*)
Insert into uao_allalter(a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13,a14,a15,a16,a17,a18,a19,a20,a21,a22,a23,a24,a25,a26,a27,a28,a29,a30,a31,a32,a33,a34,a35,a36,a37,a38,a39,a40,a41,a42) select a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13,a14,a15,a16,a17,a18,a19,a20,a21,a22,a23,a24,a25,a26,a27,a28,a29,a30,a31,a32,a33,a34,a35,a36,a37,a38,a39,a40,a41,a42 from uao_allalter where id =10;
Select count(*) from uao_allalter;
count
-------
881
(1 row)
--Alter table drop a column
Alter table uao_allalter Drop column a12;
Insert into uao_allalter(a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a13,a14,a15,a16,a17,a18,a19,a20,a21,a22,a23,a24,a25,a26,a27,a28,a29,a30,a31,a32,a33,a34,a35,a36,a37,a38,a39,a40,a41,a42) select a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a13,a14,a15,a16,a17,a18,a19,a20,a21,a22,a23,a24,a25,a26,a27,a28,a29,a30,a31,a32,a33,a34,a35,a36,a37,a38,a39,a40,a41,a42 from uao_allalter where id =10;
Select count(*) from uao_allalter;
count
-------
882
(1 row)
--Alter table rename a column
Alter table uao_allalter Rename column a13 TO after_rename_a13;
--Insert data to the table, select count(*)
Insert into uao_allalter(a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,after_rename_a13,a14,a15,a16,a17,a18,a19,a20,a21,a22,a23,a24,a25,a26,a27,a28,a29,a30,a31,a32,a33,a34,a35,a36,a37,a38,a39,a40,a41,a42) select a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,after_rename_a13,a14,a15,a16,a17,a18,a19,a20,a21,a22,a23,a24,a25,a26,a27,a28,a29,a30,a31,a32,a33,a34,a35,a36,a37,a38,a39,a40,a41,a42 from uao_allalter where id =10;
Select count(*) from uao_allalter;
count
-------
883
(1 row)
update uao_allalter set a9 = a9 + 10 where a1 = 10;
COMMIT;
......@@ -2302,3 +2302,27 @@ COPY rle_co_block_boundary (distcol, col1) FROM stdin NULL AS 'NULL';
1 510226581578439
1 510226576578439
\.
--
-- Bulk dense content header with RLE compression
begin;
create table bulk_rle_tab (a int) with (appendonly=true, orientation=column, compresstype='rle_type', compresslevel=3, checksum=true);
insert into bulk_rle_tab select i/50 from generate_series(1, 1000000)i;
insert into bulk_rle_tab values (1),(1),(1),(1),(1),(1),(2),(2),(2),(2),(2),(2),(2),(33),(3),(3),(3),(1),(8),(19),
(20),(31),(32),(33),(34),(5),(5),(5),(5),(5),(6),(6),(6),(6),(6),(6),(7),(7),(7),(7),(7),(7),(7),(7),
(null),(7),(7),(7),(null),(8),(8),(8),(8),(8),(8),(4),(4),(null),(4),(17),(17),(17),(null),(null),(null);
alter table bulk_rle_tab add column b varchar default 'abc' encoding(blocksize=8192);
insert into bulk_rle_tab values (-1, 'xyz');
update bulk_rle_tab set b = 'green' where a = -1;
commit;
--
-- Small content header with RLE header inside
begin;
create table sml_rle_hdr (a int) with (appendonly=true, orientation=column, compresstype='rle_type');
insert into sml_rle_hdr values (1),(1),(1),(1),(1),(1),(2),(2),(2),(2),(2),(2),(2),(33),(3),(3),(3),(1),(8),(19),
(20),(31),(32),(33),(34),(5),(5),(5),(5),(5),(6),(6),(6),(6),(6),(6),(7),(7),(7),(7),(7),(7),(7),(7),
(null),(7),(7),(7),(null),(8),(8),(8),(8),(8),(8),(4),(4),(null),(4),(17),(17),(17),(null),(null),(null);
alter table sml_rle_hdr add column b float default random();
-- update / insert / select after this operation
insert into sml_rle_hdr values (-1,-1.1);
update sml_rle_hdr set b = b + 10 where a = -1;
commit;
This directory only contains generated files created by running the
./pg_regress --ao-dir=uao_ddl/...
command.
All files in this directory are ignored by .gitignore.
--
-- @created 2014-04-14 12:00:00
-- @modified 2014-04-14 12:00:00
-- @tags storage
-- @description AOCO table: Alter data type So that a segfile move happens
Drop table if exists change_col_type;
DROP TABLE
CREATE table change_col_type(i int, j int) with (appendonly=true,orientation=column);
psql:/path/sql_file:1: NOTICE: Table doesn't have 'DISTRIBUTED BY' clause -- Using column named 'i' as the Greenplum Database data distribution key for this table.
HINT: The 'DISTRIBUTED BY' clause determines the distribution of data. Make sure column(s) chosen are the optimal data distribution key to minimize skew.
CREATE TABLE
\d change_col_type;
Append-Only Columnar Table "public.change_col_type"
Column | Type | Modifiers
--------+---------+-----------
i | integer |
j | integer |
Checksum: f
Distributed by: (i)
INSERT into change_col_type select i, i+10 from generate_series(1,1000) i;
INSERT 0 1000
ALTER table change_col_type alter column j type numeric;
ALTER TABLE
INSERT into change_col_type select i, i+10 from generate_series(1,1000) i;
INSERT 0 1000
\d change_col_type;
Append-Only Columnar Table "public.change_col_type"
Column | Type | Modifiers
--------+---------+-----------
i | integer |
j | numeric |
Checksum: f
Distributed by: (i)
--
-- @created 2014-05-19 12:00:00
-- @modified 2014-05-19 12:00:00
-- @tags storage
-- @description AOCO multi_encoding table : drop column with default value non NULL
DROP table if exists aoco_multi_encoding;
DROP TABLE
CREATE TABLE aoco_multi_encoding (
col1 int ENCODING (compresstype=ZLIB,compresslevel=8,blocksize=8192),
col2 char(5) ENCODING (compresstype=ZLIB,compresslevel=8,blocksize=8192),
col3 text ENCODING (compresstype=ZLIB,compresslevel=8,blocksize=8192),
col4 timestamp ENCODING (compresstype=ZLIB,compresslevel=8,blocksize=8192),
col5 date ENCODING (compresstype=ZLIB,compresslevel=8,blocksize=8192)
)with (appendonly=true,orientation=column);
psql:/path/sql_file:1: NOTICE: Table doesn't have 'DISTRIBUTED BY' clause -- Using column named 'col1' as the Greenplum Database data distribution key for this table.
HINT: The 'DISTRIBUTED BY' clause determines the distribution of data. Make sure column(s) chosen are the optimal data distribution key to minimize skew.
CREATE TABLE
alter table aoco_multi_encoding ADD COLUMN added_col6 bytea default ("decode"(repeat('1234567890',10000),'greenplum'));
ALTER TABLE
select count(*) as added_col6 from pg_attribute pa, pg_class pc where pa.attrelid = pc.oid and pc.relname='aoco_multi_encoding' and attname='added_col6';
added_col6
------------
1
(1 row)
alter table aoco_multi_encoding DROP COLUMN added_col6;
ALTER TABLE
select count(*) as added_col6 from pg_attribute pa, pg_class pc where pa.attrelid = pc.oid and pc.relname='aoco_multi_encoding' and attname='added_col6';
added_col6
------------
0
(1 row)
VACUUM aoco_multi_encoding;
VACUUM
--
-- @created 2014-04-14 12:00:00
-- @modified 2014-04-14 12:00:00
-- @tags storage
-- @description AOCO table: Alter add column and then add partition
--start_ignore
Drop table if exists alter_part_tab1;
DROP TABLE
--end_ignore
Create table alter_part_tab1 (id SERIAL,a1 int ,a2 char(5) ,a3 text )
WITH (appendonly=true, orientation=column, compresstype=zlib) partition by list(a2) subpartition by range(a1)
subpartition template (default subpartition subothers,subpartition sp1 start(1) end(9) with(appendonly=true,orientation=column,compresstype=rle_type), subpartition sp2 start(11) end(20) with(appendonly=true,orientation=column,compresstype=QUICKLZ))
(partition p1 values('val1') , partition p2 values('val2'));
psql:/path/sql_file:1: NOTICE: CREATE TABLE will create implicit sequence "alter_part_tab1_id_seq" for serial column "alter_part_tab1.id"
psql:/path/sql_file:1: NOTICE: Table doesn't have 'DISTRIBUTED BY' clause -- Using column named 'id' as the Greenplum Database data distribution key for this table.
HINT: The 'DISTRIBUTED BY' clause determines the distribution of data. Make sure column(s) chosen are the optimal data distribution key to minimize skew.
psql:/path/sql_file:1: NOTICE: CREATE TABLE will create partition "alter_part_tab1_1_prt_p1" for table "alter_part_tab1"
psql:/path/sql_file:1: NOTICE: CREATE TABLE will create partition "alter_part_tab1_1_prt_p2" for table "alter_part_tab1"
psql:/path/sql_file:1: NOTICE: CREATE TABLE will create partition "alter_part_tab1_1_prt_p1_2_prt_subothers" for table "alter_part_tab1_1_prt_p1"
psql:/path/sql_file:1: NOTICE: CREATE TABLE will create partition "alter_part_tab1_1_prt_p1_2_prt_sp1" for table "alter_part_tab1_1_prt_p1"
psql:/path/sql_file:1: NOTICE: CREATE TABLE will create partition "alter_part_tab1_1_prt_p1_2_prt_sp2" for table "alter_part_tab1_1_prt_p1"
psql:/path/sql_file:1: NOTICE: CREATE TABLE will create partition "alter_part_tab1_1_prt_p2_2_prt_subothers" for table "alter_part_tab1_1_prt_p2"
psql:/path/sql_file:1: NOTICE: CREATE TABLE will create partition "alter_part_tab1_1_prt_p2_2_prt_sp1" for table "alter_part_tab1_1_prt_p2"
psql:/path/sql_file:1: NOTICE: CREATE TABLE will create partition "alter_part_tab1_1_prt_p2_2_prt_sp2" for table "alter_part_tab1_1_prt_p2"
CREATE TABLE
--(default partition others, partition p1 values('val1') , partition p2 values('val2'));
SELECT 1 AS VisimapPresent FROM pg_appendonly WHERE visimapidxid is not NULL AND visimapidxid is not NULL AND relid=(SELECT oid FROM pg_class WHERE relname='alter_part_tab1');
visimappresent
----------------
1
(1 row)
Create index alter_part_tab1_idx1 on alter_part_tab1(a1);
psql:/path/sql_file:1: NOTICE: building index for child partition "alter_part_tab1_1_prt_p1"
psql:/path/sql_file:1: NOTICE: building index for child partition "alter_part_tab1_1_prt_p2"
psql:/path/sql_file:1: NOTICE: building index for child partition "alter_part_tab1_1_prt_p1_2_prt_sp2"
psql:/path/sql_file:1: NOTICE: building index for child partition "alter_part_tab1_1_prt_p1_2_prt_subothers"
psql:/path/sql_file:1: NOTICE: building index for child partition "alter_part_tab1_1_prt_p1_2_prt_sp1"
psql:/path/sql_file:1: NOTICE: building index for child partition "alter_part_tab1_1_prt_p2_2_prt_sp1"
psql:/path/sql_file:1: NOTICE: building index for child partition "alter_part_tab1_1_prt_p2_2_prt_sp2"
psql:/path/sql_file:1: NOTICE: building index for child partition "alter_part_tab1_1_prt_p2_2_prt_subothers"
CREATE INDEX
Create index alter_part_tab1_idx2 on alter_part_tab1 using bitmap(a3);
psql:/path/sql_file:1: NOTICE: building index for child partition "alter_part_tab1_1_prt_p1"
psql:/path/sql_file:1: NOTICE: building index for child partition "alter_part_tab1_1_prt_p2"
psql:/path/sql_file:1: NOTICE: building index for child partition "alter_part_tab1_1_prt_p1_2_prt_sp2"
psql:/path/sql_file:1: NOTICE: building index for child partition "alter_part_tab1_1_prt_p1_2_prt_subothers"
psql:/path/sql_file:1: NOTICE: building index for child partition "alter_part_tab1_1_prt_p1_2_prt_sp1"
psql:/path/sql_file:1: NOTICE: building index for child partition "alter_part_tab1_1_prt_p2_2_prt_sp1"
psql:/path/sql_file:1: NOTICE: building index for child partition "alter_part_tab1_1_prt_p2_2_prt_sp2"
psql:/path/sql_file:1: NOTICE: building index for child partition "alter_part_tab1_1_prt_p2_2_prt_subothers"
CREATE INDEX
Insert into alter_part_tab1(a1,a2,a3) values(generate_series(1,10),'val1','Johnson & Johnsons McNeil Consumer Healthcare announced the voluntary dosage reduction today. Labels will carry new dosing instructions this fall');
INSERT 0 10
Insert into alter_part_tab1(a1,a2,a3) values(generate_series(11,20),'val2','We are pleased to share the September schedule for onsite legal consultations with Duane Morris, our legal counsel for all Pivotal immigration matters.  Representatives will be onsite for one-on-one consultations regarding your individual case');
INSERT 0 10
\d+ alter_part_tab1_1_prt_others_2_prt_sp1
Did not find any relation named "alter_part_tab1_1_prt_others_2_prt_sp1".
\d+ alter_part_tab1_1_prt_others_2_prt_sp2
Did not find any relation named "alter_part_tab1_1_prt_others_2_prt_sp2".
\d+ alter_part_tab1_1_prt_others_2_prt_subothers
Did not find any relation named "alter_part_tab1_1_prt_others_2_prt_subothers".
select count(*) from alter_part_tab1;
count
-------
20
(1 row)
Update alter_part_tab1 set a3='Parents and other family members are always welcome at Stratford. After the first two weeks ofschool, we encourage you to stop b#%J,mbj756HNM&%.jlyyttlnvisiting, please berespectful of the classroom environment and do not disturb the students or teachers. Prior toeach visit, we require all visits to sign in at the school offbduysfifdsna v worn while visiting.As a safety precaution, the Stratford playgrounds are closed for outside visitation during normal school hours. We thank you for your cooperation.' where id>8 and id <12;
UPDATE 2
alter table alter_part_tab1 add column a4 numeric default 5.5;
ALTER TABLE
update alter_part_tab1 set a4 = a1 % 2;
UPDATE 20
ALTER TABLE alter_part_tab1 ADD partition p31 values(1);
psql:/path/sql_file:1: NOTICE: CREATE TABLE will create partition "alter_part_tab1_1_prt_p31" for table "alter_part_tab1"
psql:/path/sql_file:1: NOTICE: CREATE TABLE will create partition "alter_part_tab1_1_prt_p31_2_prt_subothers" for table "alter_part_tab1_1_prt_p31"
psql:/path/sql_file:1: NOTICE: CREATE TABLE will create partition "alter_part_tab1_1_prt_p31_2_prt_sp1" for table "alter_part_tab1_1_prt_p31"
psql:/path/sql_file:1: NOTICE: CREATE TABLE will create partition "alter_part_tab1_1_prt_p31_2_prt_sp2" for table "alter_part_tab1_1_prt_p31"
ALTER TABLE
--
-- @created 2014-05-19 12:00:00
-- @modified 2014-05-19 12:00:00
-- @tags storage
-- @description AOCO table add column with conflicting default and check - Negative testcase
Drop table if exists aoco_tab_check;
psql:/path/sql_file:1: NOTICE: table "aoco_tab_check" does not exist, skipping
DROP TABLE
create table aoco_tab_check (i int, j char(20)) with (appendonly=true, orientation=column);
psql:/path/sql_file:1: NOTICE: Table doesn't have 'DISTRIBUTED BY' clause -- Using column named 'i' as the Greenplum Database data distribution key for this table.
HINT: The 'DISTRIBUTED BY' clause determines the distribution of data. Make sure column(s) chosen are the optimal data distribution key to minimize skew.
CREATE TABLE
insert into aoco_tab_check select i , 'abc'||i from generate_series(1,2) i;
INSERT 0 2
insert into aoco_tab_check select i , 'xyz'||i from generate_series(101,102) i;
INSERT 0 2
alter table aoco_tab_check ADD COLUMN added_col12 character varying(35) default 'abc' CHECK (added_col12 is NULL);
psql:/path/sql_file:1: ERROR: check constraint "aoco_tab_check_added_col12_check" is violated (seg0 rh55-qa02.sanmateo.greenplum.com:63000 pid=19555)
--
-- @created 2014-05-19 12:00:00
-- @modified 2014-05-19 12:00:00
-- @tags storage
-- @description AOCO table add column with conflicting default and constraint - Negative testcase
Drop table if exists aoco_tab_constraint;
psql:/path/sql_file:1: NOTICE: table "aoco_tab_constraint" does not exist, skipping
DROP TABLE
create table aoco_tab_constraint (i int, j char(20)) with (appendonly=true, orientation=column);
psql:/path/sql_file:1: NOTICE: Table doesn't have 'DISTRIBUTED BY' clause -- Using column named 'i' as the Greenplum Database data distribution key for this table.
HINT: The 'DISTRIBUTED BY' clause determines the distribution of data. Make sure column(s) chosen are the optimal data distribution key to minimize skew.
CREATE TABLE
insert into aoco_tab_constraint select i , 'abc'||i from generate_series(1,2) i;
INSERT 0 2
insert into aoco_tab_constraint select i , 'xyz'||i from generate_series(101,102) i;
INSERT 0 2
alter table aoco_tab_constraint ADD COLUMN added_col10 character varying(35) default NULL constraint added_col10 NOT NULL;
psql:/path/sql_file:1: ERROR: column "added_col10" contains null values (seg0 rh55-qa02.sanmateo.greenplum.com:63000 pid=18071)
-- Bulk dense content header with RLE compression
drop table if exists bulk_rle_tab;
DROP TABLE
create table bulk_rle_tab (a int) with (appendonly=true, orientation=column, compresstype='rle_type', compresslevel=3, checksum=true);
psql:/path/sql_file:1: NOTICE: Table doesn't have 'DISTRIBUTED BY' clause -- Using column named 'a' as the Greenplum Database data distribution key for this table.
HINT: The 'DISTRIBUTED BY' clause determines the distribution of data. Make sure column(s) chosen are the optimal data distribution key to minimize skew.
CREATE TABLE
insert into bulk_rle_tab select i/50 from generate_series(1, 1000000)i;
INSERT 0 1000000
insert into bulk_rle_tab values (1),(1),(1),(1),(1),(1),(2),(2),(2),(2),(2),(2),(2),(33),(3),(3),(3),(1),(8),(19),
(20),(31),(32),(33),(34),(5),(5),(5),(5),(5),(6),(6),(6),(6),(6),(6),(7),(7),(7),(7),(7),(7),(7),(7),
(null),(7),(7),(7),(null),(8),(8),(8),(8),(8),(8),(4),(4),(null),(4),(17),(17),(17),(null),(null),(null);
INSERT 0 65
alter table bulk_rle_tab add column b varchar default 'abc' encoding(blocksize=8192);
ALTER TABLE
insert into bulk_rle_tab values (-1, 'xyz');
INSERT 0 1
update bulk_rle_tab set b = 'green' where a = -1;
UPDATE 1
-- Small content header with RLE header inside
drop table if exists sml_rle_hdr;
DROP TABLE
create table sml_rle_hdr (a int) with (appendonly=true, orientation=column, compresstype='rle_type');
psql:/path/sql_file:1: NOTICE: Table doesn't have 'DISTRIBUTED BY' clause -- Using column named 'a' as the Greenplum Database data distribution key for this table.
HINT: The 'DISTRIBUTED BY' clause determines the distribution of data. Make sure column(s) chosen are the optimal data distribution key to minimize skew.
CREATE TABLE
insert into sml_rle_hdr values (1),(1),(1),(1),(1),(1),(2),(2),(2),(2),(2),(2),(2),(33),(3),(3),(3),(1),(8),(19),
(20),(31),(32),(33),(34),(5),(5),(5),(5),(5),(6),(6),(6),(6),(6),(6),(7),(7),(7),(7),(7),(7),(7),(7),
(null),(7),(7),(7),(null),(8),(8),(8),(8),(8),(8),(4),(4),(null),(4),(17),(17),(17),(null),(null),(null);
INSERT 0 65
alter table sml_rle_hdr add column b float default random();
ALTER TABLE
-- update / insert / select after this operation
insert into sml_rle_hdr values (-1,-1.1);
INSERT 0 1
update sml_rle_hdr set b = b + 10 where a = -1;
UPDATE 1
--
-- @created 2014-04-14 12:00:00
-- @modified 2014-04-14 12:00:00
-- @tags storage
-- @description AOCO table: Alter data type So that a segfile move happens
Drop table if exists change_col_type;
CREATE table change_col_type(i int, j int) with (appendonly=true,orientation=column);
\d change_col_type;
INSERT into change_col_type select i, i+10 from generate_series(1,1000) i;
ALTER table change_col_type alter column j type numeric;
INSERT into change_col_type select i, i+10 from generate_series(1,1000) i;
\d change_col_type;
--
-- @created 2014-05-20 12:00:00
-- @modified 2014-05-20 12:00:00
-- @tags storage
-- @description AOCO table : drop all column one by one then add new col
DROP TABLE IF EXISTS foo;
CREATE TABLE foo (a INT, b INT, c CHAR(128)) WITH (appendonly=true, orientation=column);
CREATE INDEX foo_index ON foo(b);
INSERT INTO foo SELECT i as a, i as b, 'hello world' as c FROM generate_series(1,5) AS i;
select * from foo order by a,b;
ALTER TABLE foo DROP COLUMN c;
select count(*) as c from pg_attribute pa, pg_class pc where pa.attrelid = pc.oid and pc.relname='foo' and attname='c';
select * from foo order by a,b;
ALTER TABLE foo DROP COLUMN b;
select count(*) as b from pg_attribute pa, pg_class pc where pa.attrelid = pc.oid and pc.relname='foo' and attname='b';
select * from foo order by a;
ALTER TABLE foo DROP COLUMN a;
select count(*) as a from pg_attribute pa, pg_class pc where pa.attrelid = pc.oid and pc.relname='foo' and attname='a';
select * from foo;
ALTER TABLE foo ADD COLUMN a1 int default 10;
select count(*) as a from pg_attribute pa, pg_class pc where pa.attrelid = pc.oid and pc.relname='foo' and attname='a';
select * from foo;
vacuum foo;
select * from foo;
--
-- @created 2014-05-19 12:00:00
-- @modified 2014-05-19 12:00:00
-- @tags storage
-- @description AOCO multi_encoding table : drop column with default value non NULL
DROP table if exists aoco_multi_encoding;
CREATE TABLE aoco_multi_encoding (
col1 int ENCODING (compresstype=ZLIB,compresslevel=8,blocksize=8192),
col2 char(5) ENCODING (compresstype=ZLIB,compresslevel=8,blocksize=8192),
col3 text ENCODING (compresstype=ZLIB,compresslevel=8,blocksize=8192),
col4 timestamp ENCODING (compresstype=ZLIB,compresslevel=8,blocksize=8192),
col5 date ENCODING (compresstype=ZLIB,compresslevel=8,blocksize=8192)
)with (appendonly=true,orientation=column);
alter table aoco_multi_encoding ADD COLUMN added_col6 bytea default ("decode"(repeat('1234567890',10000),'greenplum'));
select count(*) as added_col6 from pg_attribute pa, pg_class pc where pa.attrelid = pc.oid and pc.relname='aoco_multi_encoding' and attname='added_col6';
alter table aoco_multi_encoding DROP COLUMN added_col6;
select count(*) as added_col6 from pg_attribute pa, pg_class pc where pa.attrelid = pc.oid and pc.relname='aoco_multi_encoding' and attname='added_col6';
VACUUM aoco_multi_encoding;
--
-- @created 2014-04-14 12:00:00
-- @modified 2014-04-14 12:00:00
-- @tags storage
-- @description AOCO table: Alter add column and then add partition
--start_ignore
Drop table if exists alter_part_tab1;
--end_ignore
Create table alter_part_tab1 (id SERIAL,a1 int ,a2 char(5) ,a3 text )
WITH (appendonly=true, orientation=column, compresstype=zlib) partition by list(a2) subpartition by range(a1)
subpartition template (default subpartition subothers,subpartition sp1 start(1) end(9) with(appendonly=true,orientation=column,compresstype=rle_type), subpartition sp2 start(11) end(20) with(appendonly=true,orientation=column,compresstype=QUICKLZ))
(partition p1 values('val1') , partition p2 values('val2'));
--(default partition others, partition p1 values('val1') , partition p2 values('val2'));
SELECT 1 AS VisimapPresent FROM pg_appendonly WHERE visimapidxid is not NULL AND visimapidxid is not NULL AND relid=(SELECT oid FROM pg_class WHERE relname='alter_part_tab1');
Create index alter_part_tab1_idx1 on alter_part_tab1(a1);
Create index alter_part_tab1_idx2 on alter_part_tab1 using bitmap(a3);
Insert into alter_part_tab1(a1,a2,a3) values(generate_series(1,10),'val1','Johnson & Johnsons McNeil Consumer Healthcare announced the voluntary dosage reduction today. Labels will carry new dosing instructions this fall');
Insert into alter_part_tab1(a1,a2,a3) values(generate_series(11,20),'val2','We are pleased to share the September schedule for onsite legal consultations with Duane Morris, our legal counsel for all Pivotal immigration matters.  Representatives will be onsite for one-on-one consultations regarding your individual case');
\d+ alter_part_tab1_1_prt_others_2_prt_sp1
\d+ alter_part_tab1_1_prt_others_2_prt_sp2
\d+ alter_part_tab1_1_prt_others_2_prt_subothers
select count(*) from alter_part_tab1;
Update alter_part_tab1 set a3='Parents and other family members are always welcome at Stratford. After the first two weeks ofschool, we encourage you to stop b#%J,mbj756HNM&%.jlyyttlnvisiting, please berespectful of the classroom environment and do not disturb the students or teachers. Prior toeach visit, we require all visits to sign in at the school offbduysfifdsna v worn while visiting.As a safety precaution, the Stratford playgrounds are closed for outside visitation during normal school hours. We thank you for your cooperation.' where id>8 and id <12;
alter table alter_part_tab1 add column a4 numeric default 5.5;
update alter_part_tab1 set a4 = a1 % 2;
ALTER TABLE alter_part_tab1 ADD partition p31 values(1);
--
-- @created 2014-05-19 12:00:00
-- @modified 2014-05-19 12:00:00
-- @tags storage
-- @description AOCO table add column with conflicting default and check - Negative testcase
Drop table if exists aoco_tab_check;
create table aoco_tab_check (i int, j char(20)) with (appendonly=true, orientation=column);
insert into aoco_tab_check select i , 'abc'||i from generate_series(1,2) i;
insert into aoco_tab_check select i , 'xyz'||i from generate_series(101,102) i;
alter table aoco_tab_check ADD COLUMN added_col12 character varying(35) default 'abc' CHECK (added_col12 is NULL);
--
-- @created 2014-05-19 12:00:00
-- @modified 2014-05-19 12:00:00
-- @tags storage
-- @description AOCO table add column with conflicting default and constraint - Negative testcase
Drop table if exists aoco_tab_constraint;
create table aoco_tab_constraint (i int, j char(20)) with (appendonly=true, orientation=column);
insert into aoco_tab_constraint select i , 'abc'||i from generate_series(1,2) i;
insert into aoco_tab_constraint select i , 'xyz'||i from generate_series(101,102) i;
alter table aoco_tab_constraint ADD COLUMN added_col10 character varying(35) default NULL constraint added_col10 NOT NULL;
--
-- @created 2014-04-14 12:00:00
-- @modified 2014-04-14 12:00:00
-- @tags storage
-- @description AOCO zlib compressed table : alter add all types of columns
set time zone PST8PDT;
DROP TABLE if exists aoco_allalter;
DROP TABLE if exists aoco_allalter_uncompr;
CREATE TABLE aoco_allalter (
id SERIAL, DEFAULT COLUMN ENCODING (compresstype=zlib,blocksize=8192,compresslevel=1)) WITH (appendonly=true, orientation=column) distributed randomly ;
-- Alter all kinds of columns
Alter table aoco_allalter ADD COLUMN a1 int default 10 ENCODING (compresstype=quicklz,compresslevel=1,blocksize=8192);
Alter table aoco_allalter ADD COLUMN a2 char(5) default 'asdf' ENCODING (compresstype=quicklz,compresslevel=1,blocksize=8192);
Alter table aoco_allalter ADD COLUMN a3 numeric default 3.14 ENCODING (compresstype=quicklz,compresslevel=1,blocksize=8192);
Alter table aoco_allalter ADD COLUMN a4 boolean DEFAULT false ENCODING (compresstype=quicklz,compresslevel=1,blocksize=8192);
Alter table aoco_allalter ADD COLUMN a5 char DEFAULT 'd' ENCODING (compresstype=quicklz,compresslevel=1,blocksize=8192);
Alter table aoco_allalter ADD COLUMN a6 text default 'some default value' ENCODING (compresstype=quicklz,compresslevel=1,blocksize=8192);
Alter table aoco_allalter ADD COLUMN a7 timestamp default '2003-10-21 02:26:11' ENCODING (compresstype=quicklz,compresslevel=1,blocksize=8192);
Alter table aoco_allalter ADD COLUMN a8 character varying(705) default 'asdsdsfdsnfdsnafkndasfdsajfldsjafdsbfjdsbfkdsjf' ENCODING (compresstype=quicklz,compresslevel=1,blocksize=8192);
Alter table aoco_allalter ADD COLUMN a9 bigint default 2342 ENCODING (compresstype=quicklz,compresslevel=1,blocksize=8192);
Alter table aoco_allalter ADD COLUMN a10 date default '1989-11-12' ENCODING (compresstype=quicklz,compresslevel=1,blocksize=8192);
Alter table aoco_allalter ADD COLUMN a11 varchar(600) default 'ksdhfkdshfdshfkjhdskjfhdshflkdshfhdsfkjhds' ENCODING (compresstype=quicklz,compresslevel=1,blocksize=8192);
Alter table aoco_allalter ADD COLUMN a12 text default 'mnsbfsndlsjdflsjasdjhhsafhshfsljlsahfkshalsdkfks' ENCODING (compresstype=quicklz,compresslevel=1,blocksize=8192);
Alter table aoco_allalter ADD COLUMN a13 decimal default 4.123 ENCODING (compresstype=quicklz,compresslevel=1,blocksize=8192);
Alter table aoco_allalter ADD COLUMN a14 real default 23232 ENCODING (compresstype=quicklz,compresslevel=1,blocksize=8192);
Alter table aoco_allalter ADD COLUMN a15 bigint default 2342 ENCODING (compresstype=quicklz,compresslevel=1,blocksize=8192);
Alter table aoco_allalter ADD COLUMN a16 int4 default 2342 ENCODING (compresstype=quicklz,compresslevel=1,blocksize=8192);
Alter table aoco_allalter ADD COLUMN a17 bytea default '0011' ENCODING (compresstype=quicklz,compresslevel=1,blocksize=8192);
Alter table aoco_allalter ADD COLUMN a18 timestamp with time zone default '1995-07-16 01:51:15+1359' ENCODING (compresstype=quicklz,compresslevel=1,blocksize=8192);
Alter table aoco_allalter ADD COLUMN a19 timetz default '1991-12-13 01:51:15' ENCODING (compresstype=quicklz,compresslevel=1,blocksize=8192);
Alter table aoco_allalter ADD COLUMN a20 path default '((6,7),(4,5),(2,1))' ENCODING (compresstype=quicklz,compresslevel=1,blocksize=8192);
Alter table aoco_allalter ADD COLUMN a21 box default '((1,3)(4,6))' ENCODING (compresstype=quicklz,compresslevel=1,blocksize=8192);
Alter table aoco_allalter ADD COLUMN a22 macaddr default '09:00:3b:01:02:03' ENCODING (compresstype=quicklz,compresslevel=1,blocksize=8192);
Alter table aoco_allalter ADD COLUMN a23 interval default '5-7' ENCODING (compresstype=quicklz,compresslevel=1,blocksize=8192);
Alter table aoco_allalter ADD COLUMN a24 character varying(800) default 'jdgfkasdksahkjcskgcksgckdsfkdslfhksagfksajhdjag' ENCODING (compresstype=quicklz,compresslevel=1,blocksize=8192);
Alter table aoco_allalter ADD COLUMN a25 lseg default '((1,2)(2,3))' ENCODING (compresstype=quicklz,compresslevel=1,blocksize=8192);
Alter table aoco_allalter ADD COLUMN a26 point default '(3,4)' ENCODING (compresstype=quicklz,compresslevel=1,blocksize=8192);
Alter table aoco_allalter ADD COLUMN a27 double precision default 12.211 ENCODING (compresstype=quicklz,compresslevel=1,blocksize=8192);
Alter table aoco_allalter ADD COLUMN a28 circle default '((2,3),4)' ENCODING (compresstype=quicklz,compresslevel=1,blocksize=8192);
Alter table aoco_allalter ADD COLUMN a29 int4 default 37 ENCODING (compresstype=quicklz,compresslevel=1,blocksize=8192);
Alter table aoco_allalter ADD COLUMN a30 numeric(8) default 3774 ENCODING (compresstype=quicklz,compresslevel=1,blocksize=8192);
Alter table aoco_allalter ADD COLUMN a31 polygon default '(1,5,4,3)' ENCODING (compresstype=quicklz,compresslevel=1,blocksize=8192);
Alter table aoco_allalter ADD COLUMN a32 date default '1988-02-21' ENCODING (compresstype=quicklz,compresslevel=1,blocksize=8192);
Alter table aoco_allalter ADD COLUMN a33 real default 41114 ENCODING (compresstype=quicklz,compresslevel=1,blocksize=8192);
Alter table aoco_allalter ADD COLUMN a34 money default '$7,222.00' ENCODING (compresstype=quicklz,compresslevel=1,blocksize=8192);
Alter table aoco_allalter ADD COLUMN a35 cidr default '192.167.2' ENCODING (compresstype=quicklz,compresslevel=1,blocksize=8192);
Alter table aoco_allalter ADD COLUMN a36 inet default '126.2.3.4' ENCODING (compresstype=quicklz,compresslevel=1,blocksize=8192);
Alter table aoco_allalter ADD COLUMN a37 time default '10:31:45' ENCODING (compresstype=quicklz,compresslevel=1,blocksize=8192);
Alter table aoco_allalter ADD COLUMN a38 text default 'sdhjfsfksfkjskjfksjfkjsdfkjdshkjfhdsjkfkjsd' ENCODING (compresstype=quicklz,compresslevel=1,blocksize=8192);
Alter table aoco_allalter ADD COLUMN a39 bit default '0' ENCODING (compresstype=quicklz,compresslevel=1,blocksize=8192);
Alter table aoco_allalter ADD COLUMN a40 bit varying(5) default '1' ENCODING (compresstype=quicklz,compresslevel=1,blocksize=8192);
Alter table aoco_allalter ADD COLUMN a41 smallint default 12 ENCODING (compresstype=quicklz,compresslevel=1,blocksize=8192);
Alter table aoco_allalter ADD COLUMN a42 int default 2323 ENCODING (compresstype=quicklz,compresslevel=1,blocksize=8192);
--
-- Insert data to the table
--
INSERT INTO aoco_allalter(a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13,a14,a15,a16,a17,a18,a19,a20,a21,a22,a23,a24,a25,a26,a27,a28,a29,a30,a31,a32,a33,a34,a35,a36,a37,a38,a39,a40,a41,a42) values(generate_series(1,20),'M',2011,'t','a','This is news of today: Deadlock between Republicans and Democrats over how best to reduce the U.S. deficit, and over what period, has blocked an agreement to allow the raising of the $14.3 trillion debt ceiling','2001-12-24 02:26:11','U.S. House of Representatives Speaker John Boehner, the top Republican in Congress who has put forward a deficit reduction plan to be voted on later on Thursday said he had no control over whether his bill would avert a credit downgrade.',generate_series(2490,2505),'2011-10-11','The Republican-controlled House is tentatively scheduled to vote on Boehner proposal this afternoon at around 6 p.m. EDT (2200 GMT). The main Republican vote counter in the House, Kevin McCarthy, would not say if there were enough votes to pass the bill.','WASHINGTON:House Speaker John Boehner says his plan mixing spending cuts in exchange for raising the nations $14.3 trillion debt limit is not perfect but is as large a step that a divided government can take that is doable and signable by President Barack Obama.The Ohio Republican says the measure is an honest and sincere attempt at compromise and was negotiated with Democrats last weekend and that passing it would end the ongoing debt crisis. The plan blends $900 billion-plus in spending cuts with a companion increase in the nations borrowing cap.','1234.56',323453,generate_series(3452,3462),7845,'0011','2005-07-16 01:51:15+1359','2001-12-13 01:51:15','((1,2),(0,3),(2,1))','((2,3)(4,5))','08:00:2b:01:02:03','1-2','Republicans had been working throughout the day Thursday to lock down support for their plan to raise the nations debt ceiling, even as Senate Democrats vowed to swiftly kill it if passed.','((2,3)(4,5))','(6,7)',11.222,'((4,5),7)',32,3214,'(1,0,2,3)','2010-02-21',43564,'$1,000.00','192.168.1','126.1.3.4','12:30:45','Johnson & Johnsons McNeil Consumer Healthcare announced the voluntary dosage reduction today. Labels will carry new dosing instructions this fall.The company says it will cut the maximum dosage of Regular Strength Tylenol and other acetaminophen-containing products in 2012.Acetaminophen is safe when used as directed, says Edwin Kuffner, MD, McNeil vice president of over-the-counter medical affairs. But, when too much is taken, it can cause liver damage.The action is intended to cut the risk of such accidental overdoses, the company says in a news release.','1','0',12,23);
--
--Alter table set distributed by
ALTER table aoco_allalter set with ( reorganize='true') distributed by (a1);
-- Create Uncompressed table of same schema definition
CREATE TABLE aoco_allalter_uncompr (id SERIAL,a1 int,a2 char(5),a3 numeric,a4 boolean DEFAULT false ,a5 char DEFAULT 'd',a6 text,a7 timestamp,a8 character varying(705),a9 bigint,a10 date,a11 varchar(600),a12 text,a13 decimal,a14 real,a15 bigint,a16 int4 ,a17 bytea,a18 timestamp with time zone,a19 timetz,a20 path,a21 box,a22 macaddr,a23 interval,a24 character varying(800),a25 lseg,a26 point,a27 double precision,a28 circle,a29 int4,a30 numeric(8),a31 polygon,a32 date,a33 real,a34 money,a35 cidr,a36 inet,a37 time,a38 text,a39 bit,a40 bit varying(5),a41 smallint,a42 int) WITH (appendonly=true, orientation=column) distributed randomly;
--
-- Insert to uncompressed table
--
INSERT INTO aoco_allalter_uncompr(a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13,a14,a15,a16,a17,a18,a19,a20,a21,a22,a23,a24,a25,a26,a27,a28,a29,a30,a31,a32,a33,a34,a35,a36,a37,a38,a39,a40,a41,a42) values(generate_series(1,20),'M',2011,'t','a','This is news of today: Deadlock between Republicans and Democrats over how best to reduce the U.S. deficit, and over what period, has blocked an agreement to allow the raising of the $14.3 trillion debt ceiling','2001-12-24 02:26:11','U.S. House of Representatives Speaker John Boehner, the top Republican in Congress who has put forward a deficit reduction plan to be voted on later on Thursday said he had no control over whether his bill would avert a credit downgrade.',generate_series(2490,2505),'2011-10-11','The Republican-controlled House is tentatively scheduled to vote on Boehner proposal this afternoon at around 6 p.m. EDT (2200 GMT). The main Republican vote counter in the House, Kevin McCarthy, would not say if there were enough votes to pass the bill.','WASHINGTON:House Speaker John Boehner says his plan mixing spending cuts in exchange for raising the nations $14.3 trillion debt limit is not perfect but is as large a step that a divided government can take that is doable and signable by President Barack Obama.The Ohio Republican says the measure is an honest and sincere attempt at compromise and was negotiated with Democrats last weekend and that passing it would end the ongoing debt crisis. The plan blends $900 billion-plus in spending cuts with a companion increase in the nations borrowing cap.','1234.56',323453,generate_series(3452,3462),7845,'0011','2005-07-16 01:51:15+1359','2001-12-13 01:51:15','((1,2),(0,3),(2,1))','((2,3)(4,5))','08:00:2b:01:02:03','1-2','Republicans had been working throughout the day Thursday to lock down support for their plan to raise the nations debt ceiling, even as Senate Democrats vowed to swiftly kill it if passed.','((2,3)(4,5))','(6,7)',11.222,'((4,5),7)',32,3214,'(1,0,2,3)','2010-02-21',43564,'$1,000.00','192.168.1','126.1.3.4','12:30:45','Johnson & Johnsons McNeil Consumer Healthcare announced the voluntary dosage reduction today. Labels will carry new dosing instructions this fall.The company says it will cut the maximum dosage of Regular Strength Tylenol and other acetaminophen-containing products in 2012.Acetaminophen is safe when used as directed, says Edwin Kuffner, MD, McNeil vice president of over-the-counter medical affairs. But, when too much is taken, it can cause liver damage.The action is intended to cut the risk of such accidental overdoses, the company says in a news release.','1','0',12,23);
\d+ aoco_allalter
--Select from pg_attribute_encoding to see the table entry
select attrelid::regclass as relname, attnum, attoptions from pg_class c, pg_attribute_encoding e where c.relname = 'aoco_allalter' and c.oid=e.attrelid order by relname, attnum limit 3;
--
-- Compare data with uncompressed table
--
--
-- Select number of rows from the uncompressed table
--
SELECT count(*) as count_uncompressed from aoco_allalter_uncompr ;
--
-- Select number of rows from the compressed table
--
SELECT count(*) as count_compressed from aoco_allalter;
--
-- Select number of rows using a FULL outer join on all the columns of the two tables
-- Count should match with above result if the all the rows uncompressed correctly:
--
Select count(*) as count_join from aoco_allalter t1 full outer join aoco_allalter_uncompr t2 on t1.id=t2.id and t1.a1=t2.a1 and t1.a2=t2.a2 and t1.a3=t2.a3 and t1.a4=t2.a4 and t1.a5=t2.a5 and t1.a6=t2.a6 and t1.a7=t2.a7 and t1.a8=t2.a8 and t1.a9=t2.a9 and t1.a10=t2.a10 and t1.a11=t2.a11 and t1.a12=t2.a12 and t1.a13=t2.a13 and t1.a14=t2.a14 and t1.a15=t2.a15 and t1.a16=t2.a16 and t1.a17=t2.a17 and t1.a18=t2.a18 and t1.a19=t2.a19 and t1.a22=t2.a22 and t1.a23=t2.a23 and t1.a24=t2.a24 and t1.a27=t2.a27 and t1.a29=t2.a29 and t1.a30=t2.a30 and t1.a32=t2.a32 and t1.a33=t2.a33 and t1.a34=t2.a34 and t1.a35=t2.a35 and t1.a36=t2.a36 and t1.a37=t2.a37 and t1.a38=t2.a38 and t1.a39=t2.a39 and t1.a40=t2.a40 and t1.a41=t2.a41 and t1.a42=t2.a42 ;
--
-- Truncate the table
--
TRUNCATE table aoco_allalter;
--
-- Insert data again
--
insert into aoco_allalter select * from aoco_allalter_uncompr order by a1;
--
-- Select the data: Using the JOIN as mentioned above
--
Select count(*) as count_join from aoco_allalter t1 full outer join aoco_allalter_uncompr t2 on t1.id=t2.id and t1.a1=t2.a1 and t1.a2=t2.a2 and t1.a3=t2.a3 and t1.a4=t2.a4 and t1.a5=t2.a5 and t1.a6=t2.a6 and t1.a7=t2.a7 and t1.a8=t2.a8 and t1.a9=t2.a9 and t1.a10=t2.a10 and t1.a11=t2.a11 and t1.a12=t2.a12 and t1.a13=t2.a13 and t1.a14=t2.a14 and t1.a15=t2.a15 and t1.a16=t2.a16 and t1.a17=t2.a17 and t1.a18=t2.a18 and t1.a19=t2.a19 and t1.a22=t2.a22 and t1.a23=t2.a23 and t1.a24=t2.a24 and t1.a27=t2.a27 and t1.a29=t2.a29 and t1.a30=t2.a30 and t1.a32=t2.a32 and t1.a33=t2.a33 and t1.a34=t2.a34 and t1.a35=t2.a35 and t1.a36=t2.a36 and t1.a37=t2.a37 and t1.a38=t2.a38 and t1.a39=t2.a39 and t1.a40=t2.a40 and t1.a41=t2.a41 and t1.a42=t2.a42 ;
--Alter table alter type of a column
Alter table aoco_allalter Alter column a3 TYPE int4;
--Insert data to the table, select count(*)
Insert into aoco_allalter(a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13,a14,a15,a16,a17,a18,a19,a20,a21,a22,a23,a24,a25,a26,a27,a28,a29,a30,a31,a32,a33,a34,a35,a36,a37,a38,a39,a40,a41,a42) select a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13,a14,a15,a16,a17,a18,a19,a20,a21,a22,a23,a24,a25,a26,a27,a28,a29,a30,a31,a32,a33,a34,a35,a36,a37,a38,a39,a40,a41,a42 from aoco_allalter where id =10;
Select count(*) from aoco_allalter;
--Alter table drop a column
Alter table aoco_allalter Drop column a12;
Insert into aoco_allalter(a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a13,a14,a15,a16,a17,a18,a19,a20,a21,a22,a23,a24,a25,a26,a27,a28,a29,a30,a31,a32,a33,a34,a35,a36,a37,a38,a39,a40,a41,a42) select a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a13,a14,a15,a16,a17,a18,a19,a20,a21,a22,a23,a24,a25,a26,a27,a28,a29,a30,a31,a32,a33,a34,a35,a36,a37,a38,a39,a40,a41,a42 from aoco_allalter where id =10;
Select count(*) from aoco_allalter;
--Alter table rename a column
Alter table aoco_allalter Rename column a13 TO after_rename_a13;
--Insert data to the table, select count(*)
Insert into aoco_allalter(a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,after_rename_a13,a14,a15,a16,a17,a18,a19,a20,a21,a22,a23,a24,a25,a26,a27,a28,a29,a30,a31,a32,a33,a34,a35,a36,a37,a38,a39,a40,a41,a42) select a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,after_rename_a13,a14,a15,a16,a17,a18,a19,a20,a21,a22,a23,a24,a25,a26,a27,a28,a29,a30,a31,a32,a33,a34,a35,a36,a37,a38,a39,a40,a41,a42 from aoco_allalter where id =10;
Select count(*) from aoco_allalter;
update aoco_allalter set a9 = a9 + 10 where a1 = 10;
-- Bulk dense content header with RLE compression
drop table if exists bulk_rle_tab;
create table bulk_rle_tab (a int) with (appendonly=true, orientation=column, compresstype='rle_type', compresslevel=3, checksum=true);
insert into bulk_rle_tab select i/50 from generate_series(1, 1000000)i;
insert into bulk_rle_tab values (1),(1),(1),(1),(1),(1),(2),(2),(2),(2),(2),(2),(2),(33),(3),(3),(3),(1),(8),(19),
(20),(31),(32),(33),(34),(5),(5),(5),(5),(5),(6),(6),(6),(6),(6),(6),(7),(7),(7),(7),(7),(7),(7),(7),
(null),(7),(7),(7),(null),(8),(8),(8),(8),(8),(8),(4),(4),(null),(4),(17),(17),(17),(null),(null),(null);
alter table bulk_rle_tab add column b varchar default 'abc' encoding(blocksize=8192);
insert into bulk_rle_tab values (-1, 'xyz');
update bulk_rle_tab set b = 'green' where a = -1;
-- Small content header with RLE header inside
drop table if exists sml_rle_hdr;
create table sml_rle_hdr (a int) with (appendonly=true, orientation=column, compresstype='rle_type');
insert into sml_rle_hdr values (1),(1),(1),(1),(1),(1),(2),(2),(2),(2),(2),(2),(2),(33),(3),(3),(3),(1),(8),(19),
(20),(31),(32),(33),(34),(5),(5),(5),(5),(5),(6),(6),(6),(6),(6),(6),(7),(7),(7),(7),(7),(7),(7),(7),
(null),(7),(7),(7),(null),(8),(8),(8),(8),(8),(8),(4),(4),(null),(4),(17),(17),(17),(null),(null),(null);
alter table sml_rle_hdr add column b float default random();
-- update / insert / select after this operation
insert into sml_rle_hdr values (-1,-1.1);
update sml_rle_hdr set b = b + 10 where a = -1;
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册