Bug 3816 - Server crashes when trying to convert timestamp to str with incorrect format
Summary: Server crashes when trying to convert timestamp to str with incorrect format
Status: RESOLVED FIXED
Alias: None
Product: SQL
Classification: Unclassified
Component: all (show other bugs)
Version: 11.21.5 (Jul2015)
Hardware: x86_64 (amd64/em64t) Windows
: Normal critical
Assignee: SQL devs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-10-01 15:25 CEST by Sherzod Mutalov
Modified: 2015-11-03 10:18 CET (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Sherzod Mutalov 2015-10-01 15:25:20 CEST
User-Agent:       Mozilla/5.0 (Windows NT 10.0; WOW64; rv:39.0) Gecko/20100101 Firefox/39.0
Build Identifier: 

Server crashes when trying to convert timestamp to str with incorrect format.
This problem occurs, because strftime function implementation in msvc library have different behaviour, other than in GNU libraries.

Reproducible: Always

Steps to Reproduce:
1. Execute following query: SELECT timestamp_to_str(current_timestamp, '%Q');

Actual Results:  
Server crashes

Expected Results:  
SQL exception

In mtime.c file, inside MTIMEtimestamp_to_str function
at the line 3610:

>> if ((sz = strftime(buf, BUFSIZ, *format, &t)) == 0)

Also, need new feature to extract QUARTER part from dates (like pgsql date_part('quarter', ...) function)
Comment 1 MonetDB Mercurial Repository cwiconfidential 2015-10-14 19:02:06 CEST
Changeset e21bad0f10c1, made by Niels Nes <niels@cwi.nl> in the MonetDB repo, refers to this bug.

For complete details, see http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=e21bad0f10c1

Changeset description:

	added tests for bug 3815 and bug 3816
Comment 2 Sjoerd Mullender cwiconfidential 2015-10-21 15:01:26 CEST
Fixed in changeset e3f3f7c48a48.
Comment 3 Sjoerd Mullender cwiconfidential 2015-10-21 15:03:15 CEST
(In reply to Sherzod Mutalov from comment #0)
> Also, need new feature to extract QUARTER part from dates (like pgsql
> date_part('quarter', ...) function)

This is a feature request.  Please create a separate bug report (and mark it as "enhancement").
Comment 4 Sjoerd Mullender cwiconfidential 2015-11-03 10:18:00 CET
Jul2015 SP1 has been released.