Please be aware that the content in SAP SQL Anywhere Forum will be migrated to the SAP Community in June and this forum will be retired.

Hi,

There is the Locks During Deletes section in the docs, but it lacks info about triggers. I need a confirmation about row-level BEFORE DELETE trigger firing time: does it fire just after write lock is acquired on the row to be deleted?

It would be great if this info was added to that docs section.

Thanks.

P. s.: sections Locks During Inserts and Locks During Updates are missing info about BEFORE triggers too.

asked 05 Oct '21, 04:35

Arthoor's gravatar image

Arthoor
1.3k355266
accept rate: 11%

edited 05 Oct '21, 05:47

2

AFAIK a connection will obtain all necessary locks to permit a SQL operation before any part of that operation is processed.

It would make no sense to allow any part of a trigger to start executing before some other connection obtained a conflicting lock that blocks the lock this connection needs.

Having said that, a statement in the docs (or an example) would be nice.

(05 Oct '21, 08:29) Breck Carter

FWIW, here's an old posting by Glenn Paulley with detailed insights (as expected...) on the internal steps a trigger has to consider - cf. that old NNTP article "Before update trigger and computed column ".

Sigh, the old link does not work currently, the following might help:

https://sybase.public.sqlanywhere.general.narkive.com/ZWtL2C7m/before-update-trigger-and-computed-column


Note: It does not tell about locks but shows when the different kind of triggers are fired, in this case for INSERT. As Breck has stated, apparently locks must be placed before any data is modified, including the trigger's action.

(05 Oct '21, 09:25) Volker Barth
Be the first one to answer this question!
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×93
×79
×21

question asked: 05 Oct '21, 04:35

question was seen: 643 times

last updated: 05 Oct '21, 09:34