Bug 3807 - str_to_timestamp does not support sub-second accuracy, yet cast does
Summary: str_to_timestamp does not support sub-second accuracy, yet cast does
Status: RESOLVED WONTFIX
Alias: None
Product: SQL
Classification: Unclassified
Component: all (show other bugs)
Version: 11.19.3 (Oct2014)
Hardware: All All
: Normal normal
Assignee: SQL devs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-09-09 15:17 CEST by Hannes Muehleisen
Modified: 2015-09-23 09:27 CEST (History)
1 user (show)



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Hannes Muehleisen cwiconfidential 2015-09-09 15:17:42 CEST
User-Agent:       Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.85 Safari/537.36
Build Identifier: 

%f formatting flag is not supported...

Reproducible: Always

Steps to Reproduce:
select cast('2015-08-28 00:00:00.023000' as timestamp) - str_to_timestamp('2015-08-28 00:00:00.023000', '%Y-%m-%d %H:%M:%S.%f');
Actual Results:  
0.023 

Expected Results:  
0.0

Python does support this:

>>> datetime.datetime.strptime('2015-08-28 00:00:00.023000', '%Y-%m-%d %H:%M:%S.%f')
datetime.datetime(2015, 8, 28, 0, 0, 0, 23000)
Comment 1 Niels Nes cwiconfidential 2015-09-23 09:27:49 CEST
str_to_timestamp is mapped to strptime, which indeed doesn't support %f.