Sv: Exclude and DoWork
Daniel Sananes
daniel.s at kopparbergs.se
Fri Mar 10 13:59:47 UTC 2023
Hi
I found this about $excludefrominsert when investigating how to make postgres autoincrement my primary key user_id.
I cannot get that to work. Does it only work if you use the built-in $insert()?
In my overridden table $insert I have this instead:
Calculate lInsertString as $cinst.$insertnames()
Calculate lString as con('@[$cinst.',iPKname,']')
Calculate lInsertString as replace(lInsertString,lString,'DEFAULT')
It replaces the primary key value with DEFAULT. This excludes it and makes postgres assign a new number.
So the string will be:
("user_id","user_name","user_password","user_short") VALUES (DEFAULT,@[$cinst.user_name],@[$cinst.user_password])
Instead of:
("user_id","user_name","user_password","user_short") VALUES (@[$cinst.user_id],@[$cinst.user_name],@[$cinst.user_password])
Regards
Daniel
-----Ursprungligt meddelande-----
Från: omnisdev-en <omnisdev-en-bounces at lists.omnis-dev.com> För IT
Skickat: den 1 augusti 2022 08:22
Till: OmnisDev List - English <omnisdev-en at lists.omnis-dev.com>
Ämne: Re: Exclude and DoWork
Hi Das,
Of course, it works.
Check your code to ensure is OK. I’m excluding from insert and from update my primaries keys in the table superclass and is working always.
Do $cinst.$cols.$sendall($ref.$excludefrominsert.$assign(kTrue);pos('_PK';$ref.$name)>0)
Do $cinst.$cols.$sendall($ref.$excludefromupdate.$assign(kTrue);pos('_PK';$ref.$name)>0)
> El 26 jul 2022, a las 20:51, Das Goravani <goravanis at gmail.com> escribió:
>
>
> Does anyone know for sure whether or not
>
> $excludefrominsert
>
> Definitely works on the $dowork and $doinserts() commands?
>
> I once did the two together and got a duplicate unique value exception when I tried to do the dowork command.
>
> Postgres was choking on the fact that the PK column WAS being included though I issued the exclude from command.
>
> That’s how I remember it, it was awhile ago, so I thought I’d ask the opinion of others.
>
>
> _____________________________________________________________
> Manage your list subscriptions at https://lists.omnis-dev.com Start a
> new message -> mailto:omnisdev-en at lists.omnis-dev.com
_____________________________________________________________
Manage your list subscriptions at https://lists.omnis-dev.com Start a new message -> mailto:omnisdev-en at lists.omnis-dev.com
VARNING: Det här e-postmeddelandet kommer från en extern avsändare. KLICKA INTE på länkar eller bilagor om du inte känner igen avsändaren och vet att innehållet är säkert.
More information about the omnisdev-en
mailing list