Cockroach: LocalDate could not be persisted by Hibernate

Created on 23 Mar 2017  路  7Comments  路  Source: cockroachdb/cockroach

create table test (x date);
insert into test (x) values ('2017-03-03 +01');

causes ERROR: could not parse '2017-03-03 +01' as type date

on the other hand this kind of syntax is perfectly legal in postgresql:

mateusz.gajewski=# create table test (x date);
CREATE TABLE
mateusz.gajewski=# insert into test (x) values ('2017-03-03 +01');
INSERT 0 1
mateusz.gajewski=#
C-question O-community

All 7 comments

I've checked that current ParseDDate does not accept format I've provided https://github.com/cockroachdb/cockroach/blob/9542f1cab202f461eae789fbc2ab167430598424/pkg/sql/parser/datum.go#L894 (it only accepts full offset like: +01:00:00

Actually PostgreSQL supports multitude of variants:

mateusz.gajewski=# insert into test (x) values ('2017-03-03 +01:00');
INSERT 0 1
mateusz.gajewski=# insert into test (x) values ('2017-03-03 +01:00:00');
INSERT 0 1                                    
mateusz.gajewski=# insert into test (x) values ('2017-03-03 +0');
INSERT 0 1
mateusz.gajewski=# insert into test (x) values ('2017-03-03');
INSERT 0 1
mateusz.gajewski=# insert into test (x) values ('2017-03-03 +1');
INSERT 0 1
mateusz.gajewski=# insert into test (x) values ('2017-03-03 +1:0:1');
INSERT 0 1

Thanks for the digging in to this and putting together such a detailed report!

@dt I can prepare PR if you want me to :)

@wendigo, whoops, sorry, I meant to add this but got sidetracked looking at our ORM testing and haven't touched it, so if you have a patch, we'd certainly appreciate a PR!

@cuongdo david doesn't have the bandwidth for this. can you triage if this needs to be in 1.0 and assign to someone if it does?

Thx!

Was this page helpful?
0 / 5 - 0 ratings