mirror of
https://github.com/postgres/postgres.git
synced 2025-09-09 13:09:39 +03:00
Add a couple of regression test cases related to array subscripting.
Exercise some error cases that were never reached in the existing regression tests. This is partly for code-coverage reasons, and partly to memorialize the current behavior in advance of planned changes for generic subscripting. Also, I noticed that type_sanity's check to verify that all standard types have array types was never extended when we added arrays for all system catalog rowtypes (f7f70d5e2
), nor when we added arrays over domain types (c12d570fa
). So do that. Also, since the query's expected output isn't empty, it seems like a good idea to add an ORDER BY to make sure the result stays stable.
This commit is contained in:
@@ -34,6 +34,9 @@ INSERT INTO arrtest (a, b[1:2][1:2], c, d, e, f, g)
|
||||
INSERT INTO arrtest (a, b[1:2], c, d[1:2])
|
||||
VALUES ('{}', '{3,4}', '{foo,bar}', '{bar,foo}');
|
||||
|
||||
INSERT INTO arrtest (b[2]) VALUES(now()); -- error, type mismatch
|
||||
|
||||
INSERT INTO arrtest (b[1:2]) VALUES(now()); -- error, type mismatch
|
||||
|
||||
SELECT * FROM arrtest;
|
||||
|
||||
@@ -122,6 +125,8 @@ UPDATE arrtest
|
||||
UPDATE arrtest
|
||||
SET c[1:NULL] = '{"can''t assign"}'
|
||||
WHERE array_dims(c) is not null;
|
||||
-- Un-subscriptable type
|
||||
SELECT (now())[1];
|
||||
|
||||
-- test slices with empty lower and/or upper index
|
||||
CREATE TEMP TABLE arrtest_s (
|
||||
|
Reference in New Issue
Block a user