summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPallavi Sontakke2016-01-11 10:21:28 +0000
committerPavan Deolasee2016-10-18 09:36:39 +0000
commitc139805ebed5a020019653626da46d752d0411f4 (patch)
tree8016e570d61d78bfc5176f2071ce2a412aa4f35e
parent6071db47bb53c202077a2f67082e44e61e7321ee (diff)
Test, sql changes for insert_conflict
Accept ERROR for unique index on non-distribution column. Remove tableoid call, with bug reference.
-rw-r--r--src/test/regress/expected/insert_conflict.out56
-rw-r--r--src/test/regress/sql/insert_conflict.sql10
2 files changed, 37 insertions, 29 deletions
diff --git a/src/test/regress/expected/insert_conflict.out b/src/test/regress/expected/insert_conflict.out
index 4ddd54ab38..5b6cb40e2e 100644
--- a/src/test/regress/expected/insert_conflict.out
+++ b/src/test/regress/expected/insert_conflict.out
@@ -152,6 +152,8 @@ drop index both_index_expr_key;
--
-- Make sure that cross matching of attribute opclass/collation does not occur
--
+-- In XL, table is distributed by HASH( key ) by default.
+-- unique index contains fruit and not key, so this fails.
create unique index cross_match on insertconflicttest(lower(fruit) collate "C", upper(fruit) text_pattern_ops);
ERROR: Unique index of partitioned table must contain the hash/modulo distribution column.
-- fails:
@@ -507,14 +509,16 @@ select * from capitals;
(2 rows)
insert into cities values ('Las Vegas', 5.83E+5, 2001) on conflict (name) do update set population = excluded.population, altitude = excluded.altitude;
-select tableoid::regclass, * from cities;
- tableoid | name | population | altitude
-----------+---------------+------------+----------
- 58082 | San Francisco | 724000 | 63
- 58082 | Mariposa | 1200 | 1953
- 58082 | Las Vegas | 583000 | 2001
- 58490 | Madison | 191300 | 845
- 58088 | Sacramento | 466400000 | 30
+-- tableoid::regclass is not mapped to relation name in XL
+-- bug #4
+select * from cities;
+ name | population | altitude
+---------------+------------+----------
+ San Francisco | 724000 | 63
+ Mariposa | 1200 | 1953
+ Las Vegas | 583000 | 2001
+ Madison | 191300 | 845
+ Sacramento | 466400000 | 30
(5 rows)
insert into capitals values ('Las Vegas', 5.83E+5, 2222, 'NV') on conflict (name) do update set population = excluded.population;
@@ -529,28 +533,28 @@ select * from capitals;
-- Cities contains two instances of "Las Vegas", since unique constraints don't
-- work across inheritance:
-select tableoid::regclass, * from cities;
- tableoid | name | population | altitude
-----------+---------------+------------+----------
- 58082 | San Francisco | 724000 | 63
- 58082 | Mariposa | 1200 | 1953
- 58082 | Las Vegas | 583000 | 2001
- 58490 | Madison | 191300 | 845
- 58088 | Sacramento | 466400000 | 30
- 58088 | Las Vegas | 583000 | 2222
+select * from cities;
+ name | population | altitude
+---------------+------------+----------
+ San Francisco | 724000 | 63
+ Mariposa | 1200 | 1953
+ Las Vegas | 583000 | 2001
+ Madison | 191300 | 845
+ Sacramento | 466400000 | 30
+ Las Vegas | 583000 | 2222
(6 rows)
-- This only affects "cities" version of "Las Vegas":
insert into cities values ('Las Vegas', 5.86E+5, 2223) on conflict (name) do update set population = excluded.population, altitude = excluded.altitude;
-select tableoid::regclass, * from cities;
- tableoid | name | population | altitude
-----------+---------------+------------+----------
- 58082 | San Francisco | 724000 | 63
- 58082 | Mariposa | 1200 | 1953
- 58082 | Las Vegas | 586000 | 2223
- 58490 | Madison | 191300 | 845
- 58088 | Sacramento | 466400000 | 30
- 58088 | Las Vegas | 583000 | 2222
+select * from cities;
+ name | population | altitude
+---------------+------------+----------
+ San Francisco | 724000 | 63
+ Mariposa | 1200 | 1953
+ Las Vegas | 586000 | 2223
+ Madison | 191300 | 845
+ Sacramento | 466400000 | 30
+ Las Vegas | 583000 | 2222
(6 rows)
-- clean up
diff --git a/src/test/regress/sql/insert_conflict.sql b/src/test/regress/sql/insert_conflict.sql
index 48dd38983e..7c2edbc72c 100644
--- a/src/test/regress/sql/insert_conflict.sql
+++ b/src/test/regress/sql/insert_conflict.sql
@@ -60,6 +60,8 @@ drop index both_index_expr_key;
--
-- Make sure that cross matching of attribute opclass/collation does not occur
--
+-- In XL, table is distributed by HASH( key ) by default.
+-- unique index contains fruit and not key, so this fails.
create unique index cross_match on insertconflicttest(lower(fruit) collate "C", upper(fruit) text_pattern_ops);
-- fails:
@@ -266,16 +268,18 @@ insert into capitals values ('Sacramento', 4664.E+5, 30, 'CA') on conflict (name
insert into capitals values ('Sacramento', 50, 2267, 'NE') on conflict (name) do nothing;
select * from capitals;
insert into cities values ('Las Vegas', 5.83E+5, 2001) on conflict (name) do update set population = excluded.population, altitude = excluded.altitude;
-select tableoid::regclass, * from cities;
+-- tableoid::regclass is not mapped to relation name in XL
+-- bug #4
+select * from cities;
insert into capitals values ('Las Vegas', 5.83E+5, 2222, 'NV') on conflict (name) do update set population = excluded.population;
-- Capitals will contain new capital, Las Vegas:
select * from capitals;
-- Cities contains two instances of "Las Vegas", since unique constraints don't
-- work across inheritance:
-select tableoid::regclass, * from cities;
+select * from cities;
-- This only affects "cities" version of "Las Vegas":
insert into cities values ('Las Vegas', 5.86E+5, 2223) on conflict (name) do update set population = excluded.population, altitude = excluded.altitude;
-select tableoid::regclass, * from cities;
+select * from cities;
-- clean up
drop table capitals;