fetch-tail-as-of.td 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  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. #
  10. # Make sure that the AS OF is observed for SUBSCRIBE
  11. #
  12. $ set-regex match=\d{13} replacement=<TIMESTAMP>
  13. > CREATE TABLE t1 (f1 INTEGER);
  14. > CREATE DEFAULT INDEX ON t1
  15. > INSERT INTO t1 VALUES (123);
  16. > BEGIN
  17. > DECLARE c CURSOR FOR SUBSCRIBE t1 AS OF -1;
  18. ! FETCH 1 c;
  19. contains:out of range integral type conversion attempted
  20. > COMMIT
  21. # Since FETCH isn't idempotent and can't be correctly retried by testdrive
  22. # (although testdrive will try), wait until SELECT fails with this error
  23. # (which will happen after t has been compacted) and then we should be
  24. # able to see the same failure with FETCH.
  25. ! SELECT * FROM t1 AS OF 0
  26. contains:Timestamp (0) is not valid for all inputs
  27. > BEGIN
  28. > DECLARE c CURSOR FOR SUBSCRIBE t1 AS OF 0;
  29. ! FETCH 1 c;
  30. contains:Timestamp (0) is not valid for all inputs
  31. > COMMIT
  32. > BEGIN
  33. > DECLARE c CURSOR FOR SUBSCRIBE t1 AS OF AT LEAST 0;
  34. > FETCH 1 c;
  35. <TIMESTAMP> 1 123
  36. > COMMIT
  37. > BEGIN
  38. > DECLARE c CURSOR FOR SUBSCRIBE t1 AS OF 18446744073709551615;
  39. # No rows expected
  40. > FETCH 1 c WITH (timeout = '1s');