Delete records in datastore | Control Tower


I have a BP running on local control tower in which I create datastore and insert data into it from an excel file.
But when I try to delete records in datastore (through sql query/ manually selecting “Delete All Records”) nothing happens.

Code for deleting records in datastore:

delete from @this;

Following code generates an exception:
Caused by: org.postgresql.util.PSQLException: ERROR: INSERT has more expressions than target columns
Where: PL/pgSQL function archivedeletedrecords() line 1 at EXECUTE

As per my understanding insert statement has more values than columns but I don’t understand how insert query runs from my code and what is archivedeletedrecords().

I solved it. Just in case someone is also stuck here,

When datastore is created using plugin, a copy of same datastore is also created (not visible in control tower) with same structure. If at some point more columns are added to ds (using sql queries), number of columns differ in original and copy(archive) ds. When deleting records from original ds, they are inserted to archive ds, which raises this error.

Hi @aharhots/@ashapkina ,

I am trying to delete my records from DataStore in Control tower, but says the same error …as cannot execute query
“delete from DatastoreName”

Please help me on this, as this is a high priority for me .

Thanks in advance,


Please provide detailed error logs.

Meanwhile you may also look at below link for better understanding of datastores.

This is the error log in controltower :
Step name ‘Datastore deleter’ has failed. Reason: 'Failed to execute query: DELETE FROM “ds_test”