Login

Username

Password





Register   Reset password

This is a read-only archive of the forum.

# scottell 2/2/2006 1:39 PM
I am getting the following error when I try to make changes to certain sections:

An error occured: Row was updated or deleted by another transaction for Cuyahoga.Core.Domain.Section instance with identifier: 3

Any idea what could be the problem? (This is mono/linux)

Scott
# martijnb 2/2/2006 3:26 PM
Does it happen with every section? Or did you perhaps add some sections directly in the database?

Most of the times the error occures when an updatetimestamp in the database has a value that is different from the value in the .NET code. For example, the resolution of the default current_timestamp() function in PostgreSQL has a higher resolution than what a .NET DateTime can contain. So with updates, the .NET datetime value is compared to the database value and they appear to be different (even when nothing has changed).

In the past I had these issues when entering sections directly in the table (and the updatetimestamp gets a default value)
# scottell 2/2/2006 4:19 PM
This is all within Cuyahoga. I create a new section and one change will go through, but the next time I try and save it, I get the error. I cannot delete the section either, as I get the same error.

Scott
# martijnb 2/3/2006 5:03 AM
Can you perhaps show us how the dates (updatetimestamp) look in the database?

And what database are you using?
# scottell 2/3/2006 7:42 AM
This is postgresql.

The updatetimestamp for one particular troublemaker row is:

2006-02-02 15:00:26.607887

(This is from cuyahoga_section)

Scott
# martijnb 2/3/2006 8:06 AM
What I used to do was manually remove the last three digits and then the conflict went away.

The strange thing is that I just checked it on my local Linux box and to my surprise, I also have some high resolution timestamps for sections and updating still works!

*clueless*
# scottell 2/3/2006 1:20 PM
Hmm... I'm kind of dead in the water here when it comes to editing sections. Each section I add quickly becomes unmanagable.

Shall I file a bug?

Scott
# martijnb 2/3/2006 3:06 PM
Yes, do so. But I'm unable to reproduce it here so it might be really tough to find out about it.
# entity 2/4/2006 1:05 AM
Same problem with Mono/PostgreSQL/Linux:

The solution (as martijnb implyed):

psql -h localhost -U postgres -W -d cuyahoga

UPDATE cuyahoga_user set updatetimestamp='2006-02-04 08:58:04.323[the 3 last digits shuld be removed]' where username='admin';
# martijnb 2/4/2006 6:21 AM
Yes, this may solve this issue temporarily, but if someone could create a detailed (with error log, complete environment) issue about this in Jira, I'd would be glad.
# scottell 2/4/2006 10:48 AM
I created a bug:

http://tijnthuus.demon.nl:8080/jira/browse/CUY-71

# martijnb 2/5/2006 9:59 AM
Thanks, I'll look into that.
# martijnb 2/11/2006 1:05 PM
Finally I have been able to reproduce the behaviour and it appeared that the Npgsql driver is causing the issue.

Somewhere last year, Npgsql changed to storing timestamps explicitely in the default PostgreSQL format (nanoseconds). This is a higher precision than the .NET DateTime can handle (milliseconds). Apperantly, this conversion doesn't always result in the same value as stored in the database. Therefore the version conflicts.

I tried an old 0.6 version of the Npgsql.dll driver (together with an old Mono.Security.Protocol.Tls.dll and the problem disappeared.

So, a quick fix would be to find an old Npgsql driver to get things running. Drop me an email if you can't find it in the archives and I'll send the old version.
In the meantime, I contacted Francisco, the Npgsql developer, to see how this can be fixed permanently.
# martijnb 2/12/2006 1:30 PM
martijnbSomewhere last year, Npgsql changed to storing timestamps explicitely in the default PostgreSQL format (nanoseconds). This is a higher precision than the .NET DateTime can handle (milliseconds). Apperantly, this conversion doesn't always result in the same value as stored in the database. Therefore the version conflicts.

Forget the above. It doesn't make sense. It only happens on Mono. On Windows .NET with Postgres, everything works fine. I created a small test program that reproduces the issue and send it to Francisco. Hopefully, he is able to find out more about the issue.

But, the workaround with an older Npgsql version still applies.