oom.td 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. # Copyright Materialize, Inc. and contributors. All rights reserved.
  2. #
  3. # Use of this software is governed by the Business Source License
  4. # included in the LICENSE file at the root of this repository.
  5. #
  6. # As of the Change Date specified in that file, in accordance with
  7. # the Business Source License, use of this software will be governed
  8. # by the Apache License, Version 2.0.
  9. # Test that we generate errors instead of crashing due to out of memory issues
  10. $ postgres-connect name=mz_system url=postgres://mz_system:materialize@${testdrive.materialize-internal-sql-addr}
  11. $ postgres-execute connection=mz_system
  12. ALTER SYSTEM SET max_result_size = '1MB'
  13. # In environmentd each Row requires 24 bytes + number of bytes to encode. But we'll also de-dupe
  14. # repeated values by incrementing the diff.
  15. > SELECT 1::int4 FROM generate_series(1, 10000), repeat('a', 100);
  16. 10000 values hashing to b223cca8b360eae4e49568512e2de29f
  17. ! SELECT * FROM generate_series(1, 10000), repeat('a', 100);
  18. contains:result exceeds max size of 1048.6 KB
  19. > CREATE TABLE t1 (a int4, b text)
  20. > INSERT INTO t1 SELECT * FROM generate_series(1, 10000), repeat('a', 100);
  21. ! SELECT * FROM t1
  22. contains:result exceeds max size of 1048.6 KB
  23. ! INSERT INTO t1 SELECT * FROM t1;
  24. contains:result exceeds max size of 1048.6 KB
  25. > INSERT INTO t1 SELECT * FROM generate_series(1, 100), repeat('a', 100);
  26. > BEGIN
  27. > DECLARE c CURSOR FOR SUBSCRIBE t1;
  28. # No output should be produced. Instead an error .. notice?
  29. ! FETCH 1 c;
  30. contains:result exceeds max size of 1048.6 KB
  31. > ROLLBACK;
  32. # Constants with less than or equal to 10,000 rows will be evaluated in environmentd. Anything in excess of this will
  33. # be sent to computed to be executed. Therefore, we need to set the number of rows high enough such that it will be evaluated by
  34. # computed to test the computed side of things.
  35. > SELECT generate_series::int4 FROM generate_series(1, 4);
  36. 1
  37. 2
  38. 3
  39. 4
  40. ! SELECT * FROM generate_series(1, 10001), repeat('a', 100)
  41. contains:result exceeds max size of 1048.6 KB
  42. > SELECT 1::int4 FROM generate_series(1, 10001)
  43. 10001 values hashing to 7e844fba503f0b3f02daa3de7c80938e
  44. > CREATE TABLE t2 (a int4, b text)
  45. ! INSERT INTO t2 SELECT * FROM generate_series(1, 10001), repeat('a', 100);
  46. contains:result exceeds max size of 1048.6 KB
  47. > INSERT INTO t2 SELECT * FROM generate_series(1, 5000), repeat('a', 100);
  48. > INSERT INTO t2 SELECT * FROM generate_series(5001, 10000), repeat('a', 100);
  49. ! SELECT * FROM t2
  50. contains:result exceeds max size of 1048.6 KB
  51. ! INSERT INTO t2 SELECT * FROM t2;
  52. contains:result exceeds max size of 1048.6 KB
  53. $ postgres-execute connection=mz_system
  54. ALTER SYSTEM RESET max_result_size
  55. ! SELECT csv_extract(9223372036854775807, '');
  56. contains:attempt to create relation with too many columns, 9223372036854775807 max: 8192