Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Cap CDS 7x - Postgres

LuizGomes
Participant
//view.cds
view dummy as select from dummy_table{
key id,
TO_VARCHAR(TO_DATE(comm_doc.create_date )) as create_date  : String(20)
}

comand:

cds deploy --profile pg

error:

error: function to_date(date, unknown) does not exist
at /workspace/node_modules/pg/lib/client.js:526:17
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async Object.run (/workspace/node_modules/@cap-js/postgres/lib/PostgresService.js:110:24)
at async next (/workspace/node_modules/@sap/cds/lib/srv/srv-dispatch.js:79:17)
at async PostgresService.handle (/workspace/node_modules/@sap/cds/lib/srv/srv-dispatch.js:77:10)
at async Promise.all (index 72)
at async Function.cds_deploy_create [as create] (/workspace/node_modules/@sap/cds/lib/dbs/cds-deploy.js:126:3)
at async _deploy (/workspace/node_modules/@sap/cds/lib/dbs/cds-deploy.js:37:19)
at async Object.to (/workspace/node_modules/@sap/cds/lib/dbs/cds-deploy.js:47:9)
at async Object.deploy_to_sql [as deploy] (/usr/local/share/npm-global/lib/node_modules/@sap/cds-dk/bin/deploy/to-postgres.js:6:9) {
length: 216,
severity: 'ERROR',
code: '42883',
detail: undefined,
hint: 'No function matches the given name and argument types. You might need to add explicit type casts.',
position: '717',
internalPosition: undefined,
internalQuery: undefined,
where: undefined,
schema: undefined,
table: undefined,
column: undefined,
dataType: undefined,
constraint: undefined,
file: 'parse_func.c',
line: '629',
routine: 'ParseFuncOrColumn'
}

guide

https://cap.cloud.sap/docs/guides/databases-postgres

how is it possible to use the TO_VARCHAR and TO_DATE functions with cap cds to serve hana cloud and postgres banks?

1 REPLY 1

simon_oswald
Explorer

Hi,

I might not be understanding your question correctly, but think in this case, the same pattern as for sqlite and HANA applies, documented here: https://cap.cloud.sap/docs/guides/databases#sqlite-and-hana-functions

Best Regards,
Simon