timetz.err 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391
  1. <sql-statement>
  2. --
  3. -- TIMETZ
  4. --
  5. CREATE TABLE TIMETZ_TBL (f1 time(2) with time zone);
  6. </sql-statement>
  7. <sql-statement>
  8. INSERT INTO TIMETZ_TBL VALUES ('00:01 PDT');
  9. </sql-statement>
  10. -stdin-:<main>: Fatal: Execution
  11. -stdin-:<main>:1:1: Fatal: Execution of node: YtFill!
  12. INSERT INTO TIMETZ_TBL VALUES ('00:01 PDT');
  13. ^
  14. -stdin-:<main>:1:1: Fatal: ERROR: invalid input syntax for type time with time zone: "00:01 PDT"
  15. INSERT INTO TIMETZ_TBL VALUES ('00:01 PDT');
  16. ^
  17. <sql-statement>
  18. INSERT INTO TIMETZ_TBL VALUES ('01:00 PDT');
  19. </sql-statement>
  20. -stdin-:<main>: Fatal: Execution
  21. -stdin-:<main>:1:1: Fatal: Execution of node: YtFill!
  22. INSERT INTO TIMETZ_TBL VALUES ('01:00 PDT');
  23. ^
  24. -stdin-:<main>:1:1: Fatal: ERROR: invalid input syntax for type time with time zone: "01:00 PDT"
  25. INSERT INTO TIMETZ_TBL VALUES ('01:00 PDT');
  26. ^
  27. <sql-statement>
  28. INSERT INTO TIMETZ_TBL VALUES ('02:03 PDT');
  29. </sql-statement>
  30. -stdin-:<main>: Fatal: Execution
  31. -stdin-:<main>:1:1: Fatal: Execution of node: YtFill!
  32. INSERT INTO TIMETZ_TBL VALUES ('02:03 PDT');
  33. ^
  34. -stdin-:<main>:1:1: Fatal: ERROR: invalid input syntax for type time with time zone: "02:03 PDT"
  35. INSERT INTO TIMETZ_TBL VALUES ('02:03 PDT');
  36. ^
  37. <sql-statement>
  38. INSERT INTO TIMETZ_TBL VALUES ('07:07 PST');
  39. </sql-statement>
  40. -stdin-:<main>: Fatal: Execution
  41. -stdin-:<main>:1:1: Fatal: Execution of node: YtFill!
  42. INSERT INTO TIMETZ_TBL VALUES ('07:07 PST');
  43. ^
  44. -stdin-:<main>:1:1: Fatal: ERROR: invalid input syntax for type time with time zone: "07:07 PST"
  45. INSERT INTO TIMETZ_TBL VALUES ('07:07 PST');
  46. ^
  47. <sql-statement>
  48. INSERT INTO TIMETZ_TBL VALUES ('08:08 EDT');
  49. </sql-statement>
  50. -stdin-:<main>: Fatal: Execution
  51. -stdin-:<main>:1:1: Fatal: Execution of node: YtFill!
  52. INSERT INTO TIMETZ_TBL VALUES ('08:08 EDT');
  53. ^
  54. -stdin-:<main>:1:1: Fatal: ERROR: invalid input syntax for type time with time zone: "08:08 EDT"
  55. INSERT INTO TIMETZ_TBL VALUES ('08:08 EDT');
  56. ^
  57. <sql-statement>
  58. INSERT INTO TIMETZ_TBL VALUES ('11:59 PDT');
  59. </sql-statement>
  60. -stdin-:<main>: Fatal: Execution
  61. -stdin-:<main>:1:1: Fatal: Execution of node: YtFill!
  62. INSERT INTO TIMETZ_TBL VALUES ('11:59 PDT');
  63. ^
  64. -stdin-:<main>:1:1: Fatal: ERROR: invalid input syntax for type time with time zone: "11:59 PDT"
  65. INSERT INTO TIMETZ_TBL VALUES ('11:59 PDT');
  66. ^
  67. <sql-statement>
  68. INSERT INTO TIMETZ_TBL VALUES ('12:00 PDT');
  69. </sql-statement>
  70. -stdin-:<main>: Fatal: Execution
  71. -stdin-:<main>:1:1: Fatal: Execution of node: YtFill!
  72. INSERT INTO TIMETZ_TBL VALUES ('12:00 PDT');
  73. ^
  74. -stdin-:<main>:1:1: Fatal: ERROR: invalid input syntax for type time with time zone: "12:00 PDT"
  75. INSERT INTO TIMETZ_TBL VALUES ('12:00 PDT');
  76. ^
  77. <sql-statement>
  78. INSERT INTO TIMETZ_TBL VALUES ('12:01 PDT');
  79. </sql-statement>
  80. -stdin-:<main>: Fatal: Execution
  81. -stdin-:<main>:1:1: Fatal: Execution of node: YtFill!
  82. INSERT INTO TIMETZ_TBL VALUES ('12:01 PDT');
  83. ^
  84. -stdin-:<main>:1:1: Fatal: ERROR: invalid input syntax for type time with time zone: "12:01 PDT"
  85. INSERT INTO TIMETZ_TBL VALUES ('12:01 PDT');
  86. ^
  87. <sql-statement>
  88. INSERT INTO TIMETZ_TBL VALUES ('23:59 PDT');
  89. </sql-statement>
  90. -stdin-:<main>: Fatal: Execution
  91. -stdin-:<main>:1:1: Fatal: Execution of node: YtFill!
  92. INSERT INTO TIMETZ_TBL VALUES ('23:59 PDT');
  93. ^
  94. -stdin-:<main>:1:1: Fatal: ERROR: invalid input syntax for type time with time zone: "23:59 PDT"
  95. INSERT INTO TIMETZ_TBL VALUES ('23:59 PDT');
  96. ^
  97. <sql-statement>
  98. INSERT INTO TIMETZ_TBL VALUES ('11:59:59.99 PM PDT');
  99. </sql-statement>
  100. -stdin-:<main>: Fatal: Execution
  101. -stdin-:<main>:1:1: Fatal: Execution of node: YtFill!
  102. INSERT INTO TIMETZ_TBL VALUES ('11:59:59.99 PM PDT');
  103. ^
  104. -stdin-:<main>:1:1: Fatal: ERROR: invalid input syntax for type time with time zone: "11:59:59.99 PM PDT"
  105. INSERT INTO TIMETZ_TBL VALUES ('11:59:59.99 PM PDT');
  106. ^
  107. <sql-statement>
  108. INSERT INTO TIMETZ_TBL VALUES ('2003-03-07 15:36:39 America/New_York');
  109. </sql-statement>
  110. -stdin-:<main>: Fatal: Execution
  111. -stdin-:<main>:1:1: Fatal: Execution of node: YtFill!
  112. INSERT INTO TIMETZ_TBL VALUES ('2003-03-07 15:36:39 America/New_York');
  113. ^
  114. -stdin-:<main>:1:1: Fatal: ERROR: time zone "america/new_york" not recognized
  115. INSERT INTO TIMETZ_TBL VALUES ('2003-03-07 15:36:39 America/New_York');
  116. ^
  117. <sql-statement>
  118. INSERT INTO TIMETZ_TBL VALUES ('2003-07-07 15:36:39 America/New_York');
  119. </sql-statement>
  120. -stdin-:<main>: Fatal: Execution
  121. -stdin-:<main>:1:1: Fatal: Execution of node: YtFill!
  122. INSERT INTO TIMETZ_TBL VALUES ('2003-07-07 15:36:39 America/New_York');
  123. ^
  124. -stdin-:<main>:1:1: Fatal: ERROR: time zone "america/new_york" not recognized
  125. INSERT INTO TIMETZ_TBL VALUES ('2003-07-07 15:36:39 America/New_York');
  126. ^
  127. <sql-statement>
  128. -- this should fail (the timezone offset is not known)
  129. INSERT INTO TIMETZ_TBL VALUES ('15:36:39 America/New_York');
  130. </sql-statement>
  131. -stdin-:<main>: Fatal: Execution
  132. -stdin-:<main>:1:1: Fatal: Execution of node: YtFill!
  133. -- this should fail (the timezone offset is not known)
  134. ^
  135. -stdin-:<main>:1:1: Fatal: ERROR: time zone "america/new_york" not recognized
  136. -- this should fail (the timezone offset is not known)
  137. ^
  138. <sql-statement>
  139. -- this should fail (timezone not specified without a date)
  140. INSERT INTO TIMETZ_TBL VALUES ('15:36:39 m2');
  141. </sql-statement>
  142. -stdin-:<main>: Fatal: Execution
  143. -stdin-:<main>:1:1: Fatal: Execution of node: YtFill!
  144. -- this should fail (timezone not specified without a date)
  145. ^
  146. -stdin-:<main>:1:1: Fatal: ERROR: invalid input syntax for type time with time zone: "15:36:39 m2"
  147. -- this should fail (timezone not specified without a date)
  148. ^
  149. <sql-statement>
  150. -- this should fail (dynamic timezone abbreviation without a date)
  151. INSERT INTO TIMETZ_TBL VALUES ('15:36:39 MSK m2');
  152. </sql-statement>
  153. -stdin-:<main>: Fatal: Execution
  154. -stdin-:<main>:1:1: Fatal: Execution of node: YtFill!
  155. -- this should fail (dynamic timezone abbreviation without a date)
  156. ^
  157. -stdin-:<main>:1:1: Fatal: ERROR: invalid input syntax for type time with time zone: "15:36:39 MSK m2"
  158. -- this should fail (dynamic timezone abbreviation without a date)
  159. ^
  160. <sql-statement>
  161. SELECT f1 AS "Time TZ" FROM TIMETZ_TBL;
  162. </sql-statement>
  163. <sql-statement>
  164. SELECT f1 AS "Three" FROM TIMETZ_TBL WHERE f1 < '05:06:07-07';
  165. </sql-statement>
  166. <sql-statement>
  167. SELECT f1 AS "Seven" FROM TIMETZ_TBL WHERE f1 > '05:06:07-07';
  168. </sql-statement>
  169. <sql-statement>
  170. SELECT f1 AS "None" FROM TIMETZ_TBL WHERE f1 < '00:00-07';
  171. </sql-statement>
  172. <sql-statement>
  173. SELECT f1 AS "Ten" FROM TIMETZ_TBL WHERE f1 >= '00:00-07';
  174. </sql-statement>
  175. <sql-statement>
  176. -- Check edge cases
  177. SELECT '23:59:59.999999 PDT'::timetz;
  178. </sql-statement>
  179. -stdin-:<main>: Fatal: Execution
  180. -stdin-:<main>:1:1: Fatal: Execution of node: Result
  181. -- Check edge cases
  182. ^
  183. -stdin-:<main>:1:1: Fatal: ERROR: invalid input syntax for type time with time zone: "23:59:59.999999 PDT"
  184. -- Check edge cases
  185. ^
  186. <sql-statement>
  187. SELECT '23:59:59.9999999 PDT'::timetz; -- rounds up
  188. </sql-statement>
  189. -stdin-:<main>: Fatal: Execution
  190. -stdin-:<main>:1:1: Fatal: Execution of node: Result
  191. SELECT '23:59:59.9999999 PDT'::timetz; -- rounds up
  192. ^
  193. -stdin-:<main>:1:1: Fatal: ERROR: invalid input syntax for type time with time zone: "23:59:59.9999999 PDT"
  194. SELECT '23:59:59.9999999 PDT'::timetz; -- rounds up
  195. ^
  196. <sql-statement>
  197. SELECT '23:59:60 PDT'::timetz; -- rounds up
  198. </sql-statement>
  199. -stdin-:<main>: Fatal: Execution
  200. -stdin-:<main>:1:1: Fatal: Execution of node: Result
  201. SELECT '23:59:60 PDT'::timetz; -- rounds up
  202. ^
  203. -stdin-:<main>:1:1: Fatal: ERROR: invalid input syntax for type time with time zone: "23:59:60 PDT"
  204. SELECT '23:59:60 PDT'::timetz; -- rounds up
  205. ^
  206. <sql-statement>
  207. SELECT '24:00:00 PDT'::timetz; -- allowed
  208. </sql-statement>
  209. -stdin-:<main>: Fatal: Execution
  210. -stdin-:<main>:1:1: Fatal: Execution of node: Result
  211. SELECT '24:00:00 PDT'::timetz; -- allowed
  212. ^
  213. -stdin-:<main>:1:1: Fatal: ERROR: invalid input syntax for type time with time zone: "24:00:00 PDT"
  214. SELECT '24:00:00 PDT'::timetz; -- allowed
  215. ^
  216. <sql-statement>
  217. SELECT '24:00:00.01 PDT'::timetz; -- not allowed
  218. </sql-statement>
  219. -stdin-:<main>: Fatal: Execution
  220. -stdin-:<main>:1:1: Fatal: Execution of node: Result
  221. SELECT '24:00:00.01 PDT'::timetz; -- not allowed
  222. ^
  223. -stdin-:<main>:1:1: Fatal: ERROR: invalid input syntax for type time with time zone: "24:00:00.01 PDT"
  224. SELECT '24:00:00.01 PDT'::timetz; -- not allowed
  225. ^
  226. <sql-statement>
  227. SELECT '23:59:60.01 PDT'::timetz; -- not allowed
  228. </sql-statement>
  229. -stdin-:<main>: Fatal: Execution
  230. -stdin-:<main>:1:1: Fatal: Execution of node: Result
  231. SELECT '23:59:60.01 PDT'::timetz; -- not allowed
  232. ^
  233. -stdin-:<main>:1:1: Fatal: ERROR: invalid input syntax for type time with time zone: "23:59:60.01 PDT"
  234. SELECT '23:59:60.01 PDT'::timetz; -- not allowed
  235. ^
  236. <sql-statement>
  237. SELECT '24:01:00 PDT'::timetz; -- not allowed
  238. </sql-statement>
  239. -stdin-:<main>: Fatal: Execution
  240. -stdin-:<main>:1:1: Fatal: Execution of node: Result
  241. SELECT '24:01:00 PDT'::timetz; -- not allowed
  242. ^
  243. -stdin-:<main>:1:1: Fatal: ERROR: invalid input syntax for type time with time zone: "24:01:00 PDT"
  244. SELECT '24:01:00 PDT'::timetz; -- not allowed
  245. ^
  246. <sql-statement>
  247. SELECT '25:00:00 PDT'::timetz; -- not allowed
  248. </sql-statement>
  249. -stdin-:<main>: Fatal: Execution
  250. -stdin-:<main>:1:1: Fatal: Execution of node: Result
  251. SELECT '25:00:00 PDT'::timetz; -- not allowed
  252. ^
  253. -stdin-:<main>:1:1: Fatal: ERROR: invalid input syntax for type time with time zone: "25:00:00 PDT"
  254. SELECT '25:00:00 PDT'::timetz; -- not allowed
  255. ^
  256. <sql-statement>
  257. --
  258. -- TIME simple math
  259. --
  260. -- We now make a distinction between time and intervals,
  261. -- and adding two times together makes no sense at all.
  262. -- Leave in one query to show that it is rejected,
  263. -- and do the rest of the testing in horology.sql
  264. -- where we do mixed-type arithmetic. - thomas 2000-12-02
  265. SELECT f1 + time with time zone '00:01' AS "Illegal" FROM TIMETZ_TBL;
  266. </sql-statement>
  267. -stdin-:<main>: Error: Type annotation
  268. -stdin-:<main>:1:1: Error: At function: RemovePrefixMembers, At function: PgSelect, At function: PgSetItem, At function: PgResultItem
  269. --
  270. ^
  271. -stdin-:<main>:9:11: Error: At function: PgOp
  272. SELECT f1 + time with time zone '00:01' AS "Illegal" FROM TIMETZ_TBL;
  273. ^
  274. -stdin-:<main>:9:11: Error: Unable to find an overload for operator + with given argument type(s): (timetz,timetz)
  275. SELECT f1 + time with time zone '00:01' AS "Illegal" FROM TIMETZ_TBL;
  276. ^
  277. <sql-statement>
  278. --
  279. -- test EXTRACT
  280. --
  281. SELECT EXTRACT(MICROSECOND FROM TIME WITH TIME ZONE '2020-05-26 13:30:25.575401-04');
  282. </sql-statement>
  283. <sql-statement>
  284. SELECT EXTRACT(MILLISECOND FROM TIME WITH TIME ZONE '2020-05-26 13:30:25.575401-04');
  285. </sql-statement>
  286. <sql-statement>
  287. SELECT EXTRACT(SECOND FROM TIME WITH TIME ZONE '2020-05-26 13:30:25.575401-04');
  288. </sql-statement>
  289. <sql-statement>
  290. SELECT EXTRACT(MINUTE FROM TIME WITH TIME ZONE '2020-05-26 13:30:25.575401-04');
  291. </sql-statement>
  292. <sql-statement>
  293. SELECT EXTRACT(HOUR FROM TIME WITH TIME ZONE '2020-05-26 13:30:25.575401-04');
  294. </sql-statement>
  295. <sql-statement>
  296. SELECT EXTRACT(DAY FROM TIME WITH TIME ZONE '2020-05-26 13:30:25.575401-04'); -- error
  297. </sql-statement>
  298. -stdin-:<main>: Fatal: Execution
  299. -stdin-:<main>:1:1: Fatal: Execution of node: Result
  300. SELECT EXTRACT(DAY FROM TIME WITH TIME ZONE '2020-05-26 13:30:25.575401-04'); -- error
  301. ^
  302. -stdin-:<main>:1:1: Fatal: ERROR: "time with time zone" units "day" not recognized
  303. SELECT EXTRACT(DAY FROM TIME WITH TIME ZONE '2020-05-26 13:30:25.575401-04'); -- error
  304. ^
  305. <sql-statement>
  306. SELECT EXTRACT(FORTNIGHT FROM TIME WITH TIME ZONE '2020-05-26 13:30:25.575401-04'); -- error
  307. </sql-statement>
  308. -stdin-:<main>: Fatal: Execution
  309. -stdin-:<main>:1:1: Fatal: Execution of node: Result
  310. SELECT EXTRACT(FORTNIGHT FROM TIME WITH TIME ZONE '2020-05-26 13:30:25.575401-04'); -- error
  311. ^
  312. -stdin-:<main>:1:1: Fatal: ERROR: "time with time zone" units "fortnight" not recognized
  313. SELECT EXTRACT(FORTNIGHT FROM TIME WITH TIME ZONE '2020-05-26 13:30:25.575401-04'); -- error
  314. ^
  315. <sql-statement>
  316. SELECT EXTRACT(TIMEZONE FROM TIME WITH TIME ZONE '2020-05-26 13:30:25.575401-04:30');
  317. </sql-statement>
  318. <sql-statement>
  319. SELECT EXTRACT(TIMEZONE_HOUR FROM TIME WITH TIME ZONE '2020-05-26 13:30:25.575401-04:30');
  320. </sql-statement>
  321. <sql-statement>
  322. SELECT EXTRACT(TIMEZONE_MINUTE FROM TIME WITH TIME ZONE '2020-05-26 13:30:25.575401-04:30');
  323. </sql-statement>
  324. <sql-statement>
  325. SELECT EXTRACT(EPOCH FROM TIME WITH TIME ZONE '2020-05-26 13:30:25.575401-04');
  326. </sql-statement>
  327. <sql-statement>
  328. -- date_part implementation is mostly the same as extract, so only
  329. -- test a few cases for additional coverage.
  330. SELECT date_part('microsecond', TIME WITH TIME ZONE '2020-05-26 13:30:25.575401-04');
  331. </sql-statement>
  332. <sql-statement>
  333. SELECT date_part('millisecond', TIME WITH TIME ZONE '2020-05-26 13:30:25.575401-04');
  334. </sql-statement>
  335. <sql-statement>
  336. SELECT date_part('second', TIME WITH TIME ZONE '2020-05-26 13:30:25.575401-04');
  337. </sql-statement>
  338. <sql-statement>
  339. SELECT date_part('epoch', TIME WITH TIME ZONE '2020-05-26 13:30:25.575401-04');
  340. </sql-statement>