Database insert from inactive branch

Dear all,

at the end of the workflow I am going to upload a single line of data into a postgres database by using a "Database SQL executor" node . Within the database table I do have a active counter which should create a ongloing number, which has to be controlled by the database and cannot be generated by KNIME before entering.

Before the upload I am using a emty table switch which should inactivate the branch into the database once the table is emty and should activate a branch which generates a error message

Now the problem:

Etherything works quite nicely, for both cases. The swich activates / inactivates the right branch and sets the database to inactive (red cross)  in case the table is emty.

Unfortunately, the database counter still counts up even if the node sits on the inactive branch and once I enter a new line one  counter entry is missing.

The database upload workflow is wrapped into a node, which interestingly switches to green after execution. All nodes within this wrapping to not have any trafic light as one would expect in an inactive branch.

Does anyone have an Idea how to prevent this behavior.

 

Thank you very much in advance for your support,

Michael

 

Hi Michael,

can you provide some more information where the counter is incremented. Is it incremented via a SQL statement within the Database SQL Executor or via an insert trigger in the database or by any other mean? Are you using any other database nodes that access the same table in the inactive branch? Maybe you can also attach a screenshot of the two branches (inactive/active) branch and teh switch node to see which nodes you are using.

Thanks

Tobias

There is actually no guarantee that database sequences are gap-free- This applies to postgresql as well. Therefore it's hard to say if the issue actually is caused by KNIME or other actions in the database. But still no database will give you such assurances. If you really need a gapless sequence, you probably need to do it in knime itself.

http://stackoverflow.com/questions/19004453/postgresql-generate-sequence-with-no-gap