2 CREATE TABLE timetztmp (a timetz);
3 \copy timetztmp from 'data/timetz.data'
4 CREATE TABLE timetzcmp ( r_id int2, a int4, b int4 );
6 INSERT INTO timetzcmp (r_id,a) SELECT 1,count(*) FROM timetztmp WHERE a < '07:46:45 GMT+3';
7 INSERT INTO timetzcmp (r_id,a) SELECT 2,count(*) FROM timetztmp WHERE a <= '07:46:45 GMT+3';
8 INSERT INTO timetzcmp (r_id,a) SELECT 3,count(*) FROM timetztmp WHERE a = '07:46:45 GMT+3';
9 INSERT INTO timetzcmp (r_id,a) SELECT 4,count(*) FROM timetztmp WHERE a >= '07:46:45 GMT+3';
10 INSERT INTO timetzcmp (r_id,a) SELECT 5,count(*) FROM timetztmp WHERE a > '07:46:45 GMT+3';
11 INSERT INTO timetzcmp (r_id,a) SELECT 11,count(*) FROM timetztmp WHERE a < '07:46:45 GMT+2';
12 INSERT INTO timetzcmp (r_id,a) SELECT 12,count(*) FROM timetztmp WHERE a <= '07:46:45 GMT+2';
13 INSERT INTO timetzcmp (r_id,a) SELECT 13,count(*) FROM timetztmp WHERE a = '07:46:45 GMT+2';
14 INSERT INTO timetzcmp (r_id,a) SELECT 14,count(*) FROM timetztmp WHERE a >= '07:46:45 GMT+2';
15 INSERT INTO timetzcmp (r_id,a) SELECT 15,count(*) FROM timetztmp WHERE a > '07:46:45 GMT+2';
16 INSERT INTO timetzcmp (r_id,a) SELECT 21,count(*) FROM timetztmp WHERE a < '07:46:45 GMT+4';
17 INSERT INTO timetzcmp (r_id,a) SELECT 22,count(*) FROM timetztmp WHERE a <= '07:46:45 GMT+4';
18 INSERT INTO timetzcmp (r_id,a) SELECT 23,count(*) FROM timetztmp WHERE a = '07:46:45 GMT+4';
19 INSERT INTO timetzcmp (r_id,a) SELECT 24,count(*) FROM timetztmp WHERE a >= '07:46:45 GMT+4';
20 INSERT INTO timetzcmp (r_id,a) SELECT 25,count(*) FROM timetztmp WHERE a > '07:46:45 GMT+4';
21 CREATE INDEX timetzidx ON timetztmp USING gist ( a );
22 SET enable_seqscan=off;
23 UPDATE timetzcmp SET b=c FROM ( SELECT count(*) AS c FROM timetztmp WHERE a < '07:46:45 GMT+3'::timetz ) q WHERE r_id=1 ;
24 UPDATE timetzcmp SET b=c FROM ( SELECT count(*) AS c FROM timetztmp WHERE a <= '07:46:45 GMT+3'::timetz ) q WHERE r_id=2 ;
25 UPDATE timetzcmp SET b=c FROM ( SELECT count(*) AS c FROM timetztmp WHERE a = '07:46:45 GMT+3'::timetz ) q WHERE r_id=3 ;
26 UPDATE timetzcmp SET b=c FROM ( SELECT count(*) AS c FROM timetztmp WHERE a >= '07:46:45 GMT+3'::timetz ) q WHERE r_id=4 ;
27 UPDATE timetzcmp SET b=c FROM ( SELECT count(*) AS c FROM timetztmp WHERE a > '07:46:45 GMT+3'::timetz ) q WHERE r_id=5 ;
28 UPDATE timetzcmp SET b=c FROM ( SELECT count(*) AS c FROM timetztmp WHERE a < '07:46:45 GMT+2'::timetz ) q WHERE r_id=11 ;
29 UPDATE timetzcmp SET b=c FROM ( SELECT count(*) AS c FROM timetztmp WHERE a <= '07:46:45 GMT+2'::timetz ) q WHERE r_id=12 ;
30 UPDATE timetzcmp SET b=c FROM ( SELECT count(*) AS c FROM timetztmp WHERE a = '07:46:45 GMT+2'::timetz ) q WHERE r_id=13 ;
31 UPDATE timetzcmp SET b=c FROM ( SELECT count(*) AS c FROM timetztmp WHERE a >= '07:46:45 GMT+2'::timetz ) q WHERE r_id=14 ;
32 UPDATE timetzcmp SET b=c FROM ( SELECT count(*) AS c FROM timetztmp WHERE a > '07:46:45 GMT+2'::timetz ) q WHERE r_id=15 ;
33 UPDATE timetzcmp SET b=c FROM ( SELECT count(*) AS c FROM timetztmp WHERE a < '07:46:45 GMT+4'::timetz ) q WHERE r_id=21 ;
34 UPDATE timetzcmp SET b=c FROM ( SELECT count(*) AS c FROM timetztmp WHERE a <= '07:46:45 GMT+4'::timetz ) q WHERE r_id=22 ;
35 UPDATE timetzcmp SET b=c FROM ( SELECT count(*) AS c FROM timetztmp WHERE a = '07:46:45 GMT+4'::timetz ) q WHERE r_id=23 ;
36 UPDATE timetzcmp SET b=c FROM ( SELECT count(*) AS c FROM timetztmp WHERE a >= '07:46:45 GMT+4'::timetz ) q WHERE r_id=24 ;
37 UPDATE timetzcmp SET b=c FROM ( SELECT count(*) AS c FROM timetztmp WHERE a > '07:46:45 GMT+4'::timetz ) q WHERE r_id=25 ;
38 SELECT count(*) FROM timetzcmp WHERE a=b;