Multi fields primary keys in database manager and editing data

OS info

  • Operating System : Windows 10.0.19041
  • Wappler Version : 3.5.1

Problem description

overwriting every line in database with the same data

Steps to reproduce

  1. change data in one colomn could only get the first line
  2. click save
  3. all posts will change to the same data as the first one. Just for that coloumn.

Debuging of sql call will be added soon.

the database viewer is not using primary key. So if the primary key has several columns thte database viewer isnot using them

Her is the SQL that ruined my database
update timeliste
set tid_inn = ‘2020-11-10 22:03:43’,
km_inn = 99999
where brsted = 1
it should have been
update timeliste
set tid_inn = ‘2020-11-10 22:03:43’,
km_inn = 99999
where brsted = 1
and kunde = 45
and id = 123

What is the primary key of your table?

The primary key is made of 3 coloumns due to connection between 3 tables
those 3 that is in the where clause

I have found out by testing that if the table has severals coloumns the database viewer
is using the field in the primary key that is first in the in the view

example table has following coloumns Date, Id1, id2 and id1 and id2 is the primary key
And the view is id2, id1, date it uses id2 as reference for update
and if the view is id1, id2, date it uses id1 as reference
regardless of the primary key sequence that is id1 as first part of primary key and then id2

If any questions just ask for more info.

We currently support a single field primary keys only - which is actually the best practice anyway.
For the data inline data editing at least.

Will see if we can support multi fields primary keys in the future.