Fix a bug that pg_reorg cannot parse index definitions with reserved named columns,

i.e, it failed to parse quoted column names. (bug #1010828)
This commit is contained in:
Takahiro Itagaki
2010-06-14 05:11:26 +00:00
parent 79757ccb62
commit 67a5d7b786
4 changed files with 24 additions and 63 deletions

View File

@ -4,11 +4,11 @@ SET client_min_messages = warning;
--
CREATE TABLE tbl_cluster (
col1 int,
col2 timestamp,
"time" timestamp,
","")" text,
PRIMARY KEY (","")", col1) WITH (fillfactor = 75)
) WITH (fillfactor = 70);
CREATE INDEX ","") cluster" ON tbl_cluster (col2, length(","")"), ","")" text_pattern_ops) WITH (fillfactor = 75);
CREATE INDEX ","") cluster" ON tbl_cluster ("time", length(","")"), ","")" text_pattern_ops) WITH (fillfactor = 75);
ALTER TABLE tbl_cluster CLUSTER ON ","") cluster";
CREATE TABLE tbl_only_pkey (
col1 int PRIMARY KEY,
@ -100,11 +100,11 @@ SELECT * FROM tbl_with_dropped_toast;
Column | Type | Modifiers
--------+-----------------------------+-----------
col1 | integer | not null
col2 | timestamp without time zone |
time | timestamp without time zone |
,") | text | not null
Indexes:
"tbl_cluster_pkey" PRIMARY KEY, btree (","")", col1) WITH (fillfactor=75)
",") cluster" btree (col2, length(","")"), ","")" text_pattern_ops) WITH (fillfactor=75) CLUSTER
",") cluster" btree ("time", length(","")"), ","")" text_pattern_ops) WITH (fillfactor=75) CLUSTER
\d tbl_gistkey
Table "public.tbl_gistkey"
@ -157,7 +157,7 @@ Table "public.tbl_with_dropped_toast"
Indexes:
"tbl_with_dropped_toast_pkey" PRIMARY KEY, btree (i, j) CLUSTER
SELECT col1, to_char(col2, 'YYYY-MM-DD HH24:MI:SS'), ","")" FROM tbl_cluster;
SELECT col1, to_char("time", 'YYYY-MM-DD HH24:MI:SS'), ","")" FROM tbl_cluster;
col1 | to_char | ,")
------+---------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
2 | 2008-01-01 00:00:00 | king
@ -222,12 +222,3 @@ SELECT oid, relname
-----+---------
(0 rows)
--
-- clean up
--
DROP TABLE tbl_cluster;
DROP TABLE tbl_only_pkey;
DROP TABLE tbl_only_ckey;
DROP TABLE tbl_gistkey;
DROP TABLE tbl_with_dropped_column;
RESET client_min_messages;

View File

@ -4,12 +4,12 @@ SET client_min_messages = warning;
--
CREATE TABLE tbl_cluster (
col1 int,
col2 timestamp,
"time" timestamp,
","")" text,
PRIMARY KEY (","")", col1) WITH (fillfactor = 75)
) WITH (fillfactor = 70);
CREATE INDEX ","") cluster" ON tbl_cluster (col2, length(","")"), ","")" text_pattern_ops) WITH (fillfactor = 75);
CREATE INDEX ","") cluster" ON tbl_cluster ("time", length(","")"), ","")" text_pattern_ops) WITH (fillfactor = 75);
ALTER TABLE tbl_cluster CLUSTER ON ","") cluster";
CREATE TABLE tbl_only_pkey (
@ -110,7 +110,7 @@ SELECT * FROM tbl_with_dropped_toast;
\d tbl_with_dropped_column
\d tbl_with_dropped_toast
SELECT col1, to_char(col2, 'YYYY-MM-DD HH24:MI:SS'), ","")" FROM tbl_cluster;
SELECT col1, to_char("time", 'YYYY-MM-DD HH24:MI:SS'), ","")" FROM tbl_cluster;
SELECT * FROM tbl_only_ckey ORDER BY 1;
SELECT * FROM tbl_only_pkey ORDER BY 1;
SELECT * FROM tbl_gistkey ORDER BY 1;
@ -130,14 +130,3 @@ SELECT oid, relname
WHERE relkind = 'r'
AND reltoastrelid <> 0
AND reltoastrelid NOT IN (SELECT oid FROM pg_class WHERE relkind = 't');
--
-- clean up
--
DROP TABLE tbl_cluster;
DROP TABLE tbl_only_pkey;
DROP TABLE tbl_only_ckey;
DROP TABLE tbl_gistkey;
DROP TABLE tbl_with_dropped_column;
RESET client_min_messages;