This is a general issue I have been already thinking about. What CONNECT currently does,
when a column is nullable, is to regard character columns as NULL when represented by an empty string
and to regard numeric columns as NULL when their value is 0. The case of DATE column is unclear.
Currently they are treated as numeric (dates are internally represented like in C by the number of
second since 01-01-1970) Unfortunately, even invalid dates are automatically set to 01-01-1970,
their value is not 0 because added or substracted a time shift corresponding to their GMT setting.
This why they are not set to NULL in this case.
I am not yet ready to implement a general solution. Should the NULL_CHAR option be a column or
table option, the NULL representation be a single character or a string or a numeric value?
These questions are still open.
Meanwhile, to take care of your problem, I have updated the DATE data type for invalid dates
to be regarded as NULL whatever GMT setting is applied. Here is the CREATE TABLE I used:
CREATE TABLE `salute` (
`CODICEIDENTIFICATIVOSITO` int(6) NOT NULL,
`DENOMINAZIONESITOLOGISTICO` char(83) NOT NULL,
`INDIRIZZO` char(97) NOT NULL,
`PARTITAIVA` bigint(11) NOT NULL FIELD_FORMAT='Z',
`CAP` int(5) NOT NULL,
`CODICECOMUNEISTAT` char(6) NOT NULL,
`DESCRIZIONECOMUNE` char(33) NOT NULL,
`CODICEPROVINCIAISTAT` char(3) NOT NULL,
`SIGLAPROVINCIA` char(2) NOT NULL,
`DESCRIZIONEPROVINCIA` char(25) NOT NULL,
`CODICEREGIONE` char(3) NOT NULL,
`DESCRIZIONEREGIONE` char(21) NOT NULL,
`DATAINIZIOVALIDITA` date NOT NULL DATE_FORMAT='DD/MM/YYYY',
`DATAFINEVALIDITA` date DATE_FORMAT='DD/MM/YYYY',
`LATITUDINE` double(17,14) NOT NULL FIELD_FORMAT='D,',
`LONGITUDINE` double(17,14) NOT NULL FIELD_FORMAT='D,',
Note the FIELD_FORMAT='D,' to take care of the comma used as decimal separator and
the QUOTED=0 option needed because two lines in the file have their INDIRIZZO column quoted.
The query:
SELECT DENOMINAZIONESITOLOGISTICO, DATAINIZIOVALIDITA, DATAFINEVALIDITA, LATITUDINE FROM salute LIMIT 10;
now returns:
DENOMINAZIONESITOLOGISTICO
DATAINIZIOVALIDITA
DATAFINEVALIDITA
LATITUDINE
Parafarmacia S.F.A. Fasani
2006-10-01
NULL
41.55404142482020
eurosan
2006-10-01
NULL
38.18235051630770
DOCPHARMA DI EPIS DOTT. LEONARDO
2006-10-01
2014-01-31
45.73083169375610
PARAFARMACIA NATURESTE
2006-10-01
NULL
45.21971325978440
parafarmacia sanitaria di tamagni dott.ssa roberta
2006-10-01
NULL
46.18183947061230
FARMA+ dott.Giuseppe moscariello
2006-10-01
NULL
40.84112547106560
pharmasan
2006-10-01
2007-02-28
40.83665880000000
Sole e Natura di Aricò Alessandra
2006-10-01
2009-03-31
37.51717130000000
ARTEMISIA
2006-11-01
2009-03-31
36.95185760000000
Erboristeria D.ssa Valeria Tantardini
2006-11-01
2007-06-30
46.11608700000000
Olivier Bertrand
added a comment - This is a general issue I have been already thinking about. What CONNECT currently does,
when a column is nullable, is to regard character columns as NULL when represented by an empty string
and to regard numeric columns as NULL when their value is 0. The case of DATE column is unclear.
Currently they are treated as numeric (dates are internally represented like in C by the number of
second since 01-01-1970) Unfortunately, even invalid dates are automatically set to 01-01-1970,
their value is not 0 because added or substracted a time shift corresponding to their GMT setting.
This why they are not set to NULL in this case.
I am not yet ready to implement a general solution. Should the NULL_CHAR option be a column or
table option, the NULL representation be a single character or a string or a numeric value?
These questions are still open.
Meanwhile, to take care of your problem, I have updated the DATE data type for invalid dates
to be regarded as NULL whatever GMT setting is applied. Here is the CREATE TABLE I used:
CREATE TABLE `salute` (
`CODICEIDENTIFICATIVOSITO` int(6) NOT NULL,
`DENOMINAZIONESITOLOGISTICO` char(83) NOT NULL,
`INDIRIZZO` char(97) NOT NULL,
`PARTITAIVA` bigint(11) NOT NULL FIELD_FORMAT='Z',
`CAP` int(5) NOT NULL,
`CODICECOMUNEISTAT` char(6) NOT NULL,
`DESCRIZIONECOMUNE` char(33) NOT NULL,
`CODICEPROVINCIAISTAT` char(3) NOT NULL,
`SIGLAPROVINCIA` char(2) NOT NULL,
`DESCRIZIONEPROVINCIA` char(25) NOT NULL,
`CODICEREGIONE` char(3) NOT NULL,
`DESCRIZIONEREGIONE` char(21) NOT NULL,
`DATAINIZIOVALIDITA` date NOT NULL DATE_FORMAT='DD/MM/YYYY',
`DATAFINEVALIDITA` date DATE_FORMAT='DD/MM/YYYY',
`LATITUDINE` double(17,14) NOT NULL FIELD_FORMAT='D,',
`LONGITUDINE` double(17,14) NOT NULL FIELD_FORMAT='D,',
`LOCALIZE` int(1) NOT NULL
) ENGINE=CONNECT DEFAULT CHARSET=latin1 `TABLE_TYPE`='csv' `FILE_NAME`='E:/Data/salute.csv' `SEP_CHAR`=';' `HEADER`=1 `QUOTED`=0;
Note the FIELD_FORMAT='D,' to take care of the comma used as decimal separator and
the QUOTED=0 option needed because two lines in the file have their INDIRIZZO column quoted.
The query:
SELECT DENOMINAZIONESITOLOGISTICO, DATAINIZIOVALIDITA, DATAFINEVALIDITA, LATITUDINE FROM salute LIMIT 10;
now returns:
DENOMINAZIONESITOLOGISTICO
DATAINIZIOVALIDITA
DATAFINEVALIDITA
LATITUDINE
Parafarmacia S.F.A. Fasani
2006-10-01
NULL
41.55404142482020
eurosan
2006-10-01
NULL
38.18235051630770
DOCPHARMA DI EPIS DOTT. LEONARDO
2006-10-01
2014-01-31
45.73083169375610
PARAFARMACIA NATURESTE
2006-10-01
NULL
45.21971325978440
parafarmacia sanitaria di tamagni dott.ssa roberta
2006-10-01
NULL
46.18183947061230
FARMA+ dott.Giuseppe moscariello
2006-10-01
NULL
40.84112547106560
pharmasan
2006-10-01
2007-02-28
40.83665880000000
Sole e Natura di Aricò Alessandra
2006-10-01
2009-03-31
37.51717130000000
ARTEMISIA
2006-11-01
2009-03-31
36.95185760000000
Erboristeria D.ssa Valeria Tantardini
2006-11-01
2007-06-30
46.11608700000000
People
Olivier Bertrand
Federico Razzoli
Votes:
0Vote for this issue
Watchers:
3Start watching this issue
Dates
Created:
Updated:
Git Integration
Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.
{"report":{"fcp":1170.4000000953674,"ttfb":239.70000004768372,"pageVisibility":"visible","entityId":44602,"key":"jira.project.issue.view-issue","isInitial":true,"threshold":1000,"elementTimings":{},"userDeviceMemory":8,"userDeviceProcessors":64,"apdex":0.5,"journeyId":"c1ec48a0-4183-439f-9000-5b24d9ae448c","navigationType":0,"readyForUser":1240.1000001430511,"redirectCount":0,"resourceLoadedEnd":840.8000001907349,"resourceLoadedStart":245.30000019073486,"resourceTiming":[{"duration":50.69999980926514,"initiatorType":"link","name":"https://jira.mariadb.org/s/2c21342762a6a02add1c328bed317ffd-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/css/_super/batch.css","startTime":245.30000019073486,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":245.30000019073486,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":296,"responseStart":0,"secureConnectionStart":0},{"duration":50.700000047683716,"initiatorType":"link","name":"https://jira.mariadb.org/s/7ebd35e77e471bc30ff0eba799ebc151-CDN/lu2cib/820016/12ta74/494e4c556ecbb29f90a3d3b4f09cb99c/_/download/contextbatch/css/jira.browse.project,project.issue.navigator,jira.view.issue,jira.general,jira.global,atl.general,-_super/batch.css?agile_global_admin_condition=true&jag=true&jira.create.linked.issue=true&slack-enabled=true&whisper-enabled=true","startTime":245.60000014305115,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":245.60000014305115,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":296.30000019073486,"responseStart":0,"secureConnectionStart":0},{"duration":409.39999985694885,"initiatorType":"script","name":"https://jira.mariadb.org/s/0917945aaa57108d00c5076fea35e069-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/js/_super/batch.js?locale=en","startTime":245.80000019073486,"connectEnd":245.80000019073486,"connectStart":245.80000019073486,"domainLookupEnd":245.80000019073486,"domainLookupStart":245.80000019073486,"fetchStart":245.80000019073486,"redirectEnd":0,"redirectStart":0,"requestStart":300.10000014305115,"responseEnd":655.2000000476837,"responseStart":320,"secureConnectionStart":245.80000019073486},{"duration":594.8000001907349,"initiatorType":"script","name":"https://jira.mariadb.org/s/2d8175ec2fa4c816e8023260bd8c1786-CDN/lu2cib/820016/12ta74/494e4c556ecbb29f90a3d3b4f09cb99c/_/download/contextbatch/js/jira.browse.project,project.issue.navigator,jira.view.issue,jira.general,jira.global,atl.general,-_super/batch.js?agile_global_admin_condition=true&jag=true&jira.create.linked.issue=true&locale=en&slack-enabled=true&whisper-enabled=true","startTime":246,"connectEnd":246,"connectStart":246,"domainLookupEnd":246,"domainLookupStart":246,"fetchStart":246,"redirectEnd":0,"redirectStart":0,"requestStart":307.7000000476837,"responseEnd":840.8000001907349,"responseStart":326.60000014305115,"secureConnectionStart":246},{"duration":97.70000004768372,"initiatorType":"script","name":"https://jira.mariadb.org/s/a9324d6758d385eb45c462685ad88f1d-CDN/lu2cib/820016/12ta74/c92c0caa9a024ae85b0ebdbed7fb4bd7/_/download/contextbatch/js/atl.global,-_super/batch.js?locale=en","startTime":246.10000014305115,"connectEnd":246.10000014305115,"connectStart":246.10000014305115,"domainLookupEnd":246.10000014305115,"domainLookupStart":246.10000014305115,"fetchStart":246.10000014305115,"redirectEnd":0,"redirectStart":0,"requestStart":312.60000014305115,"responseEnd":343.80000019073486,"responseStart":336.2000000476837,"secureConnectionStart":246.10000014305115},{"duration":102.20000004768372,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2cib/820016/12ta74/1.0/_/download/batch/jira.webresources:calendar-en/jira.webresources:calendar-en.js","startTime":247,"connectEnd":247,"connectStart":247,"domainLookupEnd":247,"domainLookupStart":247,"fetchStart":247,"redirectEnd":0,"redirectStart":0,"requestStart":313.30000019073486,"responseEnd":349.2000000476837,"responseStart":338.90000009536743,"secureConnectionStart":247},{"duration":105.39999985694885,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2cib/820016/12ta74/1.0/_/download/batch/jira.webresources:calendar-localisation-moment/jira.webresources:calendar-localisation-moment.js","startTime":247.10000014305115,"connectEnd":247.10000014305115,"connectStart":247.10000014305115,"domainLookupEnd":247.10000014305115,"domainLookupStart":247.10000014305115,"fetchStart":247.10000014305115,"redirectEnd":0,"redirectStart":0,"requestStart":317.10000014305115,"responseEnd":352.5,"responseStart":341.40000009536743,"secureConnectionStart":247.10000014305115},{"duration":61.5,"initiatorType":"link","name":"https://jira.mariadb.org/s/b04b06a02d1959df322d9cded3aeecc1-CDN/lu2cib/820016/12ta74/a2ff6aa845ffc9a1d22fe23d9ee791fc/_/download/contextbatch/css/jira.global.look-and-feel,-_super/batch.css","startTime":247.40000009536743,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":247.40000009536743,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":308.90000009536743,"responseStart":0,"secureConnectionStart":0},{"duration":105.5,"initiatorType":"script","name":"https://jira.mariadb.org/rest/api/1.0/shortcuts/820016/47140b6e0a9bc2e4913da06536125810/shortcuts.js?context=issuenavigation&context=issueaction","startTime":247.5,"connectEnd":247.5,"connectStart":247.5,"domainLookupEnd":247.5,"domainLookupStart":247.5,"fetchStart":247.5,"redirectEnd":0,"redirectStart":0,"requestStart":321.30000019073486,"responseEnd":353,"responseStart":344.40000009536743,"secureConnectionStart":247.5},{"duration":61.5,"initiatorType":"link","name":"https://jira.mariadb.org/s/3ac36323ba5e4eb0af2aa7ac7211b4bb-CDN/lu2cib/820016/12ta74/d176f0986478cc64f24226b3d20c140d/_/download/contextbatch/css/com.atlassian.jira.projects.sidebar.init,-_super,-project.issue.navigator,-jira.view.issue/batch.css?jira.create.linked.issue=true","startTime":247.60000014305115,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":247.60000014305115,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":309.10000014305115,"responseStart":0,"secureConnectionStart":0},{"duration":105.5,"initiatorType":"script","name":"https://jira.mariadb.org/s/5d5e8fe91fbc506585e83ea3b62ccc4b-CDN/lu2cib/820016/12ta74/d176f0986478cc64f24226b3d20c140d/_/download/contextbatch/js/com.atlassian.jira.projects.sidebar.init,-_super,-project.issue.navigator,-jira.view.issue/batch.js?jira.create.linked.issue=true&locale=en","startTime":247.80000019073486,"connectEnd":247.80000019073486,"connectStart":247.80000019073486,"domainLookupEnd":247.80000019073486,"domainLookupStart":247.80000019073486,"fetchStart":247.80000019073486,"redirectEnd":0,"redirectStart":0,"requestStart":321.60000014305115,"responseEnd":353.30000019073486,"responseStart":346,"secureConnectionStart":247.80000019073486},{"duration":561,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2cib/820016/12ta74/1.0/_/download/batch/jira.webresources:bigpipe-js/jira.webresources:bigpipe-js.js","startTime":256.7000000476837,"connectEnd":256.7000000476837,"connectStart":256.7000000476837,"domainLookupEnd":256.7000000476837,"domainLookupStart":256.7000000476837,"fetchStart":256.7000000476837,"redirectEnd":0,"redirectStart":0,"requestStart":380.7000000476837,"responseEnd":817.7000000476837,"responseStart":801.8000001907349,"secureConnectionStart":256.7000000476837},{"duration":561.9000000953674,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2cib/820016/12ta74/1.0/_/download/batch/jira.webresources:bigpipe-init/jira.webresources:bigpipe-init.js","startTime":256.7000000476837,"connectEnd":256.7000000476837,"connectStart":256.7000000476837,"domainLookupEnd":256.7000000476837,"domainLookupStart":256.7000000476837,"fetchStart":256.7000000476837,"redirectEnd":0,"redirectStart":0,"requestStart":419.5,"responseEnd":818.6000001430511,"responseStart":806.9000000953674,"secureConnectionStart":256.7000000476837},{"duration":59,"initiatorType":"xmlhttprequest","name":"https://jira.mariadb.org/rest/webResources/1.0/resources","startTime":810,"connectEnd":810,"connectStart":810,"domainLookupEnd":810,"domainLookupStart":810,"fetchStart":810,"redirectEnd":0,"redirectStart":0,"requestStart":834,"responseEnd":869,"responseStart":867.6000001430511,"secureConnectionStart":810}],"fetchStart":0,"domainLookupStart":42,"domainLookupEnd":61,"connectStart":62,"connectEnd":80,"secureConnectionStart":70,"requestStart":82,"responseStart":240,"responseEnd":256,"domLoading":244,"domInteractive":1312,"domContentLoadedEventStart":1313,"domContentLoadedEventEnd":1362,"domComplete":1616,"loadEventStart":1616,"loadEventEnd":1617,"userAgent":"Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)","marks":[{"name":"bigPipe.sidebar-id.start","time":1281},{"name":"bigPipe.sidebar-id.end","time":1281.9000000953674},{"name":"bigPipe.activity-panel-pipe-id.start","time":1282.1000001430511},{"name":"bigPipe.activity-panel-pipe-id.end","time":1283.9000000953674},{"name":"activityTabFullyLoaded","time":1380.7000000476837}],"measures":[],"correlationId":"94e571b63175c2","effectiveType":"4g","downlink":9.6,"rtt":0,"serverDuration":89,"dbReadsTimeInMs":8,"dbConnsTimeInMs":15,"applicationHash":"9d11dbea5f4be3d4cc21f03a88dd11d8c8687422","experiments":[]}}
This is a general issue I have been already thinking about. What CONNECT currently does,
when a column is nullable, is to regard character columns as NULL when represented by an empty string
and to regard numeric columns as NULL when their value is 0. The case of DATE column is unclear.
Currently they are treated as numeric (dates are internally represented like in C by the number of
second since 01-01-1970) Unfortunately, even invalid dates are automatically set to 01-01-1970,
their value is not 0 because added or substracted a time shift corresponding to their GMT setting.
This why they are not set to NULL in this case.
I am not yet ready to implement a general solution. Should the NULL_CHAR option be a column or
table option, the NULL representation be a single character or a string or a numeric value?
These questions are still open.
Meanwhile, to take care of your problem, I have updated the DATE data type for invalid dates
to be regarded as NULL whatever GMT setting is applied. Here is the CREATE TABLE I used:
CREATE TABLE `salute` (
`CODICEIDENTIFICATIVOSITO` int(6) NOT NULL,
`DENOMINAZIONESITOLOGISTICO` char(83) NOT NULL,
`INDIRIZZO` char(97) NOT NULL,
`PARTITAIVA` bigint(11) NOT NULL FIELD_FORMAT='Z',
`CAP` int(5) NOT NULL,
`CODICECOMUNEISTAT` char(6) NOT NULL,
`DESCRIZIONECOMUNE` char(33) NOT NULL,
`CODICEPROVINCIAISTAT` char(3) NOT NULL,
`SIGLAPROVINCIA` char(2) NOT NULL,
`DESCRIZIONEPROVINCIA` char(25) NOT NULL,
`CODICEREGIONE` char(3) NOT NULL,
`DESCRIZIONEREGIONE` char(21) NOT NULL,
`DATAINIZIOVALIDITA` date NOT NULL DATE_FORMAT='DD/MM/YYYY',
`DATAFINEVALIDITA` date DATE_FORMAT='DD/MM/YYYY',
`LATITUDINE` double(17,14) NOT NULL FIELD_FORMAT='D,',
`LONGITUDINE` double(17,14) NOT NULL FIELD_FORMAT='D,',
`LOCALIZE` int(1) NOT NULL
) ENGINE=CONNECT DEFAULT CHARSET=latin1 `TABLE_TYPE`='csv' `FILE_NAME`='E:/Data/salute.csv' `SEP_CHAR`=';' `HEADER`=1 `QUOTED`=0;
Note the FIELD_FORMAT='D,' to take care of the comma used as decimal separator and
the QUOTED=0 option needed because two lines in the file have their INDIRIZZO column quoted.
The query:
SELECT DENOMINAZIONESITOLOGISTICO, DATAINIZIOVALIDITA, DATAFINEVALIDITA, LATITUDINE FROM salute LIMIT 10;
now returns: