Skip to main content
edited tags
Link
Hannah Vernon
  • 70.5k
  • 22
  • 177
  • 321
correct an example
Source Link
bignose
  • 1.3k
  • 1
  • 9
  • 17
=> SELECT CAST('1962'1964-05-02 00:00' AS TIMESTAMP) = CAST('1962'1964-05-02 00:00:00' AS TIMESTAMP);
 ?column? 
----------
 t
(1 row)

=> SELECT CAST('1962'1964-05' AS TIMESTAMP) = CAST('1962'1964-05-02' AS TIMESTAMP);
 ?column? 
----------
 t
(1 row)
=> SELECT CAST('1962-05-02 00:00' AS TIMESTAMP) = CAST('1962-05-02 00:00:00' AS TIMESTAMP);
 ?column? 
----------
 t
(1 row)

=> SELECT CAST('1962-05' AS TIMESTAMP) = CAST('1962-05-02' AS TIMESTAMP);
 ?column? 
----------
 t
(1 row)
=> SELECT CAST('1964-05-02 00:00' AS TIMESTAMP) = CAST('1964-05-02 00:00:00' AS TIMESTAMP);
 ?column? 
----------
 t
(1 row)

=> SELECT CAST('1964-05' AS TIMESTAMP) = CAST('1964-05-02' AS TIMESTAMP);
 ?column? 
----------
 t
(1 row)
more implications of ISO 8601
Source Link
bignose
  • 1.3k
  • 1
  • 9
  • 17

The meaning of 1964-05 in ISO 8601 includes the more-precise values 1964-05-02 and 1964-05-02 18:27 and 1964-05-23. So those should all compare equal.

The meaning of 1964-05 in ISO 8601 includes the more-precise values 1964-05-02 and 1964-05-02 18:27 and 1964-05-23. So those should all compare equal.

more detail about expected behaviour
Source Link
bignose
  • 1.3k
  • 1
  • 9
  • 17
Loading
highlight
Source Link
bignose
  • 1.3k
  • 1
  • 9
  • 17
Loading
Tweeted twitter.com/#!/StackDBAs/status/117176848303128576
respond to suggestions for using different type
Source Link
bignose
  • 1.3k
  • 1
  • 9
  • 17
Loading
fix pasted session
Source Link
bignose
  • 1.3k
  • 1
  • 9
  • 17
Loading
Source Link
bignose
  • 1.3k
  • 1
  • 9
  • 17
Loading