Subject Re: [IBO] BUG: wrong auto generatd UPDATE SQL queries
Author Geoff Worboys
Just following up on unanswered items...

> INSERT INTO CONTATTI_U_CATEGORIE(
> CATEGORIA_ID, /*PK*/
> CONTATTO_ID, /*PK*) [----- error!!!]
> VALUES (
> :CATEGORIA_ID,
> :CONTATTO_ID)
<...>
> UPDATE CONTATTI_U_CATEGORIE SE [----- error!!!]
> [----- error!!!]
> WHERE
> CATEGORIA_ID= :OLD_CATEGORIA_ID AND
> CONTATTO_ID= :OLD_CONTATTO_ID

Yes I can see where this is happening - even in 3.6.D
The code was obviously not expecting an insert/update that only
contained key fields.

In the update sql the removal of the 'T' from 'SET' is obviously
wrong. However the addition of a key field in to the updated fields
list is not something I think is appropriate for automation. Updating
key fields in update SQL is not something to be expected and I think
the user should have to enter such requirements themselves.

eg. You said...
> Instead of:
>
> UPDATE CONTATTI_U_CATEGORIE SET
> CATEGORIA_ID = :CATEGORIA_ID
> WHERE
> CATEGORIA_ID= :OLD_CATEGORIA_ID AND
> CONTATTO_ID= :OLD_CONTATTO_ID

but how is automation to know that it should not produce any one of
these three alternatives...

UPDATE CONTATTI_U_CATEGORIE SET
CATEGORIA_ID = :CATEGORIA_ID
WHERE
CATEGORIA_ID = :OLD_CATEGORIA_ID AND
CONTATTO_ID = :OLD_CONTATTO_ID

UPDATE CONTATTI_U_CATEGORIE SET
CONTATTO_ID = :CONTATTO_ID
WHERE
CATEGORIA_ID = :OLD_CATEGORIA_ID AND
CONTATTO_ID = :OLD_CONTATTO_ID

UPDATE CONTATTI_U_CATEGORIE SET
CATEGORIA_ID = :CATEGORIA_ID
CONTATTO_ID = :CONTATTO_ID
WHERE
CATEGORIA_ID= :OLD_CATEGORIA_ID AND
CONTATTO_ID= :OLD_CONTATTO_ID


Geoff Worboys
Telesis Computing