Fixed a bug reorganizing tables without toast tables.
This commit is contained in:
@ -27,63 +27,68 @@ CREATE TABLE tbl_gistkey (
|
||||
);
|
||||
CREATE INDEX cidx_circle ON tbl_gistkey USING gist (c);
|
||||
ALTER TABLE tbl_gistkey CLUSTER ON cidx_circle;
|
||||
--
|
||||
-- insert data
|
||||
--
|
||||
INSERT INTO tbl_cluster VALUES(1, '2008-12-31 10:00:00', 'admin');
|
||||
INSERT INTO tbl_cluster VALUES(2, '2008-01-01 00:00:00', 'king');
|
||||
INSERT INTO tbl_cluster VALUES(3, '2008-03-04 12:00:00', 'joker');
|
||||
INSERT INTO tbl_cluster VALUES(4, '2008-03-05 15:00:00', 'queen');
|
||||
INSERT INTO tbl_cluster VALUES(5, '2008-01-01 00:30:00', sqrt(2::numeric(1000,999))::text || sqrt(3::numeric(1000,999))::text);
|
||||
INSERT INTO tbl_only_pkey VALUES(1, 'abc');
|
||||
INSERT INTO tbl_only_pkey VALUES(2, 'def');
|
||||
INSERT INTO tbl_only_ckey VALUES(1, '2008-01-01 00:00:00', 'abc');
|
||||
INSERT INTO tbl_only_ckey VALUES(2, '2008-02-01 00:00:00', 'def');
|
||||
INSERT INTO tbl_gistkey VALUES(1, '<(1,2),3>');
|
||||
INSERT INTO tbl_gistkey VALUES(2, '<(4,5),6>');
|
||||
--
|
||||
-- do reorg
|
||||
--
|
||||
\! pg_reorg --dbname=contrib_regression --no-order
|
||||
\! pg_reorg --dbname=contrib_regression
|
||||
\! pg_reorg --dbname=contrib_regression --table=tbl_cluster
|
||||
--
|
||||
-- results
|
||||
--
|
||||
\d+ tbl_cluster
|
||||
Table "public.tbl_cluster"
|
||||
Column | Type | Modifiers | Storage | Description
|
||||
--------+-----------------------------+-----------+----------+-------------
|
||||
col1 | integer | not null | plain |
|
||||
col2 | timestamp without time zone | | plain |
|
||||
:-) | text | not null | extended |
|
||||
\d tbl_cluster
|
||||
Table "public.tbl_cluster"
|
||||
Column | Type | Modifiers
|
||||
--------+-----------------------------+-----------
|
||||
col1 | integer | not null
|
||||
col2 | timestamp without time zone |
|
||||
:-) | text | not null
|
||||
Indexes:
|
||||
"tbl_cluster_pkey" PRIMARY KEY, btree (":-)", col1)
|
||||
"cidx_cluster" btree (col2, length(":-)")) CLUSTER
|
||||
Has OIDs: no
|
||||
Options: fillfactor=70
|
||||
|
||||
\d+ tbl_gistkey
|
||||
Table "public.tbl_gistkey"
|
||||
Column | Type | Modifiers | Storage | Description
|
||||
--------+---------+-----------+---------+-------------
|
||||
id | integer | not null | plain |
|
||||
c | circle | | plain |
|
||||
\d tbl_gistkey
|
||||
Table "public.tbl_gistkey"
|
||||
Column | Type | Modifiers
|
||||
--------+---------+-----------
|
||||
id | integer | not null
|
||||
c | circle |
|
||||
Indexes:
|
||||
"tbl_gistkey_pkey" PRIMARY KEY, btree (id)
|
||||
"cidx_circle" gist (c) CLUSTER
|
||||
Has OIDs: no
|
||||
|
||||
\d+ tbl_only_ckey
|
||||
Table "public.tbl_only_ckey"
|
||||
Column | Type | Modifiers | Storage | Description
|
||||
--------+-----------------------------+-----------+----------+-------------
|
||||
col1 | integer | | plain |
|
||||
col2 | timestamp without time zone | | plain |
|
||||
:-) | text | | extended |
|
||||
\d tbl_only_ckey
|
||||
Table "public.tbl_only_ckey"
|
||||
Column | Type | Modifiers
|
||||
--------+-----------------------------+-----------
|
||||
col1 | integer |
|
||||
col2 | timestamp without time zone |
|
||||
:-) | text |
|
||||
Indexes:
|
||||
"cidx_only_ckey" btree (col2, ":-)") CLUSTER
|
||||
Has OIDs: no
|
||||
Options: fillfactor=70
|
||||
|
||||
\d+ tbl_only_pkey
|
||||
Table "public.tbl_only_pkey"
|
||||
Column | Type | Modifiers | Storage | Description
|
||||
--------+---------+-----------+----------+-------------
|
||||
col1 | integer | not null | plain |
|
||||
:-) | text | | extended |
|
||||
\d tbl_only_pkey
|
||||
Table "public.tbl_only_pkey"
|
||||
Column | Type | Modifiers
|
||||
--------+---------+-----------
|
||||
col1 | integer | not null
|
||||
:-) | text |
|
||||
Indexes:
|
||||
"tbl_only_pkey_pkey" PRIMARY KEY, btree (col1)
|
||||
Has OIDs: no
|
||||
|
||||
SET synchronize_seqscans = off;
|
||||
SELECT col1, to_char(col2, 'YYYY-MM-DD HH24:MI:SS'), ":-)" FROM tbl_cluster;
|
||||
@ -96,27 +101,33 @@ SELECT col1, to_char(col2, 'YYYY-MM-DD HH24:MI:SS'), ":-)" FROM tbl_cluster;
|
||||
1 | 2008-12-31 10:00:00 | admin
|
||||
(5 rows)
|
||||
|
||||
SELECT * FROM tbl_gistkey;
|
||||
id | c
|
||||
----+---
|
||||
(0 rows)
|
||||
SELECT * FROM tbl_only_ckey ORDER BY 1;
|
||||
col1 | col2 | :-)
|
||||
------+--------------------------+-----
|
||||
1 | Tue Jan 01 00:00:00 2008 | abc
|
||||
2 | Fri Feb 01 00:00:00 2008 | def
|
||||
(2 rows)
|
||||
|
||||
SELECT * FROM tbl_only_ckey;
|
||||
col1 | col2 | :-)
|
||||
------+------+-----
|
||||
(0 rows)
|
||||
|
||||
SELECT * FROM tbl_only_pkey;
|
||||
SELECT * FROM tbl_only_pkey ORDER BY 1;
|
||||
col1 | :-)
|
||||
------+-----
|
||||
(0 rows)
|
||||
1 | abc
|
||||
2 | def
|
||||
(2 rows)
|
||||
|
||||
SELECT * FROM tbl_gistkey ORDER BY 1;
|
||||
id | c
|
||||
----+-----------
|
||||
1 | <(1,2),3>
|
||||
2 | <(4,5),6>
|
||||
(2 rows)
|
||||
|
||||
RESET synchronize_seqscans;
|
||||
--
|
||||
-- clean up
|
||||
--
|
||||
DROP TABLE tbl_cluster;
|
||||
DROP TABLE tbl_gistkey;
|
||||
DROP TABLE tbl_only_pkey;
|
||||
DROP TABLE tbl_only_ckey;
|
||||
DROP TABLE tbl_gistkey;
|
||||
RESET client_min_messages;
|
||||
|
@ -34,32 +34,47 @@ CREATE TABLE tbl_gistkey (
|
||||
CREATE INDEX cidx_circle ON tbl_gistkey USING gist (c);
|
||||
ALTER TABLE tbl_gistkey CLUSTER ON cidx_circle;
|
||||
|
||||
--
|
||||
-- insert data
|
||||
--
|
||||
|
||||
INSERT INTO tbl_cluster VALUES(1, '2008-12-31 10:00:00', 'admin');
|
||||
INSERT INTO tbl_cluster VALUES(2, '2008-01-01 00:00:00', 'king');
|
||||
INSERT INTO tbl_cluster VALUES(3, '2008-03-04 12:00:00', 'joker');
|
||||
INSERT INTO tbl_cluster VALUES(4, '2008-03-05 15:00:00', 'queen');
|
||||
INSERT INTO tbl_cluster VALUES(5, '2008-01-01 00:30:00', sqrt(2::numeric(1000,999))::text || sqrt(3::numeric(1000,999))::text);
|
||||
|
||||
INSERT INTO tbl_only_pkey VALUES(1, 'abc');
|
||||
INSERT INTO tbl_only_pkey VALUES(2, 'def');
|
||||
|
||||
INSERT INTO tbl_only_ckey VALUES(1, '2008-01-01 00:00:00', 'abc');
|
||||
INSERT INTO tbl_only_ckey VALUES(2, '2008-02-01 00:00:00', 'def');
|
||||
|
||||
INSERT INTO tbl_gistkey VALUES(1, '<(1,2),3>');
|
||||
INSERT INTO tbl_gistkey VALUES(2, '<(4,5),6>');
|
||||
|
||||
--
|
||||
-- do reorg
|
||||
--
|
||||
|
||||
\! pg_reorg --dbname=contrib_regression --no-order
|
||||
\! pg_reorg --dbname=contrib_regression
|
||||
\! pg_reorg --dbname=contrib_regression --table=tbl_cluster
|
||||
|
||||
--
|
||||
-- results
|
||||
--
|
||||
|
||||
\d+ tbl_cluster
|
||||
\d+ tbl_gistkey
|
||||
\d+ tbl_only_ckey
|
||||
\d+ tbl_only_pkey
|
||||
\d tbl_cluster
|
||||
\d tbl_gistkey
|
||||
\d tbl_only_ckey
|
||||
\d tbl_only_pkey
|
||||
|
||||
SET synchronize_seqscans = off;
|
||||
SELECT col1, to_char(col2, 'YYYY-MM-DD HH24:MI:SS'), ":-)" FROM tbl_cluster;
|
||||
SELECT * FROM tbl_gistkey;
|
||||
SELECT * FROM tbl_only_ckey;
|
||||
SELECT * FROM tbl_only_pkey;
|
||||
SELECT * FROM tbl_only_ckey ORDER BY 1;
|
||||
SELECT * FROM tbl_only_pkey ORDER BY 1;
|
||||
SELECT * FROM tbl_gistkey ORDER BY 1;
|
||||
RESET synchronize_seqscans;
|
||||
|
||||
--
|
||||
@ -67,7 +82,7 @@ RESET synchronize_seqscans;
|
||||
--
|
||||
|
||||
DROP TABLE tbl_cluster;
|
||||
DROP TABLE tbl_gistkey;
|
||||
DROP TABLE tbl_only_pkey;
|
||||
DROP TABLE tbl_only_ckey;
|
||||
DROP TABLE tbl_gistkey;
|
||||
RESET client_min_messages;
|
||||
|
Reference in New Issue
Block a user