summaryrefslogtreecommitdiff
path: root/src/test/regress/sql
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2004-06-09 19:08:20 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2004-06-09 19:08:20 +0000
commit7e64dbc6b5e516a2510ae41c8c7999d1d8d25872 (patch)
treec819b78903b490e720b4c20969ed6cf8816889d1 /src/test/regress/sql
parent3a0df651da253879bf133a8556853acfb1f664fd (diff)
downloadpostgresql-7e64dbc6b5e516a2510ae41c8c7999d1d8d25872.tar.gz
Support assignment to subfields of composite columns in UPDATE and INSERT.
As a side effect, cause subscripts in INSERT targetlists to do something more or less sensible; previously we evaluated such subscripts and then effectively ignored them. Another side effect is that UPDATE-ing an element or slice of an array value that is NULL now produces a non-null result, namely an array containing just the assigned-to positions.
Diffstat (limited to 'src/test/regress/sql')
-rw-r--r--src/test/regress/sql/arrays.sql9
-rw-r--r--src/test/regress/sql/rowtypes.sql9
2 files changed, 9 insertions, 9 deletions
diff --git a/src/test/regress/sql/arrays.sql b/src/test/regress/sql/arrays.sql
index 629ca15fb1..97cb5bbc07 100644
--- a/src/test/regress/sql/arrays.sql
+++ b/src/test/regress/sql/arrays.sql
@@ -13,11 +13,10 @@ CREATE TABLE arrtest (
);
--
--- only this array as a 0-based 'e', the others are 1-based.
--- 'e' is also a large object.
+-- only the 'e' array is 0-based, the others are 1-based.
--
-INSERT INTO arrtest (a[5], b[2][1][2], c, d, f, g)
+INSERT INTO arrtest (a[1:5], b[1:1][1:2][1:2], c, d, f, g)
VALUES ('{1,2,3,4,5}', '{{{0,0},{1,2}}}', '{}', '{}', '{}', '{}');
UPDATE arrtest SET e[0] = '1.1';
@@ -27,12 +26,12 @@ UPDATE arrtest SET e[1] = '2.2';
INSERT INTO arrtest (f)
VALUES ('{"too long"}');
-INSERT INTO arrtest (a, b[2][2][1], c, d, e, f, g)
+INSERT INTO arrtest (a, b[1:2][1:2], c, d, e, f, g)
VALUES ('{11,12,23}', '{{3,4},{4,5}}', '{"foobar"}',
'{{"elt1", "elt2"}}', '{"3.4", "6.7"}',
'{"abc","abcde"}', '{"abc","abcde"}');
-INSERT INTO arrtest (a, b[1][2][2], c, d[2][1])
+INSERT INTO arrtest (a, b[1:2], c, d[1:2])
VALUES ('{}', '{3,4}', '{foo,bar}', '{bar,foo}');
diff --git a/src/test/regress/sql/rowtypes.sql b/src/test/regress/sql/rowtypes.sql
index 809cad8f32..e53197c05b 100644
--- a/src/test/regress/sql/rowtypes.sql
+++ b/src/test/regress/sql/rowtypes.sql
@@ -53,14 +53,15 @@ alter table fullname add column suffix text default null;
select * from people;
--- This fails at the moment, would like it to work though:
+-- test insertion/updating of subfields
update people set fn.suffix = 'Jr';
--- ugly workaround:
-update people set fn = ((fn).first, (fn).last, 'III');
-
select * from people;
+insert into quadtable (f1, q.c1.r, q.c2.i) values(44,55,66);
+
+select * from quadtable;
+
-- The object here is to ensure that toasted references inside
-- composite values don't cause problems. The large f1 value will
-- be toasted inside pp, it must still work after being copied to people.