Test, sql changes for insert_conflict
authorPallavi Sontakke <[email protected]>
Mon, 11 Jan 2016 10:21:28 +0000 (15:51 +0530)
committerPallavi Sontakke <[email protected]>
Mon, 11 Jan 2016 10:21:28 +0000 (15:51 +0530)
Accept ERROR for unique index on non-distribution column.
Remove tableoid call, with bug reference.

src/test/regress/expected/insert_conflict.out
src/test/regress/sql/insert_conflict.sql

index 40893a44a369af81d101beaf800748905f92a7e7..ed52c05e06d20cbeab87c528d0fa07d075906ded 100644 (file)
@@ -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:
@@ -522,14 +524,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;
@@ -544,28 +548,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
index 8d846f51df4ae2873c832f1a33f1bd2873fc4582..e29e6aecc58c98025a373a48cceff817850a24aa 100644 (file)
@@ -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:
@@ -301,16 +303,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;