BUFFER-COPY creates record

Posted by James Palmer on 10-Mar-2014 06:56

According to the help on BUFFER-COPY...

Creates a target record if none already exists and executes any applicable CREATE triggers

Is there a way of stopping this with a parameter or something? Other than doing and IF AVAILABLE of course... Pretty sure this didn't use to be the case and we've got a bunch of legacy code that is badly written and is creating rogue records. 

All Replies

Posted by jmls on 10-Mar-2014 07:04

I'm pretty sure that this always used to be the case ;)

What are you wanting to prevent ? The creation or the create triggers ?

What's the use-case for not wanting to create a new record if the target buffer has no record ?

Julian


[collapse]
On 10 March 2014 11:56, James Palmer <bounce-jdpjamesp@community.progress.com> wrote:
Thread created by James Palmer

According to the help on BUFFER-COPY...

Creates a target record if none already exists and executes any applicable CREATE triggers

Is there a way of stopping this with a parameter or something? Other than doing and IF AVAILABLE of course... Pretty sure this didn't use to be the case and we've got a bunch of legacy code that is badly written and is creating rogue records. 

Stop receiving emails on this subject.

Flag this post as spam/abuse.




--
Julian Lyndon-Smith
IT Director,
dot.r
http://www.dotr.com

"The bitterness of poor quality remains long after the sweetness of low price is forgotten”

Follow dot.r on http://twitter.com/DotRlimited
[/collapse]

Posted by James Palmer on 10-Mar-2014 07:36

Thanks for the answer. Don't have a valid use case. Just found a raft of copies that are using the wrong buffer as the target. It creates a record in one table and then buffer copies to a different table. As we explicitly CREATE for buffer copy in normal circumstances the option to just make this code break while we fix all the instances would be nice!

Posted by Brian K. Maher on 10-Mar-2014 07:40

James, please enter an enhancement on the Ideas page.

Posted by James Palmer on 10-Mar-2014 08:00

Thanks Brian.

Posted by Tim Kuehn on 18-Mar-2014 09:05

So you're looking for a SESSION WIDE switch to control buffer-copy's behavior?

Posted by James Palmer on 19-Mar-2014 04:00

That's the sort of thing I was thinking, yes. We've fixed our particular instance of the problem now, but it could have been nasty! :)

Posted by Marian Edu on 19-Mar-2014 04:26

always found misleading the buffer-copy behaviour, it should be either always create the record or expect the record to exists and fail-fast if not... keeping that for backward compatibility only means that there are code that not always behave as expected, very hard to spot the issue and the thing will keep on 'working' till some business user discover there are actually inconsistency in application's data :(

best will be if the compiler could issue warnings for cases like that, then at least one knows have potential issues in code and can go and hunt them down... just because is a 4GL doesn't mean it has to be fault-tolerant ;)

This thread is closed