schema_topology.out 463.1 KB
Newer Older
1 2
\echo -- start_ignore
-- start_ignore
3 4
drop database db_test_bed;
ERROR:  database "db_test_bed" does not exist
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182
drop database db_tobe_vacuum;
ERROR:  database "db_tobe_vacuum" does not exist
drop database db_tobe_vacuum_analyze;
ERROR:  database "db_tobe_vacuum_analyze" does not exist
drop database db_test;
ERROR:  database "db_test" does not exist
drop database ao_db;
ERROR:  database "ao_db" does not exist
drop database partition_db;
ERROR:  database "partition_db" does not exist
drop database check_oid_relfilenode_db;
ERROR:  database "check_oid_relfilenode_db" does not exist
drop database vacuum_data_db;
ERROR:  database "vacuum_data_db" does not exist
drop database unvacuum_data_db;
ERROR:  database "unvacuum_data_db" does not exist
drop database "TEST_DB";
ERROR:  database "TEST_DB" does not exist
drop database "TEST_db";
ERROR:  database "TEST_db" does not exist
drop database alter_table_db;
ERROR:  database "alter_table_db" does not exist
drop database cancel_trans;
ERROR:  database "cancel_trans" does not exist
drop database ao_table_drop_col1;
ERROR:  database "ao_table_drop_col1" does not exist
drop database ao_table_drop_col2;
ERROR:  database "ao_table_drop_col2" does not exist
drop database ao_table_drop_col3;
ERROR:  database "ao_table_drop_col3" does not exist
drop database co_db;
ERROR:  database "co_db" does not exist
drop database co_table_drop_col3;
ERROR:  database "co_table_drop_col3" does not exist
DROP USER "MAIN_USER";
ERROR:  role "MAIN_USER" does not exist
DROP USER "sub_user" ;
ERROR:  role "sub_user" does not exist
DROP USER "SUB_user_1";
ERROR:  role "SUB_user_1" does not exist
DROP USER "user123" ;
ERROR:  role "user123" does not exist
drop role  user_1;
ERROR:  role "user_1" does not exist
drop role "ISO";
ERROR:  role "ISO" does not exist
drop role "geography" ;
ERROR:  role "geography" does not exist
drop role "ISO_ro_1";
ERROR:  role "ISO_ro_1" does not exist
drop role "iso123" ;
ERROR:  role "iso123" does not exist
drop GROUP prachgrp;
ERROR:  role "prachgrp" does not exist
DROP RESOURCE QUEUE db_resque2;
ERROR:  resource queue "db_resque2" does not exist
DROP RESOURCE QUEUE DB_RESque3;
ERROR:  resource queue "db_resque3" does not exist
DROP RESOURCE QUEUE DB_RESQUE4;
ERROR:  resource queue "db_resque4" does not exist
DROP ROLE db_role1;
ERROR:  role "db_role1" does not exist
DROP ROLE db_role2;
ERROR:  role "db_role2" does not exist
DROP ROLE db_role3;
ERROR:  role "db_role3" does not exist
DROP ROLE db_role4;
ERROR:  role "db_role4" does not exist
DROP ROLE db_role5;
ERROR:  role "db_role5" does not exist
DROP ROLE db_role6;
ERROR:  role "db_role6" does not exist
DROP ROLE db_role7;
ERROR:  role "db_role7" does not exist
DROP ROLE new_role8;
ERROR:  role "new_role8" does not exist
DROP ROLE db_role9;
ERROR:  role "db_role9" does not exist
DROP ROLE db_role10;
ERROR:  role "db_role10" does not exist
DROP ROLE db_role11;
ERROR:  role "db_role11" does not exist
DROP ROLE db_role12;
ERROR:  role "db_role12" does not exist
DROP GROUP db_grp1;
ERROR:  role "db_grp1" does not exist
DROP GROUP db_user_grp1;
ERROR:  role "db_user_grp1" does not exist
DROP ROLE db_user1;
ERROR:  role "db_user1" does not exist
DROP ROLE db_user2;
ERROR:  role "db_user2" does not exist
DROP ROLE db_user3;
ERROR:  role "db_user3" does not exist
DROP ROLE db_user4;
ERROR:  role "db_user4" does not exist
DROP ROLE db_user5;
ERROR:  role "db_user5" does not exist
DROP ROLE db_user6;
ERROR:  role "db_user6" does not exist
DROP ROLE db_user7;
ERROR:  role "db_user7" does not exist
DROP ROLE new_user8;
ERROR:  role "new_user8" does not exist
DROP ROLE db_user9;
ERROR:  role "db_user9" does not exist
DROP ROLE db_user10;
ERROR:  role "db_user10" does not exist
DROP ROLE db_user11;
ERROR:  role "db_user11" does not exist
DROP ROLE db_user12;
ERROR:  role "db_user12" does not exist
DROP RESOURCE QUEUE resqueu3;
ERROR:  resource queue "resqueu3" does not exist
DROP RESOURCE QUEUE resqueu4;
ERROR:  resource queue "resqueu4" does not exist
DROP DATABASE db_schema_test;
ERROR:  database "db_schema_test" does not exist
DROP USER db_user13 ;
ERROR:  role "db_user13" does not exist
DROP ROLE db_owner1;
ERROR:  role "db_owner1" does not exist
DROP DATABASE db_name1;
ERROR:  database "db_name1" does not exist
DROP ROLE db_owner2;
ERROR:  role "db_owner2" does not exist
DROP GROUP db_group1; 
ERROR:  role "db_group1" does not exist
DROP GROUP db_grp2;
ERROR:  role "db_grp2" does not exist
DROP GROUP db_grp3;
ERROR:  role "db_grp3" does not exist
DROP GROUP db_grp4;
ERROR:  role "db_grp4" does not exist
DROP GROUP db_grp5;
ERROR:  role "db_grp5" does not exist
DROP GROUP db_grp6;
ERROR:  role "db_grp6" does not exist
DROP GROUP db_grp7;
ERROR:  role "db_grp7" does not exist
DROP GROUP db_grp8;
ERROR:  role "db_grp8" does not exist
DROP GROUP db_grp9;
ERROR:  role "db_grp9" does not exist
DROP GROUP db_grp10;
ERROR:  role "db_grp10" does not exist
DROP GROUP db_grp11;
ERROR:  role "db_grp11" does not exist
DROP GROUP db_grp12;
ERROR:  role "db_grp12" does not exist
DROP ROLE grp_role1;
ERROR:  role "grp_role1" does not exist
DROP ROLE grp_role2;
ERROR:  role "grp_role2" does not exist
DROP USER test_user_1;
ERROR:  role "test_user_1" does not exist
DROP RESOURCE QUEUE grp_rsq1 ;
ERROR:  resource queue "grp_rsq1" does not exist
DROP RESOURCE QUEUE db_resque1;
ERROR:  resource queue "db_resque1" does not exist
DROP ROLE domain_owner;
ERROR:  role "domain_owner" does not exist
DROP ROLE agg_owner;
ERROR:  role "agg_owner" does not exist
DROP ROLE func_role ;
ERROR:  role "func_role" does not exist
DROP ROLE sally;
ERROR:  role "sally" does not exist
DROP ROLE ron;
ERROR:  role "ron" does not exist
DROP ROLE ken;
ERROR:  role "ken" does not exist
\c template1
select current_database();
 current_database 
------------------
 template1
(1 row)
183

184 185 186 187 188 189 190 191 192
DROP ROLE admin ;
ERROR:  role "admin" does not exist
--
\echo -- end_ignore
-- end_ignore
set optimizer_disable_missing_stats_collection = on;
create database ao_db;
CREATE DATABASE db_test_bed;
--
193
\c regression
194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275
--Create Table
--with uppercase
    CREATE TABLE "TABLE_NAME"( col_text text, col_numeric numeric ) DISTRIBUTED RANDOMLY;
    insert into "TABLE_NAME" values ('0_zero',0);
    insert into "TABLE_NAME" values ('1_one',1);
    insert into "TABLE_NAME" values ('2_two',2);
    insert into "TABLE_NAME" select i||'_'||repeat('text',100),i from generate_series(1,100)i;
--with lowercase
    CREATE TABLE table_name( col_text text, col_numeric numeric ) DISTRIBUTED RANDOMLY;
    insert into table_name values ('0_zero',0);
    insert into table_name values ('1_one',1);
    insert into table_name values ('2_two',2);
    insert into table_name select i||'_'||repeat('text',100),i from generate_series(1,100)i;
--with mixedcase
    CREATE TABLE "TABLE_name"( col_text text, col_numeric numeric ) DISTRIBUTED RANDOMLY;
    insert into "TABLE_name" values ('0_zero',0);
    insert into "TABLE_name" values ('1_one',1);
    insert into "TABLE_name" values ('2_two',2);
    insert into "TABLE_name" select i||'_'||repeat('text',100),i from generate_series(1,100)i;
--with numbers 
    CREATE TABLE table_123( col_text text, col_numeric numeric ) DISTRIBUTED RANDOMLY;
    insert into table_123 values ('0_zero',0);
    insert into table_123 values ('1_one',1);
    insert into table_123 values ('2_two',2);
    insert into table_123 select i||'_'||repeat('text',100),i from generate_series(1,100)i;
--Create Sequence
--with uppercase
    CREATE SEQUENCE "SERIAL" START 101;
--with lowercase
    CREATE SEQUENCE serialone START 101;
--with mixedcase
    CREATE SEQUENCE "Serial_123" START 101;
--with numbers
    CREATE SEQUENCE serial123 START 101;
--Create indexes
    create table empl1(id integer,empname varchar,sal integer) distributed randomly;
    insert into empl1 values (50001,'mohit',1000);
    insert into empl1 values (50002,'lalit',2000);
    insert into empl1 select i,i||'_'||repeat('text',100),i from generate_series(1,100)i;
    create index empl_idx ON empl1(id) ;
    select count(*) from empl1;
 count 
-------
   102
(1 row)

    --drop table empl1;
--REINDEX bitmap index : Note: create bitmap index then vacuum leads to corrupted bitmap
    create table bm_test (i int, j int) distributed randomly;
    insert into bm_test values (0, 0), (0, 0), (0, 1), (1,0), (1,0), (1,1);
    create index bm_test_j on bm_test using bitmap(j);
    delete from bm_test where j =1;
    insert into bm_test values (0, 0), (1,0);
    insert into bm_test select i,i from generate_series(2,100)i;
    REINDEX index "public"."bm_test_j";
    --drop index  bm_test_j ;
--CLUSTER clusterindex on table
    create table table2 (col1 int,col2 int) distributed randomly;
    insert into table2 values (1,1);
    insert into table2 values (2,2);
    insert into table2 values (3,3);
    insert into table2 values (4,4);
    insert into table2 values (5,5);
    insert into table2 select i,i from generate_series(6,100)i;
                                                                    
 create index clusterindex on table2(col1);
    CLUSTER clusterindex on table2; 
    --drop index clusterindex;
--Create Group
    \echo -- start_ignore
-- start_ignore
    create GROUP prachgrp; 
NOTICE:  resource queue required -- using default resource queue "pg_default"
    --drop GROUP prachgrp;
    \echo -- end_ignore
-- end_ignore
--Create Domain
    
    create DOMAIN country_code1 char(2) NOT NULL;
   --drop DOMAIN country_code1 CASCADE;
    
--Create Rule
276
create table foo_rule_ao (a int) with (appendonly=true);
277 278
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.
279
create table bar_rule_ao (a int);
280 281 282
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.
--try and trick by setting rules
283 284
create rule one as on insert to bar_rule_ao do instead update foo_rule_ao set a=1;
create rule two as on insert to bar_rule_ao do instead delete from foo_rule_ao where a=1;
285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349
--Create User
\echo -- start_ignore
-- start_ignore
--with uppercase
    create user "MAIN_USER" login password 'MAIN_USER';
NOTICE:  resource queue required -- using default resource queue "pg_default"
    --DROP USER "MAIN_USER";
--with lowercase
    create user "sub_user" login password 'sub_user';
NOTICE:  resource queue required -- using default resource queue "pg_default"
    --DROP USER "sub_user" ;
--with mixedcase
    create user "SUB_user_1" login password 'SUB_user_1';
NOTICE:  resource queue required -- using default resource queue "pg_default"
    --DROP USER "SUB_user_1";
--with numbers
    create user "user123" login password 'user123';
NOTICE:  resource queue required -- using default resource queue "pg_default"
    --DROP USER "user123" ;
--Create Roles
--with uppercase
    create role "ISO" login password 'ISO';
NOTICE:  resource queue required -- using default resource queue "pg_default"
    --drop role "ISO";
--with lowercase
    create role "geography" login password 'geography';
NOTICE:  resource queue required -- using default resource queue "pg_default"
    --drop role "geography" ;
--with mixedcase
    create role "ISO_ro_1" login password 'ISO_ro_1';
NOTICE:  resource queue required -- using default resource queue "pg_default"
    --drop role "ISO_ro_1";
--with numbers
    create role "iso123" login password 'iso123';
NOTICE:  resource queue required -- using default resource queue "pg_default"
    --drop role "iso123" ;
   \echo  -- end_ignore
-- end_ignore
--Create schema
    
--with uppercase
    create schema "USDA";
    --drop schema "USDA";
    
--with lowercase
    create schema "geography";
    --drop schema "geography";
    
--with mixedcase
    create schema "test_schema-3166";
    --drop schema "test_schema-3166";
    
--with numbers
    create schema "test_schema1";
    --drop schema "test_schema1";
--Create Database
    
--with uppercase
    create database "TEST_DB";
    --drop database "TEST_DB";
    
--with mixedcase
    create database "TEST_db";
    --drop database "TEST_db";
--
350
\c regression
351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597
--Table with all data types
    CREATE TABLE all_types( bit1 bit(1), bit2 bit varying(50), boolean1 boolean, char1 char(50), charvar1 character varying(50), char2 character(50),
varchar1 varchar(50),date1 date,dp1 double precision,int1 integer,interval1 interval,numeric1 numeric,real1 real,smallint1 smallint,time1 time,bigint1 bigint,
bigserial1 bigserial,bytea1 bytea,cidr1 cidr,decimal1 decimal,inet1 inet,macaddr1 macaddr,money1 money,serial1 serial,text1 text,time2 time without time zone,
time3 time with time zone,time4 timestamp without time zone,time5 timestamp with time zone) distributed randomly;
NOTICE:  CREATE TABLE will create implicit sequence "all_types_bigserial1_seq" for serial column "all_types.bigserial1"
NOTICE:  CREATE TABLE will create implicit sequence "all_types_serial1_seq" for serial column "all_types.serial1"
insert into all_types values ('1','0','t','c','varchar1','char1','varchar1','2001-11-11',234.23234,23,'24',234,23,4,'12:12:12',2,3,'d','0.0.0.0',1,'0.0.0.0','AA:AA:AA:AA:AA:AA','34.23',5,'text1','00:00:00','00:00:00+1359','2001-12-13 01:51:15','2001-12-13 01:51:15+1359');
insert into all_types values ('0','0','f','c','varchar2','char2','varchar2','2002-11-11',234.23234,23,'24',234,23,4,'12:12:12',2,3,'d','0.0.0.0',1,'0.0.0.0','BB:BB:BB:BB:BB:BB','34.23',5,'text2','00:00:00','00:00:00+1359','2002-12-13 01:51:15','2002-12-13 01:51:15+1359');
insert into all_types values ('1','0','t','c','varchar3','char3','varchar3','2003-11-11',234.23234,23,'24',234,23,4,'12:12:12',2,3,'d','0.0.0.0',1,'0.0.0.0','CC:CC:CC:CC:CC:CC','34.23',5,'text3','00:00:00','00:00:00+1359','2003-12-13 01:51:15','2003-12-13 01:51:15+1359');
insert into all_types values ('0','0','f','c','varchar4','char4','varchar4','2004-11-11',234.23234,23,'24',234,23,4,'12:12:12',2,3,'d','0.0.0.0',1,'0.0.0.0','DD:DD:DD:DD:DD:DD','34.23',5,'text4','00:00:00','00:00:00+1359','2004-12-13 01:51:15','2004-12-13 01:51:15+1359');
insert into all_types values ('1','0','t','c','varchar5','char5','varchar5','2005-11-11',234.23234,23,'24',234,23,4,'12:12:12',2,3,'d','0.0.0.0',1,'0.0.0.0','EE:EE:EE:EE:EE:EE','34.23',5,'text5','00:00:00','00:00:00+1359','2005-12-13 01:51:15','2005-12-13 01:51:15+1359');
insert into all_types values ('1','0','t','c','varchar5','char5','varchar5','2005-06-16',634.23234,6,'24',634,63,6,'12:12:12',6,6,'d','0.0.0.0',6,'0.0.0.0','EE:EE:EE:EE:EE:EE','64.23',generate_series(6,100),repeat('text',100),'00:00:00','00:00:00+1359','2005-07-15 01:51:15','2005-07-16 01:51:15+1359');
--global table
    CREATE GLOBAL TEMP TABLE table_global (
    text_col text,
    bigint_col bigint,
    char_vary_col character varying(30),
    numeric_col numeric
    ) DISTRIBUTED RANDOMLY;
    insert into table_global values ('0_zero',0000,'0_test',0);
    insert into table_global values ('1_one',1111,'1_test',1);
    insert into table_global values ('2_two',2222,'2_test',2);
    insert into table_global select i||'_'||repeat('text',100),i,i||'_'||repeat('text',5),i from generate_series(1,100)i;
--local table
    CREATE LOCAL TEMP TABLE table_local (
    text_col text,
    bigint_col bigint,
    char_vary_col character varying(30),
    numeric_col numeric
    ) DISTRIBUTED RANDOMLY;
    insert into table_local values ('0_zero',0000,'0_test',0);
    insert into table_local values ('1_one',1111,'1_test',1);
    insert into table_local values ('2_two',2222,'2_test',2);
    insert into table_local select i||'_'||repeat('text',100),i,i||'_'||repeat('text',5),i from generate_series(1,100)i;
--like parent_table
    CREATE TABLE table_like_parent (
    like table_local
    ) DISTRIBUTED RANDOMLY;
--like parent_table
    CREATE TABLE table_like_parent1 (
    like table_local INCLUDING DEFAULTS
    ) DISTRIBUTED RANDOMLY;
--like parent_table
    CREATE TABLE table_like_parent2 (
    like table_local INCLUDING CONSTRAINTS
    ) DISTRIBUTED RANDOMLY;
--like parent_table
    CREATE TABLE table_like_parent3 (
    like table_local EXCLUDING DEFAULTS
    ) DISTRIBUTED RANDOMLY;
--like parent_table
CREATE TABLE table_like_parent4 (
    like table_local EXCLUDING CONSTRAINTS
    ) DISTRIBUTED RANDOMLY; 
    
--Incorrect inherits parent_table
-- good test case, but there's a bug for earlier gpdb versions so it won't work with upgrade.  it causes pg_dump to die
--    CREATE TABLE table_inherits_parent (
--    INHERITS table_local
--    ) DISTRIBUTED RANDOMLY;
    
--Inherits parent_table - MPP-5300 
    
   CREATE TABLE table_parent ( a int, b text) DISTRIBUTED BY (a);
   insert into table_parent values (generate_series(1,10),'test');
\echo -- start_ignore
-- start_ignore
   select count(*) from table_parent;
 count 
-------
    10
(1 row)

   CREATE TABLE table_child() INHERITS(table_parent);
NOTICE:  Table has parent, setting distribution columns to match parent table
   insert into table_child values (generate_series(11,20),'child');
   select * from table_child;
 a  |   b   
----+-------
 13 | child
 14 | child
 15 | child
 16 | child
 17 | child
 18 | child
 19 | child
 20 | child
 11 | child
 12 | child
(10 rows)

   select * from table_parent;
 a  |   b   
----+-------
  1 | test
  2 | test
 13 | child
 14 | child
 15 | child
 16 | child
 17 | child
  3 | test
  4 | test
  5 | test
  6 | test
  7 | test
 18 | child
 19 | child
 20 | child
  8 | test
  9 | test
 10 | test
 11 | child
 12 | child
(20 rows)

   select * from table_child;
 a  |   b   
----+-------
 13 | child
 14 | child
 15 | child
 16 | child
 17 | child
 18 | child
 19 | child
 20 | child
 11 | child
 12 | child
(10 rows)

   \echo -- end_ignore 
-- end_ignore
--on commit
    
    CREATE LOCAL TEMP TABLE on_commit (
    text_col text,
    bigint_col bigint,
    char_vary_col character varying(30),
    numeric_col numeric
    ) ON COMMIT PRESERVE ROWS
    DISTRIBUTED RANDOMLY;
    insert into on_commit values ('0_zero',0000,'0_test',0);
    insert into on_commit values ('1_one',1111,'1_test',1);
    insert into on_commit values ('2_two',2222,'2_test',2);
    insert into on_commit select i||'_'||repeat('text',100),i,i||'_'||repeat('text',5),i from generate_series(1,100)i;
--on commit
CREATE LOCAL TEMP TABLE on_commit1 (
    text_col text,
    bigint_col bigint,
    char_vary_col character varying(30),
    numeric_col numeric
    ) ON COMMIT DELETE ROWS
    DISTRIBUTED RANDOMLY;
    insert into on_commit1 values ('0_zero',0000,'0_test',0);
    insert into on_commit1 values ('1_one',1111,'1_test',1);
    insert into on_commit1 values ('2_two',2222,'2_test',2);
    insert into on_commit1 select i||'_'||repeat('text',100),i,i||'_'||repeat('text',5),i from generate_series(1,100)i;
--on commit
    CREATE LOCAL TEMP TABLE on_commit2 (
    text_col text,
    bigint_col bigint,
    char_vary_col character varying(30),
    numeric_col numeric
    ) ON COMMIT DROP
    DISTRIBUTED RANDOMLY;
--Table Creation using Create Table As (CTAS) with both the new tables columns being explicitly or implicitly created
    CREATE TABLE test_table(
    text_col text,
    bigint_col bigint,
    char_vary_col character varying(30),
    numeric_col numeric,
    int_col int4,
    float_col float4,
    int_array_col int[],
    before_rename_col int4,
    change_datatype_col numeric,
    a_ts_without timestamp without time zone,
    b_ts_with timestamp with time zone,
    date_column date,
    col_set_default numeric)DISTRIBUTED RANDOMLY;
insert into test_table values ('0_zero', 0, '0_zero', 0, 0, 0, '{0}', 0, 0, '2004-10-19 10:23:54', '2004-10-19 10:23:54+02', '1-1-2000',0);
    insert into test_table values ('1_zero', 1, '1_zero', 1, 1, 1, '{1}', 1, 1, '2005-10-19 10:23:54', '2005-10-19 10:23:54+02', '1-1-2001',1);
    insert into test_table values ('2_zero', 2, '2_zero', 2, 2, 2, '{2}', 2, 2, '2006-10-19 10:23:54', '2006-10-19 10:23:54+02', '1-1-2002',2);
    insert into test_table select i||'_'||repeat('text',100),i,i||'_'||repeat('text',3),i,i,i,'{3}',i,i,'2006-10-19 10:23:54', '2006-10-19 10:23:54+02', '1-1-2002',i from generate_series(3,100)i;
    
CREATE TABLE ctas_table1 AS SELECT * FROM test_table;
NOTICE:  Table doesn't have 'DISTRIBUTED BY' clause -- Using column(s) named 'text_col' 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 ctas_table2 AS SELECT text_col,bigint_col,char_vary_col,numeric_col FROM test_table;
NOTICE:  Table doesn't have 'DISTRIBUTED BY' clause -- Using column(s) named 'text_col' 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 and then Select Into / Insert
    
    CREATE TABLE test_table2(
    int_array_col int[],
    before_rename_col int4, 
    change_datatype_col numeric,
    a_ts_without timestamp without time zone,
    b_ts_with timestamp with time zone,
    date_column date
) DISTRIBUTED RANDOMLY;
    
insert into test_table2(int_array_col ,    before_rename_col ,    change_datatype_col ,    a_ts_without ,b_ts_with ,date_column)(select    int_array_col ,    before_rename_col ,    change_datatype_col ,    a_ts_without ,b_ts_with ,date_column from test_table);
--Toast Table
    
    CREATE TABLE toast_table (
    text_col text,
    bigint_col bigint,
    char_vary_col character varying(30),
    numeric_col numeric
    ) DISTRIBUTED RANDOMLY;
    
    insert into toast_table values ('0_zero', 0, '0_zero', 0);
    insert into toast_table values ('1_zero', 1, '1_zero', 1);
    insert into toast_table values ('2_zero', 2, '2_zero', 2);
    insert into toast_table select i||'_'||repeat('text',100),i,i||'_'||repeat('text',5),i from generate_series(1,100)i;
    
--Temp Table
                                                      
 CREATE TEMP TABLE temp_table(
    text_col text,
    bigint_col bigint,
    char_vary_col character varying(30),
    numeric_col numeric
    ) DISTRIBUTED RANDOMLY;
    insert into temp_table values ('0_zero', 0, '0_zero', 0);
    insert into temp_table values ('1_zero', 1, '1_zero', 1);
    insert into temp_table values ('2_zero', 2, '2_zero', 2);
    insert into table_local select i||'_'||repeat('text',100),i,i||'_'||repeat('text',5),i from generate_series(1,50000)i;
--External Table
CREATE EXTERNAL TABLE ext_20081031095512_23244_11671 (
    a_party_id bigint,
    start_date date,
    start_time_hour smallint,
    start_time_min smallint,
    start_time_sec smallint,
    duration integer,
    record_dt timestamp without time zone,
    framed_ip_address character varying(15)
) LOCATION (
    'gpfdist://97.253.36.12:9010/R_LAA_DATA_2008-10-27.dat'
) FORMAT 'text' (delimiter ',' null '' )
ENCODING 'UTF8'
598
LOG ERRORS SEGMENT REJECT LIMIT 100 ROWS;
599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222
CREATE WRITABLE EXTERNAL TABLE wet_ext_20081031095512_23244_11671 (
    a_party_id bigint,
    start_date date,
    start_time_hour smallint,
    start_time_min smallint,
    start_time_sec smallint,
    duration integer,
    record_dt timestamp without time zone,
    framed_ip_address character varying(15)
) LOCATION (
'gpfdist://97.253.36.12:9010/R_LAA_DATA_2008-10-27.dat'
) FORMAT 'text' (delimiter ',' null '' );
    
--Web External Table
    
    CREATE EXTERNAL WEB TABLE web_ex_table_vmstat_output (
    hostname text,
    threads text,
    memory text,
    page text,
    disk text,
    faults text,
    cpu text
    ) EXECUTE E'vmstat 1 2|tail -1|nawk -v H=`hostname` \'{print H"|"$1" "$2" "$3"|"$4" "$5"|"$6" "$7" "$8" "$9" "$10" "$11" "$12"|"$13" "$14" "$15" "$16"|"$17" "$18" "$19"|"$20" "$21" "$22}\'' ON HOST
    FORMAT 'text' (delimiter '|' null ''  )
--ENCODING 'UFT8'
;   
    
--Tables with distributed randomly and distributed columns
    
    CREATE TABLE table_distributed_by (
    col_with_default numeric DEFAULT 0,
    col_with_default_drop_default character varying(30) DEFAULT 'test1',
    col_with_constraint numeric UNIQUE
    ) DISTRIBUTED BY (col_with_constraint);
NOTICE:  CREATE TABLE / UNIQUE will create implicit index "table_distributed_by_col_with_constraint_key" for table "table_distributed_by"
    insert into table_distributed_by (col_with_default_drop_default,col_with_constraint) values('0_zero',0);
    insert into table_distributed_by values(11,'1_zero',1);
    insert into table_distributed_by select i,i||'_'||repeat('text',5),i from generate_series(20,100)i;
    insert into table_distributed_by (col_with_default,col_with_constraint)values (33,3);
    CREATE TABLE table_distributed_randomly (
    text_col text,
    bigint_col bigint,
    char_vary_col character varying(30),
    numeric_col numeric
    ) DISTRIBUTED RANDOMLY;
    
    insert into table_distributed_randomly values ('0_zero', 0, '0_zero', 0);
    insert into table_distributed_randomly values ('1_zero', 1, '1_zero', 1);
    insert into table_distributed_randomly values ('2_zero', 2, '2_zero', 2);
    insert into table_distributed_randomly select i||'_'||repeat('text',100),i,i||'_'||repeat('text',5),i from generate_series(1,100)i;
--Table constraint
    CREATE TABLE table_constraint  (
    did integer,
    name varchar(40)
    CONSTRAINT con1 CHECK (did > 99 AND name <> '')
    )DISTRIBUTED RANDOMLY;
    insert into table_constraint  values (100,'name_1');
    insert into table_constraint  values (200,'name_2');
    insert into table_constraint  values (300,'name_3');
--Tables with Default and column constraint
    CREATE TABLE table_with_default_constraint (
    col_with_default_numeric numeric DEFAULT 0,
    col_with_default_text character varying(30) DEFAULT 'test1',
    col_with_constraint numeric UNIQUE
    ) DISTRIBUTED BY (col_with_constraint);
NOTICE:  CREATE TABLE / UNIQUE will create implicit index "table_with_default_constraint_col_with_constraint_key" for table "table_with_default_constraint"
    insert into table_with_default_constraint  (col_with_default_text,col_with_constraint) values('0_zero',0);
    insert into table_with_default_constraint  values(11,'1_zero',1);
    insert into table_with_default_constraint select i,i||'_'||repeat('text',5),i from generate_series(20,100)i;
    insert into table_with_default_constraint  (col_with_default_numeric,col_with_constraint)values (33,3);
--Table with column constraint
    CREATE TABLE table_with_default_constraint1 (
    col_with_default_numeric numeric PRIMARY KEY,
    col_with_default_text character varying(30) DEFAULT 'test1',
    col_with_constraint numeric
    ) DISTRIBUTED BY (col_with_default_numeric);
NOTICE:  CREATE TABLE / PRIMARY KEY will create implicit index "table_with_default_constraint1_pkey" for table "table_with_default_constraint1"
    insert into table_with_default_constraint1 values (0,'hello0',0);
    insert into table_with_default_constraint1 values (1,'hello1',1);
    insert into table_with_default_constraint1 values (2,'hello2',2);
    insert into table_with_default_constraint1 select i,i||'_'||repeat('text',5),i from generate_series(3,100)i;
--Table with Oids
    CREATE TABLE table_with_oid (
    text_col text,
    bigint_col bigint,
    char_vary_col character varying(30),
    numeric_col numeric
    ) WITH OIDS DISTRIBUTED RANDOMLY;
NOTICE:  OIDS=TRUE is not recommended for user-created tables. Use OIDS=FALSE to prevent wrap-around of the OID counter
    
\echo -- start_ignore
-- start_ignore
    insert into table_with_oid values ('0_zero', 0, '0_zero', 0);
    insert into table_with_oid values ('1_zero', 1, '1_zero', 1);
    insert into table_with_oid values ('2_zero', 2, '2_zero', 2);
    insert into table_with_oid select i||'_'||repeat('text',100),i,i||'_'||repeat('text',5),i from generate_series(1,100)i;
\echo -- end_ignore
-- end_ignore
    
--Tables with storage Parameters is covered in ao_tables
    
create table nodetest (testname text, oldnode text, newnode text) distributed by (testname);
copy nodetest from stdin delimiter '|';
ERROR:  missing data for column "oldnode"
CONTEXT:  COPY nodetest, line 6: "\.  "
create view ugtest1 as select oid, sum(reltuples) from pg_class group by 1
  having(sum(reltuples) > 100) order by 2;
create view ugtest2 as select 10000000000000 as a,
'2007-01-01 11:11:11'::timestamp as b,
'2007-01-01 11:11:11 PST'::timestamptz as c,
'200000.0000'::float4 as d,
'2000.00000000'::float8 as e,
123 as f;
create view ugtest3 as select * from pg_database limit 5;
create view ugtest4 as select relname, length(relname) from pg_class
where oid in (select distinct oid from pg_attribute);
create view ugtest5 as select array[ '100000000000000'::int8 ] as test;
--Alter table
create database alter_table_db;
\c alter_table_db
--Rename Table
          CREATE TABLE table_name(
          col_text text,
          col_numeric numeric
          ) DISTRIBUTED RANDOMLY;
    	insert into table_name values ('0_zero',0);
    	insert into table_name values ('1_one',1);
    	insert into table_name values ('2_two',2);
        insert into table_name select i||'_'||repeat('text',100),i from generate_series(1,100)i;
          ALTER TABLE table_name RENAME TO table_new_name;
--ALTER Schema name
          CREATE SCHEMA dept;
          CREATE TABLE dept.csc(
          stud_id int,
          stud_name varchar(20)
          ) DISTRIBUTED RANDOMLY;
	  insert into dept.csc values ( 1,'ann');
          insert into dept.csc values ( 2,'ben');
          insert into dept.csc values ( 3,'sam');
          insert into dept.csc select i,i||'_'||repeat('text',3) from generate_series(4,100)i;
          CREATE SCHEMA new_dept;
          ALTER TABLE dept.csc SET SCHEMA new_dept;
--RENAME & ADD Column & ALTER column TYPE type & ALTER column SET DEFAULT expression
          CREATE TABLE test_alter_table(
          text_col text,
          bigint_col bigint,
          char_vary_col character varying(30),
          numeric_col numeric,
          int_col int4,
          float_col float4,
          int_array_col int[],
          before_rename_col int4,
          change_datatype_col numeric,
          a_ts_without timestamp without time zone,
          b_ts_with timestamp with time zone,
          date_column date,
          col_set_default numeric)DISTRIBUTED RANDOMLY;
          insert into test_alter_table values ('0_zero', 0, '0_zero', 0, 0, 0, '{0}', 0, 0, '2004-10-19 10:23:54', '2004-10-19 10:23:54+02', '1-1-2000',0);
          insert into test_alter_table values ('1_zero', 1, '1_zero', 1, 1, 1, '{1}', 1, 1, '2005-10-19 10:23:54', '2005-10-19 10:23:54+02', '1-1-2001',1);
          insert into test_alter_table values ('2_zero', 2, '2_zero', 2, 2, 2, '{2}', 2, 2, '2006-10-19 10:23:54', '2006-10-19 10:23:54+02', '1-1-2002',2);
          insert into test_alter_table select i||'_'||repeat('text',100),i,i||'_'||repeat('text',3),i,i,i,'{3}',i,i,'2006-10-19 10:23:54', '2006-10-19 10:23:54+02', '1-1-2002',i from generate_series(3,100)i;
--ADD column type [ column_constraint [ ... ] ]
          ALTER TABLE test_alter_table ADD COLUMN added_col character varying(30);
--RENAME Column
          ALTER TABLE test_alter_table RENAME COLUMN before_rename_col TO after_rename_col;
--ALTER column TYPE type
          ALTER TABLE test_alter_table ALTER COLUMN change_datatype_col TYPE int4;
--ALTER column SET DEFAULT expression
          ALTER TABLE test_alter_table ALTER COLUMN col_set_default SET DEFAULT 0;
--ALTER column [ SET | DROP ] NOT NULL
          CREATE TABLE alter_table1(
          col_text text,
          col_numeric numeric NOT NULL
          ) DISTRIBUTED RANDOMLY;
          insert into alter_table1 values ('0_zero',0);
          insert into alter_table1 values ('1_one',1);
          insert into alter_table1 values ('2_two',2);
          insert into alter_table1 select i||'_'||repeat('text',100),i from generate_series(3,100)i;
          ALTER TABLE alter_table1 ALTER COLUMN col_numeric DROP NOT NULL;
          ALTER TABLE alter_table1 ALTER COLUMN col_numeric SET NOT NULL;
--ALTER column SET STATISTICS integer
          CREATE TABLE alter_set_statistics_table(
          col_text text,
          col_numeric numeric NOT NULL
          ) DISTRIBUTED RANDOMLY;
          insert into alter_set_statistics_table values ('0_zero',0);
          insert into alter_set_statistics_table values ('1_one',1);
          insert into alter_set_statistics_table values ('2_two',2);
          insert into alter_set_statistics_table select i||'_'||repeat('text',100),i from generate_series(3,100)i;
          ALTER TABLE alter_set_statistics_table ALTER col_numeric SET STATISTICS 1;
--ALTER column SET STORAGE
          CREATE TABLE alter_set_storage_table(
          col_text text,
          col_numeric numeric NOT NULL
          ) DISTRIBUTED RANDOMLY;
         insert into alter_set_storage_table values ('0_zero',0);
         insert into alter_set_storage_table values ('1_one',1);
         insert into alter_set_storage_table values ('2_two',2);
         insert into alter_set_storage_table select i||'_'||repeat('text',100),i from generate_series(3,100)i;
	 ALTER TABLE alter_set_storage_table ALTER col_text SET STORAGE PLAIN;
--ADD table_constraint
          CREATE TABLE distributors (
          did integer,
          name varchar(40)
          ) DISTRIBUTED BY (name);
	  insert into distributors values (1,'1_one');
          insert into distributors values (2,'2_two');
          insert into distributors values (3,'3_three');
          insert into distributors select i,i||'_'||repeat('text',7) from generate_series(4,100)i;
 
          ALTER TABLE distributors ADD UNIQUE(name);
NOTICE:  ALTER TABLE / ADD UNIQUE will create implicit index "distributors_name_key" for table "distributors"
--DROP CONSTRAINT constraint_name [ RESTRICT | CASCADE ]
          CREATE TABLE films (
          code char(5),
          title varchar(40),
          did integer,
          date_prod date,
          kind varchar(10),
          len interval hour to minute,
          CONSTRAINT production UNIQUE(date_prod)
          ) distributed by (date_prod);
NOTICE:  CREATE TABLE / UNIQUE will create implicit index "films_date_prod_key" for table "films"
	  insert into films values ('aaa','Heavenly Life',1,'2008-03-03','good','2 hr 30 mins');
          insert into films values ('bbb','Beautiful Mind',2,'2007-05-05','good','1 hr 30 mins');
          insert into films values ('ccc','Wonderful Earth',3,'2009-03-03','good','2 hr 15 mins');
 
          ALTER TABLE films DROP CONSTRAINT production;
--ENABLE & DISABLE TRIGGER
          CREATE TABLE price_change (
          apn CHARACTER(15) NOT NULL,
          effective TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
          price NUMERIC(9,2),
          UNIQUE (apn, effective)
          ) distributed by (apn, effective);
NOTICE:  CREATE TABLE / UNIQUE will create implicit index "price_change_apn_key" for table "price_change"
	  insert into price_change (apn,price) values ('a',765);
          insert into price_change (apn,price) values ('b',766);
          insert into price_change (apn,price) values ('c',767);
          CREATE TABLE stock(
          stock_apn CHARACTER(15) NOT NULL,
          stock_effective TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
          stock_price NUMERIC(9,2)
          )DISTRIBUTED RANDOMLY;
          insert into stock (stock_apn,stock_price) values ('a',765);
          insert into stock (stock_apn,stock_price) values ('b',766);
          insert into stock (stock_apn,stock_price) values ('c',767);
          --trigger function to insert records as required:
          CREATE OR REPLACE FUNCTION insert_price_change() RETURNS trigger AS '
          DECLARE
          changed boolean;
          BEGIN
          IF tg_op = ''DELETE'' THEN
          INSERT INTO price_change(apn, effective, price)
          VALUES (old.barcode, CURRENT_TIMESTAMP, NULL);
          RETURN old;
          END IF;
          IF tg_op = ''INSERT'' THEN
          changed := TRUE;
          ELSE
          changed := new.price IS NULL != old.price IS NULL OR new.price != old.price;
          END IF;
          IF changed THEN
          INSERT INTO price_change(apn, effective, price)
          VALUES (new.barcode, CURRENT_TIMESTAMP, new.price);
          END IF;
          RETURN new;
          END
          ' LANGUAGE plpgsql MODIFIES SQL DATA;
          --create a trigger on the table you wish to monitor:
          CREATE TRIGGER insert_price_change AFTER INSERT OR DELETE OR UPDATE ON stock
          FOR EACH ROW EXECUTE PROCEDURE insert_price_change();
          ALTER TABLE stock DISABLE TRIGGER insert_price_change;
          ALTER TABLE stock ENABLE TRIGGER insert_price_change;
--CLUSTER ON index_name & SET WITHOUT CLUSTER
          CREATE TABLE cluster_index_table (col1 int,col2 int) distributed randomly;
          insert into cluster_index_table values (1,1);
          insert into cluster_index_table values (2,2);
          insert into cluster_index_table values (3,3);
          insert into cluster_index_table values (4,4);
          insert into cluster_index_table values (generate_series(5,100),generate_series(5,100));
         create index clusterindex on cluster_index_table(col1);
          ALTER TABLE cluster_index_table CLUSTER on clusterindex;
          ALTER TABLE cluster_index_table SET WITHOUT CLUSTER;
--SET WITHOUT OIDS
          CREATE TABLE table_with_oid (
          text_col text,
          bigint_col bigint,
          char_vary_col character varying(30),
          numeric_col numeric
          ) WITH OIDS DISTRIBUTED RANDOMLY;
NOTICE:  OIDS=TRUE is not recommended for user-created tables. Use OIDS=FALSE to prevent wrap-around of the OID counter
\echo -- start_ignore
-- start_ignore
          insert into table_with_oid values ('0_zero', 0, '0_zero', 0);
          insert into table_with_oid values ('1_zero', 1, '1_zero', 1);
          insert into table_with_oid values ('2_zero', 2, '2_zero', 2);
          insert into table_with_oid select i||'_'||repeat('text',100),i,i||'_'||repeat('text',5),i from generate_series(3,100)i;
\echo -- end_ignore
-- end_ignore
          ALTER TABLE table_with_oid SET WITHOUT OIDS;
--SET & RESET ( storage_parameter = value , ... )
          CREATE TABLE table_set_storage_parameters (
          text_col text,
          bigint_col bigint,
          char_vary_col character varying(30),
          numeric_col numeric
          ) DISTRIBUTED RANDOMLY;
          insert into table_set_storage_parameters values ('0_zero', 0, '0_zero', 0);
          insert into table_set_storage_parameters values ('1_zero', 1, '1_zero', 1);
          insert into table_set_storage_parameters values ('2_zero', 2, '2_zero', 2);
          insert into table_set_storage_parameters select i||'_'||repeat('text',100),i,i||'_'||repeat('text',5),i from generate_series(3,100)i;
          ALTER TABLE table_set_storage_parameters SET (APPENDONLY=TRUE , COMPRESSLEVEL= 5 , FILLFACTOR= 50);
ERROR:  cannot SET reloption "appendonly"
          ALTER TABLE table_set_storage_parameters RESET (APPENDONLY , COMPRESSLEVEL, FILLFACTOR);
ERROR:  cannot SET reloption "appendonly"
--INHERIT & NO INHERIT parent_table
          CREATE TABLE parent_table (
          text_col text,
          bigint_col bigint,
          char_vary_col character varying(30),
          numeric_col numeric
          ) DISTRIBUTED RANDOMLY;
          insert into parent_table values ('0_zero', 0, '0_zero', 0);
          insert into parent_table values ('1_zero', 1, '1_zero', 1);
          insert into parent_table values ('2_zero', 2, '2_zero', 2);
          CREATE TABLE child_table(
          text_col text,
          bigint_col bigint,
          char_vary_col character varying(30),
          numeric_col numeric
          ) DISTRIBUTED RANDOMLY;
          insert into child_table values ('3_zero', 3, '3_zero', 3);
          ALTER TABLE child_table INHERIT parent_table;
          select * from parent_table;
 text_col | bigint_col | char_vary_col | numeric_col 
----------+------------+---------------+-------------
 0_zero   |          0 | 0_zero        |           0
 1_zero   |          1 | 1_zero        |           1
 3_zero   |          3 | 3_zero        |           3
 2_zero   |          2 | 2_zero        |           2
(4 rows)

          ALTER TABLE child_table NO INHERIT parent_table;
          select * from parent_table;
 text_col | bigint_col | char_vary_col | numeric_col 
----------+------------+---------------+-------------
 0_zero   |          0 | 0_zero        |           0
 1_zero   |          1 | 1_zero        |           1
 2_zero   |          2 | 2_zero        |           2
(3 rows)

--OWNER TO new_owner
          CREATE TABLE table_owner (
          text_col text,
          bigint_col bigint,
          char_vary_col character varying(30),
          numeric_col numeric
          )DISTRIBUTED RANDOMLY;
	  insert into table_owner values ('1_one',1111,'1_test',1);
          insert into table_owner values ('2_two',2222,'2_test',2);
          insert into table_owner values ('3_three',3333,'3_test',3);
          insert into table_owner select i||'_'||repeat('text',100),i,i||'_'||repeat('text',5),i from generate_series(3,100)i;
          CREATE ROLE user_1;
NOTICE:  resource queue required -- using default resource queue "pg_default"
          ALTER TABLE table_owner OWNER TO user_1;
         -- DROP TABLE table_owner;
          -- DROP ROLE user_1;
--Drop column
    CREATE TABLE test_drop_column(
    toast_col text,
    bigint_col bigint,
    char_vary_col character varying(30),
    numeric_col numeric,
    int_col int4,
    float_col float4,
    int_array_col int[],
    non_toast_col numeric,
    a_ts_without timestamp without time zone,
    b_ts_with timestamp with time zone,
    date_column date,
    col_with_constraint numeric UNIQUE,
    col_with_default_text character varying(30) DEFAULT 'test1'
    ) distributed by (col_with_constraint);
NOTICE:  CREATE TABLE / UNIQUE will create implicit index "test_drop_column_col_with_constraint_key" for table "test_drop_column"
    insert into test_drop_column values ('0_zero', 0, '0_zero', 0, 0, 0, '{0}', 0, '2004-10-19 10:23:54', '2004-10-19 10:23:54+02', '1-1-2000',0);
    insert into test_drop_column values ('1_zero', 1, '1_zero', 1, 1, 1, '{1}', 1, '2005-10-19 10:23:54', '2005-10-19 10:23:54+02', '1-1-2001',1);
    insert into test_drop_column values ('2_zero', 2, '2_zero', 2, 2, 2, '{2}', 2, '2006-10-19 10:23:54', '2006-10-19 10:23:54+02', '1-1-2002',2);
    insert into test_drop_column select i||'_'||repeat('text',100),i,i||'_'||repeat('text',3),i,i,i,'{3}',i,'2006-10-19 10:23:54', '2006-10-19 10:23:54+02', '1-1-2002',i from generate_series(3,100)i;
--drop toast column
    ALTER TABLE test_drop_column DROP COLUMN toast_col ;
--drop non toast column
    ALTER TABLE test_drop_column DROP COLUMN non_toast_col ;
--drop default
\echo -- start_ignore
-- start_ignore
    ALTER TABLE test_drop_column ALTER COLUMN col_with_default_text DROP DEFAULT;
\echo -- end_ignore
-- end_ignore
--TODO - drop column from partitioned table
--Defining Multi-level Partitions
create database partition_db;
\c partition_db
 
CREATE TABLE sales (trans_id int, date date, amount 
decimal(9,2), region text) 
DISTRIBUTED BY (trans_id) 
PARTITION BY RANGE (date) 
SUBPARTITION BY LIST (region) 
SUBPARTITION TEMPLATE 
( SUBPARTITION usa VALUES ('usa'),  
  SUBPARTITION asia VALUES ('asia'),  
  SUBPARTITION europe VALUES ('europe') ) 
( START (date '2008-01-01') INCLUSIVE 
   END (date '2009-01-01') EXCLUSIVE 
   EVERY (INTERVAL '1 month') ); 
NOTICE:  CREATE TABLE will create partition "sales_1_prt_1" for table "sales"
NOTICE:  CREATE TABLE will create partition "sales_1_prt_2" for table "sales"
NOTICE:  CREATE TABLE will create partition "sales_1_prt_3" for table "sales"
NOTICE:  CREATE TABLE will create partition "sales_1_prt_4" for table "sales"
NOTICE:  CREATE TABLE will create partition "sales_1_prt_5" for table "sales"
NOTICE:  CREATE TABLE will create partition "sales_1_prt_6" for table "sales"
NOTICE:  CREATE TABLE will create partition "sales_1_prt_7" for table "sales"
NOTICE:  CREATE TABLE will create partition "sales_1_prt_8" for table "sales"
NOTICE:  CREATE TABLE will create partition "sales_1_prt_9" for table "sales"
NOTICE:  CREATE TABLE will create partition "sales_1_prt_10" for table "sales"
NOTICE:  CREATE TABLE will create partition "sales_1_prt_11" for table "sales"
NOTICE:  CREATE TABLE will create partition "sales_1_prt_12" for table "sales"
NOTICE:  CREATE TABLE will create partition "sales_1_prt_1_2_prt_usa" for table "sales_1_prt_1"
NOTICE:  CREATE TABLE will create partition "sales_1_prt_1_2_prt_asia" for table "sales_1_prt_1"
NOTICE:  CREATE TABLE will create partition "sales_1_prt_1_2_prt_europe" for table "sales_1_prt_1"
NOTICE:  CREATE TABLE will create partition "sales_1_prt_2_2_prt_usa" for table "sales_1_prt_2"
NOTICE:  CREATE TABLE will create partition "sales_1_prt_2_2_prt_asia" for table "sales_1_prt_2"
NOTICE:  CREATE TABLE will create partition "sales_1_prt_2_2_prt_europe" for table "sales_1_prt_2"
NOTICE:  CREATE TABLE will create partition "sales_1_prt_3_2_prt_usa" for table "sales_1_prt_3"
NOTICE:  CREATE TABLE will create partition "sales_1_prt_3_2_prt_asia" for table "sales_1_prt_3"
NOTICE:  CREATE TABLE will create partition "sales_1_prt_3_2_prt_europe" for table "sales_1_prt_3"
NOTICE:  CREATE TABLE will create partition "sales_1_prt_4_2_prt_usa" for table "sales_1_prt_4"
NOTICE:  CREATE TABLE will create partition "sales_1_prt_4_2_prt_asia" for table "sales_1_prt_4"
NOTICE:  CREATE TABLE will create partition "sales_1_prt_4_2_prt_europe" for table "sales_1_prt_4"
NOTICE:  CREATE TABLE will create partition "sales_1_prt_5_2_prt_usa" for table "sales_1_prt_5"
NOTICE:  CREATE TABLE will create partition "sales_1_prt_5_2_prt_asia" for table "sales_1_prt_5"
NOTICE:  CREATE TABLE will create partition "sales_1_prt_5_2_prt_europe" for table "sales_1_prt_5"
NOTICE:  CREATE TABLE will create partition "sales_1_prt_6_2_prt_usa" for table "sales_1_prt_6"
NOTICE:  CREATE TABLE will create partition "sales_1_prt_6_2_prt_asia" for table "sales_1_prt_6"
NOTICE:  CREATE TABLE will create partition "sales_1_prt_6_2_prt_europe" for table "sales_1_prt_6"
NOTICE:  CREATE TABLE will create partition "sales_1_prt_7_2_prt_usa" for table "sales_1_prt_7"
NOTICE:  CREATE TABLE will create partition "sales_1_prt_7_2_prt_asia" for table "sales_1_prt_7"
NOTICE:  CREATE TABLE will create partition "sales_1_prt_7_2_prt_europe" for table "sales_1_prt_7"
NOTICE:  CREATE TABLE will create partition "sales_1_prt_8_2_prt_usa" for table "sales_1_prt_8"
NOTICE:  CREATE TABLE will create partition "sales_1_prt_8_2_prt_asia" for table "sales_1_prt_8"
NOTICE:  CREATE TABLE will create partition "sales_1_prt_8_2_prt_europe" for table "sales_1_prt_8"
NOTICE:  CREATE TABLE will create partition "sales_1_prt_9_2_prt_usa" for table "sales_1_prt_9"
NOTICE:  CREATE TABLE will create partition "sales_1_prt_9_2_prt_asia" for table "sales_1_prt_9"
NOTICE:  CREATE TABLE will create partition "sales_1_prt_9_2_prt_europe" for table "sales_1_prt_9"
NOTICE:  CREATE TABLE will create partition "sales_1_prt_10_2_prt_usa" for table "sales_1_prt_10"
NOTICE:  CREATE TABLE will create partition "sales_1_prt_10_2_prt_asia" for table "sales_1_prt_10"
NOTICE:  CREATE TABLE will create partition "sales_1_prt_10_2_prt_europe" for table "sales_1_prt_10"
NOTICE:  CREATE TABLE will create partition "sales_1_prt_11_2_prt_usa" for table "sales_1_prt_11"
NOTICE:  CREATE TABLE will create partition "sales_1_prt_11_2_prt_asia" for table "sales_1_prt_11"
NOTICE:  CREATE TABLE will create partition "sales_1_prt_11_2_prt_europe" for table "sales_1_prt_11"
NOTICE:  CREATE TABLE will create partition "sales_1_prt_12_2_prt_usa" for table "sales_1_prt_12"
NOTICE:  CREATE TABLE will create partition "sales_1_prt_12_2_prt_asia" for table "sales_1_prt_12"
NOTICE:  CREATE TABLE will create partition "sales_1_prt_12_2_prt_europe" for table "sales_1_prt_12"
insert into sales values(generate_series(1,10000),'2008-01-01',generate_series(1,10000), 'usa');
insert into sales values(generate_series(1,10000),'2008-01-01',generate_series(1,10000), 'asia');
insert into sales values(generate_series(1,10000),'2008-01-01',generate_series(1,10000), 'europe');
insert into sales values(generate_series(10001,20000),'2008-06-01',generate_series(1,10000), 'usa');
insert into sales values(generate_series(10001,20000),'2008-06-01',generate_series(1,10000), 'asia');
insert into sales values(generate_series(10001,20000),'2008-06-01',generate_series(1,10000), 'europe');
-- Partitioning an Existing Table
CREATE TABLE sales1 (LIKE sales) 
PARTITION BY RANGE (date) 
( START (date '2008-01-01') INCLUSIVE 
   END (date '2009-01-01') EXCLUSIVE 
   EVERY (INTERVAL '1 month') );
NOTICE:  Table doesn't have 'distributed by' clause, defaulting to distribution columns from LIKE table
NOTICE:  CREATE TABLE will create partition "sales1_1_prt_1" for table "sales1"
NOTICE:  CREATE TABLE will create partition "sales1_1_prt_2" for table "sales1"
NOTICE:  CREATE TABLE will create partition "sales1_1_prt_3" for table "sales1"
NOTICE:  CREATE TABLE will create partition "sales1_1_prt_4" for table "sales1"
NOTICE:  CREATE TABLE will create partition "sales1_1_prt_5" for table "sales1"
NOTICE:  CREATE TABLE will create partition "sales1_1_prt_6" for table "sales1"
NOTICE:  CREATE TABLE will create partition "sales1_1_prt_7" for table "sales1"
NOTICE:  CREATE TABLE will create partition "sales1_1_prt_8" for table "sales1"
NOTICE:  CREATE TABLE will create partition "sales1_1_prt_9" for table "sales1"
NOTICE:  CREATE TABLE will create partition "sales1_1_prt_10" for table "sales1"
NOTICE:  CREATE TABLE will create partition "sales1_1_prt_11" for table "sales1"
NOTICE:  CREATE TABLE will create partition "sales1_1_prt_12" for table "sales1"
INSERT INTO sales1 SELECT * FROM sales; 
-- Verifying Your Partition Strategy 
--Viewing Your Partition Design 
SELECT partitionboundary, partitiontablename, partitionname, 
partitionlevel, partitionrank FROM pg_partitions WHERE 
tablename='sales'; 
                                partitionboundary                                |     partitiontablename      | partitionname | partitionlevel | partitionrank 
---------------------------------------------------------------------------------+-----------------------------+---------------+----------------+---------------
 START ('01-01-2008'::date) END ('02-01-2008'::date) EVERY ('@ 1 mon'::interval) | sales_1_prt_1               |               |              0 |             1
 START ('02-01-2008'::date) END ('03-01-2008'::date) EVERY ('@ 1 mon'::interval) | sales_1_prt_2               |               |              0 |             2
 START ('03-01-2008'::date) END ('04-01-2008'::date) EVERY ('@ 1 mon'::interval) | sales_1_prt_3               |               |              0 |             3
 START ('04-01-2008'::date) END ('05-01-2008'::date) EVERY ('@ 1 mon'::interval) | sales_1_prt_4               |               |              0 |             4
 START ('05-01-2008'::date) END ('06-01-2008'::date) EVERY ('@ 1 mon'::interval) | sales_1_prt_5               |               |              0 |             5
 START ('06-01-2008'::date) END ('07-01-2008'::date) EVERY ('@ 1 mon'::interval) | sales_1_prt_6               |               |              0 |             6
 START ('07-01-2008'::date) END ('08-01-2008'::date) EVERY ('@ 1 mon'::interval) | sales_1_prt_7               |               |              0 |             7
 START ('08-01-2008'::date) END ('09-01-2008'::date) EVERY ('@ 1 mon'::interval) | sales_1_prt_8               |               |              0 |             8
 START ('09-01-2008'::date) END ('10-01-2008'::date) EVERY ('@ 1 mon'::interval) | sales_1_prt_9               |               |              0 |             9
 START ('10-01-2008'::date) END ('11-01-2008'::date) EVERY ('@ 1 mon'::interval) | sales_1_prt_10              |               |              0 |            10
 START ('11-01-2008'::date) END ('12-01-2008'::date) EVERY ('@ 1 mon'::interval) | sales_1_prt_11              |               |              0 |            11
 START ('12-01-2008'::date) END ('01-01-2009'::date) EVERY ('@ 1 mon'::interval) | sales_1_prt_12              |               |              0 |            12
 SUBPARTITION usa VALUES('usa')                                                  | sales_1_prt_1_2_prt_usa     | usa           |              1 |              
 SUBPARTITION asia VALUES('asia')                                                | sales_1_prt_1_2_prt_asia    | asia          |              1 |              
 SUBPARTITION europe VALUES('europe')                                            | sales_1_prt_1_2_prt_europe  | europe        |              1 |              
 SUBPARTITION usa VALUES('usa')                                                  | sales_1_prt_10_2_prt_usa    | usa           |              1 |              
 SUBPARTITION asia VALUES('asia')                                                | sales_1_prt_10_2_prt_asia   | asia          |              1 |              
 SUBPARTITION europe VALUES('europe')                                            | sales_1_prt_10_2_prt_europe | europe        |              1 |              
 SUBPARTITION usa VALUES('usa')                                                  | sales_1_prt_11_2_prt_usa    | usa           |              1 |              
 SUBPARTITION asia VALUES('asia')                                                | sales_1_prt_11_2_prt_asia   | asia          |              1 |              
 SUBPARTITION europe VALUES('europe')                                            | sales_1_prt_11_2_prt_europe | europe        |              1 |              
 SUBPARTITION usa VALUES('usa')                                                  | sales_1_prt_12_2_prt_usa    | usa           |              1 |              
 SUBPARTITION asia VALUES('asia')                                                | sales_1_prt_12_2_prt_asia   | asia          |              1 |              
 SUBPARTITION europe VALUES('europe')                                            | sales_1_prt_12_2_prt_europe | europe        |              1 |              
 SUBPARTITION usa VALUES('usa')                                                  | sales_1_prt_2_2_prt_usa     | usa           |              1 |              
 SUBPARTITION asia VALUES('asia')                                                | sales_1_prt_2_2_prt_asia    | asia          |              1 |              
 SUBPARTITION europe VALUES('europe')                                            | sales_1_prt_2_2_prt_europe  | europe        |              1 |              
 SUBPARTITION usa VALUES('usa')                                                  | sales_1_prt_3_2_prt_usa     | usa           |              1 |              
 SUBPARTITION asia VALUES('asia')                                                | sales_1_prt_3_2_prt_asia    | asia          |              1 |              
 SUBPARTITION europe VALUES('europe')                                            | sales_1_prt_3_2_prt_europe  | europe        |              1 |              
 SUBPARTITION usa VALUES('usa')                                                  | sales_1_prt_4_2_prt_usa     | usa           |              1 |              
 SUBPARTITION asia VALUES('asia')                                                | sales_1_prt_4_2_prt_asia    | asia          |              1 |              
 SUBPARTITION europe VALUES('europe')                                            | sales_1_prt_4_2_prt_europe  | europe        |              1 |              
 SUBPARTITION usa VALUES('usa')                                                  | sales_1_prt_5_2_prt_usa     | usa           |              1 |              
 SUBPARTITION asia VALUES('asia')                                                | sales_1_prt_5_2_prt_asia    | asia          |              1 |              
 SUBPARTITION europe VALUES('europe')                                            | sales_1_prt_5_2_prt_europe  | europe        |              1 |              
 SUBPARTITION usa VALUES('usa')                                                  | sales_1_prt_6_2_prt_usa     | usa           |              1 |              
 SUBPARTITION asia VALUES('asia')                                                | sales_1_prt_6_2_prt_asia    | asia          |              1 |              
 SUBPARTITION europe VALUES('europe')                                            | sales_1_prt_6_2_prt_europe  | europe        |              1 |              
 SUBPARTITION usa VALUES('usa')                                                  | sales_1_prt_7_2_prt_usa     | usa           |              1 |              
 SUBPARTITION asia VALUES('asia')                                                | sales_1_prt_7_2_prt_asia    | asia          |              1 |              
 SUBPARTITION europe VALUES('europe')                                            | sales_1_prt_7_2_prt_europe  | europe        |              1 |              
 SUBPARTITION usa VALUES('usa')                                                  | sales_1_prt_8_2_prt_usa     | usa           |              1 |              
 SUBPARTITION asia VALUES('asia')                                                | sales_1_prt_8_2_prt_asia    | asia          |              1 |              
 SUBPARTITION europe VALUES('europe')                                            | sales_1_prt_8_2_prt_europe  | europe        |              1 |              
 SUBPARTITION usa VALUES('usa')                                                  | sales_1_prt_9_2_prt_usa     | usa           |              1 |              
 SUBPARTITION asia VALUES('asia')                                                | sales_1_prt_9_2_prt_asia    | asia          |              1 |              
 SUBPARTITION europe VALUES('europe')                                            | sales_1_prt_9_2_prt_europe  | europe        |              1 |              
(48 rows)

-- Adding a New Partition 
ALTER TABLE sales ALTER PARTITION FOR (RANK(12)) 
      ADD PARTITION africa VALUES ('africa');
NOTICE:  CREATE TABLE will create partition "sales_1_prt_12_2_prt_africa" for table "sales_1_prt_12"
-- Adding a Default Partition
ALTER TABLE sales ADD DEFAULT PARTITION other;
NOTICE:  CREATE TABLE will create partition "sales_1_prt_other" for table "sales"
NOTICE:  CREATE TABLE will create partition "sales_1_prt_other_2_prt_usa" for table "sales_1_prt_other"
NOTICE:  CREATE TABLE will create partition "sales_1_prt_other_2_prt_asia" for table "sales_1_prt_other"
NOTICE:  CREATE TABLE will create partition "sales_1_prt_other_2_prt_europe" for table "sales_1_prt_other"
NOTICE:  CREATE TABLE will create partition "sales_1_prt_other_2_prt_africa" for table "sales_1_prt_other"
insert into sales values(generate_series(1,10000),'2009-01-01',generate_series(1,10000), 'usa');
insert into sales values(generate_series(1,10000),'2009-01-01',generate_series(1,10000), 'asia');
insert into sales values(generate_series(1,10000),'2009-01-01',generate_series(1,10000), 'europe');
-- Renaming a Partition
--ALTER TABLE sales RENAME PARTITION FOR ('2008-01-01') TO jan08;
ALTER TABLE sales RENAME PARTITION FOR (RANK(1)) TO jan08;
-- Dropping a Partition
ALTER TABLE sales DROP PARTITION FOR (RANK(1));
NOTICE:  dropped partition "jan08" for relation "sales" and its children
-- Truncating a Partition
ALTER TABLE sales TRUNCATE PARTITION FOR (RANK(1));
NOTICE:  truncated partition for rank 1 for relation "sales" and its children
-- Exchanging a Partition
CREATE TABLE sales2 (trans_id int, date date, amount 
decimal(9,2), region text) 
DISTRIBUTED BY (trans_id) 
PARTITION BY RANGE (date) 
( START (date '2008-01-01') INCLUSIVE 
   END (date '2009-01-01') EXCLUSIVE 
   EVERY (INTERVAL '1 month') ); 
NOTICE:  CREATE TABLE will create partition "sales2_1_prt_1" for table "sales2"
NOTICE:  CREATE TABLE will create partition "sales2_1_prt_2" for table "sales2"
NOTICE:  CREATE TABLE will create partition "sales2_1_prt_3" for table "sales2"
NOTICE:  CREATE TABLE will create partition "sales2_1_prt_4" for table "sales2"
NOTICE:  CREATE TABLE will create partition "sales2_1_prt_5" for table "sales2"
NOTICE:  CREATE TABLE will create partition "sales2_1_prt_6" for table "sales2"
NOTICE:  CREATE TABLE will create partition "sales2_1_prt_7" for table "sales2"
NOTICE:  CREATE TABLE will create partition "sales2_1_prt_8" for table "sales2"
NOTICE:  CREATE TABLE will create partition "sales2_1_prt_9" for table "sales2"
NOTICE:  CREATE TABLE will create partition "sales2_1_prt_10" for table "sales2"
NOTICE:  CREATE TABLE will create partition "sales2_1_prt_11" for table "sales2"
NOTICE:  CREATE TABLE will create partition "sales2_1_prt_12" for table "sales2"
insert into sales2 values(generate_series(1,10000),'2008-01-01',generate_series(1,10000), 'usa');
insert into sales2 values(generate_series(1,10000),'2008-01-01',generate_series(1,10000), 'asia');
insert into sales2 values(generate_series(1,10000),'2008-01-01',generate_series(1,10000), 'europe');
CREATE TABLE jan08 (trans_id int, date date, amount 
decimal(9,2), region text) 
DISTRIBUTED BY (trans_id) ;
ALTER TABLE sales2 EXCHANGE PARTITION FOR ('2008-01-01') WITH 
TABLE jan08;
-- Splitting a Partition
CREATE TABLE sales3 (trans_id int, date date, amount 
decimal(9,2), region text) 
DISTRIBUTED BY (trans_id) 
PARTITION BY RANGE (date) 
( START (date '2008-01-01') INCLUSIVE 
   END (date '2009-01-01') EXCLUSIVE 
   EVERY (INTERVAL '1 month') ); 
NOTICE:  CREATE TABLE will create partition "sales3_1_prt_1" for table "sales3"
NOTICE:  CREATE TABLE will create partition "sales3_1_prt_2" for table "sales3"
NOTICE:  CREATE TABLE will create partition "sales3_1_prt_3" for table "sales3"
NOTICE:  CREATE TABLE will create partition "sales3_1_prt_4" for table "sales3"
NOTICE:  CREATE TABLE will create partition "sales3_1_prt_5" for table "sales3"
NOTICE:  CREATE TABLE will create partition "sales3_1_prt_6" for table "sales3"
NOTICE:  CREATE TABLE will create partition "sales3_1_prt_7" for table "sales3"
NOTICE:  CREATE TABLE will create partition "sales3_1_prt_8" for table "sales3"
NOTICE:  CREATE TABLE will create partition "sales3_1_prt_9" for table "sales3"
NOTICE:  CREATE TABLE will create partition "sales3_1_prt_10" for table "sales3"
NOTICE:  CREATE TABLE will create partition "sales3_1_prt_11" for table "sales3"
NOTICE:  CREATE TABLE will create partition "sales3_1_prt_12" for table "sales3"
ALTER TABLE sales3 SPLIT PARTITION FOR ('2008-01-01') 
AT ('2008-01-16') 
INTO (PARTITION jan081to15, PARTITION jan0816to31);
NOTICE:  CREATE TABLE will create partition "sales3_1_prt_jan081to15" for table "sales3"
NOTICE:  CREATE TABLE will create partition "sales3_1_prt_jan0816to31" for table "sales3"
ALTER TABLE sales3 ADD DEFAULT PARTITION other;
NOTICE:  CREATE TABLE will create partition "sales3_1_prt_other" for table "sales3"
ALTER TABLE sales3 SPLIT DEFAULT PARTITION 
START ('2009-01-01') INCLUSIVE 
END ('2009-02-01') EXCLUSIVE 
INTO (PARTITION jan09, PARTITION other);
NOTICE:  exchanged partition "other" of relation "sales3" with relation "pg_temp_36538"
NOTICE:  dropped partition "other" for relation "sales3"
NOTICE:  CREATE TABLE will create partition "sales3_1_prt_jan09" for table "sales3"
NOTICE:  CREATE TABLE will create partition "sales3_1_prt_other" for table "sales3"
---------------------
--AO Partitions
---------------------
CREATE TABLE sales_ao (trans_id int, date date, amount 
decimal(9,2), region text) 
DISTRIBUTED BY (trans_id) 
PARTITION BY RANGE (date) 
SUBPARTITION BY LIST (region) 
SUBPARTITION TEMPLATE 
( SUBPARTITION usa VALUES ('usa'),  
  SUBPARTITION asia VALUES ('asia'),  
  SUBPARTITION europe VALUES ('europe') ) 
( START (date '2008-01-01') INCLUSIVE 
   END (date '2009-01-01') EXCLUSIVE 
   EVERY (INTERVAL '1 month')
   WITH (appendonly=true, compresslevel=5)); 
NOTICE:  CREATE TABLE will create partition "sales_ao_1_prt_1" for table "sales_ao"
NOTICE:  CREATE TABLE will create partition "sales_ao_1_prt_2" for table "sales_ao"
NOTICE:  CREATE TABLE will create partition "sales_ao_1_prt_3" for table "sales_ao"
NOTICE:  CREATE TABLE will create partition "sales_ao_1_prt_4" for table "sales_ao"
NOTICE:  CREATE TABLE will create partition "sales_ao_1_prt_5" for table "sales_ao"
NOTICE:  CREATE TABLE will create partition "sales_ao_1_prt_6" for table "sales_ao"
NOTICE:  CREATE TABLE will create partition "sales_ao_1_prt_7" for table "sales_ao"
NOTICE:  CREATE TABLE will create partition "sales_ao_1_prt_8" for table "sales_ao"
NOTICE:  CREATE TABLE will create partition "sales_ao_1_prt_9" for table "sales_ao"
NOTICE:  CREATE TABLE will create partition "sales_ao_1_prt_10" for table "sales_ao"
NOTICE:  CREATE TABLE will create partition "sales_ao_1_prt_11" for table "sales_ao"
NOTICE:  CREATE TABLE will create partition "sales_ao_1_prt_12" for table "sales_ao"
NOTICE:  CREATE TABLE will create partition "sales_ao_1_prt_1_2_prt_usa" for table "sales_ao_1_prt_1"
NOTICE:  CREATE TABLE will create partition "sales_ao_1_prt_1_2_prt_asia" for table "sales_ao_1_prt_1"
NOTICE:  CREATE TABLE will create partition "sales_ao_1_prt_1_2_prt_europe" for table "sales_ao_1_prt_1"
NOTICE:  CREATE TABLE will create partition "sales_ao_1_prt_2_2_prt_usa" for table "sales_ao_1_prt_2"
NOTICE:  CREATE TABLE will create partition "sales_ao_1_prt_2_2_prt_asia" for table "sales_ao_1_prt_2"
NOTICE:  CREATE TABLE will create partition "sales_ao_1_prt_2_2_prt_europe" for table "sales_ao_1_prt_2"
NOTICE:  CREATE TABLE will create partition "sales_ao_1_prt_3_2_prt_usa" for table "sales_ao_1_prt_3"
NOTICE:  CREATE TABLE will create partition "sales_ao_1_prt_3_2_prt_asia" for table "sales_ao_1_prt_3"
NOTICE:  CREATE TABLE will create partition "sales_ao_1_prt_3_2_prt_europe" for table "sales_ao_1_prt_3"
NOTICE:  CREATE TABLE will create partition "sales_ao_1_prt_4_2_prt_usa" for table "sales_ao_1_prt_4"
NOTICE:  CREATE TABLE will create partition "sales_ao_1_prt_4_2_prt_asia" for table "sales_ao_1_prt_4"
NOTICE:  CREATE TABLE will create partition "sales_ao_1_prt_4_2_prt_europe" for table "sales_ao_1_prt_4"
NOTICE:  CREATE TABLE will create partition "sales_ao_1_prt_5_2_prt_usa" for table "sales_ao_1_prt_5"
NOTICE:  CREATE TABLE will create partition "sales_ao_1_prt_5_2_prt_asia" for table "sales_ao_1_prt_5"
NOTICE:  CREATE TABLE will create partition "sales_ao_1_prt_5_2_prt_europe" for table "sales_ao_1_prt_5"
NOTICE:  CREATE TABLE will create partition "sales_ao_1_prt_6_2_prt_usa" for table "sales_ao_1_prt_6"
NOTICE:  CREATE TABLE will create partition "sales_ao_1_prt_6_2_prt_asia" for table "sales_ao_1_prt_6"
NOTICE:  CREATE TABLE will create partition "sales_ao_1_prt_6_2_prt_europe" for table "sales_ao_1_prt_6"
NOTICE:  CREATE TABLE will create partition "sales_ao_1_prt_7_2_prt_usa" for table "sales_ao_1_prt_7"
NOTICE:  CREATE TABLE will create partition "sales_ao_1_prt_7_2_prt_asia" for table "sales_ao_1_prt_7"
NOTICE:  CREATE TABLE will create partition "sales_ao_1_prt_7_2_prt_europe" for table "sales_ao_1_prt_7"
NOTICE:  CREATE TABLE will create partition "sales_ao_1_prt_8_2_prt_usa" for table "sales_ao_1_prt_8"
NOTICE:  CREATE TABLE will create partition "sales_ao_1_prt_8_2_prt_asia" for table "sales_ao_1_prt_8"
NOTICE:  CREATE TABLE will create partition "sales_ao_1_prt_8_2_prt_europe" for table "sales_ao_1_prt_8"
NOTICE:  CREATE TABLE will create partition "sales_ao_1_prt_9_2_prt_usa" for table "sales_ao_1_prt_9"
NOTICE:  CREATE TABLE will create partition "sales_ao_1_prt_9_2_prt_asia" for table "sales_ao_1_prt_9"
NOTICE:  CREATE TABLE will create partition "sales_ao_1_prt_9_2_prt_europe" for table "sales_ao_1_prt_9"
NOTICE:  CREATE TABLE will create partition "sales_ao_1_prt_10_2_prt_usa" for table "sales_ao_1_prt_10"
NOTICE:  CREATE TABLE will create partition "sales_ao_1_prt_10_2_prt_asia" for table "sales_ao_1_prt_10"
NOTICE:  CREATE TABLE will create partition "sales_ao_1_prt_10_2_prt_europe" for table "sales_ao_1_prt_10"
NOTICE:  CREATE TABLE will create partition "sales_ao_1_prt_11_2_prt_usa" for table "sales_ao_1_prt_11"
NOTICE:  CREATE TABLE will create partition "sales_ao_1_prt_11_2_prt_asia" for table "sales_ao_1_prt_11"
NOTICE:  CREATE TABLE will create partition "sales_ao_1_prt_11_2_prt_europe" for table "sales_ao_1_prt_11"
NOTICE:  CREATE TABLE will create partition "sales_ao_1_prt_12_2_prt_usa" for table "sales_ao_1_prt_12"
NOTICE:  CREATE TABLE will create partition "sales_ao_1_prt_12_2_prt_asia" for table "sales_ao_1_prt_12"
NOTICE:  CREATE TABLE will create partition "sales_ao_1_prt_12_2_prt_europe" for table "sales_ao_1_prt_12"
insert into sales_ao values(generate_series(1,10000),'2008-01-01',generate_series(1,10000), 'usa');
insert into sales_ao values(generate_series(1,10000),'2008-01-01',generate_series(1,10000), 'asia');
insert into sales_ao values(generate_series(1,10000),'2008-01-01',generate_series(1,10000), 'europe');
insert into sales_ao values(generate_series(10001,20000),'2008-06-01',generate_series(1,10000), 'usa');
insert into sales_ao values(generate_series(10001,20000),'2008-06-01',generate_series(1,10000), 'asia');
insert into sales_ao values(generate_series(10001,20000),'2008-06-01',generate_series(1,10000), 'europe');
-- Partitioning an Existing Table
CREATE TABLE sales_ao1 (LIKE sales_ao) 
PARTITION BY RANGE (date) 
( START (date '2008-01-01') INCLUSIVE 
   END (date '2009-01-01') EXCLUSIVE 
   EVERY (INTERVAL '1 month')
   WITH (appendonly=true, compresslevel=5));
NOTICE:  Table doesn't have 'distributed by' clause, defaulting to distribution columns from LIKE table
NOTICE:  CREATE TABLE will create partition "sales_ao1_1_prt_1" for table "sales_ao1"
NOTICE:  CREATE TABLE will create partition "sales_ao1_1_prt_2" for table "sales_ao1"
NOTICE:  CREATE TABLE will create partition "sales_ao1_1_prt_3" for table "sales_ao1"
NOTICE:  CREATE TABLE will create partition "sales_ao1_1_prt_4" for table "sales_ao1"
NOTICE:  CREATE TABLE will create partition "sales_ao1_1_prt_5" for table "sales_ao1"
NOTICE:  CREATE TABLE will create partition "sales_ao1_1_prt_6" for table "sales_ao1"
NOTICE:  CREATE TABLE will create partition "sales_ao1_1_prt_7" for table "sales_ao1"
NOTICE:  CREATE TABLE will create partition "sales_ao1_1_prt_8" for table "sales_ao1"
NOTICE:  CREATE TABLE will create partition "sales_ao1_1_prt_9" for table "sales_ao1"
NOTICE:  CREATE TABLE will create partition "sales_ao1_1_prt_10" for table "sales_ao1"
NOTICE:  CREATE TABLE will create partition "sales_ao1_1_prt_11" for table "sales_ao1"
NOTICE:  CREATE TABLE will create partition "sales_ao1_1_prt_12" for table "sales_ao1"
INSERT INTO sales_ao1 SELECT * FROM sales_ao; 
-- Verifying Your Partition Strategy 
--Viewing Your Partition Design 
SELECT partitionboundary, partitiontablename, partitionname, 
partitionlevel, partitionrank FROM pg_partitions WHERE 
tablename='sales_ao'; 
                                                    partitionboundary                                                    |       partitiontablename       | partitionname | partitionlevel | partitionrank 
-------------------------------------------------------------------------------------------------------------------------+--------------------------------+---------------+----------------+---------------
 START ('01-01-2008'::date) END ('02-01-2008'::date) EVERY ('@ 1 mon'::interval) WITH (appendonly=true, compresslevel=5) | sales_ao_1_prt_1               |               |              0 |             1
 START ('02-01-2008'::date) END ('03-01-2008'::date) EVERY ('@ 1 mon'::interval) WITH (appendonly=true, compresslevel=5) | sales_ao_1_prt_2               |               |              0 |             2
 START ('03-01-2008'::date) END ('04-01-2008'::date) EVERY ('@ 1 mon'::interval) WITH (appendonly=true, compresslevel=5) | sales_ao_1_prt_3               |               |              0 |             3
 START ('04-01-2008'::date) END ('05-01-2008'::date) EVERY ('@ 1 mon'::interval) WITH (appendonly=true, compresslevel=5) | sales_ao_1_prt_4               |               |              0 |             4
 START ('05-01-2008'::date) END ('06-01-2008'::date) EVERY ('@ 1 mon'::interval) WITH (appendonly=true, compresslevel=5) | sales_ao_1_prt_5               |               |              0 |             5
 START ('06-01-2008'::date) END ('07-01-2008'::date) EVERY ('@ 1 mon'::interval) WITH (appendonly=true, compresslevel=5) | sales_ao_1_prt_6               |               |              0 |             6
 START ('07-01-2008'::date) END ('08-01-2008'::date) EVERY ('@ 1 mon'::interval) WITH (appendonly=true, compresslevel=5) | sales_ao_1_prt_7               |               |              0 |             7
 START ('08-01-2008'::date) END ('09-01-2008'::date) EVERY ('@ 1 mon'::interval) WITH (appendonly=true, compresslevel=5) | sales_ao_1_prt_8               |               |              0 |             8
 START ('09-01-2008'::date) END ('10-01-2008'::date) EVERY ('@ 1 mon'::interval) WITH (appendonly=true, compresslevel=5) | sales_ao_1_prt_9               |               |              0 |             9
 START ('10-01-2008'::date) END ('11-01-2008'::date) EVERY ('@ 1 mon'::interval) WITH (appendonly=true, compresslevel=5) | sales_ao_1_prt_10              |               |              0 |            10
 START ('11-01-2008'::date) END ('12-01-2008'::date) EVERY ('@ 1 mon'::interval) WITH (appendonly=true, compresslevel=5) | sales_ao_1_prt_11              |               |              0 |            11
 START ('12-01-2008'::date) END ('01-01-2009'::date) EVERY ('@ 1 mon'::interval) WITH (appendonly=true, compresslevel=5) | sales_ao_1_prt_12              |               |              0 |            12
 SUBPARTITION usa VALUES('usa') WITH (appendonly=true, compresslevel=5)                                                  | sales_ao_1_prt_1_2_prt_usa     | usa           |              1 |              
 SUBPARTITION asia VALUES('asia') WITH (appendonly=true, compresslevel=5)                                                | sales_ao_1_prt_1_2_prt_asia    | asia          |              1 |              
 SUBPARTITION europe VALUES('europe') WITH (appendonly=true, compresslevel=5)                                            | sales_ao_1_prt_1_2_prt_europe  | europe        |              1 |              
 SUBPARTITION usa VALUES('usa') WITH (appendonly=true, compresslevel=5)                                                  | sales_ao_1_prt_10_2_prt_usa    | usa           |              1 |              
 SUBPARTITION asia VALUES('asia') WITH (appendonly=true, compresslevel=5)                                                | sales_ao_1_prt_10_2_prt_asia   | asia          |              1 |              
 SUBPARTITION europe VALUES('europe') WITH (appendonly=true, compresslevel=5)                                            | sales_ao_1_prt_10_2_prt_europe | europe        |              1 |              
 SUBPARTITION usa VALUES('usa') WITH (appendonly=true, compresslevel=5)                                                  | sales_ao_1_prt_11_2_prt_usa    | usa           |              1 |              
 SUBPARTITION asia VALUES('asia') WITH (appendonly=true, compresslevel=5)                                                | sales_ao_1_prt_11_2_prt_asia   | asia          |              1 |              
 SUBPARTITION europe VALUES('europe') WITH (appendonly=true, compresslevel=5)                                            | sales_ao_1_prt_11_2_prt_europe | europe        |              1 |              
 SUBPARTITION usa VALUES('usa') WITH (appendonly=true, compresslevel=5)                                                  | sales_ao_1_prt_12_2_prt_usa    | usa           |              1 |              
 SUBPARTITION asia VALUES('asia') WITH (appendonly=true, compresslevel=5)                                                | sales_ao_1_prt_12_2_prt_asia   | asia          |              1 |              
 SUBPARTITION europe VALUES('europe') WITH (appendonly=true, compresslevel=5)                                            | sales_ao_1_prt_12_2_prt_europe | europe        |              1 |              
 SUBPARTITION usa VALUES('usa') WITH (appendonly=true, compresslevel=5)                                                  | sales_ao_1_prt_2_2_prt_usa     | usa           |              1 |              
 SUBPARTITION asia VALUES('asia') WITH (appendonly=true, compresslevel=5)                                                | sales_ao_1_prt_2_2_prt_asia    | asia          |              1 |              
 SUBPARTITION europe VALUES('europe') WITH (appendonly=true, compresslevel=5)                                            | sales_ao_1_prt_2_2_prt_europe  | europe        |              1 |              
 SUBPARTITION usa VALUES('usa') WITH (appendonly=true, compresslevel=5)                                                  | sales_ao_1_prt_3_2_prt_usa     | usa           |              1 |              
 SUBPARTITION asia VALUES('asia') WITH (appendonly=true, compresslevel=5)                                                | sales_ao_1_prt_3_2_prt_asia    | asia          |              1 |              
 SUBPARTITION europe VALUES('europe') WITH (appendonly=true, compresslevel=5)                                            | sales_ao_1_prt_3_2_prt_europe  | europe        |              1 |              
 SUBPARTITION usa VALUES('usa') WITH (appendonly=true, compresslevel=5)                                                  | sales_ao_1_prt_4_2_prt_usa     | usa           |              1 |              
 SUBPARTITION asia VALUES('asia') WITH (appendonly=true, compresslevel=5)                                                | sales_ao_1_prt_4_2_prt_asia    | asia          |              1 |              
 SUBPARTITION europe VALUES('europe') WITH (appendonly=true, compresslevel=5)                                            | sales_ao_1_prt_4_2_prt_europe  | europe        |              1 |              
 SUBPARTITION usa VALUES('usa') WITH (appendonly=true, compresslevel=5)                                                  | sales_ao_1_prt_5_2_prt_usa     | usa           |              1 |              
 SUBPARTITION asia VALUES('asia') WITH (appendonly=true, compresslevel=5)                                                | sales_ao_1_prt_5_2_prt_asia    | asia          |              1 |              
 SUBPARTITION europe VALUES('europe') WITH (appendonly=true, compresslevel=5)                                            | sales_ao_1_prt_5_2_prt_europe  | europe        |              1 |              
 SUBPARTITION usa VALUES('usa') WITH (appendonly=true, compresslevel=5)                                                  | sales_ao_1_prt_6_2_prt_usa     | usa           |              1 |              
 SUBPARTITION asia VALUES('asia') WITH (appendonly=true, compresslevel=5)                                                | sales_ao_1_prt_6_2_prt_asia    | asia          |              1 |              
 SUBPARTITION europe VALUES('europe') WITH (appendonly=true, compresslevel=5)                                            | sales_ao_1_prt_6_2_prt_europe  | europe        |              1 |              
 SUBPARTITION usa VALUES('usa') WITH (appendonly=true, compresslevel=5)                                                  | sales_ao_1_prt_7_2_prt_usa     | usa           |              1 |              
 SUBPARTITION asia VALUES('asia') WITH (appendonly=true, compresslevel=5)                                                | sales_ao_1_prt_7_2_prt_asia    | asia          |              1 |              
 SUBPARTITION europe VALUES('europe') WITH (appendonly=true, compresslevel=5)                                            | sales_ao_1_prt_7_2_prt_europe  | europe        |              1 |              
 SUBPARTITION usa VALUES('usa') WITH (appendonly=true, compresslevel=5)                                                  | sales_ao_1_prt_8_2_prt_usa     | usa           |              1 |              
 SUBPARTITION asia VALUES('asia') WITH (appendonly=true, compresslevel=5)                                                | sales_ao_1_prt_8_2_prt_asia    | asia          |              1 |              
 SUBPARTITION europe VALUES('europe') WITH (appendonly=true, compresslevel=5)                                            | sales_ao_1_prt_8_2_prt_europe  | europe        |              1 |              
 SUBPARTITION usa VALUES('usa') WITH (appendonly=true, compresslevel=5)                                                  | sales_ao_1_prt_9_2_prt_usa     | usa           |              1 |              
 SUBPARTITION asia VALUES('asia') WITH (appendonly=true, compresslevel=5)                                                | sales_ao_1_prt_9_2_prt_asia    | asia          |              1 |              
 SUBPARTITION europe VALUES('europe') WITH (appendonly=true, compresslevel=5)                                            | sales_ao_1_prt_9_2_prt_europe  | europe        |              1 |              
(48 rows)

-- Adding a New Partition 
ALTER TABLE sales_ao ALTER PARTITION FOR (RANK(12)) 
      ADD PARTITION africa VALUES ('africa');
NOTICE:  CREATE TABLE will create partition "sales_ao_1_prt_12_2_prt_africa" for table "sales_ao_1_prt_12"
-- Adding a Default Partition
ALTER TABLE sales_ao ADD DEFAULT PARTITION other;
NOTICE:  CREATE TABLE will create partition "sales_ao_1_prt_other" for table "sales_ao"
NOTICE:  CREATE TABLE will create partition "sales_ao_1_prt_other_2_prt_usa" for table "sales_ao_1_prt_other"
NOTICE:  CREATE TABLE will create partition "sales_ao_1_prt_other_2_prt_asia" for table "sales_ao_1_prt_other"
NOTICE:  CREATE TABLE will create partition "sales_ao_1_prt_other_2_prt_europe" for table "sales_ao_1_prt_other"
NOTICE:  CREATE TABLE will create partition "sales_ao_1_prt_other_2_prt_africa" for table "sales_ao_1_prt_other"
insert into sales_ao values(generate_series(1,10000),'2009-01-01',generate_series(1,10000), 'usa');
insert into sales_ao values(generate_series(1,10000),'2009-01-01',generate_series(1,10000), 'asia');
insert into sales_ao values(generate_series(1,10000),'2009-01-01',generate_series(1,10000), 'europe');
-- Renaming a Partition
--ALTER TABLE sales_ao RENAME PARTITION FOR ('2008-01-01') TO jan08;
ALTER TABLE sales_ao RENAME PARTITION FOR (RANK(1)) TO jan08;
-- Dropping a Partition
ALTER TABLE sales_ao DROP PARTITION FOR (RANK(1));
NOTICE:  dropped partition "jan08" for relation "sales_ao" and its children
-- Truncating a Partition
ALTER TABLE sales_ao TRUNCATE PARTITION FOR (RANK(1));
NOTICE:  truncated partition for rank 1 for relation "sales_ao" and its children
-- Exchanging a Partition
CREATE TABLE sales_ao2 (trans_id int, date date, amount 
decimal(9,2), region text) 
DISTRIBUTED BY (trans_id) 
PARTITION BY RANGE (date) 
( START (date '2008-01-01') INCLUSIVE 
   END (date '2009-01-01') EXCLUSIVE 
   EVERY (INTERVAL '1 month')
   WITH (appendonly=true, compresslevel=5)); 
NOTICE:  CREATE TABLE will create partition "sales_ao2_1_prt_1" for table "sales_ao2"
NOTICE:  CREATE TABLE will create partition "sales_ao2_1_prt_2" for table "sales_ao2"
NOTICE:  CREATE TABLE will create partition "sales_ao2_1_prt_3" for table "sales_ao2"
NOTICE:  CREATE TABLE will create partition "sales_ao2_1_prt_4" for table "sales_ao2"
NOTICE:  CREATE TABLE will create partition "sales_ao2_1_prt_5" for table "sales_ao2"
NOTICE:  CREATE TABLE will create partition "sales_ao2_1_prt_6" for table "sales_ao2"
NOTICE:  CREATE TABLE will create partition "sales_ao2_1_prt_7" for table "sales_ao2"
NOTICE:  CREATE TABLE will create partition "sales_ao2_1_prt_8" for table "sales_ao2"
NOTICE:  CREATE TABLE will create partition "sales_ao2_1_prt_9" for table "sales_ao2"
NOTICE:  CREATE TABLE will create partition "sales_ao2_1_prt_10" for table "sales_ao2"
NOTICE:  CREATE TABLE will create partition "sales_ao2_1_prt_11" for table "sales_ao2"
NOTICE:  CREATE TABLE will create partition "sales_ao2_1_prt_12" for table "sales_ao2"
insert into sales_ao2 values(generate_series(1,1000),'2008-01-01',generate_series(1,1000), 'usa');
insert into sales_ao2 values(generate_series(1,1000),'2008-01-01',generate_series(1,1000), 'asia');
insert into sales_ao2 values(generate_series(1,1000),'2008-01-01',generate_series(1,1000), 'europe');
ALTER TABLE sales_ao2 EXCHANGE PARTITION FOR ('2008-01-01') WITH 
TABLE jan08;
-- Splitting a Partition
CREATE TABLE sales_ao3 (trans_id int, date date, amount 
decimal(9,2), region text) 
DISTRIBUTED BY (trans_id) 
PARTITION BY RANGE (date) 
( START (date '2008-01-01') INCLUSIVE 
   END (date '2009-01-01') EXCLUSIVE 
   EVERY (INTERVAL '1 month')
   WITH (appendonly=true, compresslevel=5)); 
NOTICE:  CREATE TABLE will create partition "sales_ao3_1_prt_1" for table "sales_ao3"
NOTICE:  CREATE TABLE will create partition "sales_ao3_1_prt_2" for table "sales_ao3"
NOTICE:  CREATE TABLE will create partition "sales_ao3_1_prt_3" for table "sales_ao3"
NOTICE:  CREATE TABLE will create partition "sales_ao3_1_prt_4" for table "sales_ao3"
NOTICE:  CREATE TABLE will create partition "sales_ao3_1_prt_5" for table "sales_ao3"
NOTICE:  CREATE TABLE will create partition "sales_ao3_1_prt_6" for table "sales_ao3"
NOTICE:  CREATE TABLE will create partition "sales_ao3_1_prt_7" for table "sales_ao3"
NOTICE:  CREATE TABLE will create partition "sales_ao3_1_prt_8" for table "sales_ao3"
NOTICE:  CREATE TABLE will create partition "sales_ao3_1_prt_9" for table "sales_ao3"
NOTICE:  CREATE TABLE will create partition "sales_ao3_1_prt_10" for table "sales_ao3"
NOTICE:  CREATE TABLE will create partition "sales_ao3_1_prt_11" for table "sales_ao3"
NOTICE:  CREATE TABLE will create partition "sales_ao3_1_prt_12" for table "sales_ao3"
ALTER TABLE sales_ao3 SPLIT PARTITION FOR ('2008-01-01') 
AT ('2008-01-16') 
INTO (PARTITION jan081to15, PARTITION jan0816to31);
NOTICE:  CREATE TABLE will create partition "sales_ao3_1_prt_jan081to15" for table "sales_ao3"
NOTICE:  CREATE TABLE will create partition "sales_ao3_1_prt_jan0816to31" for table "sales_ao3"
ALTER TABLE sales_ao3 ADD DEFAULT PARTITION other;
NOTICE:  CREATE TABLE will create partition "sales_ao3_1_prt_other" for table "sales_ao3"
ALTER TABLE sales_ao3 SPLIT DEFAULT PARTITION 
START ('2009-01-01') INCLUSIVE 
END ('2009-02-01') EXCLUSIVE 
INTO (PARTITION jan09, PARTITION other);
NOTICE:  exchanged partition "other" of relation "sales_ao3" with relation "pg_temp_40706"
NOTICE:  dropped partition "other" for relation "sales_ao3"
NOTICE:  CREATE TABLE will create partition "sales_ao3_1_prt_jan09" for table "sales_ao3"
NOTICE:  CREATE TABLE will create partition "sales_ao3_1_prt_other" for table "sales_ao3"
-------------------------
---Hybrid partitions
-------------------------
CREATE TABLE sales_hybrid (trans_id int, date date, amount 
decimal(9,2), region text) 
DISTRIBUTED BY (trans_id) 
PARTITION BY RANGE (date) 
SUBPARTITION BY LIST (region) 
SUBPARTITION TEMPLATE 
( SUBPARTITION usa VALUES ('usa'),  
  SUBPARTITION asia VALUES ('asia'),  
  SUBPARTITION europe VALUES ('europe') ) 
( START (date '2008-01-01') INCLUSIVE 
   END (date '2009-01-01') EXCLUSIVE 
   EVERY (INTERVAL '1 month')
   WITH (appendonly=true, compresslevel=5)); 
NOTICE:  CREATE TABLE will create partition "sales_hybrid_1_prt_1" for table "sales_hybrid"
NOTICE:  CREATE TABLE will create partition "sales_hybrid_1_prt_2" for table "sales_hybrid"
NOTICE:  CREATE TABLE will create partition "sales_hybrid_1_prt_3" for table "sales_hybrid"
NOTICE:  CREATE TABLE will create partition "sales_hybrid_1_prt_4" for table "sales_hybrid"
NOTICE:  CREATE TABLE will create partition "sales_hybrid_1_prt_5" for table "sales_hybrid"
NOTICE:  CREATE TABLE will create partition "sales_hybrid_1_prt_6" for table "sales_hybrid"
NOTICE:  CREATE TABLE will create partition "sales_hybrid_1_prt_7" for table "sales_hybrid"
NOTICE:  CREATE TABLE will create partition "sales_hybrid_1_prt_8" for table "sales_hybrid"
NOTICE:  CREATE TABLE will create partition "sales_hybrid_1_prt_9" for table "sales_hybrid"
NOTICE:  CREATE TABLE will create partition "sales_hybrid_1_prt_10" for table "sales_hybrid"
NOTICE:  CREATE TABLE will create partition "sales_hybrid_1_prt_11" for table "sales_hybrid"
NOTICE:  CREATE TABLE will create partition "sales_hybrid_1_prt_12" for table "sales_hybrid"
NOTICE:  CREATE TABLE will create partition "sales_hybrid_1_prt_1_2_prt_usa" for table "sales_hybrid_1_prt_1"
NOTICE:  CREATE TABLE will create partition "sales_hybrid_1_prt_1_2_prt_asia" for table "sales_hybrid_1_prt_1"
NOTICE:  CREATE TABLE will create partition "sales_hybrid_1_prt_1_2_prt_europe" for table "sales_hybrid_1_prt_1"
NOTICE:  CREATE TABLE will create partition "sales_hybrid_1_prt_2_2_prt_usa" for table "sales_hybrid_1_prt_2"
NOTICE:  CREATE TABLE will create partition "sales_hybrid_1_prt_2_2_prt_asia" for table "sales_hybrid_1_prt_2"
NOTICE:  CREATE TABLE will create partition "sales_hybrid_1_prt_2_2_prt_europe" for table "sales_hybrid_1_prt_2"
NOTICE:  CREATE TABLE will create partition "sales_hybrid_1_prt_3_2_prt_usa" for table "sales_hybrid_1_prt_3"
NOTICE:  CREATE TABLE will create partition "sales_hybrid_1_prt_3_2_prt_asia" for table "sales_hybrid_1_prt_3"
NOTICE:  CREATE TABLE will create partition "sales_hybrid_1_prt_3_2_prt_europe" for table "sales_hybrid_1_prt_3"
NOTICE:  CREATE TABLE will create partition "sales_hybrid_1_prt_4_2_prt_usa" for table "sales_hybrid_1_prt_4"
NOTICE:  CREATE TABLE will create partition "sales_hybrid_1_prt_4_2_prt_asia" for table "sales_hybrid_1_prt_4"
NOTICE:  CREATE TABLE will create partition "sales_hybrid_1_prt_4_2_prt_europe" for table "sales_hybrid_1_prt_4"
NOTICE:  CREATE TABLE will create partition "sales_hybrid_1_prt_5_2_prt_usa" for table "sales_hybrid_1_prt_5"
NOTICE:  CREATE TABLE will create partition "sales_hybrid_1_prt_5_2_prt_asia" for table "sales_hybrid_1_prt_5"
NOTICE:  CREATE TABLE will create partition "sales_hybrid_1_prt_5_2_prt_europe" for table "sales_hybrid_1_prt_5"
NOTICE:  CREATE TABLE will create partition "sales_hybrid_1_prt_6_2_prt_usa" for table "sales_hybrid_1_prt_6"
NOTICE:  CREATE TABLE will create partition "sales_hybrid_1_prt_6_2_prt_asia" for table "sales_hybrid_1_prt_6"
NOTICE:  CREATE TABLE will create partition "sales_hybrid_1_prt_6_2_prt_europe" for table "sales_hybrid_1_prt_6"
NOTICE:  CREATE TABLE will create partition "sales_hybrid_1_prt_7_2_prt_usa" for table "sales_hybrid_1_prt_7"
NOTICE:  CREATE TABLE will create partition "sales_hybrid_1_prt_7_2_prt_asia" for table "sales_hybrid_1_prt_7"
NOTICE:  CREATE TABLE will create partition "sales_hybrid_1_prt_7_2_prt_europe" for table "sales_hybrid_1_prt_7"
NOTICE:  CREATE TABLE will create partition "sales_hybrid_1_prt_8_2_prt_usa" for table "sales_hybrid_1_prt_8"
NOTICE:  CREATE TABLE will create partition "sales_hybrid_1_prt_8_2_prt_asia" for table "sales_hybrid_1_prt_8"
NOTICE:  CREATE TABLE will create partition "sales_hybrid_1_prt_8_2_prt_europe" for table "sales_hybrid_1_prt_8"
NOTICE:  CREATE TABLE will create partition "sales_hybrid_1_prt_9_2_prt_usa" for table "sales_hybrid_1_prt_9"
NOTICE:  CREATE TABLE will create partition "sales_hybrid_1_prt_9_2_prt_asia" for table "sales_hybrid_1_prt_9"
NOTICE:  CREATE TABLE will create partition "sales_hybrid_1_prt_9_2_prt_europe" for table "sales_hybrid_1_prt_9"
NOTICE:  CREATE TABLE will create partition "sales_hybrid_1_prt_10_2_prt_usa" for table "sales_hybrid_1_prt_10"
NOTICE:  CREATE TABLE will create partition "sales_hybrid_1_prt_10_2_prt_asia" for table "sales_hybrid_1_prt_10"
NOTICE:  CREATE TABLE will create partition "sales_hybrid_1_prt_10_2_prt_europe" for table "sales_hybrid_1_prt_10"
NOTICE:  CREATE TABLE will create partition "sales_hybrid_1_prt_11_2_prt_usa" for table "sales_hybrid_1_prt_11"
NOTICE:  CREATE TABLE will create partition "sales_hybrid_1_prt_11_2_prt_asia" for table "sales_hybrid_1_prt_11"
NOTICE:  CREATE TABLE will create partition "sales_hybrid_1_prt_11_2_prt_europe" for table "sales_hybrid_1_prt_11"
NOTICE:  CREATE TABLE will create partition "sales_hybrid_1_prt_12_2_prt_usa" for table "sales_hybrid_1_prt_12"
NOTICE:  CREATE TABLE will create partition "sales_hybrid_1_prt_12_2_prt_asia" for table "sales_hybrid_1_prt_12"
NOTICE:  CREATE TABLE will create partition "sales_hybrid_1_prt_12_2_prt_europe" for table "sales_hybrid_1_prt_12"
insert into sales_hybrid values(generate_series(1,1000),'2008-01-01',generate_series(1,1000), 'usa');
insert into sales_hybrid values(generate_series(1,1000),'2008-01-01',generate_series(1,1000), 'asia');
insert into sales_hybrid values(generate_series(1,1000),'2008-01-01',generate_series(1,1000), 'europe');
insert into sales_hybrid values(generate_series(1001,2000),'2008-06-01',generate_series(1,1000), 'usa');
insert into sales_hybrid values(generate_series(1001,2000),'2008-06-01',generate_series(1,1000), 'asia');
insert into sales_hybrid values(generate_series(1001,2000),'2008-06-01',generate_series(1,1000), 'europe');
-- Partitioning an Existing Table
CREATE TABLE sales_hybrid1 (LIKE sales_hybrid) 
PARTITION BY RANGE (date) 
( START (date '2008-01-01') INCLUSIVE 
   END (date '2009-01-01') EXCLUSIVE 
   EVERY (INTERVAL '1 month'));
NOTICE:  Table doesn't have 'distributed by' clause, defaulting to distribution columns from LIKE table
NOTICE:  CREATE TABLE will create partition "sales_hybrid1_1_prt_1" for table "sales_hybrid1"
NOTICE:  CREATE TABLE will create partition "sales_hybrid1_1_prt_2" for table "sales_hybrid1"
NOTICE:  CREATE TABLE will create partition "sales_hybrid1_1_prt_3" for table "sales_hybrid1"
NOTICE:  CREATE TABLE will create partition "sales_hybrid1_1_prt_4" for table "sales_hybrid1"
NOTICE:  CREATE TABLE will create partition "sales_hybrid1_1_prt_5" for table "sales_hybrid1"
NOTICE:  CREATE TABLE will create partition "sales_hybrid1_1_prt_6" for table "sales_hybrid1"
NOTICE:  CREATE TABLE will create partition "sales_hybrid1_1_prt_7" for table "sales_hybrid1"
NOTICE:  CREATE TABLE will create partition "sales_hybrid1_1_prt_8" for table "sales_hybrid1"
NOTICE:  CREATE TABLE will create partition "sales_hybrid1_1_prt_9" for table "sales_hybrid1"
NOTICE:  CREATE TABLE will create partition "sales_hybrid1_1_prt_10" for table "sales_hybrid1"
NOTICE:  CREATE TABLE will create partition "sales_hybrid1_1_prt_11" for table "sales_hybrid1"
NOTICE:  CREATE TABLE will create partition "sales_hybrid1_1_prt_12" for table "sales_hybrid1"
INSERT INTO sales_hybrid1 SELECT * FROM sales_hybrid; 
-- Verifying Your Partition Strategy 
--Viewing Your Partition Design 
SELECT partitionboundary, partitiontablename, partitionname, 
partitionlevel, partitionrank FROM pg_partitions WHERE 
tablename='sales_hybrid'; 
                                                    partitionboundary                                                    |         partitiontablename         | partitionname | partitionlevel | partitionrank 
-------------------------------------------------------------------------------------------------------------------------+------------------------------------+---------------+----------------+---------------
 START ('01-01-2008'::date) END ('02-01-2008'::date) EVERY ('@ 1 mon'::interval) WITH (appendonly=true, compresslevel=5) | sales_hybrid_1_prt_1               |               |              0 |             1
 START ('02-01-2008'::date) END ('03-01-2008'::date) EVERY ('@ 1 mon'::interval) WITH (appendonly=true, compresslevel=5) | sales_hybrid_1_prt_2               |               |              0 |             2
 START ('03-01-2008'::date) END ('04-01-2008'::date) EVERY ('@ 1 mon'::interval) WITH (appendonly=true, compresslevel=5) | sales_hybrid_1_prt_3               |               |              0 |             3
 START ('04-01-2008'::date) END ('05-01-2008'::date) EVERY ('@ 1 mon'::interval) WITH (appendonly=true, compresslevel=5) | sales_hybrid_1_prt_4               |               |              0 |             4
 START ('05-01-2008'::date) END ('06-01-2008'::date) EVERY ('@ 1 mon'::interval) WITH (appendonly=true, compresslevel=5) | sales_hybrid_1_prt_5               |               |              0 |             5
 START ('06-01-2008'::date) END ('07-01-2008'::date) EVERY ('@ 1 mon'::interval) WITH (appendonly=true, compresslevel=5) | sales_hybrid_1_prt_6               |               |              0 |             6
 START ('07-01-2008'::date) END ('08-01-2008'::date) EVERY ('@ 1 mon'::interval) WITH (appendonly=true, compresslevel=5) | sales_hybrid_1_prt_7               |               |              0 |             7
 START ('08-01-2008'::date) END ('09-01-2008'::date) EVERY ('@ 1 mon'::interval) WITH (appendonly=true, compresslevel=5) | sales_hybrid_1_prt_8               |               |              0 |             8
 START ('09-01-2008'::date) END ('10-01-2008'::date) EVERY ('@ 1 mon'::interval) WITH (appendonly=true, compresslevel=5) | sales_hybrid_1_prt_9               |               |              0 |             9
 START ('10-01-2008'::date) END ('11-01-2008'::date) EVERY ('@ 1 mon'::interval) WITH (appendonly=true, compresslevel=5) | sales_hybrid_1_prt_10              |               |              0 |            10
 START ('11-01-2008'::date) END ('12-01-2008'::date) EVERY ('@ 1 mon'::interval) WITH (appendonly=true, compresslevel=5) | sales_hybrid_1_prt_11              |               |              0 |            11
 START ('12-01-2008'::date) END ('01-01-2009'::date) EVERY ('@ 1 mon'::interval) WITH (appendonly=true, compresslevel=5) | sales_hybrid_1_prt_12              |               |              0 |            12
 SUBPARTITION usa VALUES('usa') WITH (appendonly=true, compresslevel=5)                                                  | sales_hybrid_1_prt_1_2_prt_usa     | usa           |              1 |              
 SUBPARTITION asia VALUES('asia') WITH (appendonly=true, compresslevel=5)                                                | sales_hybrid_1_prt_1_2_prt_asia    | asia          |              1 |              
 SUBPARTITION europe VALUES('europe') WITH (appendonly=true, compresslevel=5)                                            | sales_hybrid_1_prt_1_2_prt_europe  | europe        |              1 |              
 SUBPARTITION usa VALUES('usa') WITH (appendonly=true, compresslevel=5)                                                  | sales_hybrid_1_prt_10_2_prt_usa    | usa           |              1 |              
 SUBPARTITION asia VALUES('asia') WITH (appendonly=true, compresslevel=5)                                                | sales_hybrid_1_prt_10_2_prt_asia   | asia          |              1 |              
 SUBPARTITION europe VALUES('europe') WITH (appendonly=true, compresslevel=5)                                            | sales_hybrid_1_prt_10_2_prt_europe | europe        |              1 |              
 SUBPARTITION usa VALUES('usa') WITH (appendonly=true, compresslevel=5)                                                  | sales_hybrid_1_prt_11_2_prt_usa    | usa           |              1 |              
 SUBPARTITION asia VALUES('asia') WITH (appendonly=true, compresslevel=5)                                                | sales_hybrid_1_prt_11_2_prt_asia   | asia          |              1 |              
 SUBPARTITION europe VALUES('europe') WITH (appendonly=true, compresslevel=5)                                            | sales_hybrid_1_prt_11_2_prt_europe | europe        |              1 |              
 SUBPARTITION usa VALUES('usa') WITH (appendonly=true, compresslevel=5)                                                  | sales_hybrid_1_prt_12_2_prt_usa    | usa           |              1 |              
 SUBPARTITION asia VALUES('asia') WITH (appendonly=true, compresslevel=5)                                                | sales_hybrid_1_prt_12_2_prt_asia   | asia          |              1 |              
 SUBPARTITION europe VALUES('europe') WITH (appendonly=true, compresslevel=5)                                            | sales_hybrid_1_prt_12_2_prt_europe | europe        |              1 |              
 SUBPARTITION usa VALUES('usa') WITH (appendonly=true, compresslevel=5)                                                  | sales_hybrid_1_prt_2_2_prt_usa     | usa           |              1 |              
 SUBPARTITION asia VALUES('asia') WITH (appendonly=true, compresslevel=5)                                                | sales_hybrid_1_prt_2_2_prt_asia    | asia          |              1 |              
 SUBPARTITION europe VALUES('europe') WITH (appendonly=true, compresslevel=5)                                            | sales_hybrid_1_prt_2_2_prt_europe  | europe        |              1 |              
 SUBPARTITION usa VALUES('usa') WITH (appendonly=true, compresslevel=5)                                                  | sales_hybrid_1_prt_3_2_prt_usa     | usa           |              1 |              
 SUBPARTITION asia VALUES('asia') WITH (appendonly=true, compresslevel=5)                                                | sales_hybrid_1_prt_3_2_prt_asia    | asia          |              1 |              
 SUBPARTITION europe VALUES('europe') WITH (appendonly=true, compresslevel=5)                                            | sales_hybrid_1_prt_3_2_prt_europe  | europe        |              1 |              
 SUBPARTITION usa VALUES('usa') WITH (appendonly=true, compresslevel=5)                                                  | sales_hybrid_1_prt_4_2_prt_usa     | usa           |              1 |              
 SUBPARTITION asia VALUES('asia') WITH (appendonly=true, compresslevel=5)                                                | sales_hybrid_1_prt_4_2_prt_asia    | asia          |              1 |              
 SUBPARTITION europe VALUES('europe') WITH (appendonly=true, compresslevel=5)                                            | sales_hybrid_1_prt_4_2_prt_europe  | europe        |              1 |              
 SUBPARTITION usa VALUES('usa') WITH (appendonly=true, compresslevel=5)                                                  | sales_hybrid_1_prt_5_2_prt_usa     | usa           |              1 |              
 SUBPARTITION asia VALUES('asia') WITH (appendonly=true, compresslevel=5)                                                | sales_hybrid_1_prt_5_2_prt_asia    | asia          |              1 |              
 SUBPARTITION europe VALUES('europe') WITH (appendonly=true, compresslevel=5)                                            | sales_hybrid_1_prt_5_2_prt_europe  | europe        |              1 |              
 SUBPARTITION usa VALUES('usa') WITH (appendonly=true, compresslevel=5)                                                  | sales_hybrid_1_prt_6_2_prt_usa     | usa           |              1 |              
 SUBPARTITION asia VALUES('asia') WITH (appendonly=true, compresslevel=5)                                                | sales_hybrid_1_prt_6_2_prt_asia    | asia          |              1 |              
 SUBPARTITION europe VALUES('europe') WITH (appendonly=true, compresslevel=5)                                            | sales_hybrid_1_prt_6_2_prt_europe  | europe        |              1 |              
 SUBPARTITION usa VALUES('usa') WITH (appendonly=true, compresslevel=5)                                                  | sales_hybrid_1_prt_7_2_prt_usa     | usa           |              1 |              
 SUBPARTITION asia VALUES('asia') WITH (appendonly=true, compresslevel=5)                                                | sales_hybrid_1_prt_7_2_prt_asia    | asia          |              1 |              
 SUBPARTITION europe VALUES('europe') WITH (appendonly=true, compresslevel=5)                                            | sales_hybrid_1_prt_7_2_prt_europe  | europe        |              1 |              
 SUBPARTITION usa VALUES('usa') WITH (appendonly=true, compresslevel=5)                                                  | sales_hybrid_1_prt_8_2_prt_usa     | usa           |              1 |              
 SUBPARTITION asia VALUES('asia') WITH (appendonly=true, compresslevel=5)                                                | sales_hybrid_1_prt_8_2_prt_asia    | asia          |              1 |              
 SUBPARTITION europe VALUES('europe') WITH (appendonly=true, compresslevel=5)                                            | sales_hybrid_1_prt_8_2_prt_europe  | europe        |              1 |              
 SUBPARTITION usa VALUES('usa') WITH (appendonly=true, compresslevel=5)                                                  | sales_hybrid_1_prt_9_2_prt_usa     | usa           |              1 |              
 SUBPARTITION asia VALUES('asia') WITH (appendonly=true, compresslevel=5)                                                | sales_hybrid_1_prt_9_2_prt_asia    | asia          |              1 |              
 SUBPARTITION europe VALUES('europe') WITH (appendonly=true, compresslevel=5)                                            | sales_hybrid_1_prt_9_2_prt_europe  | europe        |              1 |              
(48 rows)

-- Adding a New Partition 
ALTER TABLE sales_hybrid ALTER PARTITION FOR (RANK(12)) 
      ADD PARTITION africa VALUES ('africa');
NOTICE:  CREATE TABLE will create partition "sales_hybrid_1_prt_12_2_prt_africa" for table "sales_hybrid_1_prt_12"
-- Adding a Default Partition
ALTER TABLE sales_hybrid ADD DEFAULT PARTITION other;
NOTICE:  CREATE TABLE will create partition "sales_hybrid_1_prt_other" for table "sales_hybrid"
NOTICE:  CREATE TABLE will create partition "sales_hybrid_1_prt_other_2_prt_usa" for table "sales_hybrid_1_prt_other"
NOTICE:  CREATE TABLE will create partition "sales_hybrid_1_prt_other_2_prt_asia" for table "sales_hybrid_1_prt_other"
NOTICE:  CREATE TABLE will create partition "sales_hybrid_1_prt_other_2_prt_europe" for table "sales_hybrid_1_prt_other"
NOTICE:  CREATE TABLE will create partition "sales_hybrid_1_prt_other_2_prt_africa" for table "sales_hybrid_1_prt_other"
insert into sales_hybrid values(generate_series(1,1000),'2009-01-01',generate_series(1,1000), 'usa');
insert into sales_hybrid values(generate_series(1,1000),'2009-01-01',generate_series(1,1000), 'asia');
insert into sales_hybrid values(generate_series(1,1000),'2009-01-01',generate_series(1,1000), 'europe');
-- Renaming a Partition
--ALTER TABLE sales_hybrid RENAME PARTITION FOR ('2008-01-01') TO jan08;
ALTER TABLE sales_hybrid RENAME PARTITION FOR (RANK(1)) TO jan08;
-- Dropping a Partition
ALTER TABLE sales_hybrid DROP PARTITION FOR (RANK(1));
NOTICE:  dropped partition "jan08" for relation "sales_hybrid" and its children
-- Truncating a Partition
ALTER TABLE sales_hybrid TRUNCATE PARTITION FOR (RANK(1));
NOTICE:  truncated partition for rank 1 for relation "sales_hybrid" and its children
-- Exchanging a Partition
CREATE TABLE sales_hybrid2 (trans_id int, date date, amount 
decimal(9,2), region text) 
DISTRIBUTED BY (trans_id) 
PARTITION BY RANGE (date) 
( START (date '2008-01-01') INCLUSIVE 
   END (date '2009-01-01') EXCLUSIVE 
   EVERY (INTERVAL '1 month')
   WITH (appendonly=true, compresslevel=5)); 
NOTICE:  CREATE TABLE will create partition "sales_hybrid2_1_prt_1" for table "sales_hybrid2"
NOTICE:  CREATE TABLE will create partition "sales_hybrid2_1_prt_2" for table "sales_hybrid2"
NOTICE:  CREATE TABLE will create partition "sales_hybrid2_1_prt_3" for table "sales_hybrid2"
NOTICE:  CREATE TABLE will create partition "sales_hybrid2_1_prt_4" for table "sales_hybrid2"
NOTICE:  CREATE TABLE will create partition "sales_hybrid2_1_prt_5" for table "sales_hybrid2"
NOTICE:  CREATE TABLE will create partition "sales_hybrid2_1_prt_6" for table "sales_hybrid2"
NOTICE:  CREATE TABLE will create partition "sales_hybrid2_1_prt_7" for table "sales_hybrid2"
NOTICE:  CREATE TABLE will create partition "sales_hybrid2_1_prt_8" for table "sales_hybrid2"
NOTICE:  CREATE TABLE will create partition "sales_hybrid2_1_prt_9" for table "sales_hybrid2"
NOTICE:  CREATE TABLE will create partition "sales_hybrid2_1_prt_10" for table "sales_hybrid2"
NOTICE:  CREATE TABLE will create partition "sales_hybrid2_1_prt_11" for table "sales_hybrid2"
NOTICE:  CREATE TABLE will create partition "sales_hybrid2_1_prt_12" for table "sales_hybrid2"
insert into sales_hybrid2 values(generate_series(1,1000),'2008-01-01',generate_series(1,1000), 'usa');
insert into sales_hybrid2 values(generate_series(1,1000),'2008-01-01',generate_series(1,1000), 'asia');
insert into sales_hybrid2 values(generate_series(1,1000),'2008-01-01',generate_series(1,1000), 'europe');
ALTER TABLE sales_hybrid2 EXCHANGE PARTITION FOR ('2008-01-01') WITH 
TABLE jan08;
-- Splitting a Partition
CREATE TABLE sales_hybrid3 (trans_id int, date date, amount 
decimal(9,2), region text) 
DISTRIBUTED BY (trans_id) 
PARTITION BY RANGE (date) 
( START (date '2008-01-01') INCLUSIVE 
   END (date '2009-01-01') EXCLUSIVE 
   EVERY (INTERVAL '1 month')
   WITH (appendonly=true, compresslevel=5)); 
NOTICE:  CREATE TABLE will create partition "sales_hybrid3_1_prt_1" for table "sales_hybrid3"
NOTICE:  CREATE TABLE will create partition "sales_hybrid3_1_prt_2" for table "sales_hybrid3"
NOTICE:  CREATE TABLE will create partition "sales_hybrid3_1_prt_3" for table "sales_hybrid3"
NOTICE:  CREATE TABLE will create partition "sales_hybrid3_1_prt_4" for table "sales_hybrid3"
NOTICE:  CREATE TABLE will create partition "sales_hybrid3_1_prt_5" for table "sales_hybrid3"
NOTICE:  CREATE TABLE will create partition "sales_hybrid3_1_prt_6" for table "sales_hybrid3"
NOTICE:  CREATE TABLE will create partition "sales_hybrid3_1_prt_7" for table "sales_hybrid3"
NOTICE:  CREATE TABLE will create partition "sales_hybrid3_1_prt_8" for table "sales_hybrid3"
NOTICE:  CREATE TABLE will create partition "sales_hybrid3_1_prt_9" for table "sales_hybrid3"
NOTICE:  CREATE TABLE will create partition "sales_hybrid3_1_prt_10" for table "sales_hybrid3"
NOTICE:  CREATE TABLE will create partition "sales_hybrid3_1_prt_11" for table "sales_hybrid3"
NOTICE:  CREATE TABLE will create partition "sales_hybrid3_1_prt_12" for table "sales_hybrid3"
ALTER TABLE sales_hybrid3 SPLIT PARTITION FOR ('2008-01-01') 
AT ('2008-01-16') 
INTO (PARTITION jan081to15, PARTITION jan0816to31);
NOTICE:  CREATE TABLE will create partition "sales_hybrid3_1_prt_jan081to15" for table "sales_hybrid3"
NOTICE:  CREATE TABLE will create partition "sales_hybrid3_1_prt_jan0816to31" for table "sales_hybrid3"
ALTER TABLE sales_hybrid3 ADD DEFAULT PARTITION other;
NOTICE:  CREATE TABLE will create partition "sales_hybrid3_1_prt_other" for table "sales_hybrid3"
ALTER TABLE sales_hybrid3 SPLIT DEFAULT PARTITION 
START ('2009-01-01') INCLUSIVE 
END ('2009-02-01') EXCLUSIVE 
INTO (PARTITION jan09, PARTITION other);
NOTICE:  exchanged partition "other" of relation "sales_hybrid3" with relation "pg_temp_44878"
NOTICE:  dropped partition "other" for relation "sales_hybrid3"
NOTICE:  CREATE TABLE will create partition "sales_hybrid3_1_prt_jan09" for table "sales_hybrid3"
NOTICE:  CREATE TABLE will create partition "sales_hybrid3_1_prt_other" for table "sales_hybrid3"
-- Visibility of data and objects--Update, Delete, Insert of data into a table
--Vaccuumed vs. Unvaccumed Data
--DROP TABLE
--TRUNCATE TABLE
--VACUUMED DATA
create database vacuum_data_db;
\c vacuum_data_db;
CREATE TABLE all_types(bit1 bit(1),bit2 bit varying(50), boolean1 boolean, char1 char(50), charvar1 character varying(50), char2 character(50),varchar1 varchar(50),date1 date,dp1 double precision,int1 integer, interval1 interval, numeric1 numeric, real1 real,smallint1 smallint,time1 time,bigint1 bigint,bigserial1 bigserial,bytea1 bytea,cidr1 cidr,decimal1 decimal,inet1 inet,macaddr1 macaddr,money1 money,serial1 serial,text1 text,time2 time without time zone,time3 time with time zone,time4 timestamp without time zone,time5 timestamp with time zone) distributed randomly; 
NOTICE:  CREATE TABLE will create implicit sequence "all_types_bigserial1_seq" for serial column "all_types.bigserial1"
NOTICE:  CREATE TABLE will create implicit sequence "all_types_serial1_seq" for serial column "all_types.serial1"
insert into all_types values ('1','0','t','c','varchar1','char1','varchar1','2001-11-11',234.23234,23,'24',234,23,4,'12:12:12',2,3,'d','0.0.0.0',1,'0.0.0.0','AA:AA:AA:AA:AA:AA','34.23',5,'text1','00:00:00','00:00:00+1359','2001-12-13 01:51:15','2001-12-13 01:51:15+1359');
insert into all_types values ('0','0','f','c','varchar2','char2','varchar2','2002-11-11',234.23234,23,'24',234,23,4,'12:12:12',2,3,'d','0.0.0.0',1,'0.0.0.0','BB:BB:BB:BB:BB:BB','34.23',5,'text2','00:00:00','00:00:00+1359','2002-12-13 01:51:15','2002-12-13 01:51:15+1359');
insert into all_types values ('1','0','t','c','varchar3','char3','varchar3','2003-11-11',234.23234,23,'24',234,23,4,'12:12:12',2,3,'d','0.0.0.0',1,'0.0.0.0','CC:CC:CC:CC:CC:CC','34.23',5,'text3','00:00:00','00:00:00+1359','2003-12-13 01:51:15','2003-12-13 01:51:15+1359');
insert into all_types values ('0','0','f','c','varchar4','char4','varchar4','2004-11-11',234.23234,23,'24',234,23,4,'12:12:12',2,3,'d','0.0.0.0',1,'0.0.0.0','DD:DD:DD:DD:DD:DD','34.23',5,'text4','00:00:00','00:00:00+1359','2004-12-13 01:51:15','2004-12-13 01:51:15+1359');
insert into all_types values ('1','0','t','c','varchar5','char5','varchar5','2005-11-11',234.23234,23,'24',234,23,4,'12:12:12',2,3,'d','0.0.0.0',1,'0.0.0.0','EE:EE:EE:EE:EE:EE','34.23',5,'text5','00:00:00','00:00:00+1359','2005-12-13 01:51:15','2005-12-13 01:51:15+1359');
update all_types set cidr1='1.1.1.1' where cidr1='0.0.0.0';
update all_types set bytea1='x' where bytea1='d';
update all_types set charvar1='hello' where charvar1='varchar1';
delete from all_types where  charvar1='varchar2';
delete from all_types where  date1 = '2003-11-11';
delete from all_types;
truncate all_types;
drop table all_types cascade;
CREATE EXTERNAL TABLE ext_table1 (
    a_party_id bigint,
    start_date date,
    start_time_hour smallint,
    start_time_min smallint,
    start_time_sec smallint,
    duration integer,
    record_dt timestamp without time zone,
    framed_ip_address character varying(15)
) LOCATION (
    'gpfdist://97.253.36.12:9010/R_LAA_DATA_2008-10-27.dat'
) FORMAT 'text' (delimiter ',' null '' )
ENCODING 'UTF8';
DROP EXTERNAL TABLE ext_table1;
vacuum ;
--UNVACUUMED DATA
create database unvacuum_data_db;
\c unvacuum_data_db
CREATE TABLE all_types(bit1 bit(1),bit2 bit varying(50), boolean1 boolean, char1 char(50), charvar1 character varying(50), char2 character(50),varchar1 varchar(50),date1 date,dp1 double precision,int1 integer, interval1 interval, numeric1 numeric, real1 real,smallint1 smallint,time1 time,bigint1 bigint,bigserial1 bigserial,bytea1 bytea,cidr1 cidr,decimal1 decimal,inet1 inet,macaddr1 macaddr,money1 money,serial1 serial,text1 text,time2 time without time zone,time3 time with time zone,time4 timestamp without time zone,time5 timestamp with time zone) distributed randomly;
NOTICE:  CREATE TABLE will create implicit sequence "all_types_bigserial1_seq" for serial column "all_types.bigserial1"
NOTICE:  CREATE TABLE will create implicit sequence "all_types_serial1_seq" for serial column "all_types.serial1"
insert into all_types values ('1','0','t','c','varchar1','char1','varchar1','2001-11-11',234.23234,23,'24',234,23,4,'12:12:12',2,3,'d','0.0.0.0',1,'0.0.0.0','AA:AA:AA:AA:AA:AA','34.23',5,'text1','00:00:00','00:00:00+1359','2001-12-13 01:51:15','2001-12-13 01:51:15+1359');
insert into all_types values ('0','0','f','c','varchar2','char2','varchar2','2002-11-11',234.23234,23,'24',234,23,4,'12:12:12',2,3,'d','0.0.0.0',1,'0.0.0.0','BB:BB:BB:BB:BB:BB','34.23',5,'text2','00:00:00','00:00:00+1359','2002-12-13 01:51:15','2002-12-13 01:51:15+1359');
insert into all_types values ('1','0','t','c','varchar3','char3','varchar3','2003-11-11',234.23234,23,'24',234,23,4,'12:12:12',2,3,'d','0.0.0.0',1,'0.0.0.0','CC:CC:CC:CC:CC:CC','34.23',5,'text3','00:00:00','00:00:00+1359','2003-12-13 01:51:15','2003-12-13 01:51:15+1359');
insert into all_types values ('0','0','f','c','varchar4','char4','varchar4','2004-11-11',234.23234,23,'24',234,23,4,'12:12:12',2,3,'d','0.0.0.0',1,'0.0.0.0','DD:DD:DD:DD:DD:DD','34.23',5,'text4','00:00:00','00:00:00+1359','2004-12-13 01:51:15','2004-12-13 01:51:15+1359');
insert into all_types values ('1','0','t','c','varchar5','char5','varchar5','2005-11-11',234.23234,23,'24',234,23,4,'12:12:12',2,3,'d','0.0.0.0',1,'0.0.0.0','EE:EE:EE:EE:EE:EE','34.23',5,'text5','00:00:00','00:00:00+1359','2005-12-13 01:51:15','2005-12-13 01:51:15+1359');
update all_types set cidr1='1.1.1.1' where cidr1='0.0.0.0';
update all_types set bytea1='x' where bytea1='d';
update all_types set charvar1='hello' where charvar1='varchar1';
delete from all_types where  charvar1='varchar2';
delete from all_types where  date1 = '2003-11-11';
delete from all_types;
truncate all_types;
drop table all_types cascade;
CREATE EXTERNAL TABLE ext_table1 (
    a_party_id bigint,
    start_date date,
    start_time_hour smallint,
    start_time_min smallint,
    start_time_sec smallint,
    duration integer,
    record_dt timestamp without time zone,
    framed_ip_address character varying(15)
) LOCATION (
    'gpfdist://97.253.36.12:9010/R_LAA_DATA_2008-10-27.dat'
) FORMAT 'text' (delimiter ',' null '' )
ENCODING 'UTF8';
DROP EXTERNAL TABLE ext_table1;
CREATE DATABASE cancel_trans;
\c cancel_trans
CREATE TABLE employee(ID int,name varchar(10),salary real,start_date date,city varchar(10),region char(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.
INSERT INTO employee values (1,'jason',40420,'02/01/2007','New York');
INSERT INTO employee values (2,'Robert',14420,'01/02/2007','Vacouver');
SELECT * FROM employee;
 id |  name  | salary | start_date |   city   | region 
----+--------+--------+------------+----------+--------
  1 | jason  |  40420 | 02-01-2007 | New York | 
  2 | Robert |  14420 | 01-02-2007 | Vacouver | 
(2 rows)

BEGIN work;
INSERT INTO employee(ID,name) values (106,'Hall');
INSERT INTO employee values (3,'ann',40420,'02/01/2008','CA');
INSERT INTO employee values (4,'ben',14420,'01/02/2009','Texus');
INSERT INTO employee values (5,'cen',40420,'02/01/2007','NJ');
INSERT INTO employee values (6,'den',14420,'01/02/2006','Vacouver');
INSERT INTO employee values (7,'emily',40420,'02/01/2005','New York');
INSERT INTO employee values (8,'fen',14420,'01/02/2004','Vacouver');
INSERT INTO employee values (9,'ivel',40420,'02/01/2003','MD');
INSERT INTO employee values (10,'sam',14420,'01/02/2002','OH');
INSERT INTO employee values (11,'jack',40420,'02/01/2001','VT');
INSERT INTO employee values (12,'tom',14420,'01/02/2000','CT');
COMMIT work;
BEGIN ; 
INSERT INTO employee(ID,salary) values ( generate_series(13,100),generate_series(13,100));
ROLLBACK ;
BEGIN;
CREATE SCHEMA admin;
create table admin.fact_shc_dly_opr_sls(
 vend_pack_id  integer        not null,
 locn_nbr    integer        not null,
 day_nbr       date           not null,
 trs_typ_cd   character(1)  not null,
 mds_sts       smallint       not null,
 trs_un_qt     integer       , 
 trs_cst_dlr  numeric(15,4) , 
 trs_sll_dlr   numeric(15,2) )
Distributed by (vend_pack_id, locn_nbr, day_nbr, trs_typ_cd, mds_sts);
insert into admin.fact_shc_dly_opr_sls values ( generate_series(1,100), generate_series(1,100),'2008-11-11','A',1,12,123,1234);
 insert into admin.fact_shc_dly_opr_sls values ( generate_series(1,100), generate_series(1,100),'2009-12-12','R',2,22,223,2234);
 insert into admin.fact_shc_dly_opr_sls values ( generate_series(1,100), generate_series(1,100),'2006-10-10','S',3,33,225,3334);
 insert into admin.fact_shc_dly_opr_sls values ( generate_series(1,100), generate_series(1,100),'2006-10-10','B',4,44,445,4444);
 insert into admin.fact_shc_dly_opr_sls values ( generate_series(1,100), generate_series(1,100),'2005-09-09','X',5,55,555,555);
ROLLBACK;
BEGIN;
    CREATE TABLE test_drop_column(
    toast_col text,
    bigint_col bigint,
    char_vary_col character varying(30),
    numeric_col numeric,
    int_col int4,
    float_col float4,
    int_array_col int[],
    non_toast_col numeric,
    a_ts_without timestamp without time zone,
    b_ts_with timestamp with time zone,
    date_column date,
    col_with_constraint numeric UNIQUE,
    col_with_default_text character varying(30) DEFAULT 'test1'
    ) distributed by (col_with_constraint);
NOTICE:  CREATE TABLE / UNIQUE will create implicit index "test_drop_column_col_with_constraint_key" for table "test_drop_column"
    insert into test_drop_column values ('0_zero', 0, '0_zero', 0, 0, 0, '{0}', 0, '2004-10-19 10:23:54', '2004-10-19 10:23:54+02', '1-1-2000',0);
    insert into test_drop_column values ('1_zero', 1, '1_zero', 1, 1, 1, '{1}', 1, '2005-10-19 10:23:54', '2005-10-19 10:23:54+02', '1-1-2001',1);
    insert into test_drop_column values ('2_zero', 2, '2_zero', 2, 2, 2, '{2}', 2, '2006-10-19 10:23:54', '2006-10-19 10:23:54+02', '1-1-2002',2);
    insert into test_drop_column select i||'_'||repeat('text',100),i,i||'_'||repeat('text',3),i,i,i,'{3}',i,'2006-10-19 10:23:54', '2006-10-19 10:23:54+02', '1-1-2002',i,i||'_'||repeat('text',3) from generate_series(3,500)i;
--drop toast column
    ALTER TABLE test_drop_column DROP COLUMN toast_col ;
--drop non toast column
    ALTER TABLE test_drop_column DROP COLUMN non_toast_col ;
--drop default
    ALTER TABLE test_drop_column ALTER COLUMN col_with_default_text DROP DEFAULT;
    ALTER TABLE test_drop_column ALTER COLUMN col_with_default_text SET DEFAULT 'test1';
    ALTER TABLE test_drop_column ADD COLUMN added_col character varying(30);
    ALTER TABLE test_drop_column RENAME COLUMN bigint_col TO after_rename_col; 
    ALTER TABLE test_drop_column ALTER COLUMN numeric_col SET NOT NULL; 
ROLLBACK;
\c db_test_bed
CREATE RESOURCE QUEUE db_resque1 ACTIVE THRESHOLD 2 COST THRESHOLD 2000.00;
CREATE RESOURCE QUEUE db_resque2 COST THRESHOLD 3000.00 OVERCOMMIT;
CREATE RESOURCE QUEUE DB_RESque3 COST THRESHOLD 2000.0 NOOVERCOMMIT;
CREATE RESOURCE QUEUE DB_RESQUE4 ACTIVE THRESHOLD 2  IGNORE THRESHOLD  1000.0;
ALTER RESOURCE QUEUE db_resque1 ACTIVE THRESHOLD 3 COST THRESHOLD 1000.00;
ALTER RESOURCE QUEUE db_resque2 COST THRESHOLD 300.00 NOOVERCOMMIT;
ALTER RESOURCE QUEUE DB_RESque3 COST THRESHOLD 200.0 OVERCOMMIT;
ALTER RESOURCE QUEUE DB_RESQUE4 ACTIVE THRESHOLD 5  IGNORE THRESHOLD  500.0;
\c db_test_bed
CREATE ROLE db_role1 WITH SUPERUSER CREATEDB  INHERIT LOGIN CONNECTION LIMIT  1 ENCRYPTED PASSWORD 'passwd';
CREATE ROLE db_role2 WITH NOSUPERUSER NOCREATEDB  NOINHERIT NOLOGIN  UNENCRYPTED PASSWORD 'passwd';
NOTICE:  resource queue required -- using default resource queue "pg_default"
CREATE ROLE db_role3 WITH NOCREATEROLE NOCREATEUSER;
NOTICE:  resource queue required -- using default resource queue "pg_default"
CREATE ROLE db_role4 WITH CREATEROLE CREATEUSER;
CREATE ROLE db_role5 WITH VALID UNTIL '2009-02-13 01:51:15';
NOTICE:  resource queue required -- using default resource queue "pg_default"
CREATE ROLE db_role6 WITH IN ROLE db_role1; 
NOTICE:  resource queue required -- using default resource queue "pg_default"
CREATE GROUP db_grp1;
NOTICE:  resource queue required -- using default resource queue "pg_default"
CREATE ROLE db_role7 WITH IN GROUP db_grp1; 
NOTICE:  resource queue required -- using default resource queue "pg_default"
CREATE ROLE db_role8 WITH ROLE db_role7;
NOTICE:  resource queue required -- using default resource queue "pg_default"
CREATE ROLE db_role9 WITH ADMIN db_role8;
NOTICE:  resource queue required -- using default resource queue "pg_default"
CREATE ROLE db_role10 WITH USER db_role1;
NOTICE:  resource queue required -- using default resource queue "pg_default"
CREATE ROLE db_role11 SYSID 100 ;
NOTICE:  SYSID can no longer be specified
NOTICE:  resource queue required -- using default resource queue "pg_default"
CREATE RESOURCE QUEUE db_resque1 ACTIVE THRESHOLD 2 COST THRESHOLD 2000.00;
ERROR:  resource queue "db_resque1" already exists
CREATE ROLE db_role12 RESOURCE QUEUE db_resque1;
ALTER ROLE db_role1 WITH NOSUPERUSER NOCREATEDB  NOINHERIT NOLOGIN  UNENCRYPTED PASSWORD 'passwd';
ALTER ROLE db_role2 WITH SUPERUSER CREATEDB  INHERIT LOGIN CONNECTION LIMIT  1 ENCRYPTED PASSWORD 'passwd';
ALTER ROLE db_role3 WITH CREATEROLE CREATEUSER;
ALTER ROLE db_role4 WITH NOCREATEROLE NOCREATEUSER;
ALTER ROLE db_role5 WITH VALID UNTIL '2009-06-13 01:51:15';
ALTER ROLE db_role6 WITH CONNECTION LIMIT 5;
ALTER ROLE db_role7 WITH RESOURCE QUEUE db_resque1;
ALTER ROLE db_role8 RENAME TO new_role8; 
CREATE SCHEMA db_schema1;
ALTER ROLE db_role9 SET search_path TO db_schema1;
ALTER ROLE db_role9 RESET search_path ;
\c db_test_bed
CREATE USER db_user1 WITH SUPERUSER CREATEDB  INHERIT LOGIN CONNECTION LIMIT  1 ENCRYPTED PASSWORD 'passwd';
CREATE USER db_user2 WITH NOSUPERUSER NOCREATEDB  NOINHERIT NOLOGIN  UNENCRYPTED PASSWORD 'passwd';
NOTICE:  resource queue required -- using default resource queue "pg_default"
CREATE USER db_user3 WITH NOCREATEROLE NOCREATEUSER;
NOTICE:  resource queue required -- using default resource queue "pg_default"
CREATE USER db_user4 WITH CREATEROLE CREATEUSER;
CREATE USER db_user5 WITH VALID UNTIL '2009-02-13 01:51:15';
NOTICE:  resource queue required -- using default resource queue "pg_default"
CREATE USER db_user6 WITH IN ROLE db_role1; 
NOTICE:  resource queue required -- using default resource queue "pg_default"
CREATE GROUP db_user_grp1;
NOTICE:  resource queue required -- using default resource queue "pg_default"
CREATE USER db_user7 WITH IN GROUP db_user_grp1; 
NOTICE:  resource queue required -- using default resource queue "pg_default"
CREATE USER db_user8 WITH ROLE db_user7;
NOTICE:  resource queue required -- using default resource queue "pg_default"
CREATE USER db_user9 WITH ADMIN db_user8;
NOTICE:  resource queue required -- using default resource queue "pg_default"
CREATE USER db_user10 WITH USER db_user1;
NOTICE:  resource queue required -- using default resource queue "pg_default"
CREATE USER db_user11 SYSID 100 ;
NOTICE:  SYSID can no longer be specified
NOTICE:  resource queue required -- using default resource queue "pg_default"
CREATE RESOURCE QUEUE resqueu3 ACTIVE THRESHOLD 1;
CREATE USER db_user12 RESOURCE QUEUE resqueu3;
ALTER USER db_user1 WITH NOSUPERUSER NOCREATEDB  NOINHERIT NOLOGIN  UNENCRYPTED PASSWORD 'passwd';
ALTER USER db_user2 WITH SUPERUSER CREATEDB  INHERIT LOGIN CONNECTION LIMIT  1 ENCRYPTED PASSWORD 'passwd';
ALTER USER db_user3 WITH CREATEROLE CREATEUSER;
ALTER USER db_user4 WITH NOCREATEROLE NOCREATEUSER;
ALTER USER db_user5 WITH VALID UNTIL '2009-06-13 01:51:15';
ALTER USER db_user6 WITH CONNECTION LIMIT 5;
CREATE RESOURCE QUEUE resqueu4 ACTIVE THRESHOLD 1;
ALTER USER db_user7 WITH RESOURCE QUEUE resqueu4;
ALTER USER db_user8 RENAME TO new_user8; 
CREATE SCHEMA db_schema2;
ALTER USER db_user9 SET search_path TO db_schema2;
ALTER USER db_user9 RESET search_path ;
\c db_test_bed
CREATE ROLE grp_role1;
NOTICE:  resource queue required -- using default resource queue "pg_default"
CREATE ROLE grp_role2;
NOTICE:  resource queue required -- using default resource queue "pg_default"
CREATE GROUP db_group1 WITH SUPERUSER CREATEDB  INHERIT LOGIN CONNECTION LIMIT  1 ENCRYPTED PASSWORD 'passwd';
CREATE GROUP db_grp2 WITH NOSUPERUSER NOCREATEDB  NOINHERIT NOLOGIN  UNENCRYPTED PASSWORD 'passwd';
NOTICE:  resource queue required -- using default resource queue "pg_default"
CREATE GROUP db_grp3 WITH NOCREATEROLE NOCREATEUSER;
NOTICE:  resource queue required -- using default resource queue "pg_default"
CREATE GROUP db_grp4 WITH CREATEROLE CREATEUSER;
CREATE GROUP db_grp5 WITH VALID UNTIL '2009-02-13 01:51:15';
NOTICE:  resource queue required -- using default resource queue "pg_default"
CREATE GROUP db_grp6 WITH IN ROLE grp_role1; 
NOTICE:  resource queue required -- using default resource queue "pg_default"
CREATE GROUP db_grp7 WITH IN GROUP db_group1; 
NOTICE:  resource queue required -- using default resource queue "pg_default"
CREATE GROUP db_grp8 WITH ROLE grp_role2;
NOTICE:  resource queue required -- using default resource queue "pg_default"
CREATE GROUP db_grp9 WITH ADMIN db_grp8;
NOTICE:  resource queue required -- using default resource queue "pg_default"
CREATE GROUP db_grp10 WITH USER db_group1;
NOTICE:  resource queue required -- using default resource queue "pg_default"
CREATE GROUP db_grp11 SYSID 100 ;
NOTICE:  SYSID can no longer be specified
NOTICE:  resource queue required -- using default resource queue "pg_default"
CREATE RESOURCE QUEUE grp_rsq1 ACTIVE THRESHOLD 1;
CREATE GROUP db_grp12 RESOURCE QUEUE grp_rsq1;
CREATE USER test_user_1;
NOTICE:  resource queue required -- using default resource queue "pg_default"
ALTER GROUP db_grp12 ADD USER test_user_1;
ALTER GROUP db_grp12 DROP USER test_user_1;
ALTER GROUP db_grp12 RENAME TO new_db_grp12;
ALTER GROUP new_db_grp12 RENAME TO db_grp12;
\c db_test_bed
CREATE TABLE test_emp (ename varchar(20),eno int,salary int,ssn int,gender char(1)) distributed by (ename,eno,gender);
CREATE UNIQUE INDEX eno_idx ON test_emp (eno);
NOTICE:  updating distribution policy to match new unique index
CREATE INDEX gender_bmp_idx ON test_emp USING bitmap (gender);
CREATE INDEX lower_ename_idex  ON test_emp ((upper(ename))) WHERE upper(ename)='JIM';
CREATE  INDEX ename_idx ON test_emp  (ename) WITH (fillfactor =80);
ALTER INDEX gender_bmp_idx RENAME TO new_gender_bmp_idx;
ALTER INDEX ename_idx SET (fillfactor =100);
ALTER INDEX ename_idx RESET (fillfactor) ;
\c db_test_bed
CREATE TEMPORARY SEQUENCE  db_seq1 START WITH 101;
CREATE TEMP SEQUENCE  db_seq2 START 101;
CREATE SEQUENCE db_seq3  INCREMENT BY 2 MINVALUE 1 MAXVALUE  100;
CREATE SEQUENCE db_seq4  INCREMENT BY 2 NO MINVALUE  NO MAXVALUE ;
CREATE SEQUENCE db_seq5  INCREMENT BY 2 MINVALUE 1 MAXVALUE  100  CACHE 100 CYCLE;
CREATE SEQUENCE db_seq6  INCREMENT BY 2 MINVALUE 1 MAXVALUE  100  NO CYCLE;
CREATE SEQUENCE db_seq7 START 101 OWNED BY NONE;
CREATE TABLE test_tbl ( col1 int, col2 int) DISTRIBUTED RANDOMLY;
INSERT INTO test_tbl values (generate_series(1,100),generate_series(1,100));
CREATE SEQUENCE db_seq8 START 101 OWNED BY test_tbl.col1;
ALTER TABLE test_tbl DROP COLUMN col1;
ALTER SEQUENCE db_seq1 RESTART WITH 100;
ALTER SEQUENCE db_seq2 INCREMENT BY 2 MINVALUE 101 MAXVALUE  400  CACHE 100 CYCLE;
ALTER SEQUENCE db_seq3  INCREMENT BY 2 NO MINVALUE  NO MAXVALUE;
ALTER SEQUENCE db_seq4 INCREMENT BY 2 MINVALUE 1 MAXVALUE  100;
ALTER SEQUENCE db_seq5 NO CYCLE;
CREATE SCHEMA db_schema9;
ALTER SEQUENCE db_seq6 SET SCHEMA db_schema9;
ALTER SEQUENCE db_seq7  OWNED BY test_tbl.col2;
ALTER SEQUENCE db_seq7  OWNED BY NONE;
\c db_test_bed
-- MPP-8466: set this GUC so that we can create database with latin8 encoding
-- 20100412: Ngoc
-- SET gp_check_locale_encoding_compatibility = off;
-- 20100414: Ngoc: GUC is not ported into 4.0 => remove ENCODING='latin8'
CREATE ROLE db_owner1;
NOTICE:  resource queue required -- using default resource queue "pg_default"
CREATE ROLE db_owner2;
NOTICE:  resource queue required -- using default resource queue "pg_default"
CREATE DATABASE db_name1 WITH OWNER = db_owner1 TEMPLATE =template1 CONNECTION LIMIT= 2;
--CREATE DATABASE db_name1 WITH OWNER = db_owner1 TEMPLATE =template1 ENCODING='latin8'  CONNECTION LIMIT= 2;
ALTER DATABASE db_name1 WITH  CONNECTION LIMIT 3;
ALTER DATABASE db_name1  RENAME TO new_db_name1;
ALTER DATABASE new_db_name1  OWNER TO db_owner2;
ALTER DATABASE new_db_name1 RENAME TO db_name1;
CREATE SCHEMA myschema;
ALTER DATABASE db_name1 SET search_path TO myschema, public, pg_catalog;
\echo -- start_ignore
-- start_ignore
ALTER DATABASE db_name1 RESET search_path;
\echo -- end_ignore
-- end_ignore
\c db_test_bed
CREATE USER db_user13;
NOTICE:  resource queue required -- using default resource queue "pg_default"
CREATE DATABASE db_schema_test owner db_user13;
\c  db_schema_test
CREATE SCHEMA db_schema5 AUTHORIZATION db_user13 ;
CREATE SCHEMA AUTHORIZATION db_user13;
ALTER SCHEMA db_user13 RENAME TO db_schema6;
ALTER SCHEMA  db_schema6 OWNER TO db_user13;
\c db_test_bed
CREATE DOMAIN domain_us_zip_code AS TEXT CHECK ( VALUE ~ E'\\d{5}$' OR VALUE ~ E'\\d{5}-\\d{4}$');
CREATE DOMAIN domain_1 AS int DEFAULT 1 CONSTRAINT cons_not_null NOT NULL;
CREATE DOMAIN domain_2 AS int CONSTRAINT cons_null NULL;
CREATE DOMAIN domain_3 AS TEXT ;
CREATE ROLE domain_owner;
NOTICE:  resource queue required -- using default resource queue "pg_default"
CREATE SCHEMA domain_schema;
ALTER DOMAIN domain_2 SET DEFAULT 1;
ALTER DOMAIN domain_2 DROP  DEFAULT;
ALTER DOMAIN domain_2 SET NOT NULL;
ALTER DOMAIN domain_2 DROP NOT NULL;
ALTER DOMAIN domain_3 ADD CONSTRAINT  domain_constraint3 CHECK (char_length(VALUE) = 5) ;
ALTER DOMAIN domain_3 DROP CONSTRAINT  domain_constraint3 RESTRICT;
ALTER DOMAIN domain_3 ADD CONSTRAINT  domain_constraint3 CHECK (char_length(VALUE) = 5);
ALTER DOMAIN domain_3 DROP CONSTRAINT domain_constraint3 CASCADE;
ALTER DOMAIN domain_3 OWNER TO domain_owner;
ALTER DOMAIN domain_3 SET SCHEMA domain_schema;
\c db_test_bed
CREATE OR REPLACE FUNCTION add(integer, integer) RETURNS integer 
    AS 'select $1 + $2;' 
    LANGUAGE SQL CONTAINS SQL
    STABLE
    RETURNS NULL ON NULL INPUT; 
CREATE OR REPLACE FUNCTION increment(i integer) RETURNS 
integer AS $$ 
        BEGIN 
                RETURN i + 1; 
        END; 
$$ LANGUAGE plpgsql NO SQL
VOLATILE; 
CREATE FUNCTION dup(in int, out f1 int, out f2 text) 
    AS $$ SELECT $1, CAST($1 AS text) || ' is text' $$ 
    LANGUAGE SQL IMMUTABLE STRICT CONTAINS SQL;
CREATE FUNCTION dup1(in int, out f1 int, out f2 text) 
    AS $$ SELECT $1, CAST($1 AS text) || ' is text' $$ 
    LANGUAGE SQL IMMUTABLE CONTAINS SQL CALLED ON NULL INPUT  EXTERNAL  SECURITY INVOKER  ;
CREATE FUNCTION dup2(in int, out f1 int, out f2 text) 
    AS $$ SELECT $1, CAST($1 AS text) || ' is text' $$ 
    LANGUAGE SQL IMMUTABLE CONTAINS SQL CALLED ON NULL INPUT  EXTERNAL  SECURITY DEFINER  ;
CREATE FUNCTION dup3(in int, out f1 int, out f2 text) 
    AS $$ SELECT $1, CAST($1 AS text) || ' is text' $$ 
    LANGUAGE SQL IMMUTABLE CONTAINS SQL CALLED ON NULL INPUT  SECURITY INVOKER  ;
CREATE FUNCTION dup4(in int, out f1 int, out f2 text) 
    AS $$ SELECT $1, CAST($1 AS text) || ' is text' $$ 
    LANGUAGE SQL IMMUTABLE CONTAINS SQL CALLED ON NULL INPUT  SECURITY DEFINER  ;
CREATE ROLE func_role;
NOTICE:  resource queue required -- using default resource queue "pg_default"
CREATE SCHEMA func_schema;
ALTER FUNCTION add(integer, integer) OWNER TO func_role;
ALTER FUNCTION add(integer, integer)  SET SCHEMA func_schema;
set search_path to func_schema;
ALTER FUNCTION add(integer, integer)  SET SCHEMA public;
set search_path to public;
ALTER FUNCTION add(integer, integer)   RENAME TO new_add;
ALTER FUNCTION new_add(integer, integer)   RENAME TO add;
ALTER FUNCTION dup(in int, out f1 int, out f2 text) RETURNS NULL ON NULL INPUT STABLE EXTERNAL SECURITY INVOKER;
ALTER FUNCTION dup(in int, out f1 int, out f2 text) CALLED ON NULL INPUT VOLATILE EXTERNAL SECURITY DEFINER;
ALTER FUNCTION dup(in int, out f1 int, out f2 text) IMMUTABLE STRICT SECURITY INVOKER;
ALTER FUNCTION dup(in int, out f1 int, out f2 text) IMMUTABLE STRICT SECURITY DEFINER;
\c db_test_bed
CREATE FUNCTION scube_accum(numeric, numeric) RETURNS 
numeric 
    AS 'select $1 + $2 * $2 * $2' 
    LANGUAGE SQL CONTAINS SQL
    IMMUTABLE 
    RETURNS NULL ON NULL INPUT; 
CREATE FUNCTION pre_accum(numeric, numeric) RETURNS 
numeric 
    AS 'select $1 + $2 * $2 * $2 * $2' 
    LANGUAGE SQL CONTAINS SQL
    IMMUTABLE 
    RETURNS NULL ON NULL INPUT; 
CREATE FUNCTION final_accum(numeric) RETURNS 
numeric 
    AS 'select $1 + $1 * $1' 
    LANGUAGE SQL CONTAINS SQL
    IMMUTABLE 
    RETURNS NULL ON NULL INPUT; 
CREATE AGGREGATE scube(numeric) ( 
    SFUNC = scube_accum, 
    STYPE = numeric, 
         PREFUNC =pre_accum,
       FINALFUNC =final_accum,
    INITCOND = 0 ,
          SORTOP = >); 
CREATE AGGREGATE old_scube ( 
	BASETYPE = numeric,
    SFUNC = scube_accum, 
    STYPE = numeric, 
       FINALFUNC =final_accum,
    INITCOND = 0 ,
          SORTOP = >); 
CREATE ROLE agg_owner;
NOTICE:  resource queue required -- using default resource queue "pg_default"
CREATE SCHEMA agg_schema;
ALTER AGGREGATE scube(numeric) RENAME TO new_scube;
ALTER AGGREGATE new_scube(numeric) RENAME TO scube;
ALTER AGGREGATE scube(numeric) OWNER TO agg_owner;
ALTER AGGREGATE scube(numeric) SET SCHEMA agg_schema;
\c db_test_bed
CREATE ROLE sally;
NOTICE:  resource queue required -- using default resource queue "pg_default"
CREATE ROLE ron;
NOTICE:  resource queue required -- using default resource queue "pg_default"
CREATE ROLE ken;
NOTICE:  resource queue required -- using default resource queue "pg_default"
CREATE ROLE admin;
NOTICE:  resource queue required -- using default resource queue "pg_default"
CREATE TABLE foo1 (i int, j int) DISTRIBUTED  RANDOMLY;
ALTER TABLE foo1 OWNER TO sally;
CREATE TABLE foo2 (i int, j int) DISTRIBUTED  RANDOMLY;
ALTER TABLE foo2 OWNER TO ron;
CREATE TABLE foo3 (i int, j int) DISTRIBUTED  RANDOMLY;
ALTER TABLE foo3 OWNER TO ken;
DROP OWNED by sally CASCADE;
DROP OWNED by ron RESTRICT;
DROP OWNED by ken;
CREATE TABLE foo1 (i int, j int) DISTRIBUTED  RANDOMLY;
ALTER TABLE foo1 OWNER TO sally;
CREATE TABLE foo2 (i int, j int) DISTRIBUTED  RANDOMLY;
ALTER TABLE foo2 OWNER TO ron;
CREATE TABLE foo3 (i int, j int) DISTRIBUTED  RANDOMLY;
ALTER TABLE foo3 OWNER TO ken;
REASSIGN OWNED BY sally,ron,ken to admin;
\c db_test_bed
    CREATE TABLE test_table(
    text_col text,
    bigint_col bigint,
    char_vary_col character varying(30),
    numeric_col numeric,
    int_col int4,
    float_col float4,
    int_array_col int[],
    before_rename_col int4,
    change_datatype_col numeric,
    a_ts_without timestamp without time zone,
    b_ts_with timestamp with time zone,
    date_column date,
    col_set_default numeric)DISTRIBUTED RANDOMLY;
    insert into test_table values ('0_zero', 0, '0_zero', 0, 0, 0, '{0}', 0, 0, '2004-10-19 10:23:54', '2004-10-19 10:23:54+02', '1-1-2000',0);
    insert into test_table values ('1_zero', 1, '1_zero', 1, 1, 1, '{1}', 1, 1, '2005-10-19 10:23:54', '2005-10-19 10:23:54+02', '1-1-2001',1);
    insert into test_table values ('2_zero', 2, '2_zero', 2, 2, 2, '{2}', 2, 2, '2006-10-19 10:23:54', '2006-10-19 10:23:54+02', '1-1-2002',2);
    insert into test_table select i||'_'||repeat('text',100),i,i||'_'||repeat('text',3),i,i,i,'{3}',i,i,'2006-10-19 10:23:54', '2006-10-19 10:23:54+02', '1-1-2002',i from generate_series(3,100)i;
    CREATE TABLE test_table1(
    text_col text,
    bigint_col bigint,
    char_vary_col character varying(30),
    numeric_col numeric,
    int_col int4,
    float_col float4,
    int_array_col int[],
    before_rename_col int4,
    change_datatype_col numeric,
    a_ts_without timestamp without time zone,
    b_ts_with timestamp with time zone,
    date_column date,
    col_set_default numeric)DISTRIBUTED RANDOMLY;
CREATE TABLE err_table1 (cmdtime timestamp with time zone, relname text, filename text, linenum integer, bytenum integer, errmsg text, rawdata text, rawbytes bytea) DISTRIBUTED RANDOMLY;    
    insert into test_table1 values ('0_zero', 0, '0_zero', 0, 0, 0, '{0}', 0, 0, '2004-10-19 10:23:54', '2004-10-19 10:23:54+02', '1-1-2000',0);
    insert into test_table1 values ('1_zero', 1, '1_zero', 1, 1, 1, '{1}', 1, 1, '2005-10-19 10:23:54', '2005-10-19 10:23:54+02', '1-1-2001',1);
    insert into test_table1 values ('2_zero', 2, '2_zero', 2, 2, 2, '{2}', 2, 2, '2006-10-19 10:23:54', '2006-10-19 10:23:54+02', '1-1-2002',2);
    insert into test_table1 select i||'_'||repeat('text',100),i,i||'_'||repeat('text',3),i,i,i,'{3}',i,i,'2006-10-19 10:23:54', '2006-10-19 10:23:54+02', '1-1-2002',i from generate_series(3,100)i;
    CREATE TABLE test_table2(
    text_col text,
    bigint_col bigint,
    char_vary_col character varying(30),
    numeric_col numeric,
    int_col int4,
    float_col float4,
    int_array_col int[],
    before_rename_col int4,
    change_datatype_col numeric,
    a_ts_without timestamp without time zone,
    b_ts_with timestamp with time zone,
    date_column date,
    col_set_default numeric) WITH OIDS DISTRIBUTED RANDOMLY;
NOTICE:  OIDS=TRUE is not recommended for user-created tables. Use OIDS=FALSE to prevent wrap-around of the OID counter
\echo -- start_ignore
-- start_ignore
    insert into test_table2 values ('0_zero', 0, '0_zero', 0, 0, 0, '{0}', 0, 0, '2004-10-19 10:23:54', '2004-10-19 10:23:54+02', '1-1-2000',0);
    insert into test_table2 values ('1_zero', 1, '1_zero', 1, 1, 1, '{1}', 1, 1, '2005-10-19 10:23:54', '2005-10-19 10:23:54+02', '1-1-2001',1);
    insert into test_table2 values ('2_zero', 2, '2_zero', 2, 2, 2, '{2}', 2, 2, '2006-10-19 10:23:54', '2006-10-19 10:23:54+02', '1-1-2002',2);
    insert into test_table2 select i||'_'||repeat('text',100),i,i||'_'||repeat('text',3),i,i,i,'{3}',i,i,'2006-10-19 10:23:54', '2006-10-19 10:23:54+02', '1-1-2002',i from generate_series(3,100)i;
\echo -- end_ignore
-- end_ignore
COPY (select * from test_table) TO 'data/test1_file_copy' WITH DELIMITER AS ',' NULL AS 'null string' ESCAPE AS E'\n' CSV HEADER QUOTE AS '"' FORCE QUOTE char_vary_col;
ERROR:  relative path not allowed for COPY to file
COPY (select * from test_table) TO 'data/test1_file_copy' WITH HEADER DELIMITER AS ',' NULL AS 'null string' ESCAPE AS E'\n' CSV QUOTE AS '"' FORCE QUOTE char_vary_col;
ERROR:  relative path not allowed for COPY to file
COPY test_table2(   text_col,    bigint_col,    char_vary_col,    numeric_col,    int_col,    float_col,    int_array_col,    before_rename_col,    change_datatype_col,    a_ts_without ,    b_ts_with ,    date_column,    col_set_default)
 TO 'data/test2_file_copy' WITH OIDS  DELIMITER AS ','  NULL AS 'null string' ESCAPE AS 'OFF' ;
ERROR:  relative path not allowed for COPY to file
2223
COPY test_table2 (   text_col,    bigint_col,    char_vary_col,    numeric_col,    int_col,    float_col,    int_array_col,    before_rename_col,    change_datatype_col,    a_ts_without ,    b_ts_with ,    date_column,    col_set_default) FROM 'data/test1_file_copy' WITH DELIMITER AS ',' NULL AS 'null string' ESCAPE AS E'\n' CSV HEADER QUOTE AS '"' FORCE NOT NULL date_column LOG ERRORS SEGMENT REJECT LIMIT 10 ROWS  ;
2224
ERROR:  could not open file "data/test1_file_copy" for reading: No such file or directory
2225
COPY test_table2 (   text_col,    bigint_col,    char_vary_col,    numeric_col,    int_col,    float_col,    int_array_col,    before_rename_col,    change_datatype_col,    a_ts_without ,    b_ts_with ,    date_column,    col_set_default) FROM 'data/test2_file_copy' WITH OIDS DELIMITER AS ',' NULL AS 'null string' ESCAPE AS 'OFF' LOG ERRORS SEGMENT REJECT LIMIT 10 PERCENT  ;
2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 2747 2748 2749 2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814
ERROR:  could not open file "data/test2_file_copy" for reading: No such file or directory
\c db_test_bed
CREATE OR REPLACE TEMP VIEW vista AS SELECT 'Hello World'; 
WARNING:  column "?column?" has type "unknown"
DETAIL:  Proceeding with relation creation anyway.
CREATE TEMPORARY VIEW vista1 AS SELECT text 'Hello World' AS hello;
CREATE TABLE test_emp_view (ename varchar(20),eno int,salary int,ssn int,gender char(1)) distributed by (ename,eno,gender);
CREATE VIEW emp_view AS SELECT ename ,eno ,salary ,ssn FROM test_emp_view WHERE salary >5000;
--Create the tables and views
CREATE TABLE sch_tbint (
    rnum integer NOT NULL,
    cbint bigint
) DISTRIBUTED BY (rnum);
COMMENT ON TABLE sch_tbint IS 'This describes table SCH_TBINT.';
CREATE TABLE sch_tchar (
    rnum integer NOT NULL,
    cchar character(32)
) DISTRIBUTED BY (rnum);
COMMENT ON TABLE sch_tchar IS 'This describes table SCH_TCHAR.';
CREATE TABLE sch_tclob (
    rnum integer NOT NULL,
    cclob text
) DISTRIBUTED BY (rnum);
COMMENT ON TABLE sch_tclob IS 'This describes table SCH_TCLOB.';
CREATE VIEW sch_vbint AS
    SELECT tbint.rnum, tbint.cbint FROM sch_tbint as tbint;
COMMENT ON VIEW sch_vbint IS 'This describes view SCH_VBINT.';
CREATE VIEW sch_vchar AS
    SELECT tchar.rnum, tchar.cchar FROM sch_tchar as tchar;
COMMENT ON VIEW sch_vchar IS 'This describes view SCH_VCHAR.';
CREATE VIEW sch_vclob AS
    SELECT tclob.rnum, tclob.cclob FROM sch_tclob as tclob;
COMMENT ON VIEW sch_vclob IS 'This describes view SCH_VCLOB.';
CREATE TABLE sch_tversion (
    rnum integer NOT NULL,
    c1 integer,
    cver character(6),
    cnnull integer,
    ccnull character(1)
) DISTRIBUTED BY (rnum);
COPY sch_tversion (rnum, c1, cver, cnnull, ccnull) FROM stdin;
CREATE TABLE sch_tjoin2 (
    rnum integer NOT NULL,
    c1 integer,
    c2 character(2)
) DISTRIBUTED BY (rnum);
COPY sch_tjoin2 (rnum, c1, c2) FROM stdin;
create view sch_view1001 as 
select 10 f1, 'BB' f2 from sch_tversion union
select sch_tjoin2.c1, sch_tjoin2.c2 from sch_tjoin2 where sch_tjoin2.c2 like '_B';
--Views with deep sliced queries
create table sch_T43(	C487 int,	C488 int,	C489 int,	C490 int,	C491 int,	C492 int,	C493 int,	C494 int,	C495 int,	C496 int,	C497 int,	C498 int,	C499 int,	C500 int,	C501 int) WITH (compresstype=zlib,compresslevel=1,appendonly=true,blocksize=1327104,checksum=true);
NOTICE:  Table doesn't have 'DISTRIBUTED BY' clause -- Using column named 'c487' 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.
COPY sch_T43 FROM STDIN delimiter '|';
create table sch_T33(	C383 int,	C384 int,	C385 int,	C386 int,	C387 int,	C388 int,	C389 int,	C390 int,	C391 int,	C392 int,	C393 int,	C394 int,	C395 int,	C396 int,	C397 int,	C398 int,	C399 int,	C400 int,	C401 int) WITH (compresstype=zlib,blocksize=548864,appendonly=true,compresslevel=2,checksum=true);
NOTICE:  Table doesn't have 'DISTRIBUTED BY' clause -- Using column named 'c383' 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 sch_T33 VALUES ( 5, 1, 3, 1, 5, 2, 4, 2, 2, 2, 4, 5, 3, 4, 1, 4, 2, 1, 3 );
INSERT INTO sch_T33 VALUES ( 2, 2, 1, 5, 2, 4, 3, 4, 5, 5, 2, 4, 2, 4, 2, 1, 2, 3, 5 );
INSERT INTO sch_T33 VALUES ( 1, 3, 2, 3, 5, 3, 2, 2, 5, 5, 5, 1, 4, 1, 5, 2, 4, 2, 4 );
INSERT INTO sch_T33 VALUES ( 1, 1, 4, 3, 1, 5, 1, 2, 1, 1, 3, 2, 4, 3, 5, 1, 1, 2, 2 );
INSERT INTO sch_T33 VALUES ( 1, 4, 1, 2, 5, 2, 5, 1, 4, 2, 3, 5, 3, 2, 3, 3, 2, 2, 4 );
INSERT INTO sch_T33 VALUES ( 4, 2, 5, 3, 4, 4, 3, 2, 1, 2, 1, 3, 3, 3, 5, 4, 2, 1, 4 );
INSERT INTO sch_T33 VALUES ( 2, 3, 1, 5, 2, 2, 3, 4, 2, 5, 2, 3, 4, 2, 4, 4, 5, 5, 3 );
INSERT INTO sch_T33 VALUES ( 3, 1, 2, 2, 2, 5, 3, 3, 3, 5, 3, 2, 2, 4, 3, 5, 3, 4, 1 );
INSERT INTO sch_T33 VALUES ( 2, 5, 5, 3, 1, 2, 4, 3, 3, 4, 1, 4, 3, 2, 5, 3, 2, 1, 1 );
INSERT INTO sch_T33 VALUES ( 1, 2, 5, 1, 2, 2, 4, 5, 2, 1, 2, 2, 3, 5, 3, 5, 5, 1, 2 );
create table sch_T29(	C334 int,	C335 int,	C336 int,	C337 int,	C338 int,	C339 int,	C340 int) WITH (compresstype=zlib,checksum=true,appendonly=true,blocksize=1155072,compresslevel=1);
NOTICE:  Table doesn't have 'DISTRIBUTED BY' clause -- Using column named 'c334' 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 sch_T29 VALUES ( 5, 1, 1, 3, 1, 2, 4 );
INSERT INTO sch_T29 VALUES ( 5, 5, 4, 3, 3, 3, 2 );
INSERT INTO sch_T29 VALUES ( 5, 1, 3, 2, 1, 5, 4 );
INSERT INTO sch_T29 VALUES ( 4, 1, 4, 4, 3, 2, 3 );
INSERT INTO sch_T29 VALUES ( 3, 4, 1, 5, 3, 3, 3 );
INSERT INTO sch_T29 VALUES ( 2, 5, 4, 3, 5, 3, 4 );
INSERT INTO sch_T29 VALUES ( 4, 5, 1, 1, 1, 3, 2 );
INSERT INTO sch_T29 VALUES ( 4, 5, 2, 1, 5, 3, 4 );
INSERT INTO sch_T29 VALUES ( 4, 5, 2, 1, 5, 3, 1 );
INSERT INTO sch_T29 VALUES ( 1, 2, 2, 2, 4, 3, 3 );
CREATE VIEW sch_view_ao (col1,col2,col3,col4,col5,col6) AS
SELECT
	DT102.C339
	, DT102.C340
	, DT100.C498
	, SUM( DT102.C339 )
	, SUM( DT102.C340 )
	, COUNT( DT100.C498 )
FROM
	(
		(
			sch_T43 DT100
		INNER JOIN
			sch_T33 DT101
		ON
			DT100.C498 = DT101.C401
		)
	INNER JOIN
		sch_T29 DT102
	ON
		DT101.C385 = DT102.C338
	)
WHERE
	(
		(
			DT101.C390 = DT100.C500
		)
		OR
		(
			(
				DT102.C338 <> DT101.C388
			)
			AND
			(
				DT102.C336 < DT100.C494
			)
		)
	)
	OR
	(
		(
			DT101.C391 < DT101.C399
		)
		AND
		(
			DT102.C335 = DT100.C490
		)
	)
GROUP BY
	DT100.C498
	, DT102.C339
	, DT102.C340
ORDER BY
	DT102.C339
	, DT102.C340
	, DT100.C498
	, SUM( DT102.C339 )
	, SUM( DT102.C340 )
	, COUNT( DT100.C498 )
LIMIT 497;
SELECT count(*) FROM sch_view_ao;
 count 
-------
    12
(1 row)

--Create view from set_returning_functions
create view sch_srf_view1 as select * from generate_series(1,10);
Select count(*) from sch_srf_view1;
 count 
-------
    10
(1 row)

--Create view from functions
CREATE FUNCTION sch_multiply(value integer,times integer) RETURNS integer AS $$
DECLARE
    res integer;
BEGIN
    RETURN $1*$2;
END;
 
$$ LANGUAGE plpgsql NO SQL;
create view sch_fn_view2 as select  sch_multiply(4,5);
Select * from sch_fn_view2;
 sch_multiply 
--------------
           20
(1 row)

\c db_test_bed
CREATE OR REPLACE FUNCTION int4(boolean)
  RETURNS int4 AS
$BODY$

SELECT CASE WHEN $1 THEN 1 ELSE 0 END;

$BODY$
  LANGUAGE 'sql' IMMUTABLE CONTAINS SQL;
\echo -- start_ignore
-- start_ignore
CREATE CAST (boolean AS int4) WITH FUNCTION int4(boolean) AS ASSIGNMENT;
ERROR:  cast from type pg_catalog.bool to type int4 already exists
CREATE CAST (varchar AS text) WITHOUT FUNCTION AS IMPLICIT;
ERROR:  cast from type pg_catalog.varchar to type text already exists
\echo -- end_ignore
-- end_ignore
\c ao_db
-- Heap Table 
CREATE TABLE retail_heap (
    datacenter character varying(32),
    poolname character varying(256),
    machinename character varying(256),
    transactionid character varying(32),
    threadid integer,
    transactionorder integer,
    eventclass character(1),
    eventtime timestamp(2) without time zone,
    eventtype character varying(256),
    eventname character varying(256),
    status character varying(256),
    duration numeric(18,2),
    data character varying(4096),
    value int,
    test text
) distributed randomly;
-- Insert values into the Heap Table
insert into retail_heap values ('den02','v3listingsintl','hr-wlst012','491539361b0000035e5be7d916',173,276,'A','2008-11-08 00:01:10.27','EXEC','2250293824','0',39.00,'userlookupreadhost',1,'value_1');
insert into retail_heap values ('den02','v3listingsintl','hr-wlst012','491539361b0000035e5be7d916',173,277,'A','2008-11-08 00:01:10.30','EXEC','3722270207','0',39.00,'userwrite17host',2,'value_2');
insert into retail_heap values ('den02','v3listingsintl','hr-wlst012','491539361b0000035e5be7d916',173,278,'A','2008-11-08 00:01:10.34','EXEC','2098551587','0',40.00,'userwrite17host',3,'value_3');
insert into retail_heap values ('den02','v3listingsintl','hr-wlst012','491539361b0000035e5be7d916',173,279,'A','2008-11-08 00:01:10.39','EXEC','1143318638','0',39.00,'userwrite17host',4,'value_4');
insert into retail_heap values ('den02','v3listingsintl','hr-wlst012','491539361b0000035e5be7d916',173,280,'A','2008-11-08 00:01:10.42','EXEC','1143318638','0',35.00,'userwrite17host',5,'value_5');
insert into retail_heap values ('den02','v3listingsintl','hr-wlst012','491539361b0000035e5be7d916',173,280,'A','2008-11-08 00:01:10.42','EXEC','1143318638','0',35.00,'userwrite17host',generate_series(6,100),repeat('text',100));
-- Select from the Heap Table
select count(*) from retail_heap ;
 count 
-------
   100
(1 row)

-- AO Table with zlib compression level 1
CREATE TABLE retail_zlib_1 (
    datacenter character varying(32),
    poolname character varying(256),
    machinename character varying(256),
    transactionid character varying(32),
    threadid integer,
    transactionorder integer,
    eventclass character(1),
    eventtime timestamp(2) without time zone,
    eventtype character varying(256),
    eventname character varying(256),
    status character varying(256),
    duration numeric(18,2),
    data character varying(4096),
    value int,
    test text
) WITH (appendonly=true, compresslevel=1, compresstype=zlib) distributed by (transactionid);
-- Insert values into the AO zlib 1 table
insert into retail_zlib_1 values ('den02','v3listingsintl','hr-wlst012','491539361b0000035e5be7d916',173,276,'A','2008-11-08 00:01:10.27','EXEC','2250293824','0',39.00,'userlookupreadhost',1,'value_1');
insert into retail_zlib_1 values ('den02','v3listingsintl','hr-wlst012','491539361b0000035e5be7d916',173,277,'A','2008-11-08 00:01:10.30','EXEC','3722270207','0',39.00,'userwrite17host',2,'value_2');
insert into retail_zlib_1 values ('den02','v3listingsintl','hr-wlst012','491539361b0000035e5be7d916',173,278,'A','2008-11-08 00:01:10.34','EXEC','2098551587','0',40.00,'userwrite17host',3,'value_3');
insert into retail_zlib_1 values ('den02','v3listingsintl','hr-wlst012','491539361b0000035e5be7d916',173,279,'A','2008-11-08 00:01:10.39','EXEC','1143318638','0',39.00,'userwrite17host',4,'value_4');
insert into retail_zlib_1 values ('den02','v3listingsintl','hr-wlst012','491539361b0000035e5be7d916',173,279,'A','2008-11-08 00:01:10.39','EXEC','1143318638','0',39.00,'userwrite17host',generate_series(5,100),repeat('text',100));
-- Select from AO zlib 3 table
select count(*) from retail_zlib_1 ;
 count 
-------
   100
(1 row)

-- AO Table with zlib compression level 1
CREATE TABLE retail_zlib1 (
    datacenter character varying(32),
    poolname character varying(256),
    machinename character varying(256),
    transactionid character varying(32),
    threadid integer,
    transactionorder integer,
    eventclass character(1),
    eventtime timestamp(2) without time zone,
    eventtype character varying(256),
    eventname character varying(256),
    status character varying(256),
    duration numeric(18,2),
    data character varying(4096),
    value int,
    test text
) WITH (appendonly=true, compresslevel=1, compresstype=zlib) distributed by (transactionid); 
-- Insert values into the AO zlib 1 table 
insert into retail_zlib1 values ('den02','v3listingsintl','hr-wlst012','491539361b0000035e5be7d916',173,276,'A','2008-11-08 00:01:10.27','EXEC','2250293824','0',39.00,'userlookupreadhost',1,'value_1');
insert into retail_zlib1 values ('den02','v3listingsintl','hr-wlst012','491539361b0000035e5be7d916',173,277,'A','2008-11-08 00:01:10.30','EXEC','3722270207','0',39.00,'userwrite17host',2,'value_2');
insert into retail_zlib1 values ('den02','v3listingsintl','hr-wlst012','491539361b0000035e5be7d916',173,278,'A','2008-11-08 00:01:10.34','EXEC','2098551587','0',40.00,'userwrite17host',3,'value_3');
insert into retail_zlib1 values ('den02','v3listingsintl','hr-wlst012','491539361b0000035e5be7d916',173,279,'A','2008-11-08 00:01:10.39','EXEC','1143318638','0',39.00,'userwrite17host',4,'value_4');
insert into retail_zlib1 values ('den02','v3listingsintl','hr-wlst012','491539361b0000035e5be7d916',173,280,'A','2008-11-08 00:01:10.42','EXEC','1143318638','0',35.00,'userwrite17host',5,'value_5');
insert into retail_zlib1 values ('den02','v3listingsintl','hr-wlst012','491539361b0000035e5be7d916',173,280,'A','2008-11-08 00:01:10.42','EXEC','1143318638','0',35.00,'userwrite17host',generate_series(6,100),repeat('text',100));
-- Select from AO zlib 1 table
select count(*) from retail_zlib1 ;
 count 
-------
   100
(1 row)

-- Adding checkpoint
checkpoint;
\c db_test_bed
CREATE TABLE heap_column_with_32k(
text_col1 text,
text_col2 text,
bigint_col bigint,
char_vary_col character varying(30),
numeric_col numeric,
int_col int4,
float_col float4,
int_array_col int[],
drop_col numeric,
before_rename_col int4,
change_datatype_col numeric,
a_ts_without timestamp without time zone,
b_ts_with timestamp with time zone,
date_column date) distributed randomly;
insert into heap_column_with_32k values ('0_zero','0_zero', 0, '0_zero', 0, 0, 0, '{0}', 0, 0, 0, '2004-10-19 10:23:54', '2004-10-19 10:23:54+02', '1-1-2000');
insert into heap_column_with_32k values ('1_zero','1_zero', 1, '1_zero', 1, 1, 1, '{1}', 1, 1, 1, '2005-10-19 10:23:54', '2005-10-19 10:23:54+02', '1-1-2001');
insert into heap_column_with_32k values ('2_zero','2_zero', 2, '2_zero', 2, 2, 2, '{2}', 2, 2, 2, '2006-10-19 10:23:54', '2006-10-19 10:23:54+02', '1-1-2002');
insert into heap_column_with_32k select i||'_'||repeat('text',30000),i||'_'||repeat('text',30000),i,i||'_'||repeat('text',3),i,i,i,'{3}',i,i,i,'2006-10-19 10:23:54', '2006-10-19 10:23:54+02', '1-1-2002' from generate_series(3,1000)i;
CREATE TABLE ao_column_with_32k(
text_col1 text,
text_col2 text,
bigint_col bigint,
char_vary_col character varying(30),
numeric_col numeric,
int_col int4,
float_col float4,
int_array_col int[],
drop_col numeric,
before_rename_col int4,
change_datatype_col numeric,
a_ts_without timestamp without time zone,
b_ts_with timestamp with time zone,
date_column date) with (appendonly=true) distributed randomly;
insert into ao_column_with_32k values ('0_zero','0_zero', 0, '0_zero', 0, 0, 0, '{0}', 0, 0, 0, '2004-10-19 10:23:54', '2004-10-19 10:23:54+02', '1-1-2000');
insert into ao_column_with_32k values ('1_zero','1_zero', 1, '1_zero', 1, 1, 1, '{1}', 1, 1, 1, '2005-10-19 10:23:54', '2005-10-19 10:23:54+02', '1-1-2001');
insert into ao_column_with_32k values ('2_zero','2_zero', 2, '2_zero', 2, 2, 2, '{2}', 2, 2, 2, '2006-10-19 10:23:54', '2006-10-19 10:23:54+02', '1-1-2002');
insert into ao_column_with_32k select i||'_'||repeat('text',30000),i||'_'||repeat('text',30000),i,i||'_'||repeat('text',3),i,i,i,'{3}',i,i,i,'2006-10-19 10:23:54', '2006-10-19 10:23:54+02', '1-1-2002' from generate_series(3,1000)i;
CREATE TABLE co_column_with_32k(
text_col1 text,
text_col2 text,
bigint_col bigint,
char_vary_col character varying(30),
numeric_col numeric,
int_col int4,
float_col float4,
int_array_col int[],
drop_col numeric,
before_rename_col int4,
change_datatype_col numeric,
a_ts_without timestamp without time zone,
b_ts_with timestamp with time zone,
date_column date) with (orientation='column',appendonly=true) distributed randomly;
insert into co_column_with_32k values ('0_zero','0_zero', 0, '0_zero', 0, 0, 0, '{0}', 0, 0, 0, '2004-10-19 10:23:54', '2004-10-19 10:23:54+02', '1-1-2000');
insert into co_column_with_32k values ('1_zero','1_zero', 1, '1_zero', 1, 1, 1, '{1}', 1, 1, 1, '2005-10-19 10:23:54', '2005-10-19 10:23:54+02', '1-1-2001');
insert into co_column_with_32k values ('2_zero','2_zero', 2, '2_zero', 2, 2, 2, '{2}', 2, 2, 2, '2006-10-19 10:23:54', '2006-10-19 10:23:54+02', '1-1-2002');
insert into co_column_with_32k select i||'_'||repeat('text',30000),i||'_'||repeat('text',30000),i,i||'_'||repeat('text',3),i,i,i,'{3}',i,i,i,'2006-10-19 10:23:54', '2006-10-19 10:23:54+02', '1-1-2002' from generate_series(3,1000)i;
\c db_test_bed
CREATE TABLE heap_table_unique_index(
text_col text,
bigint_col bigint,
char_vary_col character varying(30),
numeric_col numeric,
int_col int4,
float_col float4,
int_array_col int[],
drop_col numeric,
before_rename_col int4,
change_datatype_col numeric,
a_ts_without timestamp without time zone,
b_ts_with timestamp with time zone,
date_column date)
distributed by (text_col);
CREATE UNIQUE INDEX heap_table_unq_idx ON heap_table_unique_index (numeric_col);
NOTICE:  updating distribution policy to match new unique index
insert into heap_table_unique_index values ('0_zero', 0, '0_zero', 0, 0, 0, '{0}', 0, 0, 0, '2004-10-19 10:23:54', '2004-10-19 10:23:54+02', '1-1-2000');
insert into heap_table_unique_index values ('1_zero', 1, '1_zero', 1, 1, 1, '{1}', 1, 1, 1, '2005-10-19 10:23:54', '2005-10-19 10:23:54+02', '1-1-2001');
insert into heap_table_unique_index values ('2_zero', 2, '2_zero', 2, 2, 2, '{2}', 2, 2, 2, '2006-10-19 10:23:54', '2006-10-19 10:23:54+02', '1-1-2002');
insert into heap_table_unique_index select i||'_'||repeat('text',100),i,i||'_'||repeat('text',3),i,i,i,'{3}',i,i,i,'2006-10-19 10:23:54', '2006-10-19 10:23:54+02', '1-1-2002' from generate_series(3,100)i;
CREATE TABLE heap_table_btree_index(
text_col text,
bigint_col bigint,
char_vary_col character varying(30),
numeric_col numeric,
int_col int4,
float_col float4,
int_array_col int[],
drop_col numeric,
before_rename_col int4,
change_datatype_col numeric,
a_ts_without timestamp without time zone,
b_ts_with timestamp with time zone,
date_column date) ;
NOTICE:  Table doesn't have 'DISTRIBUTED BY' clause -- Using column named 'text_col' 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 INDEX heap_table_idx ON heap_table_btree_index (numeric_col);
insert into heap_table_btree_index values ('0_zero', 0, '0_zero', 0, 0, 0, '{0}', 0, 0, 0, '2004-10-19 10:23:54', '2004-10-19 10:23:54+02', '1-1-2000');
insert into heap_table_btree_index values ('1_zero', 1, '1_zero', 1, 1, 1, '{1}', 1, 1, 1, '2005-10-19 10:23:54', '2005-10-19 10:23:54+02', '1-1-2001');
insert into heap_table_btree_index values ('2_zero', 2, '2_zero', 2, 2, 2, '{2}', 2, 2, 2, '2006-10-19 10:23:54', '2006-10-19 10:23:54+02', '1-1-2002');
insert into heap_table_btree_index select i||'_'||repeat('text',100),i,i||'_'||repeat('text',3),i,i,i,'{3}',i,i,i,'2006-10-19 10:23:54', '2006-10-19 10:23:54+02', '1-1-2002' from generate_series(3,100)i;
CREATE TABLE heap_table_bitmap_index(
text_col text,
bigint_col bigint,
char_vary_col character varying(30),
numeric_col numeric,
int_col int4,
float_col float4,
int_array_col int[],
drop_col numeric,
before_rename_col int4,
change_datatype_col numeric,
a_ts_without timestamp without time zone,
b_ts_with timestamp with time zone,
date_column date) ;
NOTICE:  Table doesn't have 'DISTRIBUTED BY' clause -- Using column named 'text_col' 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 INDEX numeric_col_bm_idx ON heap_table_bitmap_index USING bitmap (numeric_col);;
insert into heap_table_bitmap_index values ('0_zero', 0, '0_zero', 0, 0, 0, '{0}', 0, 0, 0, '2004-10-19 10:23:54', '2004-10-19 10:23:54+02', '1-1-2000');
insert into heap_table_bitmap_index values ('1_zero', 1, '1_zero', 1, 1, 1, '{1}', 1, 1, 1, '2005-10-19 10:23:54', '2005-10-19 10:23:54+02', '1-1-2001');
insert into heap_table_bitmap_index values ('2_zero', 2, '2_zero', 2, 2, 2, '{2}', 2, 2, 2, '2006-10-19 10:23:54', '2006-10-19 10:23:54+02', '1-1-2002');
insert into heap_table_bitmap_index select i||'_'||repeat('text',100),i,i||'_'||repeat('text',3),i,i,i,'{3}',i,i,i,'2006-10-19 10:23:54', '2006-10-19 10:23:54+02', '1-1-2002' from generate_series(3,100)i;
\c db_test_bed
CREATE TABLE AO_table_btree_index(
text_col text,
bigint_col bigint,
char_vary_col character varying(30),
numeric_col numeric,
int_col int4,
float_col float4,
int_array_col int[],
drop_col numeric,
before_rename_col int4,
change_datatype_col numeric,
a_ts_without timestamp without time zone,
b_ts_with timestamp with time zone,
date_column date) WITH (appendonly=true);
NOTICE:  Table doesn't have 'DISTRIBUTED BY' clause -- Using column named 'text_col' 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 INDEX AO_table_idx ON AO_table_btree_index USING bitmap (numeric_col);
insert into AO_table_btree_index values ('0_zero', 0, '0_zero', 0, 0, 0, '{0}', 0, 0, 0, '2004-10-19 10:23:54', '2004-10-19 10:23:54+02', '1-1-2000');
insert into AO_table_btree_index values ('1_zero', 1, '1_zero', 1, 1, 1, '{1}', 1, 1, 1, '2005-10-19 10:23:54', '2005-10-19 10:23:54+02', '1-1-2001');
insert into AO_table_btree_index values ('2_zero', 2, '2_zero', 2, 2, 2, '{2}', 2, 2, 2, '2006-10-19 10:23:54', '2006-10-19 10:23:54+02', '1-1-2002');
insert into AO_table_btree_index select i||'_'||repeat('text',100),i,i||'_'||repeat('text',3),i,i,i,'{3}',i,i,i,'2006-10-19 10:23:54', '2006-10-19 10:23:54+02', '1-1-2002' from generate_series(3,100)i;
CREATE TABLE AO_table_bitmap_index(
text_col text,
bigint_col bigint,
char_vary_col character varying(30),
numeric_col numeric,
int_col int4,
float_col float4,
int_array_col int[],
drop_col numeric,
before_rename_col int4,
change_datatype_col numeric,
a_ts_without timestamp without time zone,
b_ts_with timestamp with time zone,
date_column date) WITH (appendonly=true);
NOTICE:  Table doesn't have 'DISTRIBUTED BY' clause -- Using column named 'text_col' 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 INDEX ao_numeric_col_bm_idx ON AO_table_bitmap_index USING bitmap (numeric_col);
insert into AO_table_bitmap_index values ('0_zero', 0, '0_zero', 0, 0, 0, '{0}', 0, 0, 0, '2004-10-19 10:23:54', '2004-10-19 10:23:54+02', '1-1-2000');
insert into AO_table_bitmap_index values ('1_zero', 1, '1_zero', 1, 1, 1, '{1}', 1, 1, 1, '2005-10-19 10:23:54', '2005-10-19 10:23:54+02', '1-1-2001');
insert into AO_table_bitmap_index values ('2_zero', 2, '2_zero', 2, 2, 2, '{2}', 2, 2, 2, '2006-10-19 10:23:54', '2006-10-19 10:23:54+02', '1-1-2002');
insert into AO_table_bitmap_index select i||'_'||repeat('text',100),i,i||'_'||repeat('text',3),i,i,i,'{3}',i,i,i,'2006-10-19 10:23:54', '2006-10-19 10:23:54+02', '1-1-2002' from generate_series(3,100)i;
\c db_test_bed
CREATE TABLE CO_table_btree_index(
text_col text,
bigint_col bigint,
char_vary_col character varying(30),
numeric_col numeric,
int_col int4,
float_col float4,
int_array_col int[],
drop_col numeric,
before_rename_col int4,
change_datatype_col numeric,
a_ts_without timestamp without time zone,
b_ts_with timestamp with time zone,
date_column date) WITH (orientation='column', appendonly=true);
NOTICE:  Table doesn't have 'DISTRIBUTED BY' clause -- Using column named 'text_col' 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 INDEX CO_table_idx ON CO_table_btree_index (numeric_col);
insert into CO_table_btree_index values ('0_zero', 0, '0_zero', 0, 0, 0, '{0}', 0, 0, 0, '2004-10-19 10:23:54', '2004-10-19 10:23:54+02', '1-1-2000');
insert into CO_table_btree_index values ('1_zero', 1, '1_zero', 1, 1, 1, '{1}', 1, 1, 1, '2005-10-19 10:23:54', '2005-10-19 10:23:54+02', '1-1-2001');
insert into CO_table_btree_index values ('2_zero', 2, '2_zero', 2, 2, 2, '{2}', 2, 2, 2, '2006-10-19 10:23:54', '2006-10-19 10:23:54+02', '1-1-2002');
insert into CO_table_btree_index select i||'_'||repeat('text',100),i,i||'_'||repeat('text',3),i,i,i,'{3}',i,i,i,'2006-10-19 10:23:54', '2006-10-19 10:23:54+02', '1-1-2002' from generate_series(3,100)i;
CREATE TABLE CO_table_bitmap_index(
text_col text,
bigint_col bigint,
char_vary_col character varying(30),
numeric_col numeric,
int_col int4,
float_col float4,
int_array_col int[],
drop_col numeric,
before_rename_col int4,
change_datatype_col numeric,
a_ts_without timestamp without time zone,
b_ts_with timestamp with time zone,
date_column date) WITH (orientation='column', appendonly=true);
NOTICE:  Table doesn't have 'DISTRIBUTED BY' clause -- Using column named 'text_col' 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 INDEX co_numeric_col_bm_idx ON CO_table_bitmap_index USING bitmap (numeric_col);
insert into CO_table_bitmap_index values ('0_zero', 0, '0_zero', 0, 0, 0, '{0}', 0, 0, 0, '2004-10-19 10:23:54', '2004-10-19 10:23:54+02', '1-1-2000');
insert into CO_table_bitmap_index values ('1_zero', 1, '1_zero', 1, 1, 1, '{1}', 1, 1, 1, '2005-10-19 10:23:54', '2005-10-19 10:23:54+02', '1-1-2001');
insert into CO_table_bitmap_index values ('2_zero', 2, '2_zero', 2, 2, 2, '{2}', 2, 2, 2, '2006-10-19 10:23:54', '2006-10-19 10:23:54+02', '1-1-2002');
insert into CO_table_bitmap_index select i||'_'||repeat('text',100),i,i||'_'||repeat('text',3),i,i,i,'{3}',i,i,i,'2006-10-19 10:23:54', '2006-10-19 10:23:54+02', '1-1-2002' from generate_series(3,100)i;
-- Create schema and set to it   
   Create Schema oagg;
   SET search_path to oagg;
-- Create quantity table
   Drop table IF EXISTS sch_quantity;
NOTICE:  table "sch_quantity" does not exist, skipping
   create table sch_quantity ( prod_key integer, qty integer, price integer, product character(3));
NOTICE:  Table doesn't have 'DISTRIBUTED BY' clause -- Using column named 'prod_key' 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.
-- inserting values into sch_quantity table
   insert into sch_quantity values (1,100, 50, 'p1');
   insert into sch_quantity values (2,200, 100, 'p2');
   insert into sch_quantity values (3,300, 200, 'p3');
   insert into sch_quantity values (4,400, 35, 'p4');
   insert into sch_quantity values (5,500, 40, 'p5');
   insert into sch_quantity values (1,150, 50, 'p1');
   insert into sch_quantity values (2,50, 100, 'p2');
   insert into sch_quantity values (3,150, 200, 'p3');
   insert into sch_quantity values (4,200, 35, 'p4');
   insert into sch_quantity values (5,300, 40, 'p5');
-- Create a new ordered aggregate with initial condition and finalfunc
   CREATE ORDERED AGGREGATE sch_array_accum_final (anyelement)
   (
      sfunc = array_append,
      stype = anyarray,
      finalfunc = array_out,
      initcond = '{}'
   );
-- Using newly created ordered aggregate array_accum_final
   select prod_key, sch_array_accum_final(qty order by prod_key,qty) from sch_quantity group by prod_key having prod_key < 5 order by prod_key;
 prod_key | sch_array_accum_final 
----------+-----------------------
        1 | {100,150}
        2 | {50,200}
        3 | {150,300}
        4 | {200,400}
(4 rows)

-- rename ordered aggregate
alter aggregate sch_array_accum_final (anyelement) rename to sch_array_accum_final_new;
-- check ordered aggregate
\df sch_array_accum_final_new;
                                 List of functions
 Schema |           Name            | Result data type | Argument data types | Type 
--------+---------------------------+------------------+---------------------+------
 oagg   | sch_array_accum_final_new | cstring          | anyelement          | agg
(1 row)

-- drop ordered aggregate
drop aggregate if exists sch_array_accum_final_new(anyelement);
-- Drop Scehma
   Drop schema oagg CASCADE;
NOTICE:  drop cascades to table sch_quantity
   SET search_path to public;
-- Drop table if exists
--Drop table 
DROP table if exists co_compr_part_1 cascade;
NOTICE:  table "co_compr_part_1" does not exist, skipping
DROP table if exists exch_part2_compr_1 cascade;
NOTICE:  table "exch_part2_compr_1" does not exist, skipping
--
-- Create table
--
CREATE TABLE co_compr_part_1
        (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
 Partition by list(a2) Subpartition by range(a1) subpartition template (default subpartition df_sp, start(1)  end(5000) every(1000),
 COLUMN a2  ENCODING (compresstype=zlib,compresslevel=1,blocksize=32768),
 COLUMN a1 encoding (compresstype = rle_type,compresslevel=1),
 COLUMN a3 encoding (compresstype = rle_type,compresslevel=3),
 COLUMN a5 ENCODING (compresstype=zlib,compresslevel=3, blocksize=32768),
 DEFAULT COLUMN ENCODING (compresstype=zlib,compresslevel=1,blocksize=32768)) (partition p1 values('F'), partition p2 values ('M'));
NOTICE:  CREATE TABLE will create implicit sequence "co_compr_part_1_id_seq" for serial column "co_compr_part_1.id"
NOTICE:  CREATE TABLE will create partition "co_compr_part_1_1_prt_p1" for table "co_compr_part_1"
NOTICE:  CREATE TABLE will create partition "co_compr_part_1_1_prt_p2" for table "co_compr_part_1"
NOTICE:  CREATE TABLE will create partition "co_compr_part_1_1_prt_p1_2_prt_df_sp" for table "co_compr_part_1_1_prt_p1"
NOTICE:  CREATE TABLE will create partition "co_compr_part_1_1_prt_p1_2_prt_2" for table "co_compr_part_1_1_prt_p1"
NOTICE:  CREATE TABLE will create partition "co_compr_part_1_1_prt_p1_2_prt_3" for table "co_compr_part_1_1_prt_p1"
NOTICE:  CREATE TABLE will create partition "co_compr_part_1_1_prt_p1_2_prt_4" for table "co_compr_part_1_1_prt_p1"
NOTICE:  CREATE TABLE will create partition "co_compr_part_1_1_prt_p1_2_prt_5" for table "co_compr_part_1_1_prt_p1"
NOTICE:  CREATE TABLE will create partition "co_compr_part_1_1_prt_p1_2_prt_6" for table "co_compr_part_1_1_prt_p1"
NOTICE:  CREATE TABLE will create partition "co_compr_part_1_1_prt_p2_2_prt_df_sp" for table "co_compr_part_1_1_prt_p2"
NOTICE:  CREATE TABLE will create partition "co_compr_part_1_1_prt_p2_2_prt_2" for table "co_compr_part_1_1_prt_p2"
NOTICE:  CREATE TABLE will create partition "co_compr_part_1_1_prt_p2_2_prt_3" for table "co_compr_part_1_1_prt_p2"
NOTICE:  CREATE TABLE will create partition "co_compr_part_1_1_prt_p2_2_prt_4" for table "co_compr_part_1_1_prt_p2"
NOTICE:  CREATE TABLE will create partition "co_compr_part_1_1_prt_p2_2_prt_5" for table "co_compr_part_1_1_prt_p2"
NOTICE:  CREATE TABLE will create partition "co_compr_part_1_1_prt_p2_2_prt_6" for table "co_compr_part_1_1_prt_p2"
-- 
-- Create Indexes # commenting create indexes due to MPP-14747 Restore fails with duplicate index errors for subpartition level indexes
--
-- CREATE INDEX co_compr_part_1_idx_bitmap ON co_compr_part_1 USING bitmap (a1);
-- CREATE INDEX co_compr_part_1_idx_btree ON co_compr_part_1(a9);
--
--Insert data to the table
--
2815
set LC_MONETARY='C';
2816 2817 2818 2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 2857 2858 2859 2860 2861 2862 2863 2864 2865 2866 2867 2868 2869 2870 2871 2872 2873 2874 2875 2876 2877 2878 2879 2880 2881 2882 2883 2884 2885 2886 2887 2888 2889 2890 2891 2892 2893 2894 2895 2896 2897 2898 2899 2900 2901 2902 2903 2904 2905 2906 2907 2908 2909 2910 2911 2912 2913 2914 2915 2916 2917 2918 2919 2920 2921 2922 2923 2924 2925 2926 2927 2928 2929 2930 2931 2932 2933 2934 2935 2936 2937 2938 2939 2940 2941 2942
INSERT INTO co_compr_part_1(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);
INSERT INTO co_compr_part_1(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(500,510),'F',2010,'f','b','Some students may need time to adjust to school.For most children, the adjustment is quick. Tears will usually disappear after Mommy and  Daddy leave the classroom. Do not plead with your child','2001-12-25 02:22:11','Some students may need time to adjust to school.For most children, the adjustment is quick. Tears will usually disappear after Mommy and  Daddy leave the classroom. Do not plead with your child',generate_series(2500,2516),'2011-10-12','Some students may need time to adjust to school.For most children, the adjustment is quick. Tears will usually disappear after Mommy and  Daddy leave the classroom. Do not plead with your child','Some students may need time to adjust to school.For most children, the adjustment is quick. Tears will usually disappear after Mommy and  Daddy leave the classroom. Do not plead with your child The type integer is the usual choice, as it offers the best balance between range, storage size, and performance The type integer is the usual choice, as it offers the best balance between range, storage size, and performanceThe type integer is the usual choice, as it offers the best balance between range, storage size, and performanceThe type integer is the usual choice, as it offers the best balance between range, storage size, and performanceThe type integer ','1134.26',311353,generate_series(3982,3992),7885,'0101','2002-02-12 01:31:14+1344','2003-11-14 01:41:15','((1,1),(0,1),(1,1))','((2,1)(1,5))','08:00:2b:01:01:03','1-3','Some students may need time to adjust to school.For most children, the adjustment is quick. Tears will usually disappear after Mommy and  Daddy leave the classroom. Do not plead with your child The types smallint, integer, and bigint store whole numbers, that is, numbers without fractional components, of various ranges. The types smallint, integer, and bigint store whole numbers, that is, numbers without fractional components, of various ranges. Attempts to store values outside of the allowed range will result in an errorThe types smallint, integer, and bigint store whole numbers, that is, numbers without fractional components, of various ranges.','((6,5)(4,2))','(3,6)',12.233,'((5,4),2)',12,3114,'(1,1,0,3)','2010-03-21',43164,'$1,500.00','192.167.2','126.1.1.1','10:30:55','Parents and other family members are always welcome at Stratford. After the first two weeks ofschool','0','1',33,44);
--Alter table Add Partition 
ALTER TABLE co_compr_part_1 add partition new_p values('C') ;
NOTICE:  CREATE TABLE will create partition "co_compr_part_1_1_prt_new_p" for table "co_compr_part_1"
NOTICE:  CREATE TABLE will create partition "co_compr_part_1_1_prt_new_p_2_prt_df_sp" for table "co_compr_part_1_1_prt_new_p"
NOTICE:  CREATE TABLE will create partition "co_compr_part_1_1_prt_new_p_2_prt_2" for table "co_compr_part_1_1_prt_new_p"
NOTICE:  CREATE TABLE will create partition "co_compr_part_1_1_prt_new_p_2_prt_3" for table "co_compr_part_1_1_prt_new_p"
NOTICE:  CREATE TABLE will create partition "co_compr_part_1_1_prt_new_p_2_prt_4" for table "co_compr_part_1_1_prt_new_p"
NOTICE:  CREATE TABLE will create partition "co_compr_part_1_1_prt_new_p_2_prt_5" for table "co_compr_part_1_1_prt_new_p"
NOTICE:  CREATE TABLE will create partition "co_compr_part_1_1_prt_new_p_2_prt_6" for table "co_compr_part_1_1_prt_new_p"
ALTER TABLE co_compr_part_1 add default partition df_p ;
NOTICE:  CREATE TABLE will create partition "co_compr_part_1_1_prt_df_p" for table "co_compr_part_1"
NOTICE:  CREATE TABLE will create partition "co_compr_part_1_1_prt_df_p_2_prt_df_sp" for table "co_compr_part_1_1_prt_df_p"
NOTICE:  CREATE TABLE will create partition "co_compr_part_1_1_prt_df_p_2_prt_2" for table "co_compr_part_1_1_prt_df_p"
NOTICE:  CREATE TABLE will create partition "co_compr_part_1_1_prt_df_p_2_prt_3" for table "co_compr_part_1_1_prt_df_p"
NOTICE:  CREATE TABLE will create partition "co_compr_part_1_1_prt_df_p_2_prt_4" for table "co_compr_part_1_1_prt_df_p"
NOTICE:  CREATE TABLE will create partition "co_compr_part_1_1_prt_df_p_2_prt_5" for table "co_compr_part_1_1_prt_df_p"
NOTICE:  CREATE TABLE will create partition "co_compr_part_1_1_prt_df_p_2_prt_6" for table "co_compr_part_1_1_prt_df_p"
---- Create the tables to do the exchange partition--
CREATE TABLE exch_part2_compr_1 (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;
NOTICE:  CREATE TABLE will create implicit sequence "exch_part2_compr_1_id_seq" for serial column "exch_part2_compr_1.id"
INSERT INTO  exch_part2_compr_1(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 co_compr_part_1 where  a1=10;
--Alter table exchange partition
ALTER TABLE co_compr_part_1 alter partition p2 exchange partition FOR (RANK(1)) with table exch_part2_compr_1 ;
--Alter table split partition
ALTER TABLE co_compr_part_1 alter partition p1 split partition FOR (RANK(1)) at(505) into (partition splita_1,partition splitb_1) ;
NOTICE:  CREATE TABLE will create partition "co_compr_part_1_1_prt_p1_2_prt_splita_1" for table "co_compr_part_1_1_prt_p1"
NOTICE:  CREATE TABLE will create partition "co_compr_part_1_1_prt_p1_2_prt_splitb_1" for table "co_compr_part_1_1_prt_p1"
--Alter table Drop partition
ALTER TABLE co_compr_part_1 drop partition new_p;
NOTICE:  dropped partition "new_p" for relation "co_compr_part_1" and its children
ALTER TABLE co_compr_part_1 drop default partition;
NOTICE:  dropped partition "df_p" for relation "co_compr_part_1" and its children
INSERT INTO co_compr_part_1(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 co_compr_part_1 where  a1=500;
SELECT count(*) from co_compr_part_1;
 count 
-------
   248
(1 row)

-- Partition by range
--Drop table if exists
DROP table if exists co_compr_part_2 cascade;
NOTICE:  table "co_compr_part_2" does not exist, skipping
DROP table if exists  exch_part2_compr_2 cascade;
NOTICE:  table "exch_part2_compr_2" does not exist, skipping
--
-- Create table
--
CREATE TABLE co_compr_part_2
        (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
 Partition by range(a1) Subpartition by list(a2) subpartition template ( default subpartition df_sp, subpartition sp1 values('M') , subpartition sp2 values('F')  ,
 COLUMN a2  ENCODING (compresstype=zlib,compresslevel=1,blocksize=32768),
 COLUMN a1 encoding (compresstype = rle_type,compresslevel=2),
 COLUMN a5 ENCODING (compresstype=zlib,compresslevel=1, blocksize=32768),
 DEFAULT COLUMN ENCODING (compresstype=rle_type,compresslevel=4,blocksize=32768)) (start(1) end(5000) every(1000));
NOTICE:  CREATE TABLE will create implicit sequence "co_compr_part_2_id_seq" for serial column "co_compr_part_2.id"
NOTICE:  CREATE TABLE will create partition "co_compr_part_2_1_prt_1" for table "co_compr_part_2"
NOTICE:  CREATE TABLE will create partition "co_compr_part_2_1_prt_2" for table "co_compr_part_2"
NOTICE:  CREATE TABLE will create partition "co_compr_part_2_1_prt_3" for table "co_compr_part_2"
NOTICE:  CREATE TABLE will create partition "co_compr_part_2_1_prt_4" for table "co_compr_part_2"
NOTICE:  CREATE TABLE will create partition "co_compr_part_2_1_prt_5" for table "co_compr_part_2"
NOTICE:  CREATE TABLE will create partition "co_compr_part_2_1_prt_1_2_prt_df_sp" for table "co_compr_part_2_1_prt_1"
NOTICE:  CREATE TABLE will create partition "co_compr_part_2_1_prt_1_2_prt_sp1" for table "co_compr_part_2_1_prt_1"
NOTICE:  CREATE TABLE will create partition "co_compr_part_2_1_prt_1_2_prt_sp2" for table "co_compr_part_2_1_prt_1"
NOTICE:  CREATE TABLE will create partition "co_compr_part_2_1_prt_2_2_prt_df_sp" for table "co_compr_part_2_1_prt_2"
NOTICE:  CREATE TABLE will create partition "co_compr_part_2_1_prt_2_2_prt_sp1" for table "co_compr_part_2_1_prt_2"
NOTICE:  CREATE TABLE will create partition "co_compr_part_2_1_prt_2_2_prt_sp2" for table "co_compr_part_2_1_prt_2"
NOTICE:  CREATE TABLE will create partition "co_compr_part_2_1_prt_3_2_prt_df_sp" for table "co_compr_part_2_1_prt_3"
NOTICE:  CREATE TABLE will create partition "co_compr_part_2_1_prt_3_2_prt_sp1" for table "co_compr_part_2_1_prt_3"
NOTICE:  CREATE TABLE will create partition "co_compr_part_2_1_prt_3_2_prt_sp2" for table "co_compr_part_2_1_prt_3"
NOTICE:  CREATE TABLE will create partition "co_compr_part_2_1_prt_4_2_prt_df_sp" for table "co_compr_part_2_1_prt_4"
NOTICE:  CREATE TABLE will create partition "co_compr_part_2_1_prt_4_2_prt_sp1" for table "co_compr_part_2_1_prt_4"
NOTICE:  CREATE TABLE will create partition "co_compr_part_2_1_prt_4_2_prt_sp2" for table "co_compr_part_2_1_prt_4"
NOTICE:  CREATE TABLE will create partition "co_compr_part_2_1_prt_5_2_prt_df_sp" for table "co_compr_part_2_1_prt_5"
NOTICE:  CREATE TABLE will create partition "co_compr_part_2_1_prt_5_2_prt_sp1" for table "co_compr_part_2_1_prt_5"
NOTICE:  CREATE TABLE will create partition "co_compr_part_2_1_prt_5_2_prt_sp2" for table "co_compr_part_2_1_prt_5"
-- 
-- Create Indexes
--
-- CREATE INDEX co_compr_part_2_idx_bitmap ON co_compr_part_2 USING bitmap (a1);
-- CREATE INDEX co_compr_part_2_idx_btree ON co_compr_part_2(a9);
--
-- Insert data to the table
--
 INSERT INTO co_compr_part_2(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);
 INSERT INTO co_compr_part_2(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(500,510),'F',2010,'f','b','Some students may need time to adjust to school.For most children, the adjustment is quick. Tears will usually disappear after Mommy and  Daddy leave the classroom. Do not plead with your child','2001-12-25 02:22:11','Some students may need time to adjust to school.For most children, the adjustment is quick. Tears will usually disappear after Mommy and  Daddy leave the classroom. Do not plead with your child',generate_series(2500,2516),'2011-10-12','Some students may need time to adjust to school.For most children, the adjustment is quick. Tears will usually disappear after Mommy and  Daddy leave the classroom. Do not plead with your child','Some students may need time to adjust to school.For most children, the adjustment is quick. Tears will usually disappear after Mommy and  Daddy leave the classroom. Do not plead with your child The type integer is the usual choice, as it offers the best balance between range, storage size, and performance The type integer is the usual choice, as it offers the best balance between range, storage size, and performanceThe type integer is the usual choice, as it offers the best balance between range, storage size, and performanceThe type integer is the usual choice, as it offers the best balance between range, storage size, and performanceThe type integer ','1134.26',311353,generate_series(3982,3992),7885,'0101','2002-02-12 01:31:14+1344','2003-11-14 01:41:15','((1,1),(0,1),(1,1))','((2,1)(1,5))','08:00:2b:01:01:03','1-3','Some students may need time to adjust to school.For most children, the adjustment is quick. Tears will usually disappear after Mommy and  Daddy leave the classroom. Do not plead with your child The types smallint, integer, and bigint store whole numbers, that is, numbers without fractional components, of various ranges. The types smallint, integer, and bigint store whole numbers, that is, numbers without fractional components, of various ranges. Attempts to store values outside of the allowed range will result in an errorThe types smallint, integer, and bigint store whole numbers, that is, numbers without fractional components, of various ranges.','((6,5)(4,2))','(3,6)',12.233,'((5,4),2)',12,3114,'(1,1,0,3)','2010-03-21',43164,'$1,500.00','192.167.2','126.1.1.1','10:30:55','Parents and other family members are always welcome at Stratford. After the first two weeks ofschool','0','1',33,44);
\d+ co_compr_part_2_1_prt_1_2_prt_sp1
                                                      Append-Only Columnar Table "public.co_compr_part_2_1_prt_1_2_prt_sp1"
 Column |            Type             |                          Modifiers                           | Storage  | Compression Type | Compression Level | Block Size | Description 
--------+-----------------------------+--------------------------------------------------------------+----------+------------------+-------------------+------------+-------------
 id     | integer                     | not null default nextval('co_compr_part_2_id_seq'::regclass) | plain    | rle_type         | 4                 | 32768      | 
 a1     | integer                     |                                                              | plain    | rle_type         | 2                 | 32768      | 
 a2     | character(5)                |                                                              | extended | zlib             | 1                 | 32768      | 
 a3     | numeric                     |                                                              | main     | rle_type         | 4                 | 32768      | 
 a4     | boolean                     | default false                                                | plain    | rle_type         | 4                 | 32768      | 
 a5     | character(1)                | default 'd'::bpchar                                          | extended | zlib             | 1                 | 32768      | 
 a6     | text                        |                                                              | extended | rle_type         | 4                 | 32768      | 
 a7     | timestamp without time zone |                                                              | plain    | rle_type         | 4                 | 32768      | 
 a8     | character varying(705)      |                                                              | extended | rle_type         | 4                 | 32768      | 
 a9     | bigint                      |                                                              | plain    | rle_type         | 4                 | 32768      | 
 a10    | date                        |                                                              | plain    | rle_type         | 4                 | 32768      | 
 a11    | character varying(600)      |                                                              | extended | rle_type         | 4                 | 32768      | 
 a12    | text                        |                                                              | extended | rle_type         | 4                 | 32768      | 
 a13    | numeric                     |                                                              | main     | rle_type         | 4                 | 32768      | 
 a14    | real                        |                                                              | plain    | rle_type         | 4                 | 32768      | 
 a15    | bigint                      |                                                              | plain    | rle_type         | 4                 | 32768      | 
 a16    | integer                     |                                                              | plain    | rle_type         | 4                 | 32768      | 
 a17    | bytea                       |                                                              | extended | rle_type         | 4                 | 32768      | 
 a18    | timestamp with time zone    |                                                              | plain    | rle_type         | 4                 | 32768      | 
 a19    | time with time zone         |                                                              | plain    | rle_type         | 4                 | 32768      | 
 a20    | path                        |                                                              | extended | rle_type         | 4                 | 32768      | 
 a21    | box                         |                                                              | plain    | rle_type         | 4                 | 32768      | 
 a22    | macaddr                     |                                                              | plain    | rle_type         | 4                 | 32768      | 
 a23    | interval                    |                                                              | plain    | rle_type         | 4                 | 32768      | 
 a24    | character varying(800)      |                                                              | extended | rle_type         | 4                 | 32768      | 
 a25    | lseg                        |                                                              | plain    | rle_type         | 4                 | 32768      | 
 a26    | point                       |                                                              | plain    | rle_type         | 4                 | 32768      | 
 a27    | double precision            |                                                              | plain    | rle_type         | 4                 | 32768      | 
 a28    | circle                      |                                                              | plain    | rle_type         | 4                 | 32768      | 
 a29    | integer                     |                                                              | plain    | rle_type         | 4                 | 32768      | 
 a30    | numeric(8,0)                |                                                              | main     | rle_type         | 4                 | 32768      | 
 a31    | polygon                     |                                                              | extended | rle_type         | 4                 | 32768      | 
 a32    | date                        |                                                              | plain    | rle_type         | 4                 | 32768      | 
 a33    | real                        |                                                              | plain    | rle_type         | 4                 | 32768      | 
 a34    | money                       |                                                              | plain    | rle_type         | 4                 | 32768      | 
A
Adam Lee 已提交
2943 2944
 a35    | cidr                        |                                                              | main     | rle_type         | 4                 | 32768      | 
 a36    | inet                        |                                                              | main     | rle_type         | 4                 | 32768      | 
2945 2946 2947 2948 2949 2950 2951 2952 2953 2954 2955 2956 2957 2958 2959 2960 2961 2962 2963 2964 2965 2966 2967 2968 2969 2970 2971 2972 2973 2974 2975 2976 2977 2978 2979 2980 2981 2982 2983 2984 2985 2986 2987 2988 2989 2990 2991 2992 2993 2994 2995 2996 2997 2998 2999 3000 3001 3002 3003 3004 3005 3006 3007 3008 3009 3010 3011 3012 3013 3014
 a37    | time without time zone      |                                                              | plain    | rle_type         | 4                 | 32768      | 
 a38    | text                        |                                                              | extended | rle_type         | 4                 | 32768      | 
 a39    | bit(1)                      |                                                              | extended | rle_type         | 4                 | 32768      | 
 a40    | bit varying(5)              |                                                              | extended | rle_type         | 4                 | 32768      | 
 a41    | smallint                    |                                                              | plain    | rle_type         | 4                 | 32768      | 
 a42    | integer                     |                                                              | plain    | rle_type         | 4                 | 32768      | 
Checksum: t
Check constraints:
    "co_compr_part_2_1_prt_1_2_prt_sp1_check" CHECK (a2 = 'M    '::bpchar)
    "co_compr_part_2_1_prt_1_check" CHECK (a1 >= 1 AND a1 < 1001)
Inherits: co_compr_part_2_1_prt_1
Has OIDs: no
Options: appendonly=true, orientation=column
Distributed randomly

--Select from pg_attribute_encoding to see the table entry 
select parencattnum, parencattoptions from pg_partition_encoding e, pg_partition p, pg_class c  where c.relname = 'co_compr_part_2' and c.oid = p.parrelid and p.oid = e.parencoid order by parencattnum limit 3;
 parencattnum |                    parencattoptions                     
--------------+---------------------------------------------------------
            2 | {compresstype=rle_type,compresslevel=2,blocksize=32768}
            3 | {compresstype=zlib,compresslevel=1,blocksize=32768}
            6 | {compresstype=zlib,compresslevel=1,blocksize=32768}
(3 rows)

--Alter table Add Partition 
alter table co_compr_part_2 add partition new_p start(5050) end (5061);
NOTICE:  CREATE TABLE will create partition "co_compr_part_2_1_prt_new_p" for table "co_compr_part_2"
NOTICE:  CREATE TABLE will create partition "co_compr_part_2_1_prt_new_p_2_prt_sp1" for table "co_compr_part_2_1_prt_new_p"
NOTICE:  CREATE TABLE will create partition "co_compr_part_2_1_prt_new_p_2_prt_sp2" for table "co_compr_part_2_1_prt_new_p"
NOTICE:  CREATE TABLE will create partition "co_compr_part_2_1_prt_new_p_2_prt_df_sp" for table "co_compr_part_2_1_prt_new_p"
--Validation with psql utility 
  \d+ co_compr_part_2_1_prt_new_p_2_prt_sp1
                                                    Append-Only Columnar Table "public.co_compr_part_2_1_prt_new_p_2_prt_sp1"
 Column |            Type             |                          Modifiers                           | Storage  | Compression Type | Compression Level | Block Size | Description 
--------+-----------------------------+--------------------------------------------------------------+----------+------------------+-------------------+------------+-------------
 id     | integer                     | not null default nextval('co_compr_part_2_id_seq'::regclass) | plain    | none             | 0                 | 32768      | 
 a1     | integer                     |                                                              | plain    | rle_type         | 2                 | 32768      | 
 a2     | character(5)                |                                                              | extended | zlib             | 1                 | 32768      | 
 a3     | numeric                     |                                                              | main     | none             | 0                 | 32768      | 
 a4     | boolean                     | default false                                                | plain    | none             | 0                 | 32768      | 
 a5     | character(1)                | default 'd'::bpchar                                          | extended | zlib             | 1                 | 32768      | 
 a6     | text                        |                                                              | extended | none             | 0                 | 32768      | 
 a7     | timestamp without time zone |                                                              | plain    | none             | 0                 | 32768      | 
 a8     | character varying(705)      |                                                              | extended | none             | 0                 | 32768      | 
 a9     | bigint                      |                                                              | plain    | none             | 0                 | 32768      | 
 a10    | date                        |                                                              | plain    | none             | 0                 | 32768      | 
 a11    | character varying(600)      |                                                              | extended | none             | 0                 | 32768      | 
 a12    | text                        |                                                              | extended | none             | 0                 | 32768      | 
 a13    | numeric                     |                                                              | main     | none             | 0                 | 32768      | 
 a14    | real                        |                                                              | plain    | none             | 0                 | 32768      | 
 a15    | bigint                      |                                                              | plain    | none             | 0                 | 32768      | 
 a16    | integer                     |                                                              | plain    | none             | 0                 | 32768      | 
 a17    | bytea                       |                                                              | extended | none             | 0                 | 32768      | 
 a18    | timestamp with time zone    |                                                              | plain    | none             | 0                 | 32768      | 
 a19    | time with time zone         |                                                              | plain    | none             | 0                 | 32768      | 
 a20    | path                        |                                                              | extended | none             | 0                 | 32768      | 
 a21    | box                         |                                                              | plain    | none             | 0                 | 32768      | 
 a22    | macaddr                     |                                                              | plain    | none             | 0                 | 32768      | 
 a23    | interval                    |                                                              | plain    | none             | 0                 | 32768      | 
 a24    | character varying(800)      |                                                              | extended | none             | 0                 | 32768      | 
 a25    | lseg                        |                                                              | plain    | none             | 0                 | 32768      | 
 a26    | point                       |                                                              | plain    | none             | 0                 | 32768      | 
 a27    | double precision            |                                                              | plain    | none             | 0                 | 32768      | 
 a28    | circle                      |                                                              | plain    | none             | 0                 | 32768      | 
 a29    | integer                     |                                                              | plain    | none             | 0                 | 32768      | 
 a30    | numeric(8,0)                |                                                              | main     | none             | 0                 | 32768      | 
 a31    | polygon                     |                                                              | extended | none             | 0                 | 32768      | 
 a32    | date                        |                                                              | plain    | none             | 0                 | 32768      | 
 a33    | real                        |                                                              | plain    | none             | 0                 | 32768      | 
 a34    | money                       |                                                              | plain    | none             | 0                 | 32768      | 
A
Adam Lee 已提交
3015 3016
 a35    | cidr                        |                                                              | main     | none             | 0                 | 32768      | 
 a36    | inet                        |                                                              | main     | none             | 0                 | 32768      | 
3017 3018 3019 3020 3021 3022 3023 3024 3025 3026 3027 3028 3029 3030 3031 3032 3033 3034 3035 3036 3037 3038 3039 3040 3041 3042 3043 3044 3045 3046 3047 3048 3049 3050 3051 3052 3053 3054 3055 3056 3057 3058 3059 3060 3061 3062 3063 3064 3065 3066 3067 3068 3069 3070 3071 3072 3073 3074 3075 3076
 a37    | time without time zone      |                                                              | plain    | none             | 0                 | 32768      | 
 a38    | text                        |                                                              | extended | none             | 0                 | 32768      | 
 a39    | bit(1)                      |                                                              | extended | none             | 0                 | 32768      | 
 a40    | bit varying(5)              |                                                              | extended | none             | 0                 | 32768      | 
 a41    | smallint                    |                                                              | plain    | none             | 0                 | 32768      | 
 a42    | integer                     |                                                              | plain    | none             | 0                 | 32768      | 
Checksum: t
Check constraints:
    "co_compr_part_2_1_prt_new_p_2_prt_sp1_check" CHECK (a2 = 'M    '::bpchar)
    "co_compr_part_2_1_prt_new_p_check" CHECK (a1 >= 5050 AND a1 < 5061)
Inherits: co_compr_part_2_1_prt_new_p
Has OIDs: no
Options: appendonly=true, orientation=column
Distributed randomly

alter table co_compr_part_2 add default partition df_p ;
NOTICE:  CREATE TABLE will create partition "co_compr_part_2_1_prt_df_p" for table "co_compr_part_2"
NOTICE:  CREATE TABLE will create partition "co_compr_part_2_1_prt_df_p_2_prt_sp1" for table "co_compr_part_2_1_prt_df_p"
NOTICE:  CREATE TABLE will create partition "co_compr_part_2_1_prt_df_p_2_prt_sp2" for table "co_compr_part_2_1_prt_df_p"
NOTICE:  CREATE TABLE will create partition "co_compr_part_2_1_prt_df_p_2_prt_df_sp" for table "co_compr_part_2_1_prt_df_p"
--Validation with psql utility 
  \d+ co_compr_part_2_1_prt_df_p_2_prt_sp1
                                                     Append-Only Columnar Table "public.co_compr_part_2_1_prt_df_p_2_prt_sp1"
 Column |            Type             |                          Modifiers                           | Storage  | Compression Type | Compression Level | Block Size | Description 
--------+-----------------------------+--------------------------------------------------------------+----------+------------------+-------------------+------------+-------------
 id     | integer                     | not null default nextval('co_compr_part_2_id_seq'::regclass) | plain    | none             | 0                 | 32768      | 
 a1     | integer                     |                                                              | plain    | rle_type         | 2                 | 32768      | 
 a2     | character(5)                |                                                              | extended | zlib             | 1                 | 32768      | 
 a3     | numeric                     |                                                              | main     | none             | 0                 | 32768      | 
 a4     | boolean                     | default false                                                | plain    | none             | 0                 | 32768      | 
 a5     | character(1)                | default 'd'::bpchar                                          | extended | zlib             | 1                 | 32768      | 
 a6     | text                        |                                                              | extended | none             | 0                 | 32768      | 
 a7     | timestamp without time zone |                                                              | plain    | none             | 0                 | 32768      | 
 a8     | character varying(705)      |                                                              | extended | none             | 0                 | 32768      | 
 a9     | bigint                      |                                                              | plain    | none             | 0                 | 32768      | 
 a10    | date                        |                                                              | plain    | none             | 0                 | 32768      | 
 a11    | character varying(600)      |                                                              | extended | none             | 0                 | 32768      | 
 a12    | text                        |                                                              | extended | none             | 0                 | 32768      | 
 a13    | numeric                     |                                                              | main     | none             | 0                 | 32768      | 
 a14    | real                        |                                                              | plain    | none             | 0                 | 32768      | 
 a15    | bigint                      |                                                              | plain    | none             | 0                 | 32768      | 
 a16    | integer                     |                                                              | plain    | none             | 0                 | 32768      | 
 a17    | bytea                       |                                                              | extended | none             | 0                 | 32768      | 
 a18    | timestamp with time zone    |                                                              | plain    | none             | 0                 | 32768      | 
 a19    | time with time zone         |                                                              | plain    | none             | 0                 | 32768      | 
 a20    | path                        |                                                              | extended | none             | 0                 | 32768      | 
 a21    | box                         |                                                              | plain    | none             | 0                 | 32768      | 
 a22    | macaddr                     |                                                              | plain    | none             | 0                 | 32768      | 
 a23    | interval                    |                                                              | plain    | none             | 0                 | 32768      | 
 a24    | character varying(800)      |                                                              | extended | none             | 0                 | 32768      | 
 a25    | lseg                        |                                                              | plain    | none             | 0                 | 32768      | 
 a26    | point                       |                                                              | plain    | none             | 0                 | 32768      | 
 a27    | double precision            |                                                              | plain    | none             | 0                 | 32768      | 
 a28    | circle                      |                                                              | plain    | none             | 0                 | 32768      | 
 a29    | integer                     |                                                              | plain    | none             | 0                 | 32768      | 
 a30    | numeric(8,0)                |                                                              | main     | none             | 0                 | 32768      | 
 a31    | polygon                     |                                                              | extended | none             | 0                 | 32768      | 
 a32    | date                        |                                                              | plain    | none             | 0                 | 32768      | 
 a33    | real                        |                                                              | plain    | none             | 0                 | 32768      | 
 a34    | money                       |                                                              | plain    | none             | 0                 | 32768      | 
A
Adam Lee 已提交
3077 3078
 a35    | cidr                        |                                                              | main     | none             | 0                 | 32768      | 
 a36    | inet                        |                                                              | main     | none             | 0                 | 32768      | 
3079 3080 3081 3082 3083 3084 3085 3086 3087 3088 3089 3090 3091 3092 3093 3094 3095 3096 3097 3098 3099 3100 3101 3102 3103 3104 3105 3106 3107 3108 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118 3119 3120 3121 3122 3123 3124 3125 3126 3127 3128 3129 3130 3131 3132 3133 3134 3135 3136 3137 3138 3139 3140 3141 3142 3143 3144 3145 3146 3147 3148 3149 3150 3151 3152 3153 3154 3155 3156 3157 3158 3159 3160 3161 3162 3163 3164 3165 3166 3167 3168 3169 3170 3171 3172 3173 3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 3190 3191 3192 3193 3194 3195 3196 3197 3198 3199 3200 3201 3202 3203 3204 3205 3206 3207 3208 3209 3210 3211 3212 3213 3214 3215 3216 3217 3218 3219 3220 3221 3222 3223 3224 3225 3226 3227 3228 3229 3230 3231 3232 3233 3234 3235 3236 3237 3238 3239 3240 3241 3242 3243 3244 3245 3246 3247 3248 3249 3250 3251 3252 3253 3254 3255 3256 3257 3258 3259 3260 3261 3262 3263 3264 3265 3266 3267 3268 3269 3270 3271 3272 3273 3274 3275 3276 3277 3278 3279 3280 3281 3282 3283 3284 3285 3286 3287 3288 3289 3290 3291 3292 3293 3294 3295 3296 3297 3298 3299 3300 3301 3302 3303 3304 3305 3306 3307 3308 3309 3310 3311 3312 3313 3314 3315 3316 3317 3318 3319 3320 3321 3322 3323 3324 3325 3326 3327 3328 3329 3330 3331 3332 3333 3334 3335 3336 3337 3338 3339 3340 3341 3342 3343 3344 3345 3346 3347 3348 3349 3350 3351 3352 3353 3354 3355 3356 3357 3358 3359 3360 3361 3362 3363 3364 3365 3366 3367 3368 3369 3370 3371 3372 3373 3374 3375 3376 3377 3378 3379 3380 3381 3382 3383 3384 3385 3386 3387 3388 3389 3390 3391 3392 3393 3394 3395 3396 3397 3398 3399 3400 3401 3402 3403 3404 3405 3406 3407 3408 3409 3410 3411 3412 3413 3414 3415 3416 3417 3418 3419 3420 3421 3422 3423 3424 3425 3426 3427 3428 3429 3430 3431 3432 3433 3434 3435 3436 3437 3438 3439 3440 3441 3442 3443 3444 3445 3446 3447 3448 3449 3450 3451 3452 3453 3454 3455 3456 3457 3458 3459 3460 3461 3462 3463 3464 3465 3466 3467 3468 3469 3470 3471 3472 3473 3474 3475 3476 3477 3478 3479 3480 3481 3482 3483 3484 3485 3486 3487 3488 3489 3490 3491 3492 3493 3494 3495 3496 3497 3498 3499 3500 3501 3502 3503 3504 3505 3506 3507 3508 3509 3510 3511 3512 3513 3514 3515 3516 3517 3518 3519 3520 3521 3522 3523 3524 3525 3526 3527 3528 3529 3530 3531 3532 3533 3534 3535 3536 3537 3538 3539 3540 3541 3542 3543 3544 3545 3546 3547 3548 3549 3550 3551 3552 3553 3554 3555 3556 3557 3558 3559 3560 3561 3562 3563 3564 3565 3566 3567 3568 3569 3570 3571 3572 3573 3574 3575 3576 3577 3578 3579 3580 3581 3582 3583 3584 3585 3586 3587 3588 3589 3590 3591 3592 3593 3594 3595 3596 3597 3598 3599 3600 3601 3602 3603 3604 3605 3606 3607 3608 3609 3610 3611 3612 3613 3614 3615 3616 3617 3618 3619 3620 3621 3622 3623 3624 3625 3626 3627 3628 3629 3630 3631 3632 3633 3634 3635 3636 3637 3638 3639 3640 3641 3642 3643 3644 3645 3646 3647 3648 3649 3650 3651 3652 3653 3654 3655 3656 3657 3658 3659 3660 3661 3662
 a37    | time without time zone      |                                                              | plain    | none             | 0                 | 32768      | 
 a38    | text                        |                                                              | extended | none             | 0                 | 32768      | 
 a39    | bit(1)                      |                                                              | extended | none             | 0                 | 32768      | 
 a40    | bit varying(5)              |                                                              | extended | none             | 0                 | 32768      | 
 a41    | smallint                    |                                                              | plain    | none             | 0                 | 32768      | 
 a42    | integer                     |                                                              | plain    | none             | 0                 | 32768      | 
Checksum: t
Check constraints:
    "co_compr_part_2_1_prt_df_p_2_prt_sp1_check" CHECK (a2 = 'M    '::bpchar)
Inherits: co_compr_part_2_1_prt_df_p
Has OIDs: no
Options: appendonly=true, orientation=column
Distributed randomly

-- Insert data 
Insert into co_compr_part_2(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(5051,5060),'C',2011,'t','a','dfjjjjjj','2001-12-24 02:26:11','hghgh',333,'2011-10-11','Tddd','sss','1234.56',323453,4454,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','dfdf','((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','ggg','1','0',12,23) ;
 CREATE TABLE exch_part2_compr_2 (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;
NOTICE:  CREATE TABLE will create implicit sequence "exch_part2_compr_2_id_seq" for serial column "exch_part2_compr_2.id"
Insert into exch_part2_compr_2(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 co_compr_part_2 where  a1=10;
Alter table co_compr_part_2 alter partition FOR (RANK(1)) exchange partition sp1 with table exch_part2_compr_2 ;
NOTICE:  exchanged partition "sp1" of partition for rank 1 of relation "co_compr_part_2" with relation "exch_part2_compr_2"
--Alter table Drop Partition 
alter table co_compr_part_2 drop partition new_p;
NOTICE:  dropped partition "new_p" for relation "co_compr_part_2" and its children
-- Drop the default partition 
alter table co_compr_part_2 drop default partition;
NOTICE:  dropped partition "df_p" for relation "co_compr_part_2" and its children
--Alter table alter type of a column 
Alter table co_compr_part_2 Alter column a3 TYPE int4;
--Insert data to the table, select count(*)
Insert into co_compr_part_2(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 co_compr_part_2 where id =10;
Select count(*) from co_compr_part_2;
 count 
-------
   232
(1 row)

--Alter table drop a column 
Alter table co_compr_part_2 Drop column a12;
Insert into co_compr_part_2(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 co_compr_part_2 where id =10;
Select count(*) from co_compr_part_2;
 count 
-------
   233
(1 row)

--Alter table rename a column 
Alter table co_compr_part_2 Rename column a13 TO after_rename_a13;
--Insert data to the table, select count(*)
Insert into co_compr_part_2(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 co_compr_part_2 where id =10;
Select count(*) from co_compr_part_2;
 count 
-------
   234
(1 row)

DROP type if exists int_type1 cascade ; 
NOTICE:  type "int_type1" does not exist, skipping
CREATE type int_type1;
CREATE FUNCTION int_type1_in(cstring) 
 RETURNS int_type1
 AS 'int4in' 
 LANGUAGE internal IMMUTABLE STRICT NO SQL; 
NOTICE:  return type int_type1 is only a shell
CREATE FUNCTION int_type1_out(int_type1) 
 RETURNS cstring
 AS 'int4out' 
 LANGUAGE internal IMMUTABLE STRICT NO SQL; 
NOTICE:  argument type int_type1 is only a shell
CREATE TYPE int_type1( 
 input = int_type1_in ,
 output = int_type1_out ,
 internallength = 4, 
 default =55, 
 passedbyvalue, 
 compresstype=zlib,
 blocksize=32768,
 compresslevel=3);
--Drop and recreate the data type 
 Drop type if exists int_type1 cascade;
NOTICE:  drop cascades to function int_type1_out(int_type1)
NOTICE:  drop cascades to function int_type1_in(cstring)
CREATE FUNCTION int_type1_in(cstring) 
 RETURNS int_type1
 AS 'int4in' 
 LANGUAGE internal IMMUTABLE STRICT NO SQL; 
NOTICE:  type "int_type1" is not yet defined
DETAIL:  Creating a shell type definition.
CREATE FUNCTION int_type1_out(int_type1) 
 RETURNS cstring
 AS 'int4out' 
 LANGUAGE internal IMMUTABLE STRICT NO SQL; 
NOTICE:  argument type int_type1 is only a shell
CREATE TYPE int_type1( 
 input = int_type1_in ,
 output = int_type1_out ,
 internallength = 4, 
 default =55, 
 passedbyvalue, 
 compresstype=zlib,
 blocksize=32768,
 compresslevel=2);
select typoptions from pg_type_encoding where typid='int_type1 '::regtype;
                     typoptions                      
-----------------------------------------------------
 {compresstype=zlib,blocksize=32768,compresslevel=2}
(1 row)

DROP type if exists char_type1 cascade ; 
NOTICE:  type "char_type1" does not exist, skipping
CREATE type char_type1;
CREATE FUNCTION char_type1_in(cstring) 
 RETURNS char_type1
 AS 'charin' 
 LANGUAGE internal IMMUTABLE STRICT NO SQL; 
NOTICE:  return type char_type1 is only a shell
CREATE FUNCTION char_type1_out(char_type1) 
 RETURNS cstring
 AS 'charout' 
 LANGUAGE internal IMMUTABLE STRICT NO SQL; 
NOTICE:  argument type char_type1 is only a shell
CREATE TYPE char_type1( 
 input = char_type1_in ,
 output = char_type1_out ,
 internallength = 4, 
 default = 'asd' , 
 passedbyvalue, 
 compresstype=zlib,
 blocksize=32768,
 compresslevel=1);
--Drop and recreate the data type 
 Drop type if exists char_type1 cascade;
NOTICE:  drop cascades to function char_type1_out(char_type1)
NOTICE:  drop cascades to function char_type1_in(cstring)
CREATE FUNCTION char_type1_in(cstring) 
 RETURNS char_type1
 AS 'charin' 
 LANGUAGE internal IMMUTABLE STRICT NO SQL; 
NOTICE:  type "char_type1" is not yet defined
DETAIL:  Creating a shell type definition.
CREATE FUNCTION char_type1_out(char_type1) 
 RETURNS cstring
 AS 'charout' 
 LANGUAGE internal IMMUTABLE STRICT NO SQL; 
NOTICE:  argument type char_type1 is only a shell
CREATE TYPE char_type1( 
 input = char_type1_in ,
 output = char_type1_out ,
 internallength = 4, 
 default = 'asd' , 
 passedbyvalue, 
 compresstype=zlib,
 blocksize=32768,
 compresslevel=2);
select typoptions from pg_type_encoding where typid='char_type1 '::regtype;
                     typoptions                      
-----------------------------------------------------
 {compresstype=zlib,blocksize=32768,compresslevel=2}
(1 row)

DROP type if exists text_type1 cascade ; 
NOTICE:  type "text_type1" does not exist, skipping
CREATE type text_type1;
CREATE FUNCTION text_type1_in(cstring) 
 RETURNS text_type1
 AS 'textin' 
 LANGUAGE internal IMMUTABLE STRICT NO SQL; 
NOTICE:  return type text_type1 is only a shell
CREATE FUNCTION text_type1_out(text_type1) 
 RETURNS cstring
 AS 'textout' 
 LANGUAGE internal IMMUTABLE STRICT NO SQL; 
NOTICE:  argument type text_type1 is only a shell
CREATE TYPE text_type1( 
 input = text_type1_in ,
 output = text_type1_out ,
 internallength = variable, 
 default = 'hfkdshfkjsdhflkshadfkhsadflkh' , 
 compresstype=zlib,
 blocksize=32768,
 compresslevel=2);
--Drop and recreate the data type 
 Drop type if exists text_type1 cascade;
NOTICE:  drop cascades to function text_type1_out(text_type1)
NOTICE:  drop cascades to function text_type1_in(cstring)
CREATE FUNCTION text_type1_in(cstring) 
 RETURNS text_type1
 AS 'textin' 
 LANGUAGE internal IMMUTABLE STRICT NO SQL; 
NOTICE:  type "text_type1" is not yet defined
DETAIL:  Creating a shell type definition.
CREATE FUNCTION text_type1_out(text_type1) 
 RETURNS cstring
 AS 'textout' 
 LANGUAGE internal IMMUTABLE STRICT NO SQL; 
NOTICE:  argument type text_type1 is only a shell
CREATE TYPE text_type1( 
 input = text_type1_in ,
 output = text_type1_out ,
 internallength = variable, 
 default = 'hfkdshfkjsdhflkshadfkhsadflkh' , 
 compresstype=zlib,
 blocksize=32768,
 compresslevel=7);
select typoptions from pg_type_encoding where typid='text_type1 '::regtype;
                     typoptions                      
-----------------------------------------------------
 {compresstype=zlib,blocksize=32768,compresslevel=7}
(1 row)

DROP type if exists varchar_type1 cascade ; 
NOTICE:  type "varchar_type1" does not exist, skipping
CREATE type varchar_type1;
CREATE FUNCTION varchar_type1_in(cstring) 
 RETURNS varchar_type1
 AS 'varcharin' 
 LANGUAGE internal IMMUTABLE STRICT NO SQL; 
NOTICE:  return type varchar_type1 is only a shell
CREATE FUNCTION varchar_type1_out(varchar_type1) 
 RETURNS cstring
 AS 'varcharout' 
 LANGUAGE internal IMMUTABLE STRICT NO SQL; 
NOTICE:  argument type varchar_type1 is only a shell
CREATE TYPE varchar_type1( 
 input = varchar_type1_in ,
 output = varchar_type1_out ,
 internallength = variable, 
 default = 'ajhgdjagdjasdkjashk' , 
 compresstype=zlib,
 blocksize=32768,
 compresslevel=1);
--Drop and recreate the data type 
 Drop type if exists varchar_type1 cascade;
NOTICE:  drop cascades to function varchar_type1_out(varchar_type1)
NOTICE:  drop cascades to function varchar_type1_in(cstring)
CREATE FUNCTION varchar_type1_in(cstring) 
 RETURNS varchar_type1
 AS 'varcharin' 
 LANGUAGE internal IMMUTABLE STRICT NO SQL; 
NOTICE:  type "varchar_type1" is not yet defined
DETAIL:  Creating a shell type definition.
CREATE FUNCTION varchar_type1_out(varchar_type1) 
 RETURNS cstring
 AS 'varcharout' 
 LANGUAGE internal IMMUTABLE STRICT NO SQL; 
NOTICE:  argument type varchar_type1 is only a shell
CREATE TYPE varchar_type1( 
 input = varchar_type1_in ,
 output = varchar_type1_out ,
 internallength = variable, 
 default = 'ajhgdjagdjasdkjashk' , 
 compresstype=zlib,
 blocksize=32768,
 compresslevel=9);
select typoptions from pg_type_encoding where typid='varchar_type1 '::regtype;
                     typoptions                      
-----------------------------------------------------
 {compresstype=zlib,blocksize=32768,compresslevel=9}
(1 row)

DROP type if exists date_type1 cascade ; 
NOTICE:  type "date_type1" does not exist, skipping
CREATE type date_type1;
CREATE FUNCTION date_type1_in(cstring) 
 RETURNS date_type1
 AS 'date_in' 
 LANGUAGE internal IMMUTABLE STRICT NO SQL; 
NOTICE:  return type date_type1 is only a shell
CREATE FUNCTION date_type1_out(date_type1) 
 RETURNS cstring
 AS 'date_out' 
 LANGUAGE internal IMMUTABLE STRICT NO SQL; 
NOTICE:  argument type date_type1 is only a shell
CREATE TYPE date_type1( 
 input = date_type1_in ,
 output = date_type1_out ,
 internallength = 4, 
 default = '2001-12-11' , 
 passedbyvalue, 
 compresstype=rle_type,
 blocksize=32768,
 compresslevel=1);
--Drop and recreate the data type 
 Drop type if exists date_type1 cascade;
NOTICE:  drop cascades to function date_type1_out(date_type1)
NOTICE:  drop cascades to function date_type1_in(cstring)
CREATE FUNCTION date_type1_in(cstring) 
 RETURNS date_type1
 AS 'date_in' 
 LANGUAGE internal IMMUTABLE STRICT NO SQL; 
NOTICE:  type "date_type1" is not yet defined
DETAIL:  Creating a shell type definition.
CREATE FUNCTION date_type1_out(date_type1) 
 RETURNS cstring
 AS 'date_out' 
 LANGUAGE internal IMMUTABLE STRICT NO SQL; 
NOTICE:  argument type date_type1 is only a shell
CREATE TYPE date_type1( 
 input = date_type1_in ,
 output = date_type1_out ,
 internallength = 4, 
 default = '2001-12-11' , 
 passedbyvalue, 
 compresstype=zlib,
 blocksize=32768,
 compresslevel=2);
select typoptions from pg_type_encoding where typid='date_type1 '::regtype;
                     typoptions                      
-----------------------------------------------------
 {compresstype=zlib,blocksize=32768,compresslevel=2}
(1 row)

DROP type if exists timestamp_type1 cascade ; 
NOTICE:  type "timestamp_type1" does not exist, skipping
CREATE type timestamp_type1;
CREATE FUNCTION timestamp_type1_in(cstring) 
 RETURNS timestamp_type1
 AS 'timestamp_in' 
 LANGUAGE internal IMMUTABLE STRICT NO SQL; 
NOTICE:  return type timestamp_type1 is only a shell
CREATE FUNCTION timestamp_type1_out(timestamp_type1) 
 RETURNS cstring
 AS 'timestamp_out' 
 LANGUAGE internal IMMUTABLE STRICT NO SQL; 
NOTICE:  argument type timestamp_type1 is only a shell
CREATE TYPE timestamp_type1( 
 input = timestamp_type1_in ,
 output = timestamp_type1_out ,
 internallength = 4, 
 default = '2001-12-24 02:26:11' , 
 passedbyvalue, 
 compresstype=rle_type,
 blocksize=32768,
 compresslevel=2);
--Drop and recreate the data type 
 Drop type if exists timestamp_type1 cascade;
NOTICE:  drop cascades to function timestamp_type1_out(timestamp_type1)
NOTICE:  drop cascades to function timestamp_type1_in(cstring)
CREATE FUNCTION timestamp_type1_in(cstring) 
 RETURNS timestamp_type1
 AS 'timestamp_in' 
 LANGUAGE internal IMMUTABLE STRICT NO SQL; 
NOTICE:  type "timestamp_type1" is not yet defined
DETAIL:  Creating a shell type definition.
CREATE FUNCTION timestamp_type1_out(timestamp_type1) 
 RETURNS cstring
 AS 'timestamp_out' 
 LANGUAGE internal IMMUTABLE STRICT NO SQL; 
NOTICE:  argument type timestamp_type1 is only a shell
CREATE TYPE timestamp_type1( 
 input = timestamp_type1_in ,
 output = timestamp_type1_out ,
 internallength = 4, 
 default = '2001-12-24 02:26:11' , 
 passedbyvalue, 
 compresstype=rle_type,
 blocksize=32768,
 compresslevel=4);
select typoptions from pg_type_encoding where typid='timestamp_type1 '::regtype;
                       typoptions                        
---------------------------------------------------------
 {compresstype=rle_type,blocksize=32768,compresslevel=4}
(1 row)

DROP table if exists co_compr_type_tb; 
NOTICE:  table "co_compr_type_tb" does not exist, skipping
-- Create table 
CREATE TABLE co_compr_type_tb
	 (id serial,  a1 int_type1, a2 char_type1, a3 text_type1, a4 date_type1, a5 varchar_type1, a6 timestamp_type1)  WITH (appendonly=true, orientation=column) distributed randomly;
NOTICE:  CREATE TABLE will create implicit sequence "co_compr_type_tb_id_seq" for serial column "co_compr_type_tb.id"
\d+ co_compr_type_tb
                                                         Append-Only Columnar Table "public.co_compr_type_tb"
 Column |      Type       |                           Modifiers                           | Storage | Compression Type | Compression Level | Block Size | Description 
--------+-----------------+---------------------------------------------------------------+---------+------------------+-------------------+------------+-------------
 id     | integer         | not null default nextval('co_compr_type_tb_id_seq'::regclass) | plain   | none             | 0                 | 32768      | 
 a1     | int_type1       |                                                               | plain   | zlib             | 2                 | 32768      | 
 a2     | char_type1      |                                                               | plain   | zlib             | 2                 | 32768      | 
 a3     | text_type1      |                                                               | plain   | zlib             | 7                 | 32768      | 
 a4     | date_type1      |                                                               | plain   | zlib             | 2                 | 32768      | 
 a5     | varchar_type1   |                                                               | plain   | zlib             | 9                 | 32768      | 
 a6     | timestamp_type1 |                                                               | plain   | rle_type         | 4                 | 32768      | 
Checksum: t
Has OIDs: no
Options: appendonly=true, orientation=column
Distributed randomly

INSERT into co_compr_type_tb DEFAULT VALUES ; 
Select * from co_compr_type_tb;
 id | a1 | a2 |              a3               |     a4     |         a5          |               a6                
----+----+----+-------------------------------+------------+---------------------+---------------------------------
  1 | 55 | a  | hfkdshfkjsdhflkshadfkhsadflkh | 12-11-2001 | ajhgdjagdjasdkjashk | Sat Jan 01 00:22:56.712384 2000
(1 row)

Insert into co_compr_type_tb select * from co_compr_type_tb; 
Insert into co_compr_type_tb select * from co_compr_type_tb; 
Insert into co_compr_type_tb select * from co_compr_type_tb; 
Insert into co_compr_type_tb select * from co_compr_type_tb; 
Insert into co_compr_type_tb select * from co_compr_type_tb; 
Insert into co_compr_type_tb select * from co_compr_type_tb; 
Select * from co_compr_type_tb;
 id | a1 | a2 |              a3               |     a4     |         a5          |               a6                
----+----+----+-------------------------------+------------+---------------------+---------------------------------
  1 | 55 | a  | hfkdshfkjsdhflkshadfkhsadflkh | 12-11-2001 | ajhgdjagdjasdkjashk | Sat Jan 01 00:22:56.712384 2000
  1 | 55 | a  | hfkdshfkjsdhflkshadfkhsadflkh | 12-11-2001 | ajhgdjagdjasdkjashk | Sat Jan 01 00:22:56.712384 2000
  1 | 55 | a  | hfkdshfkjsdhflkshadfkhsadflkh | 12-11-2001 | ajhgdjagdjasdkjashk | Sat Jan 01 00:22:56.712384 2000
  1 | 55 | a  | hfkdshfkjsdhflkshadfkhsadflkh | 12-11-2001 | ajhgdjagdjasdkjashk | Sat Jan 01 00:22:56.712384 2000
  1 | 55 | a  | hfkdshfkjsdhflkshadfkhsadflkh | 12-11-2001 | ajhgdjagdjasdkjashk | Sat Jan 01 00:22:56.712384 2000
  1 | 55 | a  | hfkdshfkjsdhflkshadfkhsadflkh | 12-11-2001 | ajhgdjagdjasdkjashk | Sat Jan 01 00:22:56.712384 2000
  1 | 55 | a  | hfkdshfkjsdhflkshadfkhsadflkh | 12-11-2001 | ajhgdjagdjasdkjashk | Sat Jan 01 00:22:56.712384 2000
  1 | 55 | a  | hfkdshfkjsdhflkshadfkhsadflkh | 12-11-2001 | ajhgdjagdjasdkjashk | Sat Jan 01 00:22:56.712384 2000
  1 | 55 | a  | hfkdshfkjsdhflkshadfkhsadflkh | 12-11-2001 | ajhgdjagdjasdkjashk | Sat Jan 01 00:22:56.712384 2000
  1 | 55 | a  | hfkdshfkjsdhflkshadfkhsadflkh | 12-11-2001 | ajhgdjagdjasdkjashk | Sat Jan 01 00:22:56.712384 2000
  1 | 55 | a  | hfkdshfkjsdhflkshadfkhsadflkh | 12-11-2001 | ajhgdjagdjasdkjashk | Sat Jan 01 00:22:56.712384 2000
  1 | 55 | a  | hfkdshfkjsdhflkshadfkhsadflkh | 12-11-2001 | ajhgdjagdjasdkjashk | Sat Jan 01 00:22:56.712384 2000
  1 | 55 | a  | hfkdshfkjsdhflkshadfkhsadflkh | 12-11-2001 | ajhgdjagdjasdkjashk | Sat Jan 01 00:22:56.712384 2000
  1 | 55 | a  | hfkdshfkjsdhflkshadfkhsadflkh | 12-11-2001 | ajhgdjagdjasdkjashk | Sat Jan 01 00:22:56.712384 2000
  1 | 55 | a  | hfkdshfkjsdhflkshadfkhsadflkh | 12-11-2001 | ajhgdjagdjasdkjashk | Sat Jan 01 00:22:56.712384 2000
  1 | 55 | a  | hfkdshfkjsdhflkshadfkhsadflkh | 12-11-2001 | ajhgdjagdjasdkjashk | Sat Jan 01 00:22:56.712384 2000
  1 | 55 | a  | hfkdshfkjsdhflkshadfkhsadflkh | 12-11-2001 | ajhgdjagdjasdkjashk | Sat Jan 01 00:22:56.712384 2000
  1 | 55 | a  | hfkdshfkjsdhflkshadfkhsadflkh | 12-11-2001 | ajhgdjagdjasdkjashk | Sat Jan 01 00:22:56.712384 2000
  1 | 55 | a  | hfkdshfkjsdhflkshadfkhsadflkh | 12-11-2001 | ajhgdjagdjasdkjashk | Sat Jan 01 00:22:56.712384 2000
  1 | 55 | a  | hfkdshfkjsdhflkshadfkhsadflkh | 12-11-2001 | ajhgdjagdjasdkjashk | Sat Jan 01 00:22:56.712384 2000
  1 | 55 | a  | hfkdshfkjsdhflkshadfkhsadflkh | 12-11-2001 | ajhgdjagdjasdkjashk | Sat Jan 01 00:22:56.712384 2000
  1 | 55 | a  | hfkdshfkjsdhflkshadfkhsadflkh | 12-11-2001 | ajhgdjagdjasdkjashk | Sat Jan 01 00:22:56.712384 2000
  1 | 55 | a  | hfkdshfkjsdhflkshadfkhsadflkh | 12-11-2001 | ajhgdjagdjasdkjashk | Sat Jan 01 00:22:56.712384 2000
  1 | 55 | a  | hfkdshfkjsdhflkshadfkhsadflkh | 12-11-2001 | ajhgdjagdjasdkjashk | Sat Jan 01 00:22:56.712384 2000
  1 | 55 | a  | hfkdshfkjsdhflkshadfkhsadflkh | 12-11-2001 | ajhgdjagdjasdkjashk | Sat Jan 01 00:22:56.712384 2000
  1 | 55 | a  | hfkdshfkjsdhflkshadfkhsadflkh | 12-11-2001 | ajhgdjagdjasdkjashk | Sat Jan 01 00:22:56.712384 2000
  1 | 55 | a  | hfkdshfkjsdhflkshadfkhsadflkh | 12-11-2001 | ajhgdjagdjasdkjashk | Sat Jan 01 00:22:56.712384 2000
  1 | 55 | a  | hfkdshfkjsdhflkshadfkhsadflkh | 12-11-2001 | ajhgdjagdjasdkjashk | Sat Jan 01 00:22:56.712384 2000
  1 | 55 | a  | hfkdshfkjsdhflkshadfkhsadflkh | 12-11-2001 | ajhgdjagdjasdkjashk | Sat Jan 01 00:22:56.712384 2000
  1 | 55 | a  | hfkdshfkjsdhflkshadfkhsadflkh | 12-11-2001 | ajhgdjagdjasdkjashk | Sat Jan 01 00:22:56.712384 2000
  1 | 55 | a  | hfkdshfkjsdhflkshadfkhsadflkh | 12-11-2001 | ajhgdjagdjasdkjashk | Sat Jan 01 00:22:56.712384 2000
  1 | 55 | a  | hfkdshfkjsdhflkshadfkhsadflkh | 12-11-2001 | ajhgdjagdjasdkjashk | Sat Jan 01 00:22:56.712384 2000
  1 | 55 | a  | hfkdshfkjsdhflkshadfkhsadflkh | 12-11-2001 | ajhgdjagdjasdkjashk | Sat Jan 01 00:22:56.712384 2000
  1 | 55 | a  | hfkdshfkjsdhflkshadfkhsadflkh | 12-11-2001 | ajhgdjagdjasdkjashk | Sat Jan 01 00:22:56.712384 2000
  1 | 55 | a  | hfkdshfkjsdhflkshadfkhsadflkh | 12-11-2001 | ajhgdjagdjasdkjashk | Sat Jan 01 00:22:56.712384 2000
  1 | 55 | a  | hfkdshfkjsdhflkshadfkhsadflkh | 12-11-2001 | ajhgdjagdjasdkjashk | Sat Jan 01 00:22:56.712384 2000
  1 | 55 | a  | hfkdshfkjsdhflkshadfkhsadflkh | 12-11-2001 | ajhgdjagdjasdkjashk | Sat Jan 01 00:22:56.712384 2000
  1 | 55 | a  | hfkdshfkjsdhflkshadfkhsadflkh | 12-11-2001 | ajhgdjagdjasdkjashk | Sat Jan 01 00:22:56.712384 2000
  1 | 55 | a  | hfkdshfkjsdhflkshadfkhsadflkh | 12-11-2001 | ajhgdjagdjasdkjashk | Sat Jan 01 00:22:56.712384 2000
  1 | 55 | a  | hfkdshfkjsdhflkshadfkhsadflkh | 12-11-2001 | ajhgdjagdjasdkjashk | Sat Jan 01 00:22:56.712384 2000
  1 | 55 | a  | hfkdshfkjsdhflkshadfkhsadflkh | 12-11-2001 | ajhgdjagdjasdkjashk | Sat Jan 01 00:22:56.712384 2000
  1 | 55 | a  | hfkdshfkjsdhflkshadfkhsadflkh | 12-11-2001 | ajhgdjagdjasdkjashk | Sat Jan 01 00:22:56.712384 2000
  1 | 55 | a  | hfkdshfkjsdhflkshadfkhsadflkh | 12-11-2001 | ajhgdjagdjasdkjashk | Sat Jan 01 00:22:56.712384 2000
  1 | 55 | a  | hfkdshfkjsdhflkshadfkhsadflkh | 12-11-2001 | ajhgdjagdjasdkjashk | Sat Jan 01 00:22:56.712384 2000
  1 | 55 | a  | hfkdshfkjsdhflkshadfkhsadflkh | 12-11-2001 | ajhgdjagdjasdkjashk | Sat Jan 01 00:22:56.712384 2000
  1 | 55 | a  | hfkdshfkjsdhflkshadfkhsadflkh | 12-11-2001 | ajhgdjagdjasdkjashk | Sat Jan 01 00:22:56.712384 2000
  1 | 55 | a  | hfkdshfkjsdhflkshadfkhsadflkh | 12-11-2001 | ajhgdjagdjasdkjashk | Sat Jan 01 00:22:56.712384 2000
  1 | 55 | a  | hfkdshfkjsdhflkshadfkhsadflkh | 12-11-2001 | ajhgdjagdjasdkjashk | Sat Jan 01 00:22:56.712384 2000
  1 | 55 | a  | hfkdshfkjsdhflkshadfkhsadflkh | 12-11-2001 | ajhgdjagdjasdkjashk | Sat Jan 01 00:22:56.712384 2000
  1 | 55 | a  | hfkdshfkjsdhflkshadfkhsadflkh | 12-11-2001 | ajhgdjagdjasdkjashk | Sat Jan 01 00:22:56.712384 2000
  1 | 55 | a  | hfkdshfkjsdhflkshadfkhsadflkh | 12-11-2001 | ajhgdjagdjasdkjashk | Sat Jan 01 00:22:56.712384 2000
  1 | 55 | a  | hfkdshfkjsdhflkshadfkhsadflkh | 12-11-2001 | ajhgdjagdjasdkjashk | Sat Jan 01 00:22:56.712384 2000
  1 | 55 | a  | hfkdshfkjsdhflkshadfkhsadflkh | 12-11-2001 | ajhgdjagdjasdkjashk | Sat Jan 01 00:22:56.712384 2000
  1 | 55 | a  | hfkdshfkjsdhflkshadfkhsadflkh | 12-11-2001 | ajhgdjagdjasdkjashk | Sat Jan 01 00:22:56.712384 2000
  1 | 55 | a  | hfkdshfkjsdhflkshadfkhsadflkh | 12-11-2001 | ajhgdjagdjasdkjashk | Sat Jan 01 00:22:56.712384 2000
  1 | 55 | a  | hfkdshfkjsdhflkshadfkhsadflkh | 12-11-2001 | ajhgdjagdjasdkjashk | Sat Jan 01 00:22:56.712384 2000
  1 | 55 | a  | hfkdshfkjsdhflkshadfkhsadflkh | 12-11-2001 | ajhgdjagdjasdkjashk | Sat Jan 01 00:22:56.712384 2000
  1 | 55 | a  | hfkdshfkjsdhflkshadfkhsadflkh | 12-11-2001 | ajhgdjagdjasdkjashk | Sat Jan 01 00:22:56.712384 2000
  1 | 55 | a  | hfkdshfkjsdhflkshadfkhsadflkh | 12-11-2001 | ajhgdjagdjasdkjashk | Sat Jan 01 00:22:56.712384 2000
  1 | 55 | a  | hfkdshfkjsdhflkshadfkhsadflkh | 12-11-2001 | ajhgdjagdjasdkjashk | Sat Jan 01 00:22:56.712384 2000
  1 | 55 | a  | hfkdshfkjsdhflkshadfkhsadflkh | 12-11-2001 | ajhgdjagdjasdkjashk | Sat Jan 01 00:22:56.712384 2000
  1 | 55 | a  | hfkdshfkjsdhflkshadfkhsadflkh | 12-11-2001 | ajhgdjagdjasdkjashk | Sat Jan 01 00:22:56.712384 2000
  1 | 55 | a  | hfkdshfkjsdhflkshadfkhsadflkh | 12-11-2001 | ajhgdjagdjasdkjashk | Sat Jan 01 00:22:56.712384 2000
  1 | 55 | a  | hfkdshfkjsdhflkshadfkhsadflkh | 12-11-2001 | ajhgdjagdjasdkjashk | Sat Jan 01 00:22:56.712384 2000
(64 rows)

--Alter table drop a column 
Alter table co_compr_type_tb Drop column a2; 
Insert into co_compr_type_tb(a1,a3,a4,a5,a6)  select a1,a3,a4,a5,a6 from co_compr_type_tb ;
Select count(*) from co_compr_type_tb; 
 count 
-------
   128
(1 row)

--Alter table rename a column 
Alter table co_compr_type_tb Rename column a3 TO after_rename_a3; 
--Insert data to the table, select count(*)
Insert into co_compr_type_tb(a1,after_rename_a3,a4,a5,a6)  select a1,after_rename_a3,a4,a5,a6 from co_compr_type_tb ;
Select count(*) from co_compr_type_tb; 
 count 
-------
   256
(1 row)

Alter type int_type1 set default encoding (compresstype=rle_type,compresslevel=3);
\d+ co_compr_type_tb
                                                             Append-Only Columnar Table "public.co_compr_type_tb"
     Column      |      Type       |                           Modifiers                           | Storage | Compression Type | Compression Level | Block Size | Description 
-----------------+-----------------+---------------------------------------------------------------+---------+------------------+-------------------+------------+-------------
 id              | integer         | not null default nextval('co_compr_type_tb_id_seq'::regclass) | plain   | none             | 0                 | 32768      | 
 a1              | int_type1       |                                                               | plain   | zlib             | 2                 | 32768      | 
 after_rename_a3 | text_type1      |                                                               | plain   | zlib             | 7                 | 32768      | 
 a4              | date_type1      |                                                               | plain   | zlib             | 2                 | 32768      | 
 a5              | varchar_type1   |                                                               | plain   | zlib             | 9                 | 32768      | 
 a6              | timestamp_type1 |                                                               | plain   | rle_type         | 4                 | 32768      | 
Checksum: t
Has OIDs: no
Options: appendonly=true, orientation=column
Distributed randomly

Insert into co_compr_type_tb(a1,after_rename_a3,a4,a5,a6)  select a1,after_rename_a3,a4,a5,a6 from co_compr_type_tb ;
Select count(*) from co_compr_type_tb; 
 count 
-------
   512
(1 row)

--
-- Drop table if exists
--
DROP TABLE if exists co_compr_zlib_with cascade;
NOTICE:  table "co_compr_zlib_with" does not exist, skipping
--
-- Create table
--
CREATE TABLE co_compr_zlib_with 
	(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,compresstype=zlib,compresslevel=1,blocksize=32768) distributed randomly;
NOTICE:  CREATE TABLE will create implicit sequence "co_compr_zlib_with_id_seq" for serial column "co_compr_zlib_with.id"
-- 
-- Create Indexes
--
CREATE INDEX co_compr_zlib_with_idx_bitmap ON co_compr_zlib_with USING bitmap (a1);
CREATE INDEX co_compr_zlib_with_idx_btree ON co_compr_zlib_with(a9);
--
-- Insert data to the table
--
 INSERT INTO co_compr_zlib_with(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); 
 INSERT INTO co_compr_zlib_with(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(500,510),'F',2010,'f','b','Some students may need time to adjust to school.For most children, the adjustment is quick. Tears will usually disappear after Mommy and  Daddy leave the classroom. Do not plead with your child','2001-12-25 02:22:11','Some students may need time to adjust to school.For most children, the adjustment is quick. Tears will usually disappear after Mommy and  Daddy leave the classroom. Do not plead with your child',generate_series(2500,2516),'2011-10-12','Some students may need time to adjust to school.For most children, the adjustment is quick. Tears will usually disappear after Mommy and  Daddy leave the classroom. Do not plead with your child','Some students may need time to adjust to school.For most children, the adjustment is quick. Tears will usually disappear after Mommy and  Daddy leave the classroom. Do not plead with your child The type integer is the usual choice, as it offers the best balance between range, storage size, and performance The type integer is the usual choice, as it offers the best balance between range, storage size, and performanceThe type integer is the usual choice, as it offers the best balance between range, storage size, and performanceThe type integer is the usual choice, as it offers the best balance between range, storage size, and performanceThe type integer ','1134.26',311353,generate_series(3982,3992),7885,'0101','2002-02-12 01:31:14+1344','2003-11-14 01:41:15','((1,1),(0,1),(1,1))','((2,1)(1,5))','08:00:2b:01:01:03','1-3','Some students may need time to adjust to school.For most children, the adjustment is quick. Tears will usually disappear after Mommy and  Daddy leave the classroom. Do not plead with your child The types smallint, integer, and bigint store whole numbers, that is, numbers without fractional components, of various ranges. The types smallint, integer, and bigint store whole numbers, that is, numbers without fractional components, of various ranges. Attempts to store values outside of the allowed range will result in an errorThe types smallint, integer, and bigint store whole numbers, that is, numbers without fractional components, of various ranges.','((6,5)(4,2))','(3,6)',12.233,'((5,4),2)',12,3114,'(1,1,0,3)','2010-03-21',43164,'$1,500.00','192.167.2','126.1.1.1','10:30:55','Parents and other family members are always welcome at Stratford. After the first two weeks ofschool','0','1',33,44); 
 INSERT INTO co_compr_zlib_with(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(500,525),'M',2010,'f','b','Some students may need time to adjust to school.For most children, the adjustment is quick. Tears will usually disappear after Mommy and  Daddy leave the classroom. Do not plead with your child','2001-12-25 02:22:11','Some students may need time to adjust to school.For most children, the adjustment is quick. Tears will usually disappear after Mommy and  Daddy leave the classroom. Do not plead with your child',generate_series(2500,2515),'2011-10-12','Some students may need time to adjust to school.For most children, the adjustment is quick. Tears will usually disappear after Mommy and  Daddy leave the classroom. Do not plead with your child','Some students may need time to adjust to school.For most children, the adjustment is quick. Tears will usually disappear after Mommy and  Daddy leave the classroom. Do not plead with your child The bigint type might not function correctly on all platforms, since it relies on compiler support for eight-byte integers.The bigint type might not function correctly on all platforms, since it relies on compiler support for eight-byte integers.The bigint type might not function correctly on all platforms, since it relies on compiler support for eight-byte integers.The bigint type might not function correctly on all platforms, since it relies on compiler support ','1134.26',311353,generate_series(3892,3902),7885,'0101','2002-02-12 01:31:14+1344','2003-11-14 01:41:15','((1,1),(0,1),(1,1))','((2,1)(1,5))','08:00:2b:01:01:03','1-3','Some students may need time to adjust to school.For most children, the adjustment is quick. Tears will usually disappear after Mommy and  Daddy leave the classroom. Do not plead with your child The type numeric can store numbers with up to 1000 digits of precision and perform calculations exactly. It is especially recommended for storing monetary amounts and other quantities where exactness is required. However, arithmetic on numeric values is very slow compared to the integer types, or to the floating-point types described in the next section.The type numeric can store numbers with up to 1000 digits of precision and perform calculations exactly.','((6,5)(4,2))','(3,6)',12.233,'((5,4),2)',12,3114,'(1,1,0,3)','2010-03-21',43164,'$1,500.00','192.167.2','126.1.1.1','10:30:55','bit type data must match the length n exactly; it is an error to attempt to store shorter or longer','1','10',43,54); 
 INSERT INTO co_compr_zlib_with(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(600,625),'F',2011,'f','b','If the scale of a value to be stored is greater than the declared scale of the column, the system will round the value to the specified number of fractional digits. Then, if the number of digits to the left of the decimal point ','2001-11-24 02:26:11','bbffruikjjjk89kjhjjdsdsjflsdkfjowikfo;lwejkufhekusgfuyewhfkdhsuyfgjsdbfjhkdshgciuvhdskfhiewyerwhkjehriur687687rt3ughjgd67567tcghjzvcnzfTYr7tugfTRE#$#^%*GGHJFTEW#RUYJBJHCFDGJBJGYrythgfT^&^tjhE655ugHD655uVtyr%^uygUYT&^R%^FJYFHGF',2802,'2011-11-12','Through our sbdfjdsbkfndjkshgifhdsn c  environment, we encourageyour guwr6tojsbdjht8y^W%^GNBMNBHGFE^^, emotional maturity, and a lifetime love of learning.Sign and submit the Stratford enrollment contract and prepaid tuition.Sign and submit the payment authorizahrqwygjashbxuyagsu.','It is very typical for preschool and pre-kindergarten students to experience separation anxietyduring the first few days of school. Please visit the school with your child prior to the first dayof class to help him/her become acquainted with the new environment.As often as possible,speak positively and with encouragement to your child about his/her new school experience.Focus on the excitement and fun of , not the apprehension.It is important to discuss the school procedures with your child. Inform your child that youoom with him','1231.16',121451,4001,2815,'0110','2007-02-12 03:55:15+1317','2011-12-10 11:54:12','((2,2),(1,3),(1,1))','((1,3)(6,5))','07:00:2b:02:01:04','3-2','Some students may need time to adjust to school.For most children, the adjustment is quick. Tears will usually disappear after Mommy and  Daddy leave the cmnsbvduytfrw67ydwhg uygyth your child','((1,2)(6,7))','(9,1)',12.233,'((2,1),6)',12,1114,'(3,1,2,0)','2011-03-11',22564,'$6,050.00','192.168.2','126.4.4.4','12:31:25','Parents and other family members are always welcome at Stratford. After the first two weeks ofschool, we encourage you to stop by and visit any time you like. When visiting, please berespectful of the classroom environment and do not disturb the students or teachers. Prior toeach visit, we require all visidbsnfuyewfudsc,vsmckposjcofice and obtain a visit sticker to be 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.','1','1',13,24); 
 INSERT INTO co_compr_zlib_with(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(1500,1525),'M',2011,'t','b','At Stratford, we believe all children love to learn and that success in school and life depends on developing a strong foundation for learning early in life gsdgdsfoppkhgfshjdgksahdiusahdksahdksahkdhsakdhskahkhasdfu','2001-11-24 02:26:11','ttttttttttttttttrrrrrrrrrrrrrrrrrrrrrtttttttttttttttttttttttttwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwttttttttttttttttttttttttttttttwwwwwwwwwwwwwwwwwwwwweeeeeeeeeeeeeeeeeeeeeeeeeeeeeettttttttttttttttttttttttttttteeeeeeeeeeeeeeeeeeeeeeeeeeedddddddd',2572,'2011-11-12','Through our stimulating dnvuy9efoewlhrf78we68bcmnsbment, we enhsdfiyeowlfdshfkjsdhoifuoeifdhsjvdjnvbhjdfgusftsdbmfnbdstional maturity, and a lifetime loveof learning.Sign and submit the Suythjrbuyhjngy78yuhjkhgvfderujhbdfxrtyuhjcfxdserwhuc  dvfdfofdgjkfrtiomn,eriokljnhbgfdhjkljhgfrtuyhgvform (if required).','It is very typical for preschool and pre-kindergarten students to experience separation anxietyduring the first few days of school. Please visit the school with your child prior to the first dayof class to help him/her become acquainted with the new environment.As often as possible,speak positively and with encouragement to your child about his/her new school experience.Focus on the excitement and fun of school, not the apprehensmnbvcxzasdfghjkoiuytre456789hfghild that you willnot be staying in the classroom with him','1231.16',121451,4001,2815,'0110','2007-02-12 03:55:15+1317','2011-12-10 11:54:12','((2,2),(1,3),(1,1))','((1,3)(6,5))','07:00:2b:02:01:04','3-2','poiuytrewqtgvsxcvbniujhbgvdfrgtyhujjhndcvuhj, the adjustment is quick. Tears will usually disappear after Mommy and  Daddy leave the clasnbdsvuytg uhguyybvhcd with your child','((1,2)(6,7))','(9,1)',12.233,'((2,1),6)',12,1114,'(3,1,2,0)','2011-03-11',22564,'$6,050.00','192.168.2','126.4.4.4','12:31:25','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.','0','1',13,24); 
 INSERT INTO co_compr_zlib_with(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(3300,3455),'F',2011,'f','b','Numeric values are physically stored without any extra leading or trailing zeroes. Thus, the declared precision and scale of a column are maximums, not fixed allocations jwgrkesfjkdshifhdskjnbfnscgffiupjhvgfdatfdjhav','2002-12-24 02:26:10','uewrtuewfhbdshmmfbbhjjjjjjjjjjjjjjjjjjjjjjjjjewjjjjjjjjjjjjjjsb ffffffffffffffeyyyyyyyyyyyyyyyybcj  hgiusyyyy7777777777eeeeeeeeeeewiuhgsuydte78wt87rwetug7666666we7w86e7w6e87w6ew786ew8e678w6e8w6e8w6e8we6w7e827e6238272377hsys6w6yehsy6wh',2552,'2011-11-12','Through odnviudfygojlskhiusdyfdslfun classroom environment, we encourageyour child to achieve self-confidence, emotional maturity, and a lifetime love of learning.Sign and submit the Stratford enrollment contract and prepaid tuition.Sign and submit the payment authorization form (if required).','It is very typical for presclsjhfdiudhskjfnds,vnc,svljsdaon anxietyduring the first few days of school. Please visimngfrtetyuiujnsbvcrdtr to the first dayof class to help him/her become acquainted with the nsfgsduaytf8fodshkfjhdw786%$%#^&&MBHJFY*IUHjhghgasd76ewhfewagement to your child about his/her new school experience.Focus on the excitement and fun of school, not the apprehension.It is important to discuss the school procedures with yhtyrt$#%^*&*HVGfu8jkGUYT$ujjtygdkfghjklfdhgjkfndkjghfdkgkfdge classroom with him','1231.16',121451,generate_series(5,25),2815,'0110','2007-02-12 03:55:15+1317','2011-12-10 11:54:12','((2,2),(1,3),(1,1))','((1,3)(6,5))','07:00:2b:02:01:04','3-2','Snjhgfytwuie4r893r7yhwdgt678iuhjgfr5678u school.For most children, the adjustment is quick. Tears will usually disappear after Mommy and  Daddy leave the classroom. Do not plead with your child','((1,2)(6,7))','(9,1)',12.233,'((2,1),6)',12,1114,'(3,1,2,0)','2011-03-11',22564,'$6,050.00','192.168.2','126.4.4.4','12:31:25','Parents and other family members are always welcome at Stratford. After the first two weeks ofschool, we encourage you to stop  shasuymnsdjkhsayt6b bnftrrojmbmnctreiujmnb nbfyttojmn, please berespectful of the classroom environment and do not disturb the students or teachers. Prior toeach visit, we require all visitosdfiwe7r09e[wrwdhskcisitors sticker to be 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.','0','1',13,24); 
 INSERT INTO co_compr_zlib_with(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(50,55),'M',2011,'f','b','Inexact means that some values cannot be converted exactly to the internal format and are stored as approximations, so that storing and printing back out hwgfrdjwpfidsbhfsyugdskbfkjshfihsdkjfhsjhayiuyihjhvghdhgfjhdva6h','2003-12-24 02:26:11','mjhsiury8w4r9834kfjsdhcjbjghsafre6547698ukljjhgftre4t@%$^&%*&DRTDHGGUY&*^*&(^Gfhe456543^RGHJFYTE%$#!@!~#$%TGJHIU(***$%#@TRFHJG%^$&^*&FHR^%$%UTGHffge45675786gfrtew43ehghjt^%&^86575675tyftyr6tfytr65edf564ttyr565r64tyyyyr4e65tyyyyyyyyyt76',generate_series(700,725),'2011-11-11','Through87678574678uygjr565ghjenvironment, we encourageyour child to achieve ssbfuwet8ryewsjfnjksdhkcmxznbcnsfyetrusdgfdsbhjca lifetime love of learning.Sign and submit the Stratford enrollment contract and prepaid klhgiueffhlskvhfgxtfyuh form (if required).','It is very typical for preschool and pre-kindergarten students to experience separation anxietyduring the first few days of school. Please visit thuytrewfghjkjv cbvnmbvcrte78uhjgnmnbvc5678jnm 4587uijk vacquainted with the new environment.Ajfhgdsufdsjfldsbfcjhgdshhhhhhhhuyhgbn sfsfsdur child about his/her new school experience.Focus on the excitement and fun of school, not the apprehension.It is important to discuss the school procedures with your child. Inform your child that you willnot be stayisdfdsgfuyehfihdfiyiewuyfiuwhfng in the classroom with him','1231.16',121451,4001,2815,'0110','2007-02-12 03:55:15+1317','2011-12-10 11:54:12','((2,2),(1,3),(1,1))','((1,3)(6,5))','07:00:2b:02:01:04','3-2','Some students may need time to adjust to school.jhge7fefvjkehguejfgdkhjkjhgowu09f8r9wugfbwjhvuyTears will usually disappear after Mommy and  Daddy leave the classroom. bdys8snssbss97j with your child','((1,2)(6,7))','(9,1)',12.233,'((2,1),6)',12,1114,'(3,1,2,0)','2011-03-11',22564,'$6,050.00','192.168.2','126.4.4.4','12:31:25','Parents and other family members are always welcome at Stratford. After the first two weeks ofschool, jge7rty3498rtkew mfuhqy970qf wjhg8er7ewrjmwe jhg When visiting, 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 objjcshgifisdcnskjcbdiso be 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.','0','1',13,24); 
-- More data for bigger block size 
 INSERT INTO co_compr_zlib_with(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); 
 INSERT INTO co_compr_zlib_with(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(500,510),'F',2010,'f','b','Some students may need time to adjust to school.For most children, the adjustment is quick. Tears will usually disappear after Mommy and  Daddy leave the classroom. Do not plead with your child','2001-12-25 02:22:11','Some students may need time to adjust to school.For most children, the adjustment is quick. Tears will usually disappear after Mommy and  Daddy leave the classroom. Do not plead with your child',generate_series(2500,2516),'2011-10-12','Some students may need time to adjust to school.For most children, the adjustment is quick. Tears will usually disappear after Mommy and  Daddy leave the classroom. Do not plead with your child','Some students may need time to adjust to school.For most children, the adjustment is quick. Tears will usually disappear after Mommy and  Daddy leave the classroom. Do not plead with your child The type integer is the usual choice, as it offers the best balance between range, storage size, and performance The type integer is the usual choice, as it offers the best balance between range, storage size, and performanceThe type integer is the usual choice, as it offers the best balance between range, storage size, and performanceThe type integer is the usual choice, as it offers the best balance between range, storage size, and performanceThe type integer ','1134.26',311353,generate_series(3982,3992),7885,'0101','2002-02-12 01:31:14+1344','2003-11-14 01:41:15','((1,1),(0,1),(1,1))','((2,1)(1,5))','08:00:2b:01:01:03','1-3','Some students may need time to adjust to school.For most children, the adjustment is quick. Tears will usually disappear after Mommy and  Daddy leave the classroom. Do not plead with your child The types smallint, integer, and bigint store whole numbers, that is, numbers without fractional components, of various ranges. The types smallint, integer, and bigint store whole numbers, that is, numbers without fractional components, of various ranges. Attempts to store values outside of the allowed range will result in an errorThe types smallint, integer, and bigint store whole numbers, that is, numbers without fractional components, of various ranges.','((6,5)(4,2))','(3,6)',12.233,'((5,4),2)',12,3114,'(1,1,0,3)','2010-03-21',43164,'$1,500.00','192.167.2','126.1.1.1','10:30:55','Parents and other family members are always welcome at Stratford. After the first two weeks ofschool','0','1',33,44); 
 INSERT INTO co_compr_zlib_with(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(500,525),'M',2010,'f','b','Some students may need time to adjust to school.For most children, the adjustment is quick. Tears will usually disappear after Mommy and  Daddy leave the classroom. Do not plead with your child','2001-12-25 02:22:11','Some students may need time to adjust to school.For most children, the adjustment is quick. Tears will usually disappear after Mommy and  Daddy leave the classroom. Do not plead with your child',generate_series(2500,2515),'2011-10-12','Some students may need time to adjust to school.For most children, the adjustment is quick. Tears will usually disappear after Mommy and  Daddy leave the classroom. Do not plead with your child','Some students may need time to adjust to school.For most children, the adjustment is quick. Tears will usually disappear after Mommy and  Daddy leave the classroom. Do not plead with your child The bigint type might not function correctly on all platforms, since it relies on compiler support for eight-byte integers.The bigint type might not function correctly on all platforms, since it relies on compiler support for eight-byte integers.The bigint type might not function correctly on all platforms, since it relies on compiler support for eight-byte integers.The bigint type might not function correctly on all platforms, since it relies on compiler support ','1134.26',311353,generate_series(3892,3902),7885,'0101','2002-02-12 01:31:14+1344','2003-11-14 01:41:15','((1,1),(0,1),(1,1))','((2,1)(1,5))','08:00:2b:01:01:03','1-3','Some students may need time to adjust to school.For most children, the adjustment is quick. Tears will usually disappear after Mommy and  Daddy leave the classroom. Do not plead with your child The type numeric can store numbers with up to 1000 digits of precision and perform calculations exactly. It is especially recommended for storing monetary amounts and other quantities where exactness is required. However, arithmetic on numeric values is very slow compared to the integer types, or to the floating-point types described in the next section.The type numeric can store numbers with up to 1000 digits of precision and perform calculations exactly.','((6,5)(4,2))','(3,6)',12.233,'((5,4),2)',12,3114,'(1,1,0,3)','2010-03-21',43164,'$1,500.00','192.167.2','126.1.1.1','10:30:55','bit type data must match the length n exactly; it is an error to attempt to store shorter or longer','1','10',43,54); 
 INSERT INTO co_compr_zlib_with(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(600,625),'F',2011,'f','b','If the scale of a value to be stored is greater than the declared scale of the column, the system will round the value to the specified number of fractional digits. Then, if the number of digits to the left of the decimal point ','2001-11-24 02:26:11','bbffruikjjjk89kjhjjdsdsjflsdkfjowikfo;lwejkufhekusgfuyewhfkdhsuyfgjsdbfjhkdshgciuvhdskfhiewyerwhkjehriur687687rt3ughjgd67567tcghjzvcnzfTYr7tugfTRE#$#^%*GGHJFTEW#RUYJBJHCFDGJBJGYrythgfT^&^tjhE655ugHD655uVtyr%^uygUYT&^R%^FJYFHGF',2802,'2011-11-12','Through our sbdfjdsbkfndjkshgifhdsn c  environment, we encourageyour guwr6tojsbdjht8y^W%^GNBMNBHGFE^^, emotional maturity, and a lifetime love of learning.Sign and submit the Stratford enrollment contract and prepaid tuition.Sign and submit the payment authorizahrqwygjashbxuyagsu.','It is very typical for preschool and pre-kindergarten students to experience separation anxietyduring the first few days of school. Please visit the school with your child prior to the first dayof class to help him/her become acquainted with the new environment.As often as possible,speak positively and with encouragement to your child about his/her new school experience.Focus on the excitement and fun of , not the apprehension.It is important to discuss the school procedures with your child. Inform your child that youoom with him','1231.16',121451,4001,2815,'0110','2007-02-12 03:55:15+1317','2011-12-10 11:54:12','((2,2),(1,3),(1,1))','((1,3)(6,5))','07:00:2b:02:01:04','3-2','Some students may need time to adjust to school.For most children, the adjustment is quick. Tears will usually disappear after Mommy and  Daddy leave the cmnsbvduytfrw67ydwhg uygyth your child','((1,2)(6,7))','(9,1)',12.233,'((2,1),6)',12,1114,'(3,1,2,0)','2011-03-11',22564,'$6,050.00','192.168.2','126.4.4.4','12:31:25','Parents and other family members are always welcome at Stratford. After the first two weeks ofschool, we encourage you to stop by and visit any time you like. When visiting, please berespectful of the classroom environment and do not disturb the students or teachers. Prior toeach visit, we require all visidbsnfuyewfudsc,vsmckposjcofice and obtain a visit sticker to be 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.','1','1',13,24); 
 INSERT INTO co_compr_zlib_with(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(1500,1525),'M',2011,'t','b','At Stratford, we believe all children love to learn and that success in school and life depends on developing a strong foundation for learning early in life gsdgdsfoppkhgfshjdgksahdiusahdksahdksahkdhsakdhskahkhasdfu','2001-11-24 02:26:11','ttttttttttttttttrrrrrrrrrrrrrrrrrrrrrtttttttttttttttttttttttttwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwttttttttttttttttttttttttttttttwwwwwwwwwwwwwwwwwwwwweeeeeeeeeeeeeeeeeeeeeeeeeeeeeettttttttttttttttttttttttttttteeeeeeeeeeeeeeeeeeeeeeeeeeedddddddd',2572,'2011-11-12','Through our stimulating dnvuy9efoewlhrf78we68bcmnsbment, we enhsdfiyeowlfdshfkjsdhoifuoeifdhsjvdjnvbhjdfgusftsdbmfnbdstional maturity, and a lifetime loveof learning.Sign and submit the Suythjrbuyhjngy78yuhjkhgvfderujhbdfxrtyuhjcfxdserwhuc  dvfdfofdgjkfrtiomn,eriokljnhbgfdhjkljhgfrtuyhgvform (if required).','It is very typical for preschool and pre-kindergarten students to experience separation anxietyduring the first few days of school. Please visit the school with your child prior to the first dayof class to help him/her become acquainted with the new environment.As often as possible,speak positively and with encouragement to your child about his/her new school experience.Focus on the excitement and fun of school, not the apprehensmnbvcxzasdfghjkoiuytre456789hfghild that you willnot be staying in the classroom with him','1231.16',121451,4001,2815,'0110','2007-02-12 03:55:15+1317','2011-12-10 11:54:12','((2,2),(1,3),(1,1))','((1,3)(6,5))','07:00:2b:02:01:04','3-2','poiuytrewqtgvsxcvbniujhbgvdfrgtyhujjhndcvuhj, the adjustment is quick. Tears will usually disappear after Mommy and  Daddy leave the clasnbdsvuytg uhguyybvhcd with your child','((1,2)(6,7))','(9,1)',12.233,'((2,1),6)',12,1114,'(3,1,2,0)','2011-03-11',22564,'$6,050.00','192.168.2','126.4.4.4','12:31:25','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.','0','1',13,24); 
 INSERT INTO co_compr_zlib_with(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(3300,3455),'F',2011,'f','b','Numeric values are physically stored without any extra leading or trailing zeroes. Thus, the declared precision and scale of a column are maximums, not fixed allocations jwgrkesfjkdshifhdskjnbfnscgffiupjhvgfdatfdjhav','2002-12-24 02:26:10','uewrtuewfhbdshmmfbbhjjjjjjjjjjjjjjjjjjjjjjjjjewjjjjjjjjjjjjjjsb ffffffffffffffeyyyyyyyyyyyyyyyybcj  hgiusyyyy7777777777eeeeeeeeeeewiuhgsuydte78wt87rwetug7666666we7w86e7w6e87w6ew786ew8e678w6e8w6e8w6e8we6w7e827e6238272377hsys6w6yehsy6wh',2552,'2011-11-12','Through odnviudfygojlskhiusdyfdslfun classroom environment, we encourageyour child to achieve self-confidence, emotional maturity, and a lifetime love of learning.Sign and submit the Stratford enrollment contract and prepaid tuition.Sign and submit the payment authorization form (if required).','It is very typical for presclsjhfdiudhskjfnds,vnc,svljsdaon anxietyduring the first few days of school. Please visimngfrtetyuiujnsbvcrdtr to the first dayof class to help him/her become acquainted with the nsfgsduaytf8fodshkfjhdw786%$%#^&&MBHJFY*IUHjhghgasd76ewhfewagement to your child about his/her new school experience.Focus on the excitement and fun of school, not the apprehension.It is important to discuss the school procedures with yhtyrt$#%^*&*HVGfu8jkGUYT$ujjtygdkfghjklfdhgjkfndkjghfdkgkfdge classroom with him','1231.16',121451,generate_series(5,25),2815,'0110','2007-02-12 03:55:15+1317','2011-12-10 11:54:12','((2,2),(1,3),(1,1))','((1,3)(6,5))','07:00:2b:02:01:04','3-2','Snjhgfytwuie4r893r7yhwdgt678iuhjgfr5678u school.For most children, the adjustment is quick. Tears will usually disappear after Mommy and  Daddy leave the classroom. Do not plead with your child','((1,2)(6,7))','(9,1)',12.233,'((2,1),6)',12,1114,'(3,1,2,0)','2011-03-11',22564,'$6,050.00','192.168.2','126.4.4.4','12:31:25','Parents and other family members are always welcome at Stratford. After the first two weeks ofschool, we encourage you to stop  shasuymnsdjkhsayt6b bnftrrojmbmnctreiujmnb nbfyttojmn, please berespectful of the classroom environment and do not disturb the students or teachers. Prior toeach visit, we require all visitosdfiwe7r09e[wrwdhskcisitors sticker to be 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.','0','1',13,24); 
 INSERT INTO co_compr_zlib_with(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(50,55),'M',2011,'f','b','Inexact means that some values cannot be converted exactly to the internal format and are stored as approximations, so that storing and printing back out hwgfrdjwpfidsbhfsyugdskbfkjshfihsdkjfhsjhayiuyihjhvghdhgfjhdva6h','2003-12-24 02:26:11','mjhsiury8w4r9834kfjsdhcjbjghsafre6547698ukljjhgftre4t@%$^&%*&DRTDHGGUY&*^*&(^Gfhe456543^RGHJFYTE%$#!@!~#$%TGJHIU(***$%#@TRFHJG%^$&^*&FHR^%$%UTGHffge45675786gfrtew43ehghjt^%&^86575675tyftyr6tfytr65edf564ttyr565r64tyyyyr4e65tyyyyyyyyyt76',generate_series(700,725),'2011-11-11','Through87678574678uygjr565ghjenvironment, we encourageyour child to achieve ssbfuwet8ryewsjfnjksdhkcmxznbcnsfyetrusdgfdsbhjca lifetime love of learning.Sign and submit the Stratford enrollment contract and prepaid klhgiueffhlskvhfgxtfyuh form (if required).','It is very typical for preschool and pre-kindergarten students to experience separation anxietyduring the first few days of school. Please visit thuytrewfghjkjv cbvnmbvcrte78uhjgnmnbvc5678jnm 4587uijk vacquainted with the new environment.Ajfhgdsufdsjfldsbfcjhgdshhhhhhhhuyhgbn sfsfsdur child about his/her new school experience.Focus on the excitement and fun of school, not the apprehension.It is important to discuss the school procedures with your child. Inform your child that you willnot be stayisdfdsgfuyehfihdfiyiewuyfiuwhfng in the classroom with him','1231.16',121451,4001,2815,'0110','2007-02-12 03:55:15+1317','2011-12-10 11:54:12','((2,2),(1,3),(1,1))','((1,3)(6,5))','07:00:2b:02:01:04','3-2','Some students may need time to adjust to school.jhge7fefvjkehguejfgdkhjkjhgowu09f8r9wugfbwjhvuyTears will usually disappear after Mommy and  Daddy leave the classroom. bdys8snssbss97j with your child','((1,2)(6,7))','(9,1)',12.233,'((2,1),6)',12,1114,'(3,1,2,0)','2011-03-11',22564,'$6,050.00','192.168.2','126.4.4.4','12:31:25','Parents and other family members are always welcome at Stratford. After the first two weeks ofschool, jge7rty3498rtkew mfuhqy970qf wjhg8er7ewrjmwe jhg When visiting, 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 objjcshgifisdcnskjcbdiso be 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.','0','1',13,24); 
\d+ co_compr_zlib_with
                                                               Append-Only Columnar Table "public.co_compr_zlib_with"
 Column |            Type             |                             Modifiers                           | Storage  | Compression Type | Compression Level | Block Size | Description 
--------+-----------------------------+-----------------------------------------------------------------+----------+------------------+-------------------+------------+-------------
 id     | integer                     | not null default nextval('co_compr_zlib_with_id_seq'::regclass) | plain    | zlib             | 1                 | 32768      | 
 a1     | integer                     |                                                                 | plain    | zlib             | 1                 | 32768      | 
 a2     | character(5)                |                                                                 | extended | zlib             | 1                 | 32768      | 
 a3     | numeric                     |                                                                 | main     | zlib             | 1                 | 32768      | 
 a4     | boolean                     | default false                                                   | plain    | zlib             | 1                 | 32768      | 
 a5     | character(1)                | default 'd'::bpchar                                             | extended | zlib             | 1                 | 32768      | 
 a6     | text                        |                                                                 | extended | zlib             | 1                 | 32768      | 
 a7     | timestamp without time zone |                                                                 | plain    | zlib             | 1                 | 32768      | 
 a8     | character varying(705)      |                                                                 | extended | zlib             | 1                 | 32768      | 
 a9     | bigint                      |                                                                 | plain    | zlib             | 1                 | 32768      | 
 a10    | date                        |                                                                 | plain    | zlib             | 1                 | 32768      | 
 a11    | character varying(600)      |                                                                 | extended | zlib             | 1                 | 32768      | 
 a12    | text                        |                                                                 | extended | zlib             | 1                 | 32768      | 
 a13    | numeric                     |                                                                 | main     | zlib             | 1                 | 32768      | 
 a14    | real                        |                                                                 | plain    | zlib             | 1                 | 32768      | 
 a15    | bigint                      |                                                                 | plain    | zlib             | 1                 | 32768      | 
 a16    | integer                     |                                                                 | plain    | zlib             | 1                 | 32768      | 
 a17    | bytea                       |                                                                 | extended | zlib             | 1                 | 32768      | 
 a18    | timestamp with time zone    |                                                                 | plain    | zlib             | 1                 | 32768      | 
 a19    | time with time zone         |                                                                 | plain    | zlib             | 1                 | 32768      | 
 a20    | path                        |                                                                 | extended | zlib             | 1                 | 32768      | 
 a21    | box                         |                                                                 | plain    | zlib             | 1                 | 32768      | 
 a22    | macaddr                     |                                                                 | plain    | zlib             | 1                 | 32768      | 
 a23    | interval                    |                                                                 | plain    | zlib             | 1                 | 32768      | 
 a24    | character varying(800)      |                                                                 | extended | zlib             | 1                 | 32768      | 
 a25    | lseg                        |                                                                 | plain    | zlib             | 1                 | 32768      | 
 a26    | point                       |                                                                 | plain    | zlib             | 1                 | 32768      | 
 a27    | double precision            |                                                                 | plain    | zlib             | 1                 | 32768      | 
 a28    | circle                      |                                                                 | plain    | zlib             | 1                 | 32768      | 
 a29    | integer                     |                                                                 | plain    | zlib             | 1                 | 32768      | 
 a30    | numeric(8,0)                |                                                                 | main     | zlib             | 1                 | 32768      | 
 a31    | polygon                     |                                                                 | extended | zlib             | 1                 | 32768      | 
 a32    | date                        |                                                                 | plain    | zlib             | 1                 | 32768      | 
 a33    | real                        |                                                                 | plain    | zlib             | 1                 | 32768      | 
 a34    | money                       |                                                                 | plain    | zlib             | 1                 | 32768      | 
A
Adam Lee 已提交
3663 3664
 a35    | cidr                        |                                                                 | main     | zlib             | 1                 | 32768      | 
 a36    | inet                        |                                                                 | main     | zlib             | 1                 | 32768      | 
3665 3666 3667 3668 3669 3670 3671 3672 3673 3674 3675 3676 3677 3678 3679 3680 3681 3682 3683 3684 3685 3686 3687 3688 3689 3690 3691 3692 3693 3694 3695 3696 3697 3698 3699 3700 3701 3702 3703 3704 3705 3706 3707 3708 3709 3710 3711 3712 3713 3714 3715 3716 3717 3718 3719 3720 3721 3722 3723 3724 3725 3726 3727 3728 3729 3730 3731 3732 3733 3734 3735 3736 3737 3738 3739 3740 3741 3742 3743 3744 3745 3746 3747 3748 3749 3750 3751 3752 3753 3754 3755 3756 3757 3758 3759 3760 3761 3762 3763 3764 3765 3766 3767 3768 3769 3770 3771 3772 3773 3774 3775 3776 3777 3778 3779 3780 3781 3782 3783 3784 3785 3786 3787 3788 3789 3790 3791 3792 3793 3794 3795 3796 3797 3798 3799 3800 3801 3802 3803 3804 3805 3806 3807 3808 3809 3810 3811 3812 3813 3814 3815 3816 3817 3818 3819 3820 3821
 a37    | time without time zone      |                                                                 | plain    | zlib             | 1                 | 32768      | 
 a38    | text                        |                                                                 | extended | zlib             | 1                 | 32768      | 
 a39    | bit(1)                      |                                                                 | extended | zlib             | 1                 | 32768      | 
 a40    | bit varying(5)              |                                                                 | extended | zlib             | 1                 | 32768      | 
 a41    | smallint                    |                                                                 | plain    | zlib             | 1                 | 32768      | 
 a42    | integer                     |                                                                 | plain    | zlib             | 1                 | 32768      | 
Checksum: t
Indexes:
    "co_compr_zlib_with_idx_bitmap" bitmap (a1)
    "co_compr_zlib_with_idx_btree" btree (a9)
Has OIDs: no
Options: appendonly=true, orientation=column, compresstype=zlib, compresslevel=1, blocksize=32768
Distributed randomly

--
-- Select number of rows from the compressed table 
--
SELECT count(*) as count_compressed from  co_compr_zlib_with;
 count_compressed 
------------------
             9154
(1 row)

--Alter table alter type of a column 
Alter table co_compr_zlib_with Alter column a3 TYPE int4; 
--Insert data to the table, select count(*)
Insert into co_compr_zlib_with(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 co_compr_zlib_with where id =10;
Select count(*) from co_compr_zlib_with; 
 count 
-------
  9155
(1 row)

--Alter table drop a column 
Alter table co_compr_zlib_with Drop column a12; 
Insert into co_compr_zlib_with(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 co_compr_zlib_with where id =10;
Select count(*) from co_compr_zlib_with; 
 count 
-------
  9156
(1 row)

--Alter table rename a column 
Alter table co_compr_zlib_with Rename column a13 TO after_rename_a13; 
--Insert data to the table, select count(*)
Insert into co_compr_zlib_with(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 co_compr_zlib_with where id =10;
Select count(*) from co_compr_zlib_with; 
 count 
-------
  9157
(1 row)

--Drop table 
DROP table co_compr_zlib_with; 
--Create table again and insert data 
CREATE TABLE co_compr_zlib_with 
	(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,compresstype=zlib,compresslevel=1,blocksize=32768) distributed randomly;
NOTICE:  CREATE TABLE will create implicit sequence "co_compr_zlib_with_id_seq" for serial column "co_compr_zlib_with.id"
 INSERT INTO co_compr_zlib_with(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); 
 INSERT INTO co_compr_zlib_with(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(500,510),'F',2010,'f','b','Some students may need time to adjust to school.For most children, the adjustment is quick. Tears will usually disappear after Mommy and  Daddy leave the classroom. Do not plead with your child','2001-12-25 02:22:11','Some students may need time to adjust to school.For most children, the adjustment is quick. Tears will usually disappear after Mommy and  Daddy leave the classroom. Do not plead with your child',generate_series(2500,2516),'2011-10-12','Some students may need time to adjust to school.For most children, the adjustment is quick. Tears will usually disappear after Mommy and  Daddy leave the classroom. Do not plead with your child','Some students may need time to adjust to school.For most children, the adjustment is quick. Tears will usually disappear after Mommy and  Daddy leave the classroom. Do not plead with your child The type integer is the usual choice, as it offers the best balance between range, storage size, and performance The type integer is the usual choice, as it offers the best balance between range, storage size, and performanceThe type integer is the usual choice, as it offers the best balance between range, storage size, and performanceThe type integer is the usual choice, as it offers the best balance between range, storage size, and performanceThe type integer ','1134.26',311353,generate_series(3982,3992),7885,'0101','2002-02-12 01:31:14+1344','2003-11-14 01:41:15','((1,1),(0,1),(1,1))','((2,1)(1,5))','08:00:2b:01:01:03','1-3','Some students may need time to adjust to school.For most children, the adjustment is quick. Tears will usually disappear after Mommy and  Daddy leave the classroom. Do not plead with your child The types smallint, integer, and bigint store whole numbers, that is, numbers without fractional components, of various ranges. The types smallint, integer, and bigint store whole numbers, that is, numbers without fractional components, of various ranges. Attempts to store values outside of the allowed range will result in an errorThe types smallint, integer, and bigint store whole numbers, that is, numbers without fractional components, of various ranges.','((6,5)(4,2))','(3,6)',12.233,'((5,4),2)',12,3114,'(1,1,0,3)','2010-03-21',43164,'$1,500.00','192.167.2','126.1.1.1','10:30:55','Parents and other family members are always welcome at Stratford. After the first two weeks ofschool','0','1',33,44); 
 INSERT INTO co_compr_zlib_with(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(500,525),'M',2010,'f','b','Some students may need time to adjust to school.For most children, the adjustment is quick. Tears will usually disappear after Mommy and  Daddy leave the classroom. Do not plead with your child','2001-12-25 02:22:11','Some students may need time to adjust to school.For most children, the adjustment is quick. Tears will usually disappear after Mommy and  Daddy leave the classroom. Do not plead with your child',generate_series(2500,2515),'2011-10-12','Some students may need time to adjust to school.For most children, the adjustment is quick. Tears will usually disappear after Mommy and  Daddy leave the classroom. Do not plead with your child','Some students may need time to adjust to school.For most children, the adjustment is quick. Tears will usually disappear after Mommy and  Daddy leave the classroom. Do not plead with your child The bigint type might not function correctly on all platforms, since it relies on compiler support for eight-byte integers.The bigint type might not function correctly on all platforms, since it relies on compiler support for eight-byte integers.The bigint type might not function correctly on all platforms, since it relies on compiler support for eight-byte integers.The bigint type might not function correctly on all platforms, since it relies on compiler support ','1134.26',311353,generate_series(3892,3902),7885,'0101','2002-02-12 01:31:14+1344','2003-11-14 01:41:15','((1,1),(0,1),(1,1))','((2,1)(1,5))','08:00:2b:01:01:03','1-3','Some students may need time to adjust to school.For most children, the adjustment is quick. Tears will usually disappear after Mommy and  Daddy leave the classroom. Do not plead with your child The type numeric can store numbers with up to 1000 digits of precision and perform calculations exactly. It is especially recommended for storing monetary amounts and other quantities where exactness is required. However, arithmetic on numeric values is very slow compared to the integer types, or to the floating-point types described in the next section.The type numeric can store numbers with up to 1000 digits of precision and perform calculations exactly.','((6,5)(4,2))','(3,6)',12.233,'((5,4),2)',12,3114,'(1,1,0,3)','2010-03-21',43164,'$1,500.00','192.167.2','126.1.1.1','10:30:55','bit type data must match the length n exactly; it is an error to attempt to store shorter or longer','1','10',43,54); 
 INSERT INTO co_compr_zlib_with(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(600,625),'F',2011,'f','b','If the scale of a value to be stored is greater than the declared scale of the column, the system will round the value to the specified number of fractional digits. Then, if the number of digits to the left of the decimal point ','2001-11-24 02:26:11','bbffruikjjjk89kjhjjdsdsjflsdkfjowikfo;lwejkufhekusgfuyewhfkdhsuyfgjsdbfjhkdshgciuvhdskfhiewyerwhkjehriur687687rt3ughjgd67567tcghjzvcnzfTYr7tugfTRE#$#^%*GGHJFTEW#RUYJBJHCFDGJBJGYrythgfT^&^tjhE655ugHD655uVtyr%^uygUYT&^R%^FJYFHGF',2802,'2011-11-12','Through our sbdfjdsbkfndjkshgifhdsn c  environment, we encourageyour guwr6tojsbdjht8y^W%^GNBMNBHGFE^^, emotional maturity, and a lifetime love of learning.Sign and submit the Stratford enrollment contract and prepaid tuition.Sign and submit the payment authorizahrqwygjashbxuyagsu.','It is very typical for preschool and pre-kindergarten students to experience separation anxietyduring the first few days of school. Please visit the school with your child prior to the first dayof class to help him/her become acquainted with the new environment.As often as possible,speak positively and with encouragement to your child about his/her new school experience.Focus on the excitement and fun of , not the apprehension.It is important to discuss the school procedures with your child. Inform your child that youoom with him','1231.16',121451,4001,2815,'0110','2007-02-12 03:55:15+1317','2011-12-10 11:54:12','((2,2),(1,3),(1,1))','((1,3)(6,5))','07:00:2b:02:01:04','3-2','Some students may need time to adjust to school.For most children, the adjustment is quick. Tears will usually disappear after Mommy and  Daddy leave the cmnsbvduytfrw67ydwhg uygyth your child','((1,2)(6,7))','(9,1)',12.233,'((2,1),6)',12,1114,'(3,1,2,0)','2011-03-11',22564,'$6,050.00','192.168.2','126.4.4.4','12:31:25','Parents and other family members are always welcome at Stratford. After the first two weeks ofschool, we encourage you to stop by and visit any time you like. When visiting, please berespectful of the classroom environment and do not disturb the students or teachers. Prior toeach visit, we require all visidbsnfuyewfudsc,vsmckposjcofice and obtain a visit sticker to be 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.','1','1',13,24); 
 INSERT INTO co_compr_zlib_with(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(1500,1525),'M',2011,'t','b','At Stratford, we believe all children love to learn and that success in school and life depends on developing a strong foundation for learning early in life gsdgdsfoppkhgfshjdgksahdiusahdksahdksahkdhsakdhskahkhasdfu','2001-11-24 02:26:11','ttttttttttttttttrrrrrrrrrrrrrrrrrrrrrtttttttttttttttttttttttttwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwttttttttttttttttttttttttttttttwwwwwwwwwwwwwwwwwwwwweeeeeeeeeeeeeeeeeeeeeeeeeeeeeettttttttttttttttttttttttttttteeeeeeeeeeeeeeeeeeeeeeeeeeedddddddd',2572,'2011-11-12','Through our stimulating dnvuy9efoewlhrf78we68bcmnsbment, we enhsdfiyeowlfdshfkjsdhoifuoeifdhsjvdjnvbhjdfgusftsdbmfnbdstional maturity, and a lifetime loveof learning.Sign and submit the Suythjrbuyhjngy78yuhjkhgvfderujhbdfxrtyuhjcfxdserwhuc  dvfdfofdgjkfrtiomn,eriokljnhbgfdhjkljhgfrtuyhgvform (if required).','It is very typical for preschool and pre-kindergarten students to experience separation anxietyduring the first few days of school. Please visit the school with your child prior to the first dayof class to help him/her become acquainted with the new environment.As often as possible,speak positively and with encouragement to your child about his/her new school experience.Focus on the excitement and fun of school, not the apprehensmnbvcxzasdfghjkoiuytre456789hfghild that you willnot be staying in the classroom with him','1231.16',121451,4001,2815,'0110','2007-02-12 03:55:15+1317','2011-12-10 11:54:12','((2,2),(1,3),(1,1))','((1,3)(6,5))','07:00:2b:02:01:04','3-2','poiuytrewqtgvsxcvbniujhbgvdfrgtyhujjhndcvuhj, the adjustment is quick. Tears will usually disappear after Mommy and  Daddy leave the clasnbdsvuytg uhguyybvhcd with your child','((1,2)(6,7))','(9,1)',12.233,'((2,1),6)',12,1114,'(3,1,2,0)','2011-03-11',22564,'$6,050.00','192.168.2','126.4.4.4','12:31:25','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.','0','1',13,24); 
 INSERT INTO co_compr_zlib_with(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(3300,3455),'F',2011,'f','b','Numeric values are physically stored without any extra leading or trailing zeroes. Thus, the declared precision and scale of a column are maximums, not fixed allocations jwgrkesfjkdshifhdskjnbfnscgffiupjhvgfdatfdjhav','2002-12-24 02:26:10','uewrtuewfhbdshmmfbbhjjjjjjjjjjjjjjjjjjjjjjjjjewjjjjjjjjjjjjjjsb ffffffffffffffeyyyyyyyyyyyyyyyybcj  hgiusyyyy7777777777eeeeeeeeeeewiuhgsuydte78wt87rwetug7666666we7w86e7w6e87w6ew786ew8e678w6e8w6e8w6e8we6w7e827e6238272377hsys6w6yehsy6wh',2552,'2011-11-12','Through odnviudfygojlskhiusdyfdslfun classroom environment, we encourageyour child to achieve self-confidence, emotional maturity, and a lifetime love of learning.Sign and submit the Stratford enrollment contract and prepaid tuition.Sign and submit the payment authorization form (if required).','It is very typical for presclsjhfdiudhskjfnds,vnc,svljsdaon anxietyduring the first few days of school. Please visimngfrtetyuiujnsbvcrdtr to the first dayof class to help him/her become acquainted with the nsfgsduaytf8fodshkfjhdw786%$%#^&&MBHJFY*IUHjhghgasd76ewhfewagement to your child about his/her new school experience.Focus on the excitement and fun of school, not the apprehension.It is important to discuss the school procedures with yhtyrt$#%^*&*HVGfu8jkGUYT$ujjtygdkfghjklfdhgjkfndkjghfdkgkfdge classroom with him','1231.16',121451,generate_series(5,25),2815,'0110','2007-02-12 03:55:15+1317','2011-12-10 11:54:12','((2,2),(1,3),(1,1))','((1,3)(6,5))','07:00:2b:02:01:04','3-2','Snjhgfytwuie4r893r7yhwdgt678iuhjgfr5678u school.For most children, the adjustment is quick. Tears will usually disappear after Mommy and  Daddy leave the classroom. Do not plead with your child','((1,2)(6,7))','(9,1)',12.233,'((2,1),6)',12,1114,'(3,1,2,0)','2011-03-11',22564,'$6,050.00','192.168.2','126.4.4.4','12:31:25','Parents and other family members are always welcome at Stratford. After the first two weeks ofschool, we encourage you to stop  shasuymnsdjkhsayt6b bnftrrojmbmnctreiujmnb nbfyttojmn, please berespectful of the classroom environment and do not disturb the students or teachers. Prior toeach visit, we require all visitosdfiwe7r09e[wrwdhskcisitors sticker to be 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.','0','1',13,24); 
 INSERT INTO co_compr_zlib_with(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(50,55),'M',2011,'f','b','Inexact means that some values cannot be converted exactly to the internal format and are stored as approximations, so that storing and printing back out hwgfrdjwpfidsbhfsyugdskbfkjshfihsdkjfhsjhayiuyihjhvghdhgfjhdva6h','2003-12-24 02:26:11','mjhsiury8w4r9834kfjsdhcjbjghsafre6547698ukljjhgftre4t@%$^&%*&DRTDHGGUY&*^*&(^Gfhe456543^RGHJFYTE%$#!@!~#$%TGJHIU(***$%#@TRFHJG%^$&^*&FHR^%$%UTGHffge45675786gfrtew43ehghjt^%&^86575675tyftyr6tfytr65edf564ttyr565r64tyyyyr4e65tyyyyyyyyyt76',generate_series(700,725),'2011-11-11','Through87678574678uygjr565ghjenvironment, we encourageyour child to achieve ssbfuwet8ryewsjfnjksdhkcmxznbcnsfyetrusdgfdsbhjca lifetime love of learning.Sign and submit the Stratford enrollment contract and prepaid klhgiueffhlskvhfgxtfyuh form (if required).','It is very typical for preschool and pre-kindergarten students to experience separation anxietyduring the first few days of school. Please visit thuytrewfghjkjv cbvnmbvcrte78uhjgnmnbvc5678jnm 4587uijk vacquainted with the new environment.Ajfhgdsufdsjfldsbfcjhgdshhhhhhhhuyhgbn sfsfsdur child about his/her new school experience.Focus on the excitement and fun of school, not the apprehension.It is important to discuss the school procedures with your child. Inform your child that you willnot be stayisdfdsgfuyehfihdfiyiewuyfiuwhfng in the classroom with him','1231.16',121451,4001,2815,'0110','2007-02-12 03:55:15+1317','2011-12-10 11:54:12','((2,2),(1,3),(1,1))','((1,3)(6,5))','07:00:2b:02:01:04','3-2','Some students may need time to adjust to school.jhge7fefvjkehguejfgdkhjkjhgowu09f8r9wugfbwjhvuyTears will usually disappear after Mommy and  Daddy leave the classroom. bdys8snssbss97j with your child','((1,2)(6,7))','(9,1)',12.233,'((2,1),6)',12,1114,'(3,1,2,0)','2011-03-11',22564,'$6,050.00','192.168.2','126.4.4.4','12:31:25','Parents and other family members are always welcome at Stratford. After the first two weeks ofschool, jge7rty3498rtkew mfuhqy970qf wjhg8er7ewrjmwe jhg When visiting, 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 objjcshgifisdcnskjcbdiso be 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.','0','1',13,24); 
-- More data for bigger block size 
 INSERT INTO co_compr_zlib_with(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); 
 INSERT INTO co_compr_zlib_with(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(500,510),'F',2010,'f','b','Some students may need time to adjust to school.For most children, the adjustment is quick. Tears will usually disappear after Mommy and  Daddy leave the classroom. Do not plead with your child','2001-12-25 02:22:11','Some students may need time to adjust to school.For most children, the adjustment is quick. Tears will usually disappear after Mommy and  Daddy leave the classroom. Do not plead with your child',generate_series(2500,2516),'2011-10-12','Some students may need time to adjust to school.For most children, the adjustment is quick. Tears will usually disappear after Mommy and  Daddy leave the classroom. Do not plead with your child','Some students may need time to adjust to school.For most children, the adjustment is quick. Tears will usually disappear after Mommy and  Daddy leave the classroom. Do not plead with your child The type integer is the usual choice, as it offers the best balance between range, storage size, and performance The type integer is the usual choice, as it offers the best balance between range, storage size, and performanceThe type integer is the usual choice, as it offers the best balance between range, storage size, and performanceThe type integer is the usual choice, as it offers the best balance between range, storage size, and performanceThe type integer ','1134.26',311353,generate_series(3982,3992),7885,'0101','2002-02-12 01:31:14+1344','2003-11-14 01:41:15','((1,1),(0,1),(1,1))','((2,1)(1,5))','08:00:2b:01:01:03','1-3','Some students may need time to adjust to school.For most children, the adjustment is quick. Tears will usually disappear after Mommy and  Daddy leave the classroom. Do not plead with your child The types smallint, integer, and bigint store whole numbers, that is, numbers without fractional components, of various ranges. The types smallint, integer, and bigint store whole numbers, that is, numbers without fractional components, of various ranges. Attempts to store values outside of the allowed range will result in an errorThe types smallint, integer, and bigint store whole numbers, that is, numbers without fractional components, of various ranges.','((6,5)(4,2))','(3,6)',12.233,'((5,4),2)',12,3114,'(1,1,0,3)','2010-03-21',43164,'$1,500.00','192.167.2','126.1.1.1','10:30:55','Parents and other family members are always welcome at Stratford. After the first two weeks ofschool','0','1',33,44); 
 INSERT INTO co_compr_zlib_with(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(500,525),'M',2010,'f','b','Some students may need time to adjust to school.For most children, the adjustment is quick. Tears will usually disappear after Mommy and  Daddy leave the classroom. Do not plead with your child','2001-12-25 02:22:11','Some students may need time to adjust to school.For most children, the adjustment is quick. Tears will usually disappear after Mommy and  Daddy leave the classroom. Do not plead with your child',generate_series(2500,2515),'2011-10-12','Some students may need time to adjust to school.For most children, the adjustment is quick. Tears will usually disappear after Mommy and  Daddy leave the classroom. Do not plead with your child','Some students may need time to adjust to school.For most children, the adjustment is quick. Tears will usually disappear after Mommy and  Daddy leave the classroom. Do not plead with your child The bigint type might not function correctly on all platforms, since it relies on compiler support for eight-byte integers.The bigint type might not function correctly on all platforms, since it relies on compiler support for eight-byte integers.The bigint type might not function correctly on all platforms, since it relies on compiler support for eight-byte integers.The bigint type might not function correctly on all platforms, since it relies on compiler support ','1134.26',311353,generate_series(3892,3902),7885,'0101','2002-02-12 01:31:14+1344','2003-11-14 01:41:15','((1,1),(0,1),(1,1))','((2,1)(1,5))','08:00:2b:01:01:03','1-3','Some students may need time to adjust to school.For most children, the adjustment is quick. Tears will usually disappear after Mommy and  Daddy leave the classroom. Do not plead with your child The type numeric can store numbers with up to 1000 digits of precision and perform calculations exactly. It is especially recommended for storing monetary amounts and other quantities where exactness is required. However, arithmetic on numeric values is very slow compared to the integer types, or to the floating-point types described in the next section.The type numeric can store numbers with up to 1000 digits of precision and perform calculations exactly.','((6,5)(4,2))','(3,6)',12.233,'((5,4),2)',12,3114,'(1,1,0,3)','2010-03-21',43164,'$1,500.00','192.167.2','126.1.1.1','10:30:55','bit type data must match the length n exactly; it is an error to attempt to store shorter or longer','1','10',43,54); 
 INSERT INTO co_compr_zlib_with(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(600,625),'F',2011,'f','b','If the scale of a value to be stored is greater than the declared scale of the column, the system will round the value to the specified number of fractional digits. Then, if the number of digits to the left of the decimal point ','2001-11-24 02:26:11','bbffruikjjjk89kjhjjdsdsjflsdkfjowikfo;lwejkufhekusgfuyewhfkdhsuyfgjsdbfjhkdshgciuvhdskfhiewyerwhkjehriur687687rt3ughjgd67567tcghjzvcnzfTYr7tugfTRE#$#^%*GGHJFTEW#RUYJBJHCFDGJBJGYrythgfT^&^tjhE655ugHD655uVtyr%^uygUYT&^R%^FJYFHGF',2802,'2011-11-12','Through our sbdfjdsbkfndjkshgifhdsn c  environment, we encourageyour guwr6tojsbdjht8y^W%^GNBMNBHGFE^^, emotional maturity, and a lifetime love of learning.Sign and submit the Stratford enrollment contract and prepaid tuition.Sign and submit the payment authorizahrqwygjashbxuyagsu.','It is very typical for preschool and pre-kindergarten students to experience separation anxietyduring the first few days of school. Please visit the school with your child prior to the first dayof class to help him/her become acquainted with the new environment.As often as possible,speak positively and with encouragement to your child about his/her new school experience.Focus on the excitement and fun of , not the apprehension.It is important to discuss the school procedures with your child. Inform your child that youoom with him','1231.16',121451,4001,2815,'0110','2007-02-12 03:55:15+1317','2011-12-10 11:54:12','((2,2),(1,3),(1,1))','((1,3)(6,5))','07:00:2b:02:01:04','3-2','Some students may need time to adjust to school.For most children, the adjustment is quick. Tears will usually disappear after Mommy and  Daddy leave the cmnsbvduytfrw67ydwhg uygyth your child','((1,2)(6,7))','(9,1)',12.233,'((2,1),6)',12,1114,'(3,1,2,0)','2011-03-11',22564,'$6,050.00','192.168.2','126.4.4.4','12:31:25','Parents and other family members are always welcome at Stratford. After the first two weeks ofschool, we encourage you to stop by and visit any time you like. When visiting, please berespectful of the classroom environment and do not disturb the students or teachers. Prior toeach visit, we require all visidbsnfuyewfudsc,vsmckposjcofice and obtain a visit sticker to be 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.','1','1',13,24); 
 INSERT INTO co_compr_zlib_with(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(1500,1525),'M',2011,'t','b','At Stratford, we believe all children love to learn and that success in school and life depends on developing a strong foundation for learning early in life gsdgdsfoppkhgfshjdgksahdiusahdksahdksahkdhsakdhskahkhasdfu','2001-11-24 02:26:11','ttttttttttttttttrrrrrrrrrrrrrrrrrrrrrtttttttttttttttttttttttttwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwttttttttttttttttttttttttttttttwwwwwwwwwwwwwwwwwwwwweeeeeeeeeeeeeeeeeeeeeeeeeeeeeettttttttttttttttttttttttttttteeeeeeeeeeeeeeeeeeeeeeeeeeedddddddd',2572,'2011-11-12','Through our stimulating dnvuy9efoewlhrf78we68bcmnsbment, we enhsdfiyeowlfdshfkjsdhoifuoeifdhsjvdjnvbhjdfgusftsdbmfnbdstional maturity, and a lifetime loveof learning.Sign and submit the Suythjrbuyhjngy78yuhjkhgvfderujhbdfxrtyuhjcfxdserwhuc  dvfdfofdgjkfrtiomn,eriokljnhbgfdhjkljhgfrtuyhgvform (if required).','It is very typical for preschool and pre-kindergarten students to experience separation anxietyduring the first few days of school. Please visit the school with your child prior to the first dayof class to help him/her become acquainted with the new environment.As often as possible,speak positively and with encouragement to your child about his/her new school experience.Focus on the excitement and fun of school, not the apprehensmnbvcxzasdfghjkoiuytre456789hfghild that you willnot be staying in the classroom with him','1231.16',121451,4001,2815,'0110','2007-02-12 03:55:15+1317','2011-12-10 11:54:12','((2,2),(1,3),(1,1))','((1,3)(6,5))','07:00:2b:02:01:04','3-2','poiuytrewqtgvsxcvbniujhbgvdfrgtyhujjhndcvuhj, the adjustment is quick. Tears will usually disappear after Mommy and  Daddy leave the clasnbdsvuytg uhguyybvhcd with your child','((1,2)(6,7))','(9,1)',12.233,'((2,1),6)',12,1114,'(3,1,2,0)','2011-03-11',22564,'$6,050.00','192.168.2','126.4.4.4','12:31:25','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.','0','1',13,24); 
 INSERT INTO co_compr_zlib_with(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(3300,3455),'F',2011,'f','b','Numeric values are physically stored without any extra leading or trailing zeroes. Thus, the declared precision and scale of a column are maximums, not fixed allocations jwgrkesfjkdshifhdskjnbfnscgffiupjhvgfdatfdjhav','2002-12-24 02:26:10','uewrtuewfhbdshmmfbbhjjjjjjjjjjjjjjjjjjjjjjjjjewjjjjjjjjjjjjjjsb ffffffffffffffeyyyyyyyyyyyyyyyybcj  hgiusyyyy7777777777eeeeeeeeeeewiuhgsuydte78wt87rwetug7666666we7w86e7w6e87w6ew786ew8e678w6e8w6e8w6e8we6w7e827e6238272377hsys6w6yehsy6wh',2552,'2011-11-12','Through odnviudfygojlskhiusdyfdslfun classroom environment, we encourageyour child to achieve self-confidence, emotional maturity, and a lifetime love of learning.Sign and submit the Stratford enrollment contract and prepaid tuition.Sign and submit the payment authorization form (if required).','It is very typical for presclsjhfdiudhskjfnds,vnc,svljsdaon anxietyduring the first few days of school. Please visimngfrtetyuiujnsbvcrdtr to the first dayof class to help him/her become acquainted with the nsfgsduaytf8fodshkfjhdw786%$%#^&&MBHJFY*IUHjhghgasd76ewhfewagement to your child about his/her new school experience.Focus on the excitement and fun of school, not the apprehension.It is important to discuss the school procedures with yhtyrt$#%^*&*HVGfu8jkGUYT$ujjtygdkfghjklfdhgjkfndkjghfdkgkfdge classroom with him','1231.16',121451,generate_series(5,25),2815,'0110','2007-02-12 03:55:15+1317','2011-12-10 11:54:12','((2,2),(1,3),(1,1))','((1,3)(6,5))','07:00:2b:02:01:04','3-2','Snjhgfytwuie4r893r7yhwdgt678iuhjgfr5678u school.For most children, the adjustment is quick. Tears will usually disappear after Mommy and  Daddy leave the classroom. Do not plead with your child','((1,2)(6,7))','(9,1)',12.233,'((2,1),6)',12,1114,'(3,1,2,0)','2011-03-11',22564,'$6,050.00','192.168.2','126.4.4.4','12:31:25','Parents and other family members are always welcome at Stratford. After the first two weeks ofschool, we encourage you to stop  shasuymnsdjkhsayt6b bnftrrojmbmnctreiujmnb nbfyttojmn, please berespectful of the classroom environment and do not disturb the students or teachers. Prior toeach visit, we require all visitosdfiwe7r09e[wrwdhskcisitors sticker to be 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.','0','1',13,24); 
 INSERT INTO co_compr_zlib_with(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(50,55),'M',2011,'f','b','Inexact means that some values cannot be converted exactly to the internal format and are stored as approximations, so that storing and printing back out hwgfrdjwpfidsbhfsyugdskbfkjshfihsdkjfhsjhayiuyihjhvghdhgfjhdva6h','2003-12-24 02:26:11','mjhsiury8w4r9834kfjsdhcjbjghsafre6547698ukljjhgftre4t@%$^&%*&DRTDHGGUY&*^*&(^Gfhe456543^RGHJFYTE%$#!@!~#$%TGJHIU(***$%#@TRFHJG%^$&^*&FHR^%$%UTGHffge45675786gfrtew43ehghjt^%&^86575675tyftyr6tfytr65edf564ttyr565r64tyyyyr4e65tyyyyyyyyyt76',generate_series(700,725),'2011-11-11','Through87678574678uygjr565ghjenvironment, we encourageyour child to achieve ssbfuwet8ryewsjfnjksdhkcmxznbcnsfyetrusdgfdsbhjca lifetime love of learning.Sign and submit the Stratford enrollment contract and prepaid klhgiueffhlskvhfgxtfyuh form (if required).','It is very typical for preschool and pre-kindergarten students to experience separation anxietyduring the first few days of school. Please visit thuytrewfghjkjv cbvnmbvcrte78uhjgnmnbvc5678jnm 4587uijk vacquainted with the new environment.Ajfhgdsufdsjfldsbfcjhgdshhhhhhhhuyhgbn sfsfsdur child about his/her new school experience.Focus on the excitement and fun of school, not the apprehension.It is important to discuss the school procedures with your child. Inform your child that you willnot be stayisdfdsgfuyehfihdfiyiewuyfiuwhfng in the classroom with him','1231.16',121451,4001,2815,'0110','2007-02-12 03:55:15+1317','2011-12-10 11:54:12','((2,2),(1,3),(1,1))','((1,3)(6,5))','07:00:2b:02:01:04','3-2','Some students may need time to adjust to school.jhge7fefvjkehguejfgdkhjkjhgowu09f8r9wugfbwjhvuyTears will usually disappear after Mommy and  Daddy leave the classroom. bdys8snssbss97j with your child','((1,2)(6,7))','(9,1)',12.233,'((2,1),6)',12,1114,'(3,1,2,0)','2011-03-11',22564,'$6,050.00','192.168.2','126.4.4.4','12:31:25','Parents and other family members are always welcome at Stratford. After the first two weeks ofschool, jge7rty3498rtkew mfuhqy970qf wjhg8er7ewrjmwe jhg When visiting, 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 objjcshgifisdcnskjcbdiso be 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.','0','1',13,24); 
--Alter table drop a column 
Alter table co_compr_zlib_with Drop column a12; 
--Create CTAS table 
 Drop table if exists co_compr_zlib_with_ctas ;
NOTICE:  table "co_compr_zlib_with_ctas" does not exist, skipping
--Create a CTAS table 
CREATE TABLE co_compr_zlib_with_ctas  WITH (appendonly=true, orientation=column) AS Select * from co_compr_zlib_with;
NOTICE:  Table doesn't have 'DISTRIBUTED BY' clause -- Using column(s) 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.
--
-- Drop table if exists
--
DROP TABLE if exists co_compr_zlib_with cascade;
NOTICE:  table "co_compr_zlib_with" does not exist, skipping
--
-- Create table
--
CREATE TABLE co_compr_zlib_with 
	(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,compresstype=zlib,compresslevel=1,blocksize=32768) distributed randomly;
NOTICE:  CREATE TABLE will create implicit sequence "co_compr_zlib_with_id_seq" for serial column "co_compr_zlib_with.id"
-- 
-- Create Indexes
--
CREATE INDEX co_compr_zlib_with_idx_bitmap ON co_compr_zlib_with USING bitmap (a1);
CREATE INDEX co_compr_zlib_with_idx_btree ON co_compr_zlib_with(a9);
--
-- Insert data to the table
--
 INSERT INTO co_compr_zlib_with(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); 
 INSERT INTO co_compr_zlib_with(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(500,510),'F',2010,'f','b','Some students may need time to adjust to school.For most children, the adjustment is quick. Tears will usually disappear after Mommy and  Daddy leave the classroom. Do not plead with your child','2001-12-25 02:22:11','Some students may need time to adjust to school.For most children, the adjustment is quick. Tears will usually disappear after Mommy and  Daddy leave the classroom. Do not plead with your child',generate_series(2500,2516),'2011-10-12','Some students may need time to adjust to school.For most children, the adjustment is quick. Tears will usually disappear after Mommy and  Daddy leave the classroom. Do not plead with your child','Some students may need time to adjust to school.For most children, the adjustment is quick. Tears will usually disappear after Mommy and  Daddy leave the classroom. Do not plead with your child The type integer is the usual choice, as it offers the best balance between range, storage size, and performance The type integer is the usual choice, as it offers the best balance between range, storage size, and performanceThe type integer is the usual choice, as it offers the best balance between range, storage size, and performanceThe type integer is the usual choice, as it offers the best balance between range, storage size, and performanceThe type integer ','1134.26',311353,generate_series(3982,3992),7885,'0101','2002-02-12 01:31:14+1344','2003-11-14 01:41:15','((1,1),(0,1),(1,1))','((2,1)(1,5))','08:00:2b:01:01:03','1-3','Some students may need time to adjust to school.For most children, the adjustment is quick. Tears will usually disappear after Mommy and  Daddy leave the classroom. Do not plead with your child The types smallint, integer, and bigint store whole numbers, that is, numbers without fractional components, of various ranges. The types smallint, integer, and bigint store whole numbers, that is, numbers without fractional components, of various ranges. Attempts to store values outside of the allowed range will result in an errorThe types smallint, integer, and bigint store whole numbers, that is, numbers without fractional components, of various ranges.','((6,5)(4,2))','(3,6)',12.233,'((5,4),2)',12,3114,'(1,1,0,3)','2010-03-21',43164,'$1,500.00','192.167.2','126.1.1.1','10:30:55','Parents and other family members are always welcome at Stratford. After the first two weeks ofschool','0','1',33,44); 
 INSERT INTO co_compr_zlib_with(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(500,525),'M',2010,'f','b','Some students may need time to adjust to school.For most children, the adjustment is quick. Tears will usually disappear after Mommy and  Daddy leave the classroom. Do not plead with your child','2001-12-25 02:22:11','Some students may need time to adjust to school.For most children, the adjustment is quick. Tears will usually disappear after Mommy and  Daddy leave the classroom. Do not plead with your child',generate_series(2500,2515),'2011-10-12','Some students may need time to adjust to school.For most children, the adjustment is quick. Tears will usually disappear after Mommy and  Daddy leave the classroom. Do not plead with your child','Some students may need time to adjust to school.For most children, the adjustment is quick. Tears will usually disappear after Mommy and  Daddy leave the classroom. Do not plead with your child The bigint type might not function correctly on all platforms, since it relies on compiler support for eight-byte integers.The bigint type might not function correctly on all platforms, since it relies on compiler support for eight-byte integers.The bigint type might not function correctly on all platforms, since it relies on compiler support for eight-byte integers.The bigint type might not function correctly on all platforms, since it relies on compiler support ','1134.26',311353,generate_series(3892,3902),7885,'0101','2002-02-12 01:31:14+1344','2003-11-14 01:41:15','((1,1),(0,1),(1,1))','((2,1)(1,5))','08:00:2b:01:01:03','1-3','Some students may need time to adjust to school.For most children, the adjustment is quick. Tears will usually disappear after Mommy and  Daddy leave the classroom. Do not plead with your child The type numeric can store numbers with up to 1000 digits of precision and perform calculations exactly. It is especially recommended for storing monetary amounts and other quantities where exactness is required. However, arithmetic on numeric values is very slow compared to the integer types, or to the floating-point types described in the next section.The type numeric can store numbers with up to 1000 digits of precision and perform calculations exactly.','((6,5)(4,2))','(3,6)',12.233,'((5,4),2)',12,3114,'(1,1,0,3)','2010-03-21',43164,'$1,500.00','192.167.2','126.1.1.1','10:30:55','bit type data must match the length n exactly; it is an error to attempt to store shorter or longer','1','10',43,54); 
 INSERT INTO co_compr_zlib_with(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(600,625),'F',2011,'f','b','If the scale of a value to be stored is greater than the declared scale of the column, the system will round the value to the specified number of fractional digits. Then, if the number of digits to the left of the decimal point ','2001-11-24 02:26:11','bbffruikjjjk89kjhjjdsdsjflsdkfjowikfo;lwejkufhekusgfuyewhfkdhsuyfgjsdbfjhkdshgciuvhdskfhiewyerwhkjehriur687687rt3ughjgd67567tcghjzvcnzfTYr7tugfTRE#$#^%*GGHJFTEW#RUYJBJHCFDGJBJGYrythgfT^&^tjhE655ugHD655uVtyr%^uygUYT&^R%^FJYFHGF',2802,'2011-11-12','Through our sbdfjdsbkfndjkshgifhdsn c  environment, we encourageyour guwr6tojsbdjht8y^W%^GNBMNBHGFE^^, emotional maturity, and a lifetime love of learning.Sign and submit the Stratford enrollment contract and prepaid tuition.Sign and submit the payment authorizahrqwygjashbxuyagsu.','It is very typical for preschool and pre-kindergarten students to experience separation anxietyduring the first few days of school. Please visit the school with your child prior to the first dayof class to help him/her become acquainted with the new environment.As often as possible,speak positively and with encouragement to your child about his/her new school experience.Focus on the excitement and fun of , not the apprehension.It is important to discuss the school procedures with your child. Inform your child that youoom with him','1231.16',121451,4001,2815,'0110','2007-02-12 03:55:15+1317','2011-12-10 11:54:12','((2,2),(1,3),(1,1))','((1,3)(6,5))','07:00:2b:02:01:04','3-2','Some students may need time to adjust to school.For most children, the adjustment is quick. Tears will usually disappear after Mommy and  Daddy leave the cmnsbvduytfrw67ydwhg uygyth your child','((1,2)(6,7))','(9,1)',12.233,'((2,1),6)',12,1114,'(3,1,2,0)','2011-03-11',22564,'$6,050.00','192.168.2','126.4.4.4','12:31:25','Parents and other family members are always welcome at Stratford. After the first two weeks ofschool, we encourage you to stop by and visit any time you like. When visiting, please berespectful of the classroom environment and do not disturb the students or teachers. Prior toeach visit, we require all visidbsnfuyewfudsc,vsmckposjcofice and obtain a visit sticker to be 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.','1','1',13,24); 
 INSERT INTO co_compr_zlib_with(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(1500,1525),'M',2011,'t','b','At Stratford, we believe all children love to learn and that success in school and life depends on developing a strong foundation for learning early in life gsdgdsfoppkhgfshjdgksahdiusahdksahdksahkdhsakdhskahkhasdfu','2001-11-24 02:26:11','ttttttttttttttttrrrrrrrrrrrrrrrrrrrrrtttttttttttttttttttttttttwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwttttttttttttttttttttttttttttttwwwwwwwwwwwwwwwwwwwwweeeeeeeeeeeeeeeeeeeeeeeeeeeeeettttttttttttttttttttttttttttteeeeeeeeeeeeeeeeeeeeeeeeeeedddddddd',2572,'2011-11-12','Through our stimulating dnvuy9efoewlhrf78we68bcmnsbment, we enhsdfiyeowlfdshfkjsdhoifuoeifdhsjvdjnvbhjdfgusftsdbmfnbdstional maturity, and a lifetime loveof learning.Sign and submit the Suythjrbuyhjngy78yuhjkhgvfderujhbdfxrtyuhjcfxdserwhuc  dvfdfofdgjkfrtiomn,eriokljnhbgfdhjkljhgfrtuyhgvform (if required).','It is very typical for preschool and pre-kindergarten students to experience separation anxietyduring the first few days of school. Please visit the school with your child prior to the first dayof class to help him/her become acquainted with the new environment.As often as possible,speak positively and with encouragement to your child about his/her new school experience.Focus on the excitement and fun of school, not the apprehensmnbvcxzasdfghjkoiuytre456789hfghild that you willnot be staying in the classroom with him','1231.16',121451,4001,2815,'0110','2007-02-12 03:55:15+1317','2011-12-10 11:54:12','((2,2),(1,3),(1,1))','((1,3)(6,5))','07:00:2b:02:01:04','3-2','poiuytrewqtgvsxcvbniujhbgvdfrgtyhujjhndcvuhj, the adjustment is quick. Tears will usually disappear after Mommy and  Daddy leave the clasnbdsvuytg uhguyybvhcd with your child','((1,2)(6,7))','(9,1)',12.233,'((2,1),6)',12,1114,'(3,1,2,0)','2011-03-11',22564,'$6,050.00','192.168.2','126.4.4.4','12:31:25','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.','0','1',13,24); 
 INSERT INTO co_compr_zlib_with(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(3300,3455),'F',2011,'f','b','Numeric values are physically stored without any extra leading or trailing zeroes. Thus, the declared precision and scale of a column are maximums, not fixed allocations jwgrkesfjkdshifhdskjnbfnscgffiupjhvgfdatfdjhav','2002-12-24 02:26:10','uewrtuewfhbdshmmfbbhjjjjjjjjjjjjjjjjjjjjjjjjjewjjjjjjjjjjjjjjsb ffffffffffffffeyyyyyyyyyyyyyyyybcj  hgiusyyyy7777777777eeeeeeeeeeewiuhgsuydte78wt87rwetug7666666we7w86e7w6e87w6ew786ew8e678w6e8w6e8w6e8we6w7e827e6238272377hsys6w6yehsy6wh',2552,'2011-11-12','Through odnviudfygojlskhiusdyfdslfun classroom environment, we encourageyour child to achieve self-confidence, emotional maturity, and a lifetime love of learning.Sign and submit the Stratford enrollment contract and prepaid tuition.Sign and submit the payment authorization form (if required).','It is very typical for presclsjhfdiudhskjfnds,vnc,svljsdaon anxietyduring the first few days of school. Please visimngfrtetyuiujnsbvcrdtr to the first dayof class to help him/her become acquainted with the nsfgsduaytf8fodshkfjhdw786%$%#^&&MBHJFY*IUHjhghgasd76ewhfewagement to your child about his/her new school experience.Focus on the excitement and fun of school, not the apprehension.It is important to discuss the school procedures with yhtyrt$#%^*&*HVGfu8jkGUYT$ujjtygdkfghjklfdhgjkfndkjghfdkgkfdge classroom with him','1231.16',121451,generate_series(5,25),2815,'0110','2007-02-12 03:55:15+1317','2011-12-10 11:54:12','((2,2),(1,3),(1,1))','((1,3)(6,5))','07:00:2b:02:01:04','3-2','Snjhgfytwuie4r893r7yhwdgt678iuhjgfr5678u school.For most children, the adjustment is quick. Tears will usually disappear after Mommy and  Daddy leave the classroom. Do not plead with your child','((1,2)(6,7))','(9,1)',12.233,'((2,1),6)',12,1114,'(3,1,2,0)','2011-03-11',22564,'$6,050.00','192.168.2','126.4.4.4','12:31:25','Parents and other family members are always welcome at Stratford. After the first two weeks ofschool, we encourage you to stop  shasuymnsdjkhsayt6b bnftrrojmbmnctreiujmnb nbfyttojmn, please berespectful of the classroom environment and do not disturb the students or teachers. Prior toeach visit, we require all visitosdfiwe7r09e[wrwdhskcisitors sticker to be 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.','0','1',13,24); 
 INSERT INTO co_compr_zlib_with(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(50,55),'M',2011,'f','b','Inexact means that some values cannot be converted exactly to the internal format and are stored as approximations, so that storing and printing back out hwgfrdjwpfidsbhfsyugdskbfkjshfihsdkjfhsjhayiuyihjhvghdhgfjhdva6h','2003-12-24 02:26:11','mjhsiury8w4r9834kfjsdhcjbjghsafre6547698ukljjhgftre4t@%$^&%*&DRTDHGGUY&*^*&(^Gfhe456543^RGHJFYTE%$#!@!~#$%TGJHIU(***$%#@TRFHJG%^$&^*&FHR^%$%UTGHffge45675786gfrtew43ehghjt^%&^86575675tyftyr6tfytr65edf564ttyr565r64tyyyyr4e65tyyyyyyyyyt76',generate_series(700,725),'2011-11-11','Through87678574678uygjr565ghjenvironment, we encourageyour child to achieve ssbfuwet8ryewsjfnjksdhkcmxznbcnsfyetrusdgfdsbhjca lifetime love of learning.Sign and submit the Stratford enrollment contract and prepaid klhgiueffhlskvhfgxtfyuh form (if required).','It is very typical for preschool and pre-kindergarten students to experience separation anxietyduring the first few days of school. Please visit thuytrewfghjkjv cbvnmbvcrte78uhjgnmnbvc5678jnm 4587uijk vacquainted with the new environment.Ajfhgdsufdsjfldsbfcjhgdshhhhhhhhuyhgbn sfsfsdur child about his/her new school experience.Focus on the excitement and fun of school, not the apprehension.It is important to discuss the school procedures with your child. Inform your child that you willnot be stayisdfdsgfuyehfihdfiyiewuyfiuwhfng in the classroom with him','1231.16',121451,4001,2815,'0110','2007-02-12 03:55:15+1317','2011-12-10 11:54:12','((2,2),(1,3),(1,1))','((1,3)(6,5))','07:00:2b:02:01:04','3-2','Some students may need time to adjust to school.jhge7fefvjkehguejfgdkhjkjhgowu09f8r9wugfbwjhvuyTears will usually disappear after Mommy and  Daddy leave the classroom. bdys8snssbss97j with your child','((1,2)(6,7))','(9,1)',12.233,'((2,1),6)',12,1114,'(3,1,2,0)','2011-03-11',22564,'$6,050.00','192.168.2','126.4.4.4','12:31:25','Parents and other family members are always welcome at Stratford. After the first two weeks ofschool, jge7rty3498rtkew mfuhqy970qf wjhg8er7ewrjmwe jhg When visiting, 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 objjcshgifisdcnskjcbdiso be 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.','0','1',13,24); 
-- More data for bigger block size 
 INSERT INTO co_compr_zlib_with(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); 
 INSERT INTO co_compr_zlib_with(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(500,510),'F',2010,'f','b','Some students may need time to adjust to school.For most children, the adjustment is quick. Tears will usually disappear after Mommy and  Daddy leave the classroom. Do not plead with your child','2001-12-25 02:22:11','Some students may need time to adjust to school.For most children, the adjustment is quick. Tears will usually disappear after Mommy and  Daddy leave the classroom. Do not plead with your child',generate_series(2500,2516),'2011-10-12','Some students may need time to adjust to school.For most children, the adjustment is quick. Tears will usually disappear after Mommy and  Daddy leave the classroom. Do not plead with your child','Some students may need time to adjust to school.For most children, the adjustment is quick. Tears will usually disappear after Mommy and  Daddy leave the classroom. Do not plead with your child The type integer is the usual choice, as it offers the best balance between range, storage size, and performance The type integer is the usual choice, as it offers the best balance between range, storage size, and performanceThe type integer is the usual choice, as it offers the best balance between range, storage size, and performanceThe type integer is the usual choice, as it offers the best balance between range, storage size, and performanceThe type integer ','1134.26',311353,generate_series(3982,3992),7885,'0101','2002-02-12 01:31:14+1344','2003-11-14 01:41:15','((1,1),(0,1),(1,1))','((2,1)(1,5))','08:00:2b:01:01:03','1-3','Some students may need time to adjust to school.For most children, the adjustment is quick. Tears will usually disappear after Mommy and  Daddy leave the classroom. Do not plead with your child The types smallint, integer, and bigint store whole numbers, that is, numbers without fractional components, of various ranges. The types smallint, integer, and bigint store whole numbers, that is, numbers without fractional components, of various ranges. Attempts to store values outside of the allowed range will result in an errorThe types smallint, integer, and bigint store whole numbers, that is, numbers without fractional components, of various ranges.','((6,5)(4,2))','(3,6)',12.233,'((5,4),2)',12,3114,'(1,1,0,3)','2010-03-21',43164,'$1,500.00','192.167.2','126.1.1.1','10:30:55','Parents and other family members are always welcome at Stratford. After the first two weeks ofschool','0','1',33,44); 
 INSERT INTO co_compr_zlib_with(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(500,525),'M',2010,'f','b','Some students may need time to adjust to school.For most children, the adjustment is quick. Tears will usually disappear after Mommy and  Daddy leave the classroom. Do not plead with your child','2001-12-25 02:22:11','Some students may need time to adjust to school.For most children, the adjustment is quick. Tears will usually disappear after Mommy and  Daddy leave the classroom. Do not plead with your child',generate_series(2500,2515),'2011-10-12','Some students may need time to adjust to school.For most children, the adjustment is quick. Tears will usually disappear after Mommy and  Daddy leave the classroom. Do not plead with your child','Some students may need time to adjust to school.For most children, the adjustment is quick. Tears will usually disappear after Mommy and  Daddy leave the classroom. Do not plead with your child The bigint type might not function correctly on all platforms, since it relies on compiler support for eight-byte integers.The bigint type might not function correctly on all platforms, since it relies on compiler support for eight-byte integers.The bigint type might not function correctly on all platforms, since it relies on compiler support for eight-byte integers.The bigint type might not function correctly on all platforms, since it relies on compiler support ','1134.26',311353,generate_series(3892,3902),7885,'0101','2002-02-12 01:31:14+1344','2003-11-14 01:41:15','((1,1),(0,1),(1,1))','((2,1)(1,5))','08:00:2b:01:01:03','1-3','Some students may need time to adjust to school.For most children, the adjustment is quick. Tears will usually disappear after Mommy and  Daddy leave the classroom. Do not plead with your child The type numeric can store numbers with up to 1000 digits of precision and perform calculations exactly. It is especially recommended for storing monetary amounts and other quantities where exactness is required. However, arithmetic on numeric values is very slow compared to the integer types, or to the floating-point types described in the next section.The type numeric can store numbers with up to 1000 digits of precision and perform calculations exactly.','((6,5)(4,2))','(3,6)',12.233,'((5,4),2)',12,3114,'(1,1,0,3)','2010-03-21',43164,'$1,500.00','192.167.2','126.1.1.1','10:30:55','bit type data must match the length n exactly; it is an error to attempt to store shorter or longer','1','10',43,54); 
 INSERT INTO co_compr_zlib_with(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(600,625),'F',2011,'f','b','If the scale of a value to be stored is greater than the declared scale of the column, the system will round the value to the specified number of fractional digits. Then, if the number of digits to the left of the decimal point ','2001-11-24 02:26:11','bbffruikjjjk89kjhjjdsdsjflsdkfjowikfo;lwejkufhekusgfuyewhfkdhsuyfgjsdbfjhkdshgciuvhdskfhiewyerwhkjehriur687687rt3ughjgd67567tcghjzvcnzfTYr7tugfTRE#$#^%*GGHJFTEW#RUYJBJHCFDGJBJGYrythgfT^&^tjhE655ugHD655uVtyr%^uygUYT&^R%^FJYFHGF',2802,'2011-11-12','Through our sbdfjdsbkfndjkshgifhdsn c  environment, we encourageyour guwr6tojsbdjht8y^W%^GNBMNBHGFE^^, emotional maturity, and a lifetime love of learning.Sign and submit the Stratford enrollment contract and prepaid tuition.Sign and submit the payment authorizahrqwygjashbxuyagsu.','It is very typical for preschool and pre-kindergarten students to experience separation anxietyduring the first few days of school. Please visit the school with your child prior to the first dayof class to help him/her become acquainted with the new environment.As often as possible,speak positively and with encouragement to your child about his/her new school experience.Focus on the excitement and fun of , not the apprehension.It is important to discuss the school procedures with your child. Inform your child that youoom with him','1231.16',121451,4001,2815,'0110','2007-02-12 03:55:15+1317','2011-12-10 11:54:12','((2,2),(1,3),(1,1))','((1,3)(6,5))','07:00:2b:02:01:04','3-2','Some students may need time to adjust to school.For most children, the adjustment is quick. Tears will usually disappear after Mommy and  Daddy leave the cmnsbvduytfrw67ydwhg uygyth your child','((1,2)(6,7))','(9,1)',12.233,'((2,1),6)',12,1114,'(3,1,2,0)','2011-03-11',22564,'$6,050.00','192.168.2','126.4.4.4','12:31:25','Parents and other family members are always welcome at Stratford. After the first two weeks ofschool, we encourage you to stop by and visit any time you like. When visiting, please berespectful of the classroom environment and do not disturb the students or teachers. Prior toeach visit, we require all visidbsnfuyewfudsc,vsmckposjcofice and obtain a visit sticker to be 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.','1','1',13,24); 
 INSERT INTO co_compr_zlib_with(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(1500,1525),'M',2011,'t','b','At Stratford, we believe all children love to learn and that success in school and life depends on developing a strong foundation for learning early in life gsdgdsfoppkhgfshjdgksahdiusahdksahdksahkdhsakdhskahkhasdfu','2001-11-24 02:26:11','ttttttttttttttttrrrrrrrrrrrrrrrrrrrrrtttttttttttttttttttttttttwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwttttttttttttttttttttttttttttttwwwwwwwwwwwwwwwwwwwwweeeeeeeeeeeeeeeeeeeeeeeeeeeeeettttttttttttttttttttttttttttteeeeeeeeeeeeeeeeeeeeeeeeeeedddddddd',2572,'2011-11-12','Through our stimulating dnvuy9efoewlhrf78we68bcmnsbment, we enhsdfiyeowlfdshfkjsdhoifuoeifdhsjvdjnvbhjdfgusftsdbmfnbdstional maturity, and a lifetime loveof learning.Sign and submit the Suythjrbuyhjngy78yuhjkhgvfderujhbdfxrtyuhjcfxdserwhuc  dvfdfofdgjkfrtiomn,eriokljnhbgfdhjkljhgfrtuyhgvform (if required).','It is very typical for preschool and pre-kindergarten students to experience separation anxietyduring the first few days of school. Please visit the school with your child prior to the first dayof class to help him/her become acquainted with the new environment.As often as possible,speak positively and with encouragement to your child about his/her new school experience.Focus on the excitement and fun of school, not the apprehensmnbvcxzasdfghjkoiuytre456789hfghild that you willnot be staying in the classroom with him','1231.16',121451,4001,2815,'0110','2007-02-12 03:55:15+1317','2011-12-10 11:54:12','((2,2),(1,3),(1,1))','((1,3)(6,5))','07:00:2b:02:01:04','3-2','poiuytrewqtgvsxcvbniujhbgvdfrgtyhujjhndcvuhj, the adjustment is quick. Tears will usually disappear after Mommy and  Daddy leave the clasnbdsvuytg uhguyybvhcd with your child','((1,2)(6,7))','(9,1)',12.233,'((2,1),6)',12,1114,'(3,1,2,0)','2011-03-11',22564,'$6,050.00','192.168.2','126.4.4.4','12:31:25','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.','0','1',13,24); 
 INSERT INTO co_compr_zlib_with(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(3300,3455),'F',2011,'f','b','Numeric values are physically stored without any extra leading or trailing zeroes. Thus, the declared precision and scale of a column are maximums, not fixed allocations jwgrkesfjkdshifhdskjnbfnscgffiupjhvgfdatfdjhav','2002-12-24 02:26:10','uewrtuewfhbdshmmfbbhjjjjjjjjjjjjjjjjjjjjjjjjjewjjjjjjjjjjjjjjsb ffffffffffffffeyyyyyyyyyyyyyyyybcj  hgiusyyyy7777777777eeeeeeeeeeewiuhgsuydte78wt87rwetug7666666we7w86e7w6e87w6ew786ew8e678w6e8w6e8w6e8we6w7e827e6238272377hsys6w6yehsy6wh',2552,'2011-11-12','Through odnviudfygojlskhiusdyfdslfun classroom environment, we encourageyour child to achieve self-confidence, emotional maturity, and a lifetime love of learning.Sign and submit the Stratford enrollment contract and prepaid tuition.Sign and submit the payment authorization form (if required).','It is very typical for presclsjhfdiudhskjfnds,vnc,svljsdaon anxietyduring the first few days of school. Please visimngfrtetyuiujnsbvcrdtr to the first dayof class to help him/her become acquainted with the nsfgsduaytf8fodshkfjhdw786%$%#^&&MBHJFY*IUHjhghgasd76ewhfewagement to your child about his/her new school experience.Focus on the excitement and fun of school, not the apprehension.It is important to discuss the school procedures with yhtyrt$#%^*&*HVGfu8jkGUYT$ujjtygdkfghjklfdhgjkfndkjghfdkgkfdge classroom with him','1231.16',121451,generate_series(5,25),2815,'0110','2007-02-12 03:55:15+1317','2011-12-10 11:54:12','((2,2),(1,3),(1,1))','((1,3)(6,5))','07:00:2b:02:01:04','3-2','Snjhgfytwuie4r893r7yhwdgt678iuhjgfr5678u school.For most children, the adjustment is quick. Tears will usually disappear after Mommy and  Daddy leave the classroom. Do not plead with your child','((1,2)(6,7))','(9,1)',12.233,'((2,1),6)',12,1114,'(3,1,2,0)','2011-03-11',22564,'$6,050.00','192.168.2','126.4.4.4','12:31:25','Parents and other family members are always welcome at Stratford. After the first two weeks ofschool, we encourage you to stop  shasuymnsdjkhsayt6b bnftrrojmbmnctreiujmnb nbfyttojmn, please berespectful of the classroom environment and do not disturb the students or teachers. Prior toeach visit, we require all visitosdfiwe7r09e[wrwdhskcisitors sticker to be 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.','0','1',13,24); 
 INSERT INTO co_compr_zlib_with(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(50,55),'M',2011,'f','b','Inexact means that some values cannot be converted exactly to the internal format and are stored as approximations, so that storing and printing back out hwgfrdjwpfidsbhfsyugdskbfkjshfihsdkjfhsjhayiuyihjhvghdhgfjhdva6h','2003-12-24 02:26:11','mjhsiury8w4r9834kfjsdhcjbjghsafre6547698ukljjhgftre4t@%$^&%*&DRTDHGGUY&*^*&(^Gfhe456543^RGHJFYTE%$#!@!~#$%TGJHIU(***$%#@TRFHJG%^$&^*&FHR^%$%UTGHffge45675786gfrtew43ehghjt^%&^86575675tyftyr6tfytr65edf564ttyr565r64tyyyyr4e65tyyyyyyyyyt76',generate_series(700,725),'2011-11-11','Through87678574678uygjr565ghjenvironment, we encourageyour child to achieve ssbfuwet8ryewsjfnjksdhkcmxznbcnsfyetrusdgfdsbhjca lifetime love of learning.Sign and submit the Stratford enrollment contract and prepaid klhgiueffhlskvhfgxtfyuh form (if required).','It is very typical for preschool and pre-kindergarten students to experience separation anxietyduring the first few days of school. Please visit thuytrewfghjkjv cbvnmbvcrte78uhjgnmnbvc5678jnm 4587uijk vacquainted with the new environment.Ajfhgdsufdsjfldsbfcjhgdshhhhhhhhuyhgbn sfsfsdur child about his/her new school experience.Focus on the excitement and fun of school, not the apprehension.It is important to discuss the school procedures with your child. Inform your child that you willnot be stayisdfdsgfuyehfihdfiyiewuyfiuwhfng in the classroom with him','1231.16',121451,4001,2815,'0110','2007-02-12 03:55:15+1317','2011-12-10 11:54:12','((2,2),(1,3),(1,1))','((1,3)(6,5))','07:00:2b:02:01:04','3-2','Some students may need time to adjust to school.jhge7fefvjkehguejfgdkhjkjhgowu09f8r9wugfbwjhvuyTears will usually disappear after Mommy and  Daddy leave the classroom. bdys8snssbss97j with your child','((1,2)(6,7))','(9,1)',12.233,'((2,1),6)',12,1114,'(3,1,2,0)','2011-03-11',22564,'$6,050.00','192.168.2','126.4.4.4','12:31:25','Parents and other family members are always welcome at Stratford. After the first two weeks ofschool, jge7rty3498rtkew mfuhqy970qf wjhg8er7ewrjmwe jhg When visiting, 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 objjcshgifisdcnskjcbdiso be 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.','0','1',13,24); 
\d+ co_compr_zlib_with
                                                               Append-Only Columnar Table "public.co_compr_zlib_with"
 Column |            Type             |                            Modifiers                            | Storage  | Compression Type | Compression Level | Block Size | Description 
--------+-----------------------------+-----------------------------------------------------------------+----------+------------------+-------------------+------------+-------------
 id     | integer                     | not null default nextval('co_compr_zlib_with_id_seq'::regclass) | plain    | zlib             | 1                 | 32768      | 
 a1     | integer                     |                                                                 | plain    | zlib             | 1                 | 32768      | 
 a2     | character(5)                |                                                                 | extended | zlib             | 1                 | 32768      | 
 a3     | numeric                     |                                                                 | main     | zlib             | 1                 | 32768      | 
 a4     | boolean                     | default false                                                   | plain    | zlib             | 1                 | 32768      | 
 a5     | character(1)                | default 'd'::bpchar                                             | extended | zlib             | 1                 | 32768      | 
 a6     | text                        |                                                                 | extended | zlib             | 1                 | 32768      | 
 a7     | timestamp without time zone |                                                                 | plain    | zlib             | 1                 | 32768      | 
 a8     | character varying(705)      |                                                                 | extended | zlib             | 1                 | 32768      | 
 a9     | bigint                      |                                                                 | plain    | zlib             | 1                 | 32768      | 
 a10    | date                        |                                                                 | plain    | zlib             | 1                 | 32768      | 
 a11    | character varying(600)      |                                                                 | extended | zlib             | 1                 | 32768      | 
 a12    | text                        |                                                                 | extended | zlib             | 1                 | 32768      | 
 a13    | numeric                     |                                                                 | main     | zlib             | 1                 | 32768      | 
 a14    | real                        |                                                                 | plain    | zlib             | 1                 | 32768      | 
 a15    | bigint                      |                                                                 | plain    | zlib             | 1                 | 32768      | 
 a16    | integer                     |                                                                 | plain    | zlib             | 1                 | 32768      | 
 a17    | bytea                       |                                                                 | extended | zlib             | 1                 | 32768      | 
 a18    | timestamp with time zone    |                                                                 | plain    | zlib             | 1                 | 32768      | 
 a19    | time with time zone         |                                                                 | plain    | zlib             | 1                 | 32768      | 
 a20    | path                        |                                                                 | extended | zlib             | 1                 | 32768      | 
 a21    | box                         |                                                                 | plain    | zlib             | 1                 | 32768      | 
 a22    | macaddr                     |                                                                 | plain    | zlib             | 1                 | 32768      | 
 a23    | interval                    |                                                                 | plain    | zlib             | 1                 | 32768      | 
 a24    | character varying(800)      |                                                                 | extended | zlib             | 1                 | 32768      | 
 a25    | lseg                        |                                                                 | plain    | zlib             | 1                 | 32768      | 
 a26    | point                       |                                                                 | plain    | zlib             | 1                 | 32768      | 
 a27    | double precision            |                                                                 | plain    | zlib             | 1                 | 32768      | 
 a28    | circle                      |                                                                 | plain    | zlib             | 1                 | 32768      | 
 a29    | integer                     |                                                                 | plain    | zlib             | 1                 | 32768      | 
 a30    | numeric(8,0)                |                                                                 | main     | zlib             | 1                 | 32768      | 
 a31    | polygon                     |                                                                 | extended | zlib             | 1                 | 32768      | 
 a32    | date                        |                                                                 | plain    | zlib             | 1                 | 32768      | 
 a33    | real                        |                                                                 | plain    | zlib             | 1                 | 32768      | 
 a34    | money                       |                                                                 | plain    | zlib             | 1                 | 32768      | 
A
Adam Lee 已提交
3822 3823
 a35    | cidr                        |                                                                 | main     | zlib             | 1                 | 32768      | 
 a36    | inet                        |                                                                 | main     | zlib             | 1                 | 32768      | 
3824 3825 3826 3827 3828 3829 3830 3831 3832 3833 3834 3835 3836 3837 3838 3839 3840 3841 3842 3843 3844 3845 3846 3847 3848 3849 3850 3851 3852 3853 3854 3855 3856 3857 3858 3859 3860 3861 3862 3863 3864 3865 3866 3867 3868 3869 3870 3871 3872 3873 3874 3875 3876 3877 3878 3879 3880 3881 3882 3883 3884 3885 3886 3887 3888 3889 3890 3891 3892 3893 3894 3895 3896 3897 3898 3899 3900 3901 3902 3903 3904 3905 3906 3907 3908 3909 3910 3911 3912 3913 3914 3915 3916 3917 3918 3919 3920 3921 3922 3923 3924 3925 3926 3927 3928 3929 3930 3931 3932 3933 3934 3935 3936 3937 3938 3939 3940 3941 3942 3943 3944 3945 3946 3947 3948 3949 3950 3951 3952 3953 3954 3955 3956 3957 3958 3959 3960 3961 3962 3963 3964 3965 3966 3967 3968 3969 3970 3971 3972 3973 3974 3975 3976 3977 3978 3979 3980 3981 3982 3983 3984 3985 3986 3987 3988 3989 3990 3991 3992 3993 3994 3995 3996 3997 3998 3999 4000 4001 4002 4003 4004 4005 4006 4007 4008 4009 4010 4011 4012 4013 4014 4015 4016 4017 4018 4019 4020 4021 4022 4023 4024 4025 4026 4027 4028 4029 4030 4031 4032 4033 4034 4035 4036 4037 4038 4039 4040 4041 4042 4043 4044 4045 4046 4047 4048 4049 4050 4051 4052 4053 4054 4055 4056 4057 4058 4059 4060 4061 4062 4063 4064 4065 4066 4067 4068 4069 4070 4071 4072 4073 4074 4075 4076 4077 4078 4079 4080 4081 4082 4083 4084 4085 4086 4087 4088 4089 4090 4091 4092 4093 4094 4095 4096 4097 4098 4099 4100 4101 4102 4103 4104 4105 4106 4107 4108 4109 4110 4111 4112 4113 4114 4115 4116 4117 4118 4119 4120 4121 4122 4123 4124 4125 4126 4127 4128 4129 4130 4131 4132 4133 4134 4135 4136 4137 4138 4139 4140 4141 4142 4143 4144 4145 4146 4147 4148 4149 4150 4151 4152 4153 4154 4155 4156 4157 4158 4159 4160 4161 4162 4163 4164 4165 4166 4167 4168 4169 4170 4171 4172 4173 4174 4175 4176 4177 4178 4179 4180 4181 4182 4183 4184 4185 4186 4187 4188 4189 4190 4191 4192 4193 4194 4195 4196 4197 4198 4199 4200 4201 4202 4203 4204 4205 4206 4207 4208 4209 4210 4211 4212 4213 4214 4215 4216 4217 4218 4219 4220 4221 4222 4223 4224 4225 4226 4227 4228 4229 4230 4231 4232 4233 4234 4235 4236 4237 4238 4239 4240 4241 4242 4243 4244 4245 4246 4247 4248 4249 4250 4251 4252 4253 4254 4255 4256 4257 4258 4259 4260 4261 4262 4263 4264 4265 4266 4267 4268 4269 4270 4271 4272 4273 4274 4275 4276 4277 4278 4279 4280 4281 4282 4283 4284 4285 4286 4287 4288 4289 4290 4291 4292 4293 4294 4295 4296 4297 4298 4299 4300 4301 4302 4303 4304 4305 4306 4307 4308 4309 4310 4311 4312 4313 4314 4315 4316 4317 4318 4319 4320 4321 4322 4323 4324 4325 4326 4327 4328 4329 4330 4331 4332 4333 4334 4335 4336 4337 4338 4339 4340 4341 4342 4343 4344 4345 4346 4347 4348 4349 4350 4351 4352 4353 4354 4355 4356 4357 4358 4359 4360 4361 4362 4363 4364 4365 4366 4367 4368 4369 4370 4371 4372 4373 4374 4375 4376 4377 4378 4379 4380 4381 4382 4383 4384 4385 4386 4387 4388 4389 4390 4391 4392 4393 4394 4395 4396 4397 4398 4399 4400 4401 4402 4403 4404 4405 4406 4407 4408 4409 4410 4411 4412 4413 4414 4415 4416 4417 4418 4419 4420 4421 4422 4423 4424 4425 4426 4427 4428 4429 4430 4431 4432 4433 4434 4435 4436 4437 4438 4439 4440 4441 4442 4443 4444 4445 4446 4447 4448 4449 4450 4451 4452 4453 4454 4455 4456 4457 4458 4459 4460 4461 4462 4463 4464 4465 4466 4467 4468 4469 4470 4471 4472 4473 4474 4475 4476 4477 4478 4479 4480 4481 4482 4483 4484 4485 4486 4487 4488 4489 4490 4491 4492 4493 4494 4495 4496 4497 4498 4499 4500 4501 4502 4503 4504 4505 4506 4507 4508 4509 4510 4511 4512 4513 4514 4515 4516 4517 4518 4519 4520 4521 4522 4523 4524 4525 4526 4527 4528 4529 4530 4531 4532 4533 4534 4535 4536 4537 4538 4539 4540 4541 4542 4543 4544 4545 4546 4547 4548 4549 4550 4551 4552 4553 4554 4555 4556 4557 4558 4559 4560 4561 4562 4563 4564 4565 4566 4567 4568 4569 4570 4571 4572 4573 4574 4575 4576 4577 4578 4579 4580 4581 4582 4583 4584 4585 4586 4587 4588 4589 4590 4591 4592 4593 4594 4595 4596 4597 4598 4599 4600 4601 4602 4603 4604 4605 4606 4607 4608 4609 4610 4611 4612 4613 4614 4615 4616 4617 4618 4619 4620 4621 4622 4623 4624 4625 4626 4627 4628 4629 4630 4631 4632 4633 4634 4635 4636 4637 4638 4639 4640 4641 4642 4643 4644 4645 4646 4647 4648 4649 4650 4651 4652 4653 4654 4655 4656 4657 4658 4659 4660 4661 4662 4663 4664 4665 4666 4667 4668 4669 4670 4671 4672 4673 4674 4675 4676 4677 4678 4679 4680 4681 4682 4683 4684 4685 4686 4687 4688 4689 4690 4691 4692 4693 4694 4695 4696 4697 4698 4699 4700 4701 4702 4703 4704 4705 4706 4707 4708 4709 4710 4711 4712 4713 4714 4715 4716 4717 4718 4719 4720 4721 4722 4723 4724 4725 4726 4727 4728 4729 4730 4731 4732 4733 4734 4735 4736 4737 4738 4739 4740 4741 4742 4743 4744 4745 4746 4747 4748 4749 4750 4751 4752 4753 4754 4755 4756 4757 4758 4759 4760 4761 4762 4763 4764 4765 4766 4767 4768 4769 4770 4771 4772 4773 4774 4775 4776 4777 4778 4779 4780 4781 4782 4783 4784 4785 4786 4787 4788 4789 4790 4791 4792 4793 4794 4795 4796 4797 4798 4799 4800 4801 4802 4803 4804 4805 4806 4807 4808 4809 4810 4811 4812 4813 4814 4815 4816 4817 4818 4819 4820 4821 4822 4823 4824 4825 4826 4827 4828 4829 4830 4831 4832 4833 4834 4835 4836 4837 4838 4839 4840 4841 4842 4843 4844 4845 4846 4847 4848 4849 4850 4851 4852 4853 4854 4855 4856 4857 4858 4859 4860 4861 4862 4863 4864 4865 4866 4867 4868 4869 4870 4871 4872 4873 4874 4875 4876 4877 4878 4879 4880 4881 4882 4883 4884 4885 4886 4887 4888 4889 4890 4891 4892 4893 4894 4895 4896 4897 4898 4899 4900 4901 4902 4903 4904 4905 4906 4907 4908 4909 4910 4911 4912 4913 4914 4915 4916 4917 4918 4919 4920 4921 4922 4923 4924 4925 4926 4927 4928 4929 4930 4931 4932 4933 4934 4935 4936 4937 4938 4939 4940 4941 4942 4943 4944 4945 4946 4947 4948 4949 4950 4951 4952 4953 4954 4955 4956 4957 4958 4959 4960 4961 4962 4963 4964 4965 4966 4967 4968 4969 4970 4971 4972 4973 4974 4975 4976 4977 4978 4979 4980 4981 4982 4983 4984 4985 4986 4987 4988 4989 4990 4991 4992 4993 4994 4995 4996 4997 4998 4999 5000 5001 5002 5003 5004 5005 5006 5007 5008 5009 5010 5011 5012 5013 5014 5015 5016 5017 5018 5019 5020 5021 5022 5023 5024 5025 5026 5027 5028 5029 5030 5031 5032 5033 5034 5035 5036 5037 5038 5039 5040 5041 5042 5043 5044 5045 5046 5047 5048 5049 5050 5051 5052 5053 5054 5055 5056 5057 5058 5059 5060 5061 5062 5063 5064 5065 5066 5067 5068 5069 5070 5071 5072 5073 5074 5075 5076 5077 5078 5079 5080 5081 5082 5083 5084 5085 5086 5087 5088 5089 5090 5091 5092 5093 5094 5095 5096 5097 5098 5099 5100 5101 5102 5103 5104 5105 5106 5107 5108 5109 5110 5111 5112 5113 5114 5115 5116 5117 5118 5119 5120 5121 5122 5123 5124 5125 5126 5127 5128 5129 5130 5131 5132 5133 5134 5135 5136 5137 5138 5139 5140 5141 5142 5143 5144 5145 5146 5147 5148 5149 5150 5151 5152 5153 5154 5155 5156 5157 5158
 a37    | time without time zone      |                                                                 | plain    | zlib             | 1                 | 32768      | 
 a38    | text                        |                                                                 | extended | zlib             | 1                 | 32768      | 
 a39    | bit(1)                      |                                                                 | extended | zlib             | 1                 | 32768      | 
 a40    | bit varying(5)              |                                                                 | extended | zlib             | 1                 | 32768      | 
 a41    | smallint                    |                                                                 | plain    | zlib             | 1                 | 32768      | 
 a42    | integer                     |                                                                 | plain    | zlib             | 1                 | 32768      | 
Checksum: t
Indexes:
    "co_compr_zlib_with_idx_bitmap" bitmap (a1)
    "co_compr_zlib_with_idx_btree" btree (a9)
Has OIDs: no
Options: appendonly=true, orientation=column, compresstype=zlib, compresslevel=1, blocksize=32768
Distributed randomly

--
-- Select number of rows from the compressed table 
--
SELECT count(*) as count_compressed from  co_compr_zlib_with;
 count_compressed 
------------------
             9154
(1 row)

--Alter table alter type of a column 
Alter table co_compr_zlib_with Alter column a3 TYPE int4; 
--Insert data to the table, select count(*)
Insert into co_compr_zlib_with(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 co_compr_zlib_with where id =10;
Select count(*) from co_compr_zlib_with; 
 count 
-------
  9155
(1 row)

--Alter table drop a column 
Alter table co_compr_zlib_with Drop column a12; 
Insert into co_compr_zlib_with(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 co_compr_zlib_with where id =10;
Select count(*) from co_compr_zlib_with; 
 count 
-------
  9156
(1 row)

--Alter table rename a column 
Alter table co_compr_zlib_with Rename column a13 TO after_rename_a13; 
--Insert data to the table, select count(*)
Insert into co_compr_zlib_with(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 co_compr_zlib_with where id =10;
Select count(*) from co_compr_zlib_with; 
 count 
-------
  9157
(1 row)

--Drop table 
DROP table co_compr_zlib_with; 
--Create table again and insert data 
CREATE TABLE co_compr_zlib_with 
	(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,compresstype=zlib,compresslevel=1,blocksize=32768) distributed randomly;
NOTICE:  CREATE TABLE will create implicit sequence "co_compr_zlib_with_id_seq" for serial column "co_compr_zlib_with.id"
 INSERT INTO co_compr_zlib_with(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); 
 INSERT INTO co_compr_zlib_with(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(500,510),'F',2010,'f','b','Some students may need time to adjust to school.For most children, the adjustment is quick. Tears will usually disappear after Mommy and  Daddy leave the classroom. Do not plead with your child','2001-12-25 02:22:11','Some students may need time to adjust to school.For most children, the adjustment is quick. Tears will usually disappear after Mommy and  Daddy leave the classroom. Do not plead with your child',generate_series(2500,2516),'2011-10-12','Some students may need time to adjust to school.For most children, the adjustment is quick. Tears will usually disappear after Mommy and  Daddy leave the classroom. Do not plead with your child','Some students may need time to adjust to school.For most children, the adjustment is quick. Tears will usually disappear after Mommy and  Daddy leave the classroom. Do not plead with your child The type integer is the usual choice, as it offers the best balance between range, storage size, and performance The type integer is the usual choice, as it offers the best balance between range, storage size, and performanceThe type integer is the usual choice, as it offers the best balance between range, storage size, and performanceThe type integer is the usual choice, as it offers the best balance between range, storage size, and performanceThe type integer ','1134.26',311353,generate_series(3982,3992),7885,'0101','2002-02-12 01:31:14+1344','2003-11-14 01:41:15','((1,1),(0,1),(1,1))','((2,1)(1,5))','08:00:2b:01:01:03','1-3','Some students may need time to adjust to school.For most children, the adjustment is quick. Tears will usually disappear after Mommy and  Daddy leave the classroom. Do not plead with your child The types smallint, integer, and bigint store whole numbers, that is, numbers without fractional components, of various ranges. The types smallint, integer, and bigint store whole numbers, that is, numbers without fractional components, of various ranges. Attempts to store values outside of the allowed range will result in an errorThe types smallint, integer, and bigint store whole numbers, that is, numbers without fractional components, of various ranges.','((6,5)(4,2))','(3,6)',12.233,'((5,4),2)',12,3114,'(1,1,0,3)','2010-03-21',43164,'$1,500.00','192.167.2','126.1.1.1','10:30:55','Parents and other family members are always welcome at Stratford. After the first two weeks ofschool','0','1',33,44); 
 INSERT INTO co_compr_zlib_with(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(500,525),'M',2010,'f','b','Some students may need time to adjust to school.For most children, the adjustment is quick. Tears will usually disappear after Mommy and  Daddy leave the classroom. Do not plead with your child','2001-12-25 02:22:11','Some students may need time to adjust to school.For most children, the adjustment is quick. Tears will usually disappear after Mommy and  Daddy leave the classroom. Do not plead with your child',generate_series(2500,2515),'2011-10-12','Some students may need time to adjust to school.For most children, the adjustment is quick. Tears will usually disappear after Mommy and  Daddy leave the classroom. Do not plead with your child','Some students may need time to adjust to school.For most children, the adjustment is quick. Tears will usually disappear after Mommy and  Daddy leave the classroom. Do not plead with your child The bigint type might not function correctly on all platforms, since it relies on compiler support for eight-byte integers.The bigint type might not function correctly on all platforms, since it relies on compiler support for eight-byte integers.The bigint type might not function correctly on all platforms, since it relies on compiler support for eight-byte integers.The bigint type might not function correctly on all platforms, since it relies on compiler support ','1134.26',311353,generate_series(3892,3902),7885,'0101','2002-02-12 01:31:14+1344','2003-11-14 01:41:15','((1,1),(0,1),(1,1))','((2,1)(1,5))','08:00:2b:01:01:03','1-3','Some students may need time to adjust to school.For most children, the adjustment is quick. Tears will usually disappear after Mommy and  Daddy leave the classroom. Do not plead with your child The type numeric can store numbers with up to 1000 digits of precision and perform calculations exactly. It is especially recommended for storing monetary amounts and other quantities where exactness is required. However, arithmetic on numeric values is very slow compared to the integer types, or to the floating-point types described in the next section.The type numeric can store numbers with up to 1000 digits of precision and perform calculations exactly.','((6,5)(4,2))','(3,6)',12.233,'((5,4),2)',12,3114,'(1,1,0,3)','2010-03-21',43164,'$1,500.00','192.167.2','126.1.1.1','10:30:55','bit type data must match the length n exactly; it is an error to attempt to store shorter or longer','1','10',43,54); 
 INSERT INTO co_compr_zlib_with(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(600,625),'F',2011,'f','b','If the scale of a value to be stored is greater than the declared scale of the column, the system will round the value to the specified number of fractional digits. Then, if the number of digits to the left of the decimal point ','2001-11-24 02:26:11','bbffruikjjjk89kjhjjdsdsjflsdkfjowikfo;lwejkufhekusgfuyewhfkdhsuyfgjsdbfjhkdshgciuvhdskfhiewyerwhkjehriur687687rt3ughjgd67567tcghjzvcnzfTYr7tugfTRE#$#^%*GGHJFTEW#RUYJBJHCFDGJBJGYrythgfT^&^tjhE655ugHD655uVtyr%^uygUYT&^R%^FJYFHGF',2802,'2011-11-12','Through our sbdfjdsbkfndjkshgifhdsn c  environment, we encourageyour guwr6tojsbdjht8y^W%^GNBMNBHGFE^^, emotional maturity, and a lifetime love of learning.Sign and submit the Stratford enrollment contract and prepaid tuition.Sign and submit the payment authorizahrqwygjashbxuyagsu.','It is very typical for preschool and pre-kindergarten students to experience separation anxietyduring the first few days of school. Please visit the school with your child prior to the first dayof class to help him/her become acquainted with the new environment.As often as possible,speak positively and with encouragement to your child about his/her new school experience.Focus on the excitement and fun of , not the apprehension.It is important to discuss the school procedures with your child. Inform your child that youoom with him','1231.16',121451,4001,2815,'0110','2007-02-12 03:55:15+1317','2011-12-10 11:54:12','((2,2),(1,3),(1,1))','((1,3)(6,5))','07:00:2b:02:01:04','3-2','Some students may need time to adjust to school.For most children, the adjustment is quick. Tears will usually disappear after Mommy and  Daddy leave the cmnsbvduytfrw67ydwhg uygyth your child','((1,2)(6,7))','(9,1)',12.233,'((2,1),6)',12,1114,'(3,1,2,0)','2011-03-11',22564,'$6,050.00','192.168.2','126.4.4.4','12:31:25','Parents and other family members are always welcome at Stratford. After the first two weeks ofschool, we encourage you to stop by and visit any time you like. When visiting, please berespectful of the classroom environment and do not disturb the students or teachers. Prior toeach visit, we require all visidbsnfuyewfudsc,vsmckposjcofice and obtain a visit sticker to be 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.','1','1',13,24); 
 INSERT INTO co_compr_zlib_with(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(1500,1525),'M',2011,'t','b','At Stratford, we believe all children love to learn and that success in school and life depends on developing a strong foundation for learning early in life gsdgdsfoppkhgfshjdgksahdiusahdksahdksahkdhsakdhskahkhasdfu','2001-11-24 02:26:11','ttttttttttttttttrrrrrrrrrrrrrrrrrrrrrtttttttttttttttttttttttttwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwttttttttttttttttttttttttttttttwwwwwwwwwwwwwwwwwwwwweeeeeeeeeeeeeeeeeeeeeeeeeeeeeettttttttttttttttttttttttttttteeeeeeeeeeeeeeeeeeeeeeeeeeedddddddd',2572,'2011-11-12','Through our stimulating dnvuy9efoewlhrf78we68bcmnsbment, we enhsdfiyeowlfdshfkjsdhoifuoeifdhsjvdjnvbhjdfgusftsdbmfnbdstional maturity, and a lifetime loveof learning.Sign and submit the Suythjrbuyhjngy78yuhjkhgvfderujhbdfxrtyuhjcfxdserwhuc  dvfdfofdgjkfrtiomn,eriokljnhbgfdhjkljhgfrtuyhgvform (if required).','It is very typical for preschool and pre-kindergarten students to experience separation anxietyduring the first few days of school. Please visit the school with your child prior to the first dayof class to help him/her become acquainted with the new environment.As often as possible,speak positively and with encouragement to your child about his/her new school experience.Focus on the excitement and fun of school, not the apprehensmnbvcxzasdfghjkoiuytre456789hfghild that you willnot be staying in the classroom with him','1231.16',121451,4001,2815,'0110','2007-02-12 03:55:15+1317','2011-12-10 11:54:12','((2,2),(1,3),(1,1))','((1,3)(6,5))','07:00:2b:02:01:04','3-2','poiuytrewqtgvsxcvbniujhbgvdfrgtyhujjhndcvuhj, the adjustment is quick. Tears will usually disappear after Mommy and  Daddy leave the clasnbdsvuytg uhguyybvhcd with your child','((1,2)(6,7))','(9,1)',12.233,'((2,1),6)',12,1114,'(3,1,2,0)','2011-03-11',22564,'$6,050.00','192.168.2','126.4.4.4','12:31:25','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.','0','1',13,24); 
 INSERT INTO co_compr_zlib_with(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(3300,3455),'F',2011,'f','b','Numeric values are physically stored without any extra leading or trailing zeroes. Thus, the declared precision and scale of a column are maximums, not fixed allocations jwgrkesfjkdshifhdskjnbfnscgffiupjhvgfdatfdjhav','2002-12-24 02:26:10','uewrtuewfhbdshmmfbbhjjjjjjjjjjjjjjjjjjjjjjjjjewjjjjjjjjjjjjjjsb ffffffffffffffeyyyyyyyyyyyyyyyybcj  hgiusyyyy7777777777eeeeeeeeeeewiuhgsuydte78wt87rwetug7666666we7w86e7w6e87w6ew786ew8e678w6e8w6e8w6e8we6w7e827e6238272377hsys6w6yehsy6wh',2552,'2011-11-12','Through odnviudfygojlskhiusdyfdslfun classroom environment, we encourageyour child to achieve self-confidence, emotional maturity, and a lifetime love of learning.Sign and submit the Stratford enrollment contract and prepaid tuition.Sign and submit the payment authorization form (if required).','It is very typical for presclsjhfdiudhskjfnds,vnc,svljsdaon anxietyduring the first few days of school. Please visimngfrtetyuiujnsbvcrdtr to the first dayof class to help him/her become acquainted with the nsfgsduaytf8fodshkfjhdw786%$%#^&&MBHJFY*IUHjhghgasd76ewhfewagement to your child about his/her new school experience.Focus on the excitement and fun of school, not the apprehension.It is important to discuss the school procedures with yhtyrt$#%^*&*HVGfu8jkGUYT$ujjtygdkfghjklfdhgjkfndkjghfdkgkfdge classroom with him','1231.16',121451,generate_series(5,25),2815,'0110','2007-02-12 03:55:15+1317','2011-12-10 11:54:12','((2,2),(1,3),(1,1))','((1,3)(6,5))','07:00:2b:02:01:04','3-2','Snjhgfytwuie4r893r7yhwdgt678iuhjgfr5678u school.For most children, the adjustment is quick. Tears will usually disappear after Mommy and  Daddy leave the classroom. Do not plead with your child','((1,2)(6,7))','(9,1)',12.233,'((2,1),6)',12,1114,'(3,1,2,0)','2011-03-11',22564,'$6,050.00','192.168.2','126.4.4.4','12:31:25','Parents and other family members are always welcome at Stratford. After the first two weeks ofschool, we encourage you to stop  shasuymnsdjkhsayt6b bnftrrojmbmnctreiujmnb nbfyttojmn, please berespectful of the classroom environment and do not disturb the students or teachers. Prior toeach visit, we require all visitosdfiwe7r09e[wrwdhskcisitors sticker to be 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.','0','1',13,24); 
 INSERT INTO co_compr_zlib_with(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(50,55),'M',2011,'f','b','Inexact means that some values cannot be converted exactly to the internal format and are stored as approximations, so that storing and printing back out hwgfrdjwpfidsbhfsyugdskbfkjshfihsdkjfhsjhayiuyihjhvghdhgfjhdva6h','2003-12-24 02:26:11','mjhsiury8w4r9834kfjsdhcjbjghsafre6547698ukljjhgftre4t@%$^&%*&DRTDHGGUY&*^*&(^Gfhe456543^RGHJFYTE%$#!@!~#$%TGJHIU(***$%#@TRFHJG%^$&^*&FHR^%$%UTGHffge45675786gfrtew43ehghjt^%&^86575675tyftyr6tfytr65edf564ttyr565r64tyyyyr4e65tyyyyyyyyyt76',generate_series(700,725),'2011-11-11','Through87678574678uygjr565ghjenvironment, we encourageyour child to achieve ssbfuwet8ryewsjfnjksdhkcmxznbcnsfyetrusdgfdsbhjca lifetime love of learning.Sign and submit the Stratford enrollment contract and prepaid klhgiueffhlskvhfgxtfyuh form (if required).','It is very typical for preschool and pre-kindergarten students to experience separation anxietyduring the first few days of school. Please visit thuytrewfghjkjv cbvnmbvcrte78uhjgnmnbvc5678jnm 4587uijk vacquainted with the new environment.Ajfhgdsufdsjfldsbfcjhgdshhhhhhhhuyhgbn sfsfsdur child about his/her new school experience.Focus on the excitement and fun of school, not the apprehension.It is important to discuss the school procedures with your child. Inform your child that you willnot be stayisdfdsgfuyehfihdfiyiewuyfiuwhfng in the classroom with him','1231.16',121451,4001,2815,'0110','2007-02-12 03:55:15+1317','2011-12-10 11:54:12','((2,2),(1,3),(1,1))','((1,3)(6,5))','07:00:2b:02:01:04','3-2','Some students may need time to adjust to school.jhge7fefvjkehguejfgdkhjkjhgowu09f8r9wugfbwjhvuyTears will usually disappear after Mommy and  Daddy leave the classroom. bdys8snssbss97j with your child','((1,2)(6,7))','(9,1)',12.233,'((2,1),6)',12,1114,'(3,1,2,0)','2011-03-11',22564,'$6,050.00','192.168.2','126.4.4.4','12:31:25','Parents and other family members are always welcome at Stratford. After the first two weeks ofschool, jge7rty3498rtkew mfuhqy970qf wjhg8er7ewrjmwe jhg When visiting, 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 objjcshgifisdcnskjcbdiso be 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.','0','1',13,24); 
-- More data for bigger block size 
 INSERT INTO co_compr_zlib_with(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); 
 INSERT INTO co_compr_zlib_with(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(500,510),'F',2010,'f','b','Some students may need time to adjust to school.For most children, the adjustment is quick. Tears will usually disappear after Mommy and  Daddy leave the classroom. Do not plead with your child','2001-12-25 02:22:11','Some students may need time to adjust to school.For most children, the adjustment is quick. Tears will usually disappear after Mommy and  Daddy leave the classroom. Do not plead with your child',generate_series(2500,2516),'2011-10-12','Some students may need time to adjust to school.For most children, the adjustment is quick. Tears will usually disappear after Mommy and  Daddy leave the classroom. Do not plead with your child','Some students may need time to adjust to school.For most children, the adjustment is quick. Tears will usually disappear after Mommy and  Daddy leave the classroom. Do not plead with your child The type integer is the usual choice, as it offers the best balance between range, storage size, and performance The type integer is the usual choice, as it offers the best balance between range, storage size, and performanceThe type integer is the usual choice, as it offers the best balance between range, storage size, and performanceThe type integer is the usual choice, as it offers the best balance between range, storage size, and performanceThe type integer ','1134.26',311353,generate_series(3982,3992),7885,'0101','2002-02-12 01:31:14+1344','2003-11-14 01:41:15','((1,1),(0,1),(1,1))','((2,1)(1,5))','08:00:2b:01:01:03','1-3','Some students may need time to adjust to school.For most children, the adjustment is quick. Tears will usually disappear after Mommy and  Daddy leave the classroom. Do not plead with your child The types smallint, integer, and bigint store whole numbers, that is, numbers without fractional components, of various ranges. The types smallint, integer, and bigint store whole numbers, that is, numbers without fractional components, of various ranges. Attempts to store values outside of the allowed range will result in an errorThe types smallint, integer, and bigint store whole numbers, that is, numbers without fractional components, of various ranges.','((6,5)(4,2))','(3,6)',12.233,'((5,4),2)',12,3114,'(1,1,0,3)','2010-03-21',43164,'$1,500.00','192.167.2','126.1.1.1','10:30:55','Parents and other family members are always welcome at Stratford. After the first two weeks ofschool','0','1',33,44); 
 INSERT INTO co_compr_zlib_with(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(500,525),'M',2010,'f','b','Some students may need time to adjust to school.For most children, the adjustment is quick. Tears will usually disappear after Mommy and  Daddy leave the classroom. Do not plead with your child','2001-12-25 02:22:11','Some students may need time to adjust to school.For most children, the adjustment is quick. Tears will usually disappear after Mommy and  Daddy leave the classroom. Do not plead with your child',generate_series(2500,2515),'2011-10-12','Some students may need time to adjust to school.For most children, the adjustment is quick. Tears will usually disappear after Mommy and  Daddy leave the classroom. Do not plead with your child','Some students may need time to adjust to school.For most children, the adjustment is quick. Tears will usually disappear after Mommy and  Daddy leave the classroom. Do not plead with your child The bigint type might not function correctly on all platforms, since it relies on compiler support for eight-byte integers.The bigint type might not function correctly on all platforms, since it relies on compiler support for eight-byte integers.The bigint type might not function correctly on all platforms, since it relies on compiler support for eight-byte integers.The bigint type might not function correctly on all platforms, since it relies on compiler support ','1134.26',311353,generate_series(3892,3902),7885,'0101','2002-02-12 01:31:14+1344','2003-11-14 01:41:15','((1,1),(0,1),(1,1))','((2,1)(1,5))','08:00:2b:01:01:03','1-3','Some students may need time to adjust to school.For most children, the adjustment is quick. Tears will usually disappear after Mommy and  Daddy leave the classroom. Do not plead with your child The type numeric can store numbers with up to 1000 digits of precision and perform calculations exactly. It is especially recommended for storing monetary amounts and other quantities where exactness is required. However, arithmetic on numeric values is very slow compared to the integer types, or to the floating-point types described in the next section.The type numeric can store numbers with up to 1000 digits of precision and perform calculations exactly.','((6,5)(4,2))','(3,6)',12.233,'((5,4),2)',12,3114,'(1,1,0,3)','2010-03-21',43164,'$1,500.00','192.167.2','126.1.1.1','10:30:55','bit type data must match the length n exactly; it is an error to attempt to store shorter or longer','1','10',43,54); 
 INSERT INTO co_compr_zlib_with(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(600,625),'F',2011,'f','b','If the scale of a value to be stored is greater than the declared scale of the column, the system will round the value to the specified number of fractional digits. Then, if the number of digits to the left of the decimal point ','2001-11-24 02:26:11','bbffruikjjjk89kjhjjdsdsjflsdkfjowikfo;lwejkufhekusgfuyewhfkdhsuyfgjsdbfjhkdshgciuvhdskfhiewyerwhkjehriur687687rt3ughjgd67567tcghjzvcnzfTYr7tugfTRE#$#^%*GGHJFTEW#RUYJBJHCFDGJBJGYrythgfT^&^tjhE655ugHD655uVtyr%^uygUYT&^R%^FJYFHGF',2802,'2011-11-12','Through our sbdfjdsbkfndjkshgifhdsn c  environment, we encourageyour guwr6tojsbdjht8y^W%^GNBMNBHGFE^^, emotional maturity, and a lifetime love of learning.Sign and submit the Stratford enrollment contract and prepaid tuition.Sign and submit the payment authorizahrqwygjashbxuyagsu.','It is very typical for preschool and pre-kindergarten students to experience separation anxietyduring the first few days of school. Please visit the school with your child prior to the first dayof class to help him/her become acquainted with the new environment.As often as possible,speak positively and with encouragement to your child about his/her new school experience.Focus on the excitement and fun of , not the apprehension.It is important to discuss the school procedures with your child. Inform your child that youoom with him','1231.16',121451,4001,2815,'0110','2007-02-12 03:55:15+1317','2011-12-10 11:54:12','((2,2),(1,3),(1,1))','((1,3)(6,5))','07:00:2b:02:01:04','3-2','Some students may need time to adjust to school.For most children, the adjustment is quick. Tears will usually disappear after Mommy and  Daddy leave the cmnsbvduytfrw67ydwhg uygyth your child','((1,2)(6,7))','(9,1)',12.233,'((2,1),6)',12,1114,'(3,1,2,0)','2011-03-11',22564,'$6,050.00','192.168.2','126.4.4.4','12:31:25','Parents and other family members are always welcome at Stratford. After the first two weeks ofschool, we encourage you to stop by and visit any time you like. When visiting, please berespectful of the classroom environment and do not disturb the students or teachers. Prior toeach visit, we require all visidbsnfuyewfudsc,vsmckposjcofice and obtain a visit sticker to be 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.','1','1',13,24); 
 INSERT INTO co_compr_zlib_with(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(1500,1525),'M',2011,'t','b','At Stratford, we believe all children love to learn and that success in school and life depends on developing a strong foundation for learning early in life gsdgdsfoppkhgfshjdgksahdiusahdksahdksahkdhsakdhskahkhasdfu','2001-11-24 02:26:11','ttttttttttttttttrrrrrrrrrrrrrrrrrrrrrtttttttttttttttttttttttttwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwttttttttttttttttttttttttttttttwwwwwwwwwwwwwwwwwwwwweeeeeeeeeeeeeeeeeeeeeeeeeeeeeettttttttttttttttttttttttttttteeeeeeeeeeeeeeeeeeeeeeeeeeedddddddd',2572,'2011-11-12','Through our stimulating dnvuy9efoewlhrf78we68bcmnsbment, we enhsdfiyeowlfdshfkjsdhoifuoeifdhsjvdjnvbhjdfgusftsdbmfnbdstional maturity, and a lifetime loveof learning.Sign and submit the Suythjrbuyhjngy78yuhjkhgvfderujhbdfxrtyuhjcfxdserwhuc  dvfdfofdgjkfrtiomn,eriokljnhbgfdhjkljhgfrtuyhgvform (if required).','It is very typical for preschool and pre-kindergarten students to experience separation anxietyduring the first few days of school. Please visit the school with your child prior to the first dayof class to help him/her become acquainted with the new environment.As often as possible,speak positively and with encouragement to your child about his/her new school experience.Focus on the excitement and fun of school, not the apprehensmnbvcxzasdfghjkoiuytre456789hfghild that you willnot be staying in the classroom with him','1231.16',121451,4001,2815,'0110','2007-02-12 03:55:15+1317','2011-12-10 11:54:12','((2,2),(1,3),(1,1))','((1,3)(6,5))','07:00:2b:02:01:04','3-2','poiuytrewqtgvsxcvbniujhbgvdfrgtyhujjhndcvuhj, the adjustment is quick. Tears will usually disappear after Mommy and  Daddy leave the clasnbdsvuytg uhguyybvhcd with your child','((1,2)(6,7))','(9,1)',12.233,'((2,1),6)',12,1114,'(3,1,2,0)','2011-03-11',22564,'$6,050.00','192.168.2','126.4.4.4','12:31:25','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.','0','1',13,24); 
 INSERT INTO co_compr_zlib_with(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(3300,3455),'F',2011,'f','b','Numeric values are physically stored without any extra leading or trailing zeroes. Thus, the declared precision and scale of a column are maximums, not fixed allocations jwgrkesfjkdshifhdskjnbfnscgffiupjhvgfdatfdjhav','2002-12-24 02:26:10','uewrtuewfhbdshmmfbbhjjjjjjjjjjjjjjjjjjjjjjjjjewjjjjjjjjjjjjjjsb ffffffffffffffeyyyyyyyyyyyyyyyybcj  hgiusyyyy7777777777eeeeeeeeeeewiuhgsuydte78wt87rwetug7666666we7w86e7w6e87w6ew786ew8e678w6e8w6e8w6e8we6w7e827e6238272377hsys6w6yehsy6wh',2552,'2011-11-12','Through odnviudfygojlskhiusdyfdslfun classroom environment, we encourageyour child to achieve self-confidence, emotional maturity, and a lifetime love of learning.Sign and submit the Stratford enrollment contract and prepaid tuition.Sign and submit the payment authorization form (if required).','It is very typical for presclsjhfdiudhskjfnds,vnc,svljsdaon anxietyduring the first few days of school. Please visimngfrtetyuiujnsbvcrdtr to the first dayof class to help him/her become acquainted with the nsfgsduaytf8fodshkfjhdw786%$%#^&&MBHJFY*IUHjhghgasd76ewhfewagement to your child about his/her new school experience.Focus on the excitement and fun of school, not the apprehension.It is important to discuss the school procedures with yhtyrt$#%^*&*HVGfu8jkGUYT$ujjtygdkfghjklfdhgjkfndkjghfdkgkfdge classroom with him','1231.16',121451,generate_series(5,25),2815,'0110','2007-02-12 03:55:15+1317','2011-12-10 11:54:12','((2,2),(1,3),(1,1))','((1,3)(6,5))','07:00:2b:02:01:04','3-2','Snjhgfytwuie4r893r7yhwdgt678iuhjgfr5678u school.For most children, the adjustment is quick. Tears will usually disappear after Mommy and  Daddy leave the classroom. Do not plead with your child','((1,2)(6,7))','(9,1)',12.233,'((2,1),6)',12,1114,'(3,1,2,0)','2011-03-11',22564,'$6,050.00','192.168.2','126.4.4.4','12:31:25','Parents and other family members are always welcome at Stratford. After the first two weeks ofschool, we encourage you to stop  shasuymnsdjkhsayt6b bnftrrojmbmnctreiujmnb nbfyttojmn, please berespectful of the classroom environment and do not disturb the students or teachers. Prior toeach visit, we require all visitosdfiwe7r09e[wrwdhskcisitors sticker to be 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.','0','1',13,24); 
 INSERT INTO co_compr_zlib_with(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(50,55),'M',2011,'f','b','Inexact means that some values cannot be converted exactly to the internal format and are stored as approximations, so that storing and printing back out hwgfrdjwpfidsbhfsyugdskbfkjshfihsdkjfhsjhayiuyihjhvghdhgfjhdva6h','2003-12-24 02:26:11','mjhsiury8w4r9834kfjsdhcjbjghsafre6547698ukljjhgftre4t@%$^&%*&DRTDHGGUY&*^*&(^Gfhe456543^RGHJFYTE%$#!@!~#$%TGJHIU(***$%#@TRFHJG%^$&^*&FHR^%$%UTGHffge45675786gfrtew43ehghjt^%&^86575675tyftyr6tfytr65edf564ttyr565r64tyyyyr4e65tyyyyyyyyyt76',generate_series(700,725),'2011-11-11','Through87678574678uygjr565ghjenvironment, we encourageyour child to achieve ssbfuwet8ryewsjfnjksdhkcmxznbcnsfyetrusdgfdsbhjca lifetime love of learning.Sign and submit the Stratford enrollment contract and prepaid klhgiueffhlskvhfgxtfyuh form (if required).','It is very typical for preschool and pre-kindergarten students to experience separation anxietyduring the first few days of school. Please visit thuytrewfghjkjv cbvnmbvcrte78uhjgnmnbvc5678jnm 4587uijk vacquainted with the new environment.Ajfhgdsufdsjfldsbfcjhgdshhhhhhhhuyhgbn sfsfsdur child about his/her new school experience.Focus on the excitement and fun of school, not the apprehension.It is important to discuss the school procedures with your child. Inform your child that you willnot be stayisdfdsgfuyehfihdfiyiewuyfiuwhfng in the classroom with him','1231.16',121451,4001,2815,'0110','2007-02-12 03:55:15+1317','2011-12-10 11:54:12','((2,2),(1,3),(1,1))','((1,3)(6,5))','07:00:2b:02:01:04','3-2','Some students may need time to adjust to school.jhge7fefvjkehguejfgdkhjkjhgowu09f8r9wugfbwjhvuyTears will usually disappear after Mommy and  Daddy leave the classroom. bdys8snssbss97j with your child','((1,2)(6,7))','(9,1)',12.233,'((2,1),6)',12,1114,'(3,1,2,0)','2011-03-11',22564,'$6,050.00','192.168.2','126.4.4.4','12:31:25','Parents and other family members are always welcome at Stratford. After the first two weeks ofschool, jge7rty3498rtkew mfuhqy970qf wjhg8er7ewrjmwe jhg When visiting, 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 objjcshgifisdcnskjcbdiso be 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.','0','1',13,24); 
--Alter table drop a column 
Alter table co_compr_zlib_with Drop column a12; 
--Create CTAS table 
 Drop table if exists co_compr_zlib_with_ctas ;
NOTICE:  table "co_compr_zlib_with_ctas" does not exist, skipping
--Create a CTAS table 
CREATE TABLE co_compr_zlib_with_ctas  WITH (appendonly=true, orientation=column) AS Select * from co_compr_zlib_with;
NOTICE:  Table doesn't have 'DISTRIBUTED BY' clause -- Using column(s) 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.
\echo -- start_ignore
-- start_ignore
drop table if exists csq_t1;
NOTICE:  table "csq_t1" does not exist, skipping
drop table if exists csq_t2;
NOTICE:  table "csq_t2" does not exist, skipping
drop table if exists csq_t3;
NOTICE:  table "csq_t3" does not exist, skipping
create table csq_t1(a int, b int);
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 csq_t1 values (1,2);
insert into csq_t1 values (3,4);
insert into csq_t1 values (5,6);
insert into csq_t1 values (7,8);
create table csq_t2(x int,y int);
NOTICE:  Table doesn't have 'DISTRIBUTED BY' clause -- Using column named 'x' 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 csq_t2 values(1,1);
insert into csq_t2 values(3,9);
insert into csq_t2 values(5,25);
insert into csq_t2 values(7,49);
create table csq_t3(c int, d text);
NOTICE:  Table doesn't have 'DISTRIBUTED BY' clause -- Using column named 'c' 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 csq_t3 values(1,'one');
insert into csq_t3 values(3,'three');
insert into csq_t3 values(5,'five');
insert into csq_t3 values(7,'seven');
\echo -- end_ignore
-- end_ignore
-- CSQ 01: Basic query with where clause
select a, (select y from csq_t2 where x=a) from csq_t1 where b < 8 order by a;
 a | ?column? 
---+----------
 1 |        1
 3 |        9
 5 |       25
(3 rows)

-- CSQ 02: Basic query with exists
select b from csq_t1 where exists(select * from csq_t2 where y=a) order by b;
 b 
---
 2
(1 row)

-- CSQ Q3: Basic query with not exists
select b from csq_t1 where not exists(select * from csq_t2 where y=a) order by b;
 b 
---
 4
 6
 8
(3 rows)

-- CSQ Q4: Basic query with any
select a, x from csq_t1, csq_t2 where csq_t1.a = any (select x) order by a, x;
 a | x 
---+---
 1 | 1
 3 | 3
 5 | 5
 7 | 7
(4 rows)

-- CSQ Q5
select a, x from csq_t2, csq_t1 where csq_t1.a = (select x) order by a, x;
 a | x 
---+---
 1 | 1
 3 | 3
 5 | 5
 7 | 7
(4 rows)

-- CSQ Q6
select a from csq_t1 where (select (y*2)>b from csq_t2 where a=x) order by a;
 a 
---
 3
 5
 7
(3 rows)

-- CSQ Q7
SELECT a, (SELECT d FROM csq_t3 WHERE a=c) FROM csq_t1 GROUP BY a order by a;
 a | ?column? 
---+----------
 1 | one
 3 | three
 5 | five
 7 | seven
(4 rows)

-- CSQ Q8
SELECT a, (SELECT (SELECT d FROM csq_t3 WHERE a=c)) FROM csq_t1 GROUP BY a order by a;
ERROR:  correlated subquery with skip-level correlations is not supported (subselect.c:394)
\echo -- start_ignore
-- start_ignore
    drop table if exists t5;
NOTICE:  table "t5" does not exist, skipping
    CREATE TABLE t5 (val int, period text);
NOTICE:  Table doesn't have 'DISTRIBUTED BY' clause -- Using column named 'val' 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 t5 values(5, '2001-3');
    insert into t5 values(10, '2001-4');
    insert into t5 values(15, '2002-1');
    insert into t5 values(5, '2002-2');
    insert into t5 values(10, '2002-3');
    insert into t5 values(15, '2002-4');
    insert into t5 values(10, '2003-1');
    insert into t5 values(5, '2003-2');
    insert into t5 values(25, '2003-3');
    insert into t5 values(5, '2003-4');
    drop table if exists csq_emp;
NOTICE:  table "csq_emp" does not exist, skipping
    create table csq_emp(name text, department text, salary numeric);
NOTICE:  Table doesn't have 'DISTRIBUTED BY' clause -- Using column named 'name' 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 csq_emp values('a','adept',11200.00);
    insert into csq_emp values('b','adept',22222.00);
    insert into csq_emp values('c','bdept',99222.00);
    insert into csq_emp values('d','adept',23211.00);
    insert into csq_emp values('e','adept',45222.00);
    insert into csq_emp values('f','adept',992222.00);
    insert into csq_emp values('g','adept',90343.00);
    insert into csq_emp values('h','adept',11200.00);
    insert into csq_emp values('i','bdept',11200.00);
    insert into csq_emp values('j','adept',11200.00);
\echo -- end_ignore
-- end_ignore
-- CSQ Q1
    select 
	period, vsum
    from 
	(select 
      		period,
      		(select 
			sum(val) 
		from 
			t5 
		where 
			period between a.period and '2002-4') 
	as 
		vsum
      	from 
		t5 a 
	where 
		a.period between '2002-1' and '2002-4') as vsum
    where vsum < 45 order by period, vsum;
 period | vsum 
--------+------
 2002-2 |   30
 2002-3 |   25
 2002-4 |   15
(3 rows)

-- Basic CSQ using where clause
SELECT name, department, salary FROM csq_emp ea
  WHERE salary = 
    (SELECT MAX(salary) FROM csq_emp eb WHERE eb.department = ea.department) order by name, department, salary;
 name | department |  salary   
------+------------+-----------
 c    | bdept      |  99222.00
 f    | adept      | 992222.00
(2 rows)

SELECT name, department, salary FROM csq_emp ea 
  WHERE salary > 
    (SELECT MAX(salary) FROM csq_emp eb WHERE eb.department = ea.department) order by name, department, salary;
 name | department | salary 
------+------------+--------
(0 rows)

SELECT name, department, salary FROM csq_emp ea 
  WHERE salary < 
    (SELECT MAX(salary) FROM csq_emp eb WHERE eb.department = ea.department) order by name, department, salary;
 name | department |  salary  
------+------------+----------
 a    | adept      | 11200.00
 b    | adept      | 22222.00
 d    | adept      | 23211.00
 e    | adept      | 45222.00
 g    | adept      | 90343.00
 h    | adept      | 11200.00
 i    | bdept      | 11200.00
 j    | adept      | 11200.00
(8 rows)

SELECT name, department, salary FROM csq_emp ea 
  WHERE salary IN 
    (SELECT MAX(salary) FROM csq_emp eb WHERE eb.department = ea.department) order by name, department, salary;
 name | department |  salary   
------+------------+-----------
 c    | bdept      |  99222.00
 f    | adept      | 992222.00
(2 rows)

SELECT name, department, salary FROM csq_emp ea 
  WHERE salary NOT IN 
    (SELECT MAX(salary) FROM csq_emp eb WHERE eb.department = ea.department) order by name, department, salary;
 name | department |  salary  
------+------------+----------
 a    | adept      | 11200.00
 b    | adept      | 22222.00
 d    | adept      | 23211.00
 e    | adept      | 45222.00
 g    | adept      | 90343.00
 h    | adept      | 11200.00
 i    | bdept      | 11200.00
 j    | adept      | 11200.00
(8 rows)

SELECT name, department, salary FROM csq_emp ea 
  WHERE  salary = ANY 
    (SELECT MAX(salary) FROM csq_emp eb WHERE eb.department = ea.department) order by name, department, salary;
 name | department |  salary   
------+------------+-----------
 c    | bdept      |  99222.00
 f    | adept      | 992222.00
(2 rows)

SELECT name, department, salary FROM csq_emp ea 
  WHERE salary = ALL 
    (SELECT MAX(salary) FROM csq_emp eb WHERE eb.department = ea.department) order by name, department, salary;
 name | department |  salary   
------+------------+-----------
 c    | bdept      |  99222.00
 f    | adept      | 992222.00
(2 rows)

SELECT name, department, salary FROM csq_emp ea group by name, department,salary
  HAVING avg(salary) >
    (SELECT MAX(salary) FROM csq_emp eb WHERE eb.department = ea.department) order by name, department, salary;
 name | department | salary 
------+------------+--------
(0 rows)

SELECT name, department, salary FROM csq_emp ea group by name, department,salary
  HAVING avg(salary) > ALL
    (SELECT salary FROM csq_emp eb WHERE eb.department = ea.department) order by name, department, salary;
 name | department | salary 
------+------------+--------
(0 rows)

\echo -- start_ignore
-- start_ignore
DROP TABLE IF EXISTS foo1;
DROP TABLE IF EXISTS foo2;
\echo -- end_ignore
-- end_ignore
create table foo1 (i int, j varchar(10)) 
partition by list(j)
(partition p1 values('1'), partition p2 values('2'), partition p3 values('3'), partition p4 values('4'), partition p5 values('5'),partition p0 values('0'));
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.
NOTICE:  CREATE TABLE will create partition "foo1_1_prt_p1" for table "foo1"
NOTICE:  CREATE TABLE will create partition "foo1_1_prt_p2" for table "foo1"
NOTICE:  CREATE TABLE will create partition "foo1_1_prt_p3" for table "foo1"
NOTICE:  CREATE TABLE will create partition "foo1_1_prt_p4" for table "foo1"
NOTICE:  CREATE TABLE will create partition "foo1_1_prt_p5" for table "foo1"
NOTICE:  CREATE TABLE will create partition "foo1_1_prt_p0" for table "foo1"
insert into foo1 select i , i%5 || '' from generate_series(1,100) i;
create table foo2 (i int, j varchar(10));
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.
insert into foo2 select i , i ||'' from generate_series(1,5) i;
analyze foo1;
analyze foo2;
select count(*) from foo1,foo2 where foo1.j = foo2.j;DROP USER IF EXISTS testuser;
 count 
-------
    80
(1 row)

NOTICE:  role "testuser" does not exist, skipping
NOTICE:  role "testuser" does not exist, skipping  (seg0 rh55-qavm103:18506 pid=13677)
NOTICE:  role "testuser" does not exist, skipping  (seg2 rh55-qavm103:18508 pid=13681)
NOTICE:  role "testuser" does not exist, skipping  (seg1 rh55-qavm103:18507 pid=13679)
CREATE USER testuser WITH LOGIN DENY BETWEEN DAY 'Monday' TIME '01:00:00' AND DAY 'Monday' TIME '01:30:00';;
NOTICE:  resource queue required -- using default resource queue "pg_default"
SELECT r.rolname, d.start_day, d.start_time, d.end_day, d.end_time
FROM pg_auth_time_constraint d join pg_roles r ON (d.authid = r.oid)
WHERE r.rolname = 'testuser'
ORDER BY r.rolname, d.start_day, d.start_time, d.end_day, d.end_time;
 rolname  | start_day | start_time | end_day | end_time 
----------+-----------+------------+---------+----------
 testuser |         1 | 01:00:00   |       1 | 01:30:00
(1 row)

ALTER USER testuser DENY BETWEEN DAY 'Monday' TIME '01:00:00' AND DAY 'Monday' TIME '01:30:00';
ALTER USER testuser DENY BETWEEN DAY 'Monday' TIME '02:00:00' AND DAY 'Monday' TIME '02:30:00';
ALTER USER testuser DENY BETWEEN DAY 'Monday' TIME '03:00:00' AND DAY 'Monday' TIME '03:30:00';
ALTER USER testuser DENY BETWEEN DAY 'Monday' TIME '04:00:00' AND DAY 'Monday' TIME '04:30:00';
ALTER USER testuser DENY BETWEEN DAY 'Monday' TIME '05:00:00' AND DAY 'Monday' TIME '05:30:00';
ALTER USER testuser DENY BETWEEN DAY 'Monday' TIME '06:00:00' AND DAY 'Monday' TIME '06:30:00';
ALTER USER testuser DENY BETWEEN DAY 'Monday' TIME '07:00:00' AND DAY 'Monday' TIME '07:30:00';
ALTER USER testuser DENY BETWEEN DAY 'Monday' TIME '08:00:00' AND DAY 'Monday' TIME '08:30:00';
ALTER USER testuser DENY BETWEEN DAY 'Monday' TIME '09:00:00' AND DAY 'Monday' TIME '09:30:00';
ALTER USER testuser DENY BETWEEN DAY 'Monday' TIME '10:00:00' AND DAY 'Monday' TIME '10:30:00';
ALTER USER testuser DENY BETWEEN DAY 'Monday' TIME '11:00:00' AND DAY 'Monday' TIME '11:30:00';
ALTER USER testuser DENY BETWEEN DAY 'Monday' TIME '12:00:00' AND DAY 'Monday' TIME '12:30:00';
ALTER USER testuser DENY BETWEEN DAY 'Monday' TIME '13:00:00' AND DAY 'Monday' TIME '13:30:00';
ALTER USER testuser DENY BETWEEN DAY 'Monday' TIME '14:00:00' AND DAY 'Monday' TIME '14:30:00';
ALTER USER testuser DENY BETWEEN DAY 'Monday' TIME '15:00:00' AND DAY 'Monday' TIME '15:30:00';
ALTER USER testuser DENY BETWEEN DAY 'Monday' TIME '16:00:00' AND DAY 'Monday' TIME '16:30:00';
ALTER USER testuser DENY BETWEEN DAY 'Monday' TIME '17:00:00' AND DAY 'Monday' TIME '17:30:00';
ALTER USER testuser DENY BETWEEN DAY 'Monday' TIME '18:00:00' AND DAY 'Monday' TIME '18:30:00';
ALTER USER testuser DENY BETWEEN DAY 'Monday' TIME '19:00:00' AND DAY 'Monday' TIME '19:30:00';
ALTER USER testuser DENY BETWEEN DAY 'Monday' TIME '20:00:00' AND DAY 'Monday' TIME '20:30:00';
ALTER USER testuser DENY BETWEEN DAY 'Tuesday' TIME '01:00:00' AND DAY 'Tuesday' TIME '01:30:00';
ALTER USER testuser DENY BETWEEN DAY 'Tuesday' TIME '02:00:00' AND DAY 'Tuesday' TIME '02:30:00';
ALTER USER testuser DENY BETWEEN DAY 'Tuesday' TIME '03:00:00' AND DAY 'Tuesday' TIME '03:30:00';
ALTER USER testuser DENY BETWEEN DAY 'Tuesday' TIME '04:00:00' AND DAY 'Tuesday' TIME '04:30:00';
ALTER USER testuser DENY BETWEEN DAY 'Tuesday' TIME '05:00:00' AND DAY 'Tuesday' TIME '05:30:00';
ALTER USER testuser DENY BETWEEN DAY 'Tuesday' TIME '06:00:00' AND DAY 'Tuesday' TIME '06:30:00';
ALTER USER testuser DENY BETWEEN DAY 'Tuesday' TIME '07:00:00' AND DAY 'Tuesday' TIME '07:30:00';
ALTER USER testuser DENY BETWEEN DAY 'Tuesday' TIME '08:00:00' AND DAY 'Tuesday' TIME '08:30:00';
ALTER USER testuser DENY BETWEEN DAY 'Tuesday' TIME '09:00:00' AND DAY 'Tuesday' TIME '09:30:00';
ALTER USER testuser DENY BETWEEN DAY 'Tuesday' TIME '10:00:00' AND DAY 'Tuesday' TIME '10:30:00';
ALTER USER testuser DENY BETWEEN DAY 'Tuesday' TIME '11:00:00' AND DAY 'Tuesday' TIME '11:30:00';
ALTER USER testuser DENY BETWEEN DAY 'Tuesday' TIME '12:00:00' AND DAY 'Tuesday' TIME '12:30:00';
ALTER USER testuser DENY BETWEEN DAY 'Tuesday' TIME '13:00:00' AND DAY 'Tuesday' TIME '13:30:00';
ALTER USER testuser DENY BETWEEN DAY 'Tuesday' TIME '14:00:00' AND DAY 'Tuesday' TIME '14:30:00';
ALTER USER testuser DENY BETWEEN DAY 'Tuesday' TIME '15:00:00' AND DAY 'Tuesday' TIME '15:30:00';
ALTER USER testuser DENY BETWEEN DAY 'Tuesday' TIME '16:00:00' AND DAY 'Tuesday' TIME '16:30:00';
ALTER USER testuser DENY BETWEEN DAY 'Tuesday' TIME '17:00:00' AND DAY 'Tuesday' TIME '17:30:00';
ALTER USER testuser DENY BETWEEN DAY 'Tuesday' TIME '18:00:00' AND DAY 'Tuesday' TIME '18:30:00';
ALTER USER testuser DENY BETWEEN DAY 'Tuesday' TIME '19:00:00' AND DAY 'Tuesday' TIME '19:30:00';
ALTER USER testuser DENY BETWEEN DAY 'Tuesday' TIME '20:00:00' AND DAY 'Tuesday' TIME '20:30:00';
ALTER USER testuser DENY BETWEEN DAY 'Wednesday' TIME '01:00:00' AND DAY 'Wednesday' TIME '01:30:00';
ALTER USER testuser DENY BETWEEN DAY 'Wednesday' TIME '02:00:00' AND DAY 'Wednesday' TIME '02:30:00';
ALTER USER testuser DENY BETWEEN DAY 'Wednesday' TIME '03:00:00' AND DAY 'Wednesday' TIME '03:30:00';
ALTER USER testuser DENY BETWEEN DAY 'Wednesday' TIME '04:00:00' AND DAY 'Wednesday' TIME '04:30:00';
ALTER USER testuser DENY BETWEEN DAY 'Wednesday' TIME '05:00:00' AND DAY 'Wednesday' TIME '05:30:00';
ALTER USER testuser DENY BETWEEN DAY 'Wednesday' TIME '06:00:00' AND DAY 'Wednesday' TIME '06:30:00';
ALTER USER testuser DENY BETWEEN DAY 'Wednesday' TIME '07:00:00' AND DAY 'Wednesday' TIME '07:30:00';
ALTER USER testuser DENY BETWEEN DAY 'Wednesday' TIME '08:00:00' AND DAY 'Wednesday' TIME '08:30:00';
ALTER USER testuser DENY BETWEEN DAY 'Wednesday' TIME '09:00:00' AND DAY 'Wednesday' TIME '09:30:00';
ALTER USER testuser DENY BETWEEN DAY 'Wednesday' TIME '10:00:00' AND DAY 'Wednesday' TIME '10:30:00';
ALTER USER testuser DENY BETWEEN DAY 'Wednesday' TIME '11:00:00' AND DAY 'Wednesday' TIME '11:30:00';
ALTER USER testuser DENY BETWEEN DAY 'Wednesday' TIME '12:00:00' AND DAY 'Wednesday' TIME '12:30:00';
ALTER USER testuser DENY BETWEEN DAY 'Wednesday' TIME '13:00:00' AND DAY 'Wednesday' TIME '13:30:00';
ALTER USER testuser DENY BETWEEN DAY 'Wednesday' TIME '14:00:00' AND DAY 'Wednesday' TIME '14:30:00';
ALTER USER testuser DENY BETWEEN DAY 'Wednesday' TIME '15:00:00' AND DAY 'Wednesday' TIME '15:30:00';
ALTER USER testuser DENY BETWEEN DAY 'Wednesday' TIME '16:00:00' AND DAY 'Wednesday' TIME '16:30:00';
ALTER USER testuser DENY BETWEEN DAY 'Wednesday' TIME '17:00:00' AND DAY 'Wednesday' TIME '17:30:00';
ALTER USER testuser DENY BETWEEN DAY 'Wednesday' TIME '18:00:00' AND DAY 'Wednesday' TIME '18:30:00';
ALTER USER testuser DENY BETWEEN DAY 'Wednesday' TIME '19:00:00' AND DAY 'Wednesday' TIME '19:30:00';
ALTER USER testuser DENY BETWEEN DAY 'Wednesday' TIME '20:00:00' AND DAY 'Wednesday' TIME '20:30:00';
SELECT r.rolname, d.start_day, d.start_time, d.end_day, d.end_time
FROM pg_auth_time_constraint d join pg_roles r ON (d.authid = r.oid)
WHERE r.rolname = 'testuser'
ORDER BY r.rolname, d.start_day, d.start_time, d.end_day, d.end_time;
 rolname  | start_day | start_time | end_day | end_time 
----------+-----------+------------+---------+----------
 testuser |         1 | 01:00:00   |       1 | 01:30:00
 testuser |         1 | 01:00:00   |       1 | 01:30:00
 testuser |         1 | 02:00:00   |       1 | 02:30:00
 testuser |         1 | 03:00:00   |       1 | 03:30:00
 testuser |         1 | 04:00:00   |       1 | 04:30:00
 testuser |         1 | 05:00:00   |       1 | 05:30:00
 testuser |         1 | 06:00:00   |       1 | 06:30:00
 testuser |         1 | 07:00:00   |       1 | 07:30:00
 testuser |         1 | 08:00:00   |       1 | 08:30:00
 testuser |         1 | 09:00:00   |       1 | 09:30:00
 testuser |         1 | 10:00:00   |       1 | 10:30:00
 testuser |         1 | 11:00:00   |       1 | 11:30:00
 testuser |         1 | 12:00:00   |       1 | 12:30:00
 testuser |         1 | 13:00:00   |       1 | 13:30:00
 testuser |         1 | 14:00:00   |       1 | 14:30:00
 testuser |         1 | 15:00:00   |       1 | 15:30:00
 testuser |         1 | 16:00:00   |       1 | 16:30:00
 testuser |         1 | 17:00:00   |       1 | 17:30:00
 testuser |         1 | 18:00:00   |       1 | 18:30:00
 testuser |         1 | 19:00:00   |       1 | 19:30:00
 testuser |         1 | 20:00:00   |       1 | 20:30:00
 testuser |         2 | 01:00:00   |       2 | 01:30:00
 testuser |         2 | 02:00:00   |       2 | 02:30:00
 testuser |         2 | 03:00:00   |       2 | 03:30:00
 testuser |         2 | 04:00:00   |       2 | 04:30:00
 testuser |         2 | 05:00:00   |       2 | 05:30:00
 testuser |         2 | 06:00:00   |       2 | 06:30:00
 testuser |         2 | 07:00:00   |       2 | 07:30:00
 testuser |         2 | 08:00:00   |       2 | 08:30:00
 testuser |         2 | 09:00:00   |       2 | 09:30:00
 testuser |         2 | 10:00:00   |       2 | 10:30:00
 testuser |         2 | 11:00:00   |       2 | 11:30:00
 testuser |         2 | 12:00:00   |       2 | 12:30:00
 testuser |         2 | 13:00:00   |       2 | 13:30:00
 testuser |         2 | 14:00:00   |       2 | 14:30:00
 testuser |         2 | 15:00:00   |       2 | 15:30:00
 testuser |         2 | 16:00:00   |       2 | 16:30:00
 testuser |         2 | 17:00:00   |       2 | 17:30:00
 testuser |         2 | 18:00:00   |       2 | 18:30:00
 testuser |         2 | 19:00:00   |       2 | 19:30:00
 testuser |         2 | 20:00:00   |       2 | 20:30:00
 testuser |         3 | 01:00:00   |       3 | 01:30:00
 testuser |         3 | 02:00:00   |       3 | 02:30:00
 testuser |         3 | 03:00:00   |       3 | 03:30:00
 testuser |         3 | 04:00:00   |       3 | 04:30:00
 testuser |         3 | 05:00:00   |       3 | 05:30:00
 testuser |         3 | 06:00:00   |       3 | 06:30:00
 testuser |         3 | 07:00:00   |       3 | 07:30:00
 testuser |         3 | 08:00:00   |       3 | 08:30:00
 testuser |         3 | 09:00:00   |       3 | 09:30:00
 testuser |         3 | 10:00:00   |       3 | 10:30:00
 testuser |         3 | 11:00:00   |       3 | 11:30:00
 testuser |         3 | 12:00:00   |       3 | 12:30:00
 testuser |         3 | 13:00:00   |       3 | 13:30:00
 testuser |         3 | 14:00:00   |       3 | 14:30:00
 testuser |         3 | 15:00:00   |       3 | 15:30:00
 testuser |         3 | 16:00:00   |       3 | 16:30:00
 testuser |         3 | 17:00:00   |       3 | 17:30:00
 testuser |         3 | 18:00:00   |       3 | 18:30:00
 testuser |         3 | 19:00:00   |       3 | 19:30:00
 testuser |         3 | 20:00:00   |       3 | 20:30:00
(61 rows)

ALTER USER testuser DROP DENY FOR DAY 'Tuesday' TIME '01:30:00';
NOTICE:  dropping DENY rule for "testuser" between Tuesday 01:00:00 and Tuesday 01:30:00
SELECT r.rolname, d.start_day, d.start_time, d.end_day, d.end_time
FROM pg_auth_time_constraint d join pg_roles r ON (d.authid = r.oid)
WHERE r.rolname = 'testuser'
ORDER BY r.rolname, d.start_day, d.start_time, d.end_day, d.end_time;
 rolname  | start_day | start_time | end_day | end_time 
----------+-----------+------------+---------+----------
 testuser |         1 | 01:00:00   |       1 | 01:30:00
 testuser |         1 | 01:00:00   |       1 | 01:30:00
 testuser |         1 | 02:00:00   |       1 | 02:30:00
 testuser |         1 | 03:00:00   |       1 | 03:30:00
 testuser |         1 | 04:00:00   |       1 | 04:30:00
 testuser |         1 | 05:00:00   |       1 | 05:30:00
 testuser |         1 | 06:00:00   |       1 | 06:30:00
 testuser |         1 | 07:00:00   |       1 | 07:30:00
 testuser |         1 | 08:00:00   |       1 | 08:30:00
 testuser |         1 | 09:00:00   |       1 | 09:30:00
 testuser |         1 | 10:00:00   |       1 | 10:30:00
 testuser |         1 | 11:00:00   |       1 | 11:30:00
 testuser |         1 | 12:00:00   |       1 | 12:30:00
 testuser |         1 | 13:00:00   |       1 | 13:30:00
 testuser |         1 | 14:00:00   |       1 | 14:30:00
 testuser |         1 | 15:00:00   |       1 | 15:30:00
 testuser |         1 | 16:00:00   |       1 | 16:30:00
 testuser |         1 | 17:00:00   |       1 | 17:30:00
 testuser |         1 | 18:00:00   |       1 | 18:30:00
 testuser |         1 | 19:00:00   |       1 | 19:30:00
 testuser |         1 | 20:00:00   |       1 | 20:30:00
 testuser |         2 | 02:00:00   |       2 | 02:30:00
 testuser |         2 | 03:00:00   |       2 | 03:30:00
 testuser |         2 | 04:00:00   |       2 | 04:30:00
 testuser |         2 | 05:00:00   |       2 | 05:30:00
 testuser |         2 | 06:00:00   |       2 | 06:30:00
 testuser |         2 | 07:00:00   |       2 | 07:30:00
 testuser |         2 | 08:00:00   |       2 | 08:30:00
 testuser |         2 | 09:00:00   |       2 | 09:30:00
 testuser |         2 | 10:00:00   |       2 | 10:30:00
 testuser |         2 | 11:00:00   |       2 | 11:30:00
 testuser |         2 | 12:00:00   |       2 | 12:30:00
 testuser |         2 | 13:00:00   |       2 | 13:30:00
 testuser |         2 | 14:00:00   |       2 | 14:30:00
 testuser |         2 | 15:00:00   |       2 | 15:30:00
 testuser |         2 | 16:00:00   |       2 | 16:30:00
 testuser |         2 | 17:00:00   |       2 | 17:30:00
 testuser |         2 | 18:00:00   |       2 | 18:30:00
 testuser |         2 | 19:00:00   |       2 | 19:30:00
 testuser |         2 | 20:00:00   |       2 | 20:30:00
 testuser |         3 | 01:00:00   |       3 | 01:30:00
 testuser |         3 | 02:00:00   |       3 | 02:30:00
 testuser |         3 | 03:00:00   |       3 | 03:30:00
 testuser |         3 | 04:00:00   |       3 | 04:30:00
 testuser |         3 | 05:00:00   |       3 | 05:30:00
 testuser |         3 | 06:00:00   |       3 | 06:30:00
 testuser |         3 | 07:00:00   |       3 | 07:30:00
 testuser |         3 | 08:00:00   |       3 | 08:30:00
 testuser |         3 | 09:00:00   |       3 | 09:30:00
 testuser |         3 | 10:00:00   |       3 | 10:30:00
 testuser |         3 | 11:00:00   |       3 | 11:30:00
 testuser |         3 | 12:00:00   |       3 | 12:30:00
 testuser |         3 | 13:00:00   |       3 | 13:30:00
 testuser |         3 | 14:00:00   |       3 | 14:30:00
 testuser |         3 | 15:00:00   |       3 | 15:30:00
 testuser |         3 | 16:00:00   |       3 | 16:30:00
 testuser |         3 | 17:00:00   |       3 | 17:30:00
 testuser |         3 | 18:00:00   |       3 | 18:30:00
 testuser |         3 | 19:00:00   |       3 | 19:30:00
 testuser |         3 | 20:00:00   |       3 | 20:30:00
(60 rows)

ALTER USER testuser DROP DENY FOR DAY 'Wednesday';
NOTICE:  dropping DENY rule for "testuser" between Wednesday 01:00:00 and Wednesday 01:30:00
NOTICE:  dropping DENY rule for "testuser" between Wednesday 02:00:00 and Wednesday 02:30:00
NOTICE:  dropping DENY rule for "testuser" between Wednesday 03:00:00 and Wednesday 03:30:00
NOTICE:  dropping DENY rule for "testuser" between Wednesday 04:00:00 and Wednesday 04:30:00
NOTICE:  dropping DENY rule for "testuser" between Wednesday 05:00:00 and Wednesday 05:30:00
NOTICE:  dropping DENY rule for "testuser" between Wednesday 06:00:00 and Wednesday 06:30:00
NOTICE:  dropping DENY rule for "testuser" between Wednesday 07:00:00 and Wednesday 07:30:00
NOTICE:  dropping DENY rule for "testuser" between Wednesday 08:00:00 and Wednesday 08:30:00
NOTICE:  dropping DENY rule for "testuser" between Wednesday 09:00:00 and Wednesday 09:30:00
NOTICE:  dropping DENY rule for "testuser" between Wednesday 10:00:00 and Wednesday 10:30:00
NOTICE:  dropping DENY rule for "testuser" between Wednesday 11:00:00 and Wednesday 11:30:00
NOTICE:  dropping DENY rule for "testuser" between Wednesday 12:00:00 and Wednesday 12:30:00
NOTICE:  dropping DENY rule for "testuser" between Wednesday 13:00:00 and Wednesday 13:30:00
NOTICE:  dropping DENY rule for "testuser" between Wednesday 14:00:00 and Wednesday 14:30:00
NOTICE:  dropping DENY rule for "testuser" between Wednesday 15:00:00 and Wednesday 15:30:00
NOTICE:  dropping DENY rule for "testuser" between Wednesday 16:00:00 and Wednesday 16:30:00
NOTICE:  dropping DENY rule for "testuser" between Wednesday 17:00:00 and Wednesday 17:30:00
NOTICE:  dropping DENY rule for "testuser" between Wednesday 18:00:00 and Wednesday 18:30:00
NOTICE:  dropping DENY rule for "testuser" between Wednesday 19:00:00 and Wednesday 19:30:00
NOTICE:  dropping DENY rule for "testuser" between Wednesday 20:00:00 and Wednesday 20:30:00
SELECT r.rolname, d.start_day, d.start_time, d.end_day, d.end_time
FROM pg_auth_time_constraint d join pg_roles r ON (d.authid = r.oid)
WHERE r.rolname = 'testuser'
ORDER BY r.rolname, d.start_day, d.start_time, d.end_day, d.end_time;
 rolname  | start_day | start_time | end_day | end_time 
----------+-----------+------------+---------+----------
 testuser |         1 | 01:00:00   |       1 | 01:30:00
 testuser |         1 | 01:00:00   |       1 | 01:30:00
 testuser |         1 | 02:00:00   |       1 | 02:30:00
 testuser |         1 | 03:00:00   |       1 | 03:30:00
 testuser |         1 | 04:00:00   |       1 | 04:30:00
 testuser |         1 | 05:00:00   |       1 | 05:30:00
 testuser |         1 | 06:00:00   |       1 | 06:30:00
 testuser |         1 | 07:00:00   |       1 | 07:30:00
 testuser |         1 | 08:00:00   |       1 | 08:30:00
 testuser |         1 | 09:00:00   |       1 | 09:30:00
 testuser |         1 | 10:00:00   |       1 | 10:30:00
 testuser |         1 | 11:00:00   |       1 | 11:30:00
 testuser |         1 | 12:00:00   |       1 | 12:30:00
 testuser |         1 | 13:00:00   |       1 | 13:30:00
 testuser |         1 | 14:00:00   |       1 | 14:30:00
 testuser |         1 | 15:00:00   |       1 | 15:30:00
 testuser |         1 | 16:00:00   |       1 | 16:30:00
 testuser |         1 | 17:00:00   |       1 | 17:30:00
 testuser |         1 | 18:00:00   |       1 | 18:30:00
 testuser |         1 | 19:00:00   |       1 | 19:30:00
 testuser |         1 | 20:00:00   |       1 | 20:30:00
 testuser |         2 | 02:00:00   |       2 | 02:30:00
 testuser |         2 | 03:00:00   |       2 | 03:30:00
 testuser |         2 | 04:00:00   |       2 | 04:30:00
 testuser |         2 | 05:00:00   |       2 | 05:30:00
 testuser |         2 | 06:00:00   |       2 | 06:30:00
 testuser |         2 | 07:00:00   |       2 | 07:30:00
 testuser |         2 | 08:00:00   |       2 | 08:30:00
 testuser |         2 | 09:00:00   |       2 | 09:30:00
 testuser |         2 | 10:00:00   |       2 | 10:30:00
 testuser |         2 | 11:00:00   |       2 | 11:30:00
 testuser |         2 | 12:00:00   |       2 | 12:30:00
 testuser |         2 | 13:00:00   |       2 | 13:30:00
 testuser |         2 | 14:00:00   |       2 | 14:30:00
 testuser |         2 | 15:00:00   |       2 | 15:30:00
 testuser |         2 | 16:00:00   |       2 | 16:30:00
 testuser |         2 | 17:00:00   |       2 | 17:30:00
 testuser |         2 | 18:00:00   |       2 | 18:30:00
 testuser |         2 | 19:00:00   |       2 | 19:30:00
 testuser |         2 | 20:00:00   |       2 | 20:30:00
(40 rows)

DROP USER IF EXISTS testuser;
SELECT r.rolname, d.start_day, d.start_time, d.end_day, d.end_time
FROM pg_auth_time_constraint d join pg_roles r ON (d.authid = r.oid)
WHERE r.rolname = 'testuser'
ORDER BY r.rolname, d.start_day, d.start_time, d.end_day, d.end_time;
 rolname | start_day | start_time | end_day | end_time 
---------+-----------+------------+---------+----------
(0 rows)

\echo -- start_ignore
-- start_ignore
drop view if exists relconstraint cascade;
NOTICE:  view "relconstraint" does not exist, skipping
drop view if exists ptable cascade;
NOTICE:  view "ptable" does not exist, skipping
drop view if exists part_closure cascade;
NOTICE:  view "part_closure" does not exist, skipping
drop view if exists anyconstraint cascade;
NOTICE:  view "anyconstraint" does not exist, skipping
\echo -- end_ignore
-- end_ignore

create view relconstraint
    (
        relid,
        conid,
        conname,
        contype,
        consrc,
        condef,
        indexid
    )
    as
select  
    r.oid::regclass as relid, 
    c.oid as conid,
    c.conname,
    c.contype,
    c.consrc,
    pg_get_constraintdef(c.oid) as condef,
    d.objid::regclass as indexid
from 
    (
        pg_class r
			join
			pg_constraint c
			on 
			    r.oid = c.conrelid
			    and r.relkind = 'r'
	)
	    left join
	    pg_depend d
	    on 
	        d.refobjid = c.oid
	        and d.classid = 'pg_class'::regclass
	        and d.refclassid = 'pg_constraint'::regclass
	        and d.deptype = 'i';

create view ptable
    (
        tableid,
        tabledepth
    )
    as
    select 
        parrelid::regclass,
        max(parlevel)+1
    from
        pg_partition
    group by parrelid;

create view part_closure
    (
        tableid,
        tabledepth,
        partid,
        partdepth,
        partordinal,
        partstatus
    )
    as
    select 
        tableid,  
        tabledepth,
        tableid::regclass partid, 
        0 as partdepth, 
        0 as partordinal,
        'r'::char as partstatus
    from 
        ptable
    union all
    select 
        parrelid::regclass as tableid,  
        t.tabledepth as tabledepth,
        r.parchildrelid::regclass partid, 
        p.parlevel + 1 as partdepth, 
        r.parruleord as partordinal,
        case
            when t.tabledepth = p.parlevel + 1 then 'l'::char
            else 'i'::char
        end as partstatus
    from 
        pg_partition p, 
        pg_partition_rule r,
        ptable t
    where 
        p.oid = r.paroid
        and not p.paristemplate
        and p.parrelid = t.tableid;

create view anyconstraint
    (
        tableid,
        partid,
        relid,
        conid,
        conname,
        contype,
        consrc,
        condef,
        indexid
    )
    as
     select 
         coalesce(p.tableid, c.relid) as tableid,
         p.partid,
         c.relid,
         c.conid,
         c.conname,
         c.contype,
         c.consrc,
         c.condef,
         c.indexid
    from 
        relconstraint c
            left join 
        part_closure p
            on relid = partid;
\echo -- start_ignore
-- start_ignore
drop table if exists mulpt_pk;
NOTICE:  table "mulpt_pk" does not exist, skipping
\echo -- end_ignore
-- end_ignore
-- Create multi-level partitioned tables with CONSTRAINTS on distcol and ptcol
create table mulpt_pk
(
distcol int,
ptcol text,
subptcol int,
col1 int,
PRIMARY KEY(distcol, ptcol)
)
distributed by (distcol)
partition by list (ptcol)
subpartition by range (subptcol)
subpartition template (
start (1) end (3) inclusive every (1)
)
(
partition floor values ('A', 'B'),
partition lower values ('100','110'),
partition upper values ('200', '210', '220')
);
NOTICE:  CREATE TABLE will create partition "mulpt_pk_1_prt_floor" for table "mulpt_pk"
NOTICE:  CREATE TABLE will create partition "mulpt_pk_1_prt_lower" for table "mulpt_pk"
NOTICE:  CREATE TABLE will create partition "mulpt_pk_1_prt_upper" for table "mulpt_pk"
ERROR:  PRIMARY KEY constraint must contain all columns in the partition key
HINT:  Include column "subptcol" in the PRIMARY KEY constraint or create a part-wise UNIQUE index after creating the table instead.
\echo -- start_ignore
-- start_ignore
drop table if exists mulpt_un;
NOTICE:  table "mulpt_un" does not exist, skipping
\echo -- end_ignore
-- end_ignore
create table mulpt_un
(
distcol int,
ptcol text,
subptcol int,
col1 int,
UNIQUE(distcol, ptcol)
)
distributed by (distcol)
partition by list (ptcol)
subpartition by range (subptcol)
subpartition template (
start (1) end (3) inclusive every (1)
)
(
partition floor values ('A', 'B'),
partition lower values ('100','110'),
partition upper values ('200', '210', '220')
);
NOTICE:  CREATE TABLE will create partition "mulpt_un_1_prt_floor" for table "mulpt_un"
NOTICE:  CREATE TABLE will create partition "mulpt_un_1_prt_lower" for table "mulpt_un"
NOTICE:  CREATE TABLE will create partition "mulpt_un_1_prt_upper" for table "mulpt_un"
ERROR:  UNIQUE constraint must contain all columns in the partition key
HINT:  Include column "subptcol" in the UNIQUE constraint or create a part-wise UNIQUE index after creating the table instead.
--check that the tables are not created
select tablename from pg_tables where tablename in ('mulpt_pk','mulpt_un') order by tablename;
 tablename 
-----------
(0 rows)

-- create the tables with CONSTRAINTS on distcol,ptcol and subptcol, check that the tables are created.
\echo -- start_ignore
-- start_ignore
drop table if exists mulpt_pk;
NOTICE:  table "mulpt_pk" does not exist, skipping
\echo -- end_ignore
-- end_ignore
create table mulpt_pk
(
distcol int,
ptcol text,
subptcol int,
col1 int,
PRIMARY KEY(distcol, ptcol,subptcol)
)
distributed by (distcol)
partition by list (ptcol)
subpartition by range (subptcol)
subpartition template (
start (1) end (3) inclusive every (1)
)
(
partition floor values ('A', 'B'),
partition lower values ('100','110'),
partition upper values ('200', '210', '220')
);
NOTICE:  CREATE TABLE will create partition "mulpt_pk_1_prt_floor" for table "mulpt_pk"
NOTICE:  CREATE TABLE will create partition "mulpt_pk_1_prt_lower" for table "mulpt_pk"
NOTICE:  CREATE TABLE will create partition "mulpt_pk_1_prt_upper" for table "mulpt_pk"
NOTICE:  CREATE TABLE will create partition "mulpt_pk_1_prt_floor_2_prt_1" for table "mulpt_pk_1_prt_floor"
NOTICE:  CREATE TABLE will create partition "mulpt_pk_1_prt_floor_2_prt_2" for table "mulpt_pk_1_prt_floor"
NOTICE:  CREATE TABLE will create partition "mulpt_pk_1_prt_lower_2_prt_1" for table "mulpt_pk_1_prt_lower"
NOTICE:  CREATE TABLE will create partition "mulpt_pk_1_prt_lower_2_prt_2" for table "mulpt_pk_1_prt_lower"
NOTICE:  CREATE TABLE will create partition "mulpt_pk_1_prt_upper_2_prt_1" for table "mulpt_pk_1_prt_upper"
NOTICE:  CREATE TABLE will create partition "mulpt_pk_1_prt_upper_2_prt_2" for table "mulpt_pk_1_prt_upper"
NOTICE:  CREATE TABLE / PRIMARY KEY will create implicit index "mulpt_pk_pkey" for table "mulpt_pk"
NOTICE:  CREATE TABLE / PRIMARY KEY will create implicit index "mulpt_pk_1_prt_floor_pkey" for table "mulpt_pk_1_prt_floor"
NOTICE:  CREATE TABLE / PRIMARY KEY will create implicit index "mulpt_pk_1_prt_floor_2_prt_1_pkey" for table "mulpt_pk_1_prt_floor_2_prt_1"
NOTICE:  CREATE TABLE / PRIMARY KEY will create implicit index "mulpt_pk_1_prt_floor_2_prt_2_pkey" for table "mulpt_pk_1_prt_floor_2_prt_2"
NOTICE:  CREATE TABLE / PRIMARY KEY will create implicit index "mulpt_pk_1_prt_lower_pkey" for table "mulpt_pk_1_prt_lower"
NOTICE:  CREATE TABLE / PRIMARY KEY will create implicit index "mulpt_pk_1_prt_lower_2_prt_1_pkey" for table "mulpt_pk_1_prt_lower_2_prt_1"
NOTICE:  CREATE TABLE / PRIMARY KEY will create implicit index "mulpt_pk_1_prt_lower_2_prt_2_pkey" for table "mulpt_pk_1_prt_lower_2_prt_2"
NOTICE:  CREATE TABLE / PRIMARY KEY will create implicit index "mulpt_pk_1_prt_upper_pkey" for table "mulpt_pk_1_prt_upper"
NOTICE:  CREATE TABLE / PRIMARY KEY will create implicit index "mulpt_pk_1_prt_upper_2_prt_1_pkey" for table "mulpt_pk_1_prt_upper_2_prt_1"
NOTICE:  CREATE TABLE / PRIMARY KEY will create implicit index "mulpt_pk_1_prt_upper_2_prt_2_pkey" for table "mulpt_pk_1_prt_upper_2_prt_2"
\echo -- start_ignore
-- start_ignore
drop table if exists mulpt_un;
NOTICE:  table "mulpt_un" does not exist, skipping
\echo -- end_ignore
-- end_ignore
create table mulpt_un
(
distcol int,
ptcol text,
subptcol int,
col1 int,
UNIQUE(distcol, ptcol,subptcol)
)
distributed by (distcol)
partition by list (ptcol)
subpartition by range (subptcol)
subpartition template (
start (1) end (3) inclusive every (1)
)
(
partition floor values ('A', 'B'),
partition lower values ('100','110'),
partition upper values ('200', '210', '220')
);
NOTICE:  CREATE TABLE will create partition "mulpt_un_1_prt_floor" for table "mulpt_un"
NOTICE:  CREATE TABLE will create partition "mulpt_un_1_prt_lower" for table "mulpt_un"
NOTICE:  CREATE TABLE will create partition "mulpt_un_1_prt_upper" for table "mulpt_un"
NOTICE:  CREATE TABLE will create partition "mulpt_un_1_prt_floor_2_prt_1" for table "mulpt_un_1_prt_floor"
NOTICE:  CREATE TABLE will create partition "mulpt_un_1_prt_floor_2_prt_2" for table "mulpt_un_1_prt_floor"
NOTICE:  CREATE TABLE will create partition "mulpt_un_1_prt_lower_2_prt_1" for table "mulpt_un_1_prt_lower"
NOTICE:  CREATE TABLE will create partition "mulpt_un_1_prt_lower_2_prt_2" for table "mulpt_un_1_prt_lower"
NOTICE:  CREATE TABLE will create partition "mulpt_un_1_prt_upper_2_prt_1" for table "mulpt_un_1_prt_upper"
NOTICE:  CREATE TABLE will create partition "mulpt_un_1_prt_upper_2_prt_2" for table "mulpt_un_1_prt_upper"
NOTICE:  CREATE TABLE / UNIQUE will create implicit index "mulpt_un_distcol_key" for table "mulpt_un"
NOTICE:  CREATE TABLE / UNIQUE will create implicit index "mulpt_un_1_prt_floor_distcol_key" for table "mulpt_un_1_prt_floor"
NOTICE:  CREATE TABLE / UNIQUE will create implicit index "mulpt_un_1_prt_floor_2_prt_1_distcol_key" for table "mulpt_un_1_prt_floor_2_prt_1"
NOTICE:  CREATE TABLE / UNIQUE will create implicit index "mulpt_un_1_prt_floor_2_prt_2_distcol_key" for table "mulpt_un_1_prt_floor_2_prt_2"
NOTICE:  CREATE TABLE / UNIQUE will create implicit index "mulpt_un_1_prt_lower_distcol_key" for table "mulpt_un_1_prt_lower"
NOTICE:  CREATE TABLE / UNIQUE will create implicit index "mulpt_un_1_prt_lower_2_prt_1_distcol_key" for table "mulpt_un_1_prt_lower_2_prt_1"
NOTICE:  CREATE TABLE / UNIQUE will create implicit index "mulpt_un_1_prt_lower_2_prt_2_distcol_key" for table "mulpt_un_1_prt_lower_2_prt_2"
NOTICE:  CREATE TABLE / UNIQUE will create implicit index "mulpt_un_1_prt_upper_distcol_key" for table "mulpt_un_1_prt_upper"
NOTICE:  CREATE TABLE / UNIQUE will create implicit index "mulpt_un_1_prt_upper_2_prt_1_distcol_key" for table "mulpt_un_1_prt_upper_2_prt_1"
NOTICE:  CREATE TABLE / UNIQUE will create implicit index "mulpt_un_1_prt_upper_2_prt_2_distcol_key" for table "mulpt_un_1_prt_upper_2_prt_2"
select tablename from pg_tables where tablename in ('mulpt_pk','mulpt_un') order by tablename;
 tablename 
-----------
 mulpt_pk
 mulpt_un
(2 rows)

--check the constraints are present on the parent table and its partitions
select distinct conname from anyconstraint where contype='p' and tableid='mulpt_pk'::regclass ;
    conname    
---------------
 mulpt_pk_pkey
(1 row)

select conname,partid from anyconstraint where contype='p' and tableid='mulpt_pk'::regclass order by partid;
    conname    |            partid            
---------------+------------------------------
 mulpt_pk_pkey | mulpt_pk
 mulpt_pk_pkey | mulpt_pk_1_prt_floor
 mulpt_pk_pkey | mulpt_pk_1_prt_floor_2_prt_1
 mulpt_pk_pkey | mulpt_pk_1_prt_floor_2_prt_2
 mulpt_pk_pkey | mulpt_pk_1_prt_lower
 mulpt_pk_pkey | mulpt_pk_1_prt_lower_2_prt_1
 mulpt_pk_pkey | mulpt_pk_1_prt_lower_2_prt_2
 mulpt_pk_pkey | mulpt_pk_1_prt_upper
 mulpt_pk_pkey | mulpt_pk_1_prt_upper_2_prt_1
 mulpt_pk_pkey | mulpt_pk_1_prt_upper_2_prt_2
(10 rows)

select distinct conname from anyconstraint where contype='u' and tableid='mulpt_un'::regclass;
   conname    
--------------
 mulpt_un_key
(1 row)

select conname,partid from anyconstraint where contype='u' and tableid='mulpt_un'::regclass order by partid;
   conname    |            partid            
--------------+------------------------------
 mulpt_un_key | mulpt_un
 mulpt_un_key | mulpt_un_1_prt_floor
 mulpt_un_key | mulpt_un_1_prt_floor_2_prt_1
 mulpt_un_key | mulpt_un_1_prt_floor_2_prt_2
 mulpt_un_key | mulpt_un_1_prt_lower
 mulpt_un_key | mulpt_un_1_prt_lower_2_prt_1
 mulpt_un_key | mulpt_un_1_prt_lower_2_prt_2
 mulpt_un_key | mulpt_un_1_prt_upper
 mulpt_un_key | mulpt_un_1_prt_upper_2_prt_1
 mulpt_un_key | mulpt_un_1_prt_upper_2_prt_2
(10 rows)

/* Note that roles are defined at the system-level and are valid
 * for all databases in your Greenplum Database system. */
\echo -- start_ignore
-- start_ignore
revoke all on protocol gphdfs from _hadoop_perm_test_role;
ERROR:  role "_hadoop_perm_test_role" does not exist
DROP ROLE IF EXISTS _hadoop_perm_test_role;
NOTICE:  role "_hadoop_perm_test_role" does not exist, skipping
NOTICE:  role "_hadoop_perm_test_role" does not exist, skipping  (seg0 rh55-qavm103:18506 pid=13677)
NOTICE:  role "_hadoop_perm_test_role" does not exist, skipping  (seg2 rh55-qavm103:18508 pid=13681)
NOTICE:  role "_hadoop_perm_test_role" does not exist, skipping  (seg1 rh55-qavm103:18507 pid=13679)
revoke all on protocol gphdfs from _hadoop_perm_test_role2;
ERROR:  role "_hadoop_perm_test_role2" does not exist
DROP ROLE IF EXISTS _hadoop_perm_test_role2;
NOTICE:  role "_hadoop_perm_test_role2" does not exist, skipping
NOTICE:  role "_hadoop_perm_test_role2" does not exist, skipping  (seg1 rh55-qavm103:18507 pid=13679)
NOTICE:  role "_hadoop_perm_test_role2" does not exist, skipping  (seg0 rh55-qavm103:18506 pid=13677)
NOTICE:  role "_hadoop_perm_test_role2" does not exist, skipping  (seg2 rh55-qavm103:18508 pid=13681)
\echo -- end_ignore
-- end_ignore
/* Now create a new role. Initially this role should NOT
 * be allowed to create an external hdfs table. */
\echo -- start_ignore
-- start_ignore
DROP ROLE _hadoop_perm_test_role;
ERROR:  role "_hadoop_perm_test_role" does not exist
\echo -- end_ignore
-- end_ignore
\echo -- start_ignore
-- start_ignore
DROP ROLE _hadoop_perm_test_role2; 
ERROR:  role "_hadoop_perm_test_role2" does not exist
\echo -- end_ignore
-- end_ignore
CREATE ROLE _hadoop_perm_test_role
WITH CREATEEXTTABLE
LOGIN;
NOTICE:  resource queue required -- using default resource queue "pg_default"
CREATE ROLE _hadoop_perm_test_role2
WITH CREATEEXTTABLE
LOGIN;
NOTICE:  resource queue required -- using default resource queue "pg_default"
--ALTER ROLE _hadoop_perm_test_role
--WITH
--CREATEEXTTABLE(type='writable', protocol='gphdfs');
grant insert on protocol gphdfs to _hadoop_perm_test_role;
--ALTER ROLE _hadoop_perm_test_role
--WITH
--CREATEEXTTABLE(type='readable', protocol='gphdfs')
--CREATEEXTTABLE(type='writable');
grant all on protocol gphdfs to _hadoop_perm_test_role2;
--Coverage for all the table and column constraints.
--Drop tables
Drop table if exists tbl_unique_constraint;
NOTICE:  table "tbl_unique_constraint" does not exist, skipping
Drop table if exists tbl_unique_constraint2;
NOTICE:  table "tbl_unique_constraint2" does not exist, skipping
Drop table if exists tbl_primry_constraint;
NOTICE:  table "tbl_primry_constraint" does not exist, skipping
Drop table if exists tbl_primry_constraint2;
NOTICE:  table "tbl_primry_constraint2" does not exist, skipping
Drop table if exists tbl_check_constraint;
NOTICE:  table "tbl_check_constraint" does not exist, skipping
Drop table if exists col_unique_constraint;
NOTICE:  table "col_unique_constraint" does not exist, skipping
Drop table if exists col_primry_constraint;
NOTICE:  table "col_primry_constraint" does not exist, skipping
Drop table if exists col_check_constraint;
NOTICE:  table "col_check_constraint" does not exist, skipping
--Create table with table constraint -Unique
CREATE table tbl_unique_constraint (i int, t text, constraint tbl_unq1 unique(i)) distributed by (i);
NOTICE:  CREATE TABLE / UNIQUE will create implicit index "tbl_unique_constraint_i_key" for table "tbl_unique_constraint"
INSERT into tbl_unique_constraint  values (100,'text1');
INSERT into tbl_unique_constraint  values (200,'text2');
INSERT into tbl_unique_constraint  values (300,'text3');
--Alter table to add/drop a table constraint -Unique
CREATE table tbl_unique_constraint2 (i int , t text) distributed by (i);
INSERT into tbl_unique_constraint2  values (100,'text1');
INSERT into tbl_unique_constraint2  values (200,'text2');
INSERT into tbl_unique_constraint2  values (300,'text3');
ALTER table tbl_unique_constraint2 add constraint tbl_unq2 unique(i);
NOTICE:  ALTER TABLE / ADD UNIQUE will create implicit index "tbl_unique_constraint2_i_key" for table "tbl_unique_constraint2"
ALTER TABLE tbl_unique_constraint2 DROP CONSTRAINT tbl_unq2;
--Create table with table constraint -Primary key
CREATE table tbl_primry_constraint (i int, t text, constraint tbl_primary1 primary key (i)) distributed by (i);
NOTICE:  CREATE TABLE / PRIMARY KEY will create implicit index "tbl_primry_constraint_pkey" for table "tbl_primry_constraint"
INSERT into tbl_primry_constraint  values (100,'text1');
INSERT into tbl_primry_constraint  values (200,'text2');
INSERT into tbl_primry_constraint  values (300,'text3');
--Alter table to add/drop a table constraint -Primary key
CREATE table tbl_primry_constraint2 (i int, t text) distributed by (i);
INSERT into tbl_primry_constraint2  values (100,'text1');
INSERT into tbl_primry_constraint2  values (200,'text2');
INSERT into tbl_primry_constraint2  values (300,'text3');
ALTER table tbl_primry_constraint2 add constraint tbl_primary2 primary key(i);
NOTICE:  ALTER TABLE / ADD PRIMARY KEY will create implicit index "tbl_primry_constraint2_pkey" for table "tbl_primry_constraint2"
ALTER TABLE tbl_primry_constraint DROP CONSTRAINT tbl_primary1;
--Create table with table constraint -Check
CREATE TABLE tbl_check_constraint  (
    a1 integer,
    a2 text,
    a3 varchar(10),
    CONSTRAINT tbl_chk_con1 CHECK (a1 > 25 AND a2 <> '')
    )DISTRIBUTED RANDOMLY;
INSERT into tbl_check_constraint  values (100,'text1');
INSERT into tbl_check_constraint  values (200,'text2');
INSERT into tbl_check_constraint  values (300,'text3');
--Alter table to add/drop a table constraint -Check
ALTER TABLE tbl_check_constraint ADD CONSTRAINT zipchk CHECK (char_length(a3) = 5);
ALTER TABLE tbl_check_constraint DROP CONSTRAINT tbl_chk_con1;
--Create table with column constraint -Unique
CREATE table col_unique_constraint (i int  constraint col_unique1 unique, t text) distributed by (i);
NOTICE:  CREATE TABLE / UNIQUE will create implicit index "col_unique_constraint_i_key" for table "col_unique_constraint"
INSERT into col_unique_constraint  values (100,'text1');
INSERT into col_unique_constraint  values (200,'text2');
INSERT into col_unique_constraint  values (300,'text3');
--Create table with column constraint -Primary Key
CREATE table col_primry_constraint (i int constraint col_primary1 primary key, t text) distributed by (i);
NOTICE:  CREATE TABLE / PRIMARY KEY will create implicit index "col_primry_constraint_pkey" for table "col_primry_constraint"
INSERT into col_primry_constraint  values (100,'text1');
INSERT into col_primry_constraint  values (200,'text2');
INSERT into col_primry_constraint  values (300,'text3');
--Create table with column constraint -Check
CREATE TABLE col_check_constraint  (
    did integer,
    name varchar(40) NOT NULL constraint col_chk1 CHECK (name <> '')
    )DISTRIBUTED RANDOMLY;
    
INSERT into col_check_constraint  values (100,'text1');
INSERT into col_check_constraint  values (200,'text2');
INSERT into col_check_constraint  values (300,'text3');
--Drop tables and functions
Drop table if exists srf_t1;
NOTICE:  table "srf_t1" does not exist, skipping
Drop table if exists srf_t2;
NOTICE:  table "srf_t2" does not exist, skipping
Drop table if exists srf_t3;
NOTICE:  table "srf_t3" does not exist, skipping
Drop function if exists srf_vect();
NOTICE:  function srf_vect() does not exist, skipping
--Set Returning Functions
create table srf_t1 (i int, t text);
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.
insert into srf_t1 select i % 10, (i % 10)::text  from generate_series(1, 100) i;
create index srf_t1_idx on srf_t1 using bitmap (i);
select count(*) from srf_t1 where i=1;
 count 
-------
    10
(1 row)

create table srf_t2 (i int, j int, k int) distributed by (k);
create index srf_t2_i_idx on srf_t2 using bitmap(i);
insert into srf_t2 select 1,
case when (i % (16 * 16 + 8)) = 0 then 2  else 1 end, 1
from generate_series(1, 16 * 16 * 16) i;
select count(*) from srf_t2 where i = 1;
 count 
-------
  4096
(1 row)

select count(*) from srf_t2 where j = 2;
 count 
-------
    15
(1 row)

create table srf_t3 (i int, j int, k int) distributed by (k);
create index srf_t3_i_idx on srf_t3 using bitmap(i);
insert into srf_t3 select i, 1, 1 from
generate_series(1, 8250 * 8) g, generate_series(1, 2) as i;
insert into srf_t3 select 17, 1, 1 from generate_series(1, 16 * 16) i;
insert into srf_t3 values(17, 2, 1);
insert into srf_t3 select 17, 1, 1 from generate_series(1, 16 * 16) i;
insert into srf_t3 select i, 1, 1 from
generate_series(1, 8250 * 8) g, generate_series(1, 2) i;
select count(*) from srf_t3 where i = 1;
 count  
--------
 132000
(1 row)

select count(*) from srf_t3 where i = 17;
 count 
-------
   513
(1 row)

create function srf_vect() returns void as $proc$
<<lbl>>declare a integer; b varchar; c varchar; r record;
begin
  -- fori
  for i in 1 .. 3 loop
    raise notice '%', i;
  end loop;
  -- fore with record var
  for r in select gs as aa, 'BB' as bb, 'CC' as cc from generate_series(1,4) gs loop
    raise notice '% % %', r.aa, r.bb, r.cc;
  end loop;
  -- fore with single scalar
  for a in select gs from generate_series(1,4) gs loop
    raise notice '%', a;
  end loop;
  -- fore with multiple scalars
  for a,b,c in select gs, 'BB','CC' from generate_series(1,4) gs loop
    raise notice '% % %', a, b, c;
  end loop;
  -- using qualified names in fors, fore is enabled, disabled only for fori
  for lbl.a, lbl.b, lbl.c in execute $$select gs, 'bb','cc' from generate_series(1,4) gs$$ loop
    raise notice '% % %', a, b, c;
  end loop;
end;
$proc$ language plpgsql;
select srf_vect();
NOTICE:  1
NOTICE:  2
NOTICE:  3
NOTICE:  1 BB CC
NOTICE:  2 BB CC
NOTICE:  3 BB CC
NOTICE:  4 BB CC
NOTICE:  1
NOTICE:  2
NOTICE:  3
NOTICE:  4
NOTICE:  1 BB CC
NOTICE:  2 BB CC
NOTICE:  3 BB CC
NOTICE:  4 BB CC
NOTICE:  1 bb cc
NOTICE:  2 bb cc
NOTICE:  3 bb cc
NOTICE:  4 bb cc
 srf_vect 
----------
 
(1 row)

\echo -- start_ignore
-- start_ignore
drop role "ISO";
drop role "geography";
drop role "ISO_ro_1";
drop role "iso123";
DROP ROLE user_1;
ERROR:  role "user_1" cannot be dropped because some objects depend on it
DETAIL:  1 objects in database alter_table_db
DROP ROLE db_role1;
DROP ROLE db_role2;
DROP ROLE db_role3;
DROP ROLE db_role4;
DROP ROLE db_role5;
DROP ROLE db_role6; 
DROP ROLE db_role7; 
DROP ROLE db_role8;
ERROR:  role "db_role8" does not exist
DROP ROLE db_role9;
DROP ROLE db_role10;
DROP ROLE db_role11;
DROP ROLE db_role12;
DROP ROLE grp_role1;
DROP ROLE grp_role2;
DROP ROLE db_owner1;
DROP ROLE db_owner2;
ERROR:  role "db_owner2" cannot be dropped because some objects depend on it
DETAIL:  owner of database db_name1
DROP ROLE domain_owner;
ERROR:  role "domain_owner" cannot be dropped because some objects depend on it
DETAIL:  owner of type domain_schema.domain_3
DROP ROLE func_role;
ERROR:  role "func_role" cannot be dropped because some objects depend on it
DETAIL:  owner of function add(integer,integer)
DROP ROLE agg_owner;
ERROR:  role "agg_owner" cannot be dropped because some objects depend on it
DETAIL:  owner of function agg_schema.scube(numeric)
DROP ROLE sally;
DROP ROLE ron;
DROP ROLE ken;
DROP ROLE admin;
ERROR:  role "admin" cannot be dropped because some objects depend on it
DETAIL:  owner of table foo3
DROP ROLE _hadoop_perm_test_role;
ERROR:  role "_hadoop_perm_test_role" cannot be dropped because some objects depend on it
DETAIL:  access to protocol gphdfs
DROP ROLE _hadoop_perm_test_role2;
ERROR:  role "_hadoop_perm_test_role2" cannot be dropped because some objects depend on it
DETAIL:  access to protocol gphdfs
DROP USER "MAIN_USER";
DROP USER "sub_user";
DROP USER "SUB_user_1";
DROP USER "user123";
DROP USER "MAIN_USER";
ERROR:  role "MAIN_USER" does not exist
DROP USER "sub_user";
ERROR:  role "sub_user" does not exist
DROP USER "SUB_user_1";
ERROR:  role "SUB_user_1" does not exist
DROP USER "user123";
ERROR:  role "user123" does not exist
DROP USER db_user1;
DROP USER db_user2;
DROP USER db_user3;
DROP USER db_user4;
DROP USER db_user5;
DROP USER db_user6; 
DROP USER db_user7; 
DROP USER db_user8;
ERROR:  role "db_user8" does not exist
DROP USER db_user9;
DROP USER db_user10;
DROP USER db_user11;
DROP USER db_user12;
DROP USER test_user_1;
DROP USER db_user13;
ERROR:  role "db_user13" cannot be dropped because some objects depend on it
DETAIL:  owner of database db_schema_test
2 objects in database db_schema_test
DROP USER testuser;
ERROR:  role "testuser" does not exist
DROP GROUP prachgrp; 
DROP GROUP prachgrp; 
ERROR:  role "prachgrp" does not exist
DROP GROUP db_grp1;
DROP GROUP db_user_grp1;
DROP GROUP db_group1;
DROP GROUP db_grp2;
DROP GROUP db_grp3;
DROP GROUP db_grp4;
DROP GROUP db_grp5;
DROP GROUP db_grp6; 
DROP GROUP db_grp7; 
DROP GROUP db_grp8;
DROP GROUP db_grp9;
DROP GROUP db_grp10;
DROP GROUP db_grp11;
DROP GROUP db_grp12;
DROP RESOURCE QUEUE db_resque1;
DROP RESOURCE QUEUE db_resque2;
DROP RESOURCE QUEUE DB_RESque3;
DROP RESOURCE QUEUE DB_RESQUE4;
DROP RESOURCE QUEUE db_resque1;
ERROR:  resource queue "db_resque1" does not exist
DROP RESOURCE QUEUE resqueu3;
DROP RESOURCE QUEUE resqueu4;
DROP RESOURCE QUEUE grp_rsq1;
\echo -- end_ignore
-- end_ignore