Weird Postgres save of text field causing error

Hi All

I have a postgres table with a notes field defined as varchar(999) on pg
and cstring(1000) in clarion.

I update using a std form and a text box.

Now comes the weird bit

Sometime I get an Changed by another station error trying to update.

I’ve traced this back to the Postgres field having the last CR LF
truncated to LF.

So 2 lines at the end look like CR LF LF, but Clarion still sees this as
CR LF CR LF !! ie the field is 1 character different. It’s only the
last Character that this happens on.

Meaning the update which tries to update where everything matches, fails.

Anyone seen anything like this before?

I’m sort of lost

OK This looks like it might be a positioning problem.
I’m adding some text to the note and then doing a
SELECT(MyField,len(MyField)) after to allow edits.
changing this to len(MyField)+1 appears to solve the problem, although I need to do more testing to really confirm this.

This is exactly what one sees when a field is defined as varchar(x) in PG and string(x+1) in Clarion. Have you verified that the field is indeed a cstring in Clarion?

Yes the field is definitely a CSTRING.
Weirdest behaviour. I’m not sure if it’s a bug or just me.

Perhaps flailing in the dark here, but are all other table fields appropriately defined in Clarion vs PG.

Yes. It’s definatly the notes in the text box. If I add stuff in code theres no problem. It’s just when I add text and position the curser that it occurs.
The Select(?textbox, len(Mynote)+1) definatly fixes this.