0

If I specify a wrong ID , or the JSON is invalid my sequence in PostGre is kept. If i have 2 objects already in the database with ID 1 and ID 2, on failure of creation of third object and then success it will create it with ID 4.

I have looked into ways to resolve this. There is this topic:

How to reset postgres' primary key sequence when it falls out of sync?

However, I do not like to use that SQL code in PostGre , simply because a database is created on a use of specific function of a user.

Is there a way to disable it using C# code or send a command to postgre using C# ? I can use is inject the SQL query in C# and send it to PostGre, but I have read that this is a bad practice.

There is not much information regarding this on the web.

Under law our invoices must be sequential and their number is created by using the ID.

grozdeto
  • 1,201
  • 1
  • 13
  • 34

0 Answers0