Use quoted column names in targetlist of subquery substituting modified table (#135)
Fix a bug introduced by 5b8b2f0, which built targetlist of subquery substituting
modified table. When a table has a column whose name includes a capital letter,
incremental view maintenance failed because crafted targetlist contains incorrect
column name which was parsed as lower case.
Isseu #124
This commit is contained in:
parent
7966a92b8e
commit
3f33229efe
3 changed files with 24 additions and 1 deletions
|
|
@ -81,6 +81,21 @@ SELECT * FROM mv_ivm_1 ORDER BY 1,2,3;
|
|||
4 | 40 | 104
|
||||
(4 rows)
|
||||
|
||||
-- test for renaming column name to camel style
|
||||
BEGIN;
|
||||
ALTER TABLE mv_base_a RENAME i TO "I";
|
||||
ALTER TABLE mv_base_a RENAME j TO "J";
|
||||
UPDATE mv_base_a SET "J" = 0 WHERE "I" = 1;
|
||||
SELECT * FROM mv_ivm_1 ORDER BY 1,2,3;
|
||||
i | j | k
|
||||
---+----+-----
|
||||
1 | 0 | 101
|
||||
2 | 20 | 102
|
||||
3 | 30 | 103
|
||||
4 | 40 | 104
|
||||
(4 rows)
|
||||
|
||||
ROLLBACK;
|
||||
-- TRUNCATE a base table in join views
|
||||
BEGIN;
|
||||
TRUNCATE mv_base_a;
|
||||
|
|
|
|||
|
|
@ -1612,7 +1612,7 @@ make_subquery_targetlist_from_table(MV_TriggerTable *table)
|
|||
if (attr->attisdropped)
|
||||
appendStringInfo(&str, "null");
|
||||
else
|
||||
appendStringInfo(&str, "%s", NameStr(attr->attname));
|
||||
appendStringInfo(&str, "%s", quote_identifier(NameStr(attr->attname)));
|
||||
}
|
||||
|
||||
return str.data;
|
||||
|
|
|
|||
|
|
@ -37,6 +37,14 @@ SELECT * FROM mv_ivm_1 ORDER BY 1,2,3;
|
|||
ROLLBACK;
|
||||
SELECT * FROM mv_ivm_1 ORDER BY 1,2,3;
|
||||
|
||||
-- test for renaming column name to camel style
|
||||
BEGIN;
|
||||
ALTER TABLE mv_base_a RENAME i TO "I";
|
||||
ALTER TABLE mv_base_a RENAME j TO "J";
|
||||
UPDATE mv_base_a SET "J" = 0 WHERE "I" = 1;
|
||||
SELECT * FROM mv_ivm_1 ORDER BY 1,2,3;
|
||||
ROLLBACK;
|
||||
|
||||
-- TRUNCATE a base table in join views
|
||||
BEGIN;
|
||||
TRUNCATE mv_base_a;
|
||||
|
|
|
|||
Loading…
Reference in a new issue