cds-dbs
cds-dbs copied to clipboard
Postgresql CSV upload with Boolean field generates error
When doing a deploy which includes CSV with data, we are getting the following error back:
CDS output
error: in cds.deploy(): column "active" is of type boolean but expression is of type text
Query {
UPSERT: {
into: 'xxx.xxxTypes',
columns: [
'ID',
'Active',
'Title',
'Description',
'businessObject_ID',
'implementationClassID',
'externalProcessing'
],
rows: [
[Array], [Array],
[Array], [Array],
[Array], [Array],
[Array], [Array],
[Array]
]
}
}
at /home/xxxx/node_modules/pg/lib/client.js:526:17
DB output:
db_1 | 2023-09-08 13:05:23.317 UTC [753] ERROR: column "active" is of type boolean but expression is of type text at character 157
db_1 | 2023-09-08 13:05:23.317 UTC [753] HINT: You will need to rewrite or cast the expression.
db_1 | 2023-09-08 14:15:18.538 UTC [188] STATEMENT: INSERT INTO xxxxTypes (ID,Active,Title,Description,businessObject_ID,implementationClassID,externalProcessing) SELECT value->>0,value->>1,value->>2,value->>3,value->>4,value->>5,CASE value->>6 WHEN 'true' THEN true WHEN 'false' THEN false END FROM json_array_elements($1::JSON) WHERE true ON CONFLICT(ID) DO UPDATE SET Active = excluded.Active,Title = excluded.Title,Description = excluded.Description,businessObject_ID = excluded.businessObject_ID,implementationClassID = excluded.implementationClassID,externalProcessing = excluded.externalProcessing
The CSV data file deploys fine on HANA and has not changed:
ID;Active;Title;Description;businessObject_ID;implementationClassID;externalProcessing
PROFILE_INIT;True;Profile Initialization;Initialize new profiles;PROFILES;;True
I tried changing into lower case values for the boolean but that doesn't make a difference.