Changing node values directly to database exhibits erratic behaviour I needed to create a new field for each node in my website that would have as its value a concat of two existing fields. 

I firstly inserted the new rows in the newly created field table, and then updated each of the rows with he corresponding information. 
But when I check on the browser in the edit page of several nodes some of them have the correct value inside the field while others have that field blank. The strange part is that there is no apparent difference in the database between the nodes with a value in the field and those that have it blank.

After investigating the issue I copied all the table to its correspondent revision table, leaving revision_id as 0. This didn't solve the problem.

I know I'm not supposed to directly modify the database like this but it has half-worked and I was wondering if there's a way to execute a method or a module so all nodes will have their field filled, or if I should erase all contents of the table and use db_update() or node_save() to do the job.

thanks in advance
The safest way would be adding field data and saving it with node_save. If you write it to the database, you have to also duplicate the record to the revision table of that field and keep track of vids. The API will just do this for you. You do not (should not) write field data via db_insert or other functions like it. Doing so may irreparably harm your database.

To apply the data retroactively, I would advise that you create a batch op via Batch API. Query up all nodes, create batch operations, and in your batch callback, process the node and save it with node_save.

There is a docs page on getting started with the Batch API.

Here is a blog post that demonstrates a basic batch job that is close to what you'd want to start out with. You'd want to populate the $operations array with node ids, and every time the batch callback is called, the node id is passed. Then you load the node with it, set the field, then save the node.

edit: tutorial author also provides a Drupal 8 version.