You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a trigger on an articles_ft table that contains several blobs:
CREATE OR ALTER TRIGGER ARTICLE_FT_BEFORE_INSERT_UPDATE
ACTIVE BEFORE INSERT ORUPDATEON ARTICLE_FT POSITION 0
EXTERNAL NAME 'udrbouz!article_ft' ENGINE UDR;
The udr function is written in Pascal. Its role is to fill a small blob (< 64Kb) in the article_ft table.
Everything works on the udr side.
And my table is updated correctly.
Permanent BLOBs have permanent BLOB IDs. If you see temporary IDs then something is wrong with your application or trigger. And even for permanent BLOBs it is a requirement to open them in the same transactions that received the ID because stability of BLOBs between transactions is not guaranteed in any Firebird version.
On the application side, when I write my blob to a table, I initially get an id with gds_quad_high = 0, which means that in this transaction it is considered temporary. However, after a commit, its id changes to a value <> 0.
On the application side, when I write my blob to a table, I initially get an id with gds_quad_high = 0, which means that in this transaction it is considered temporary. However, after a commit, its id changes to a value <> 0.
Engine materialize (make permanent) blob when it is assigned to the some table, i.e. when blob id of new blob (temporary of course) is assigned to the some field in INSERT or UPDATE statement. When later you SELECT that blob field value, engine returns permanent blob id.
This isn't the case on the UDR side, where the ID with gds_quad_high=0 remains even after commit. I don't know how to make it permanent.
Indeed I solved my problem with a trigger as follows:
create or alter trigger ARTICLE_FT_BEFORE_INSERT_UPDATE for ARTICLE_FT
active before insert orupdate position 0asbeginnew.FT0= FILL_ART_FT_BLOB(new.CODEART);
end
I use a udr function as follows:
create or alter function FILL_ART_FT_BLOB (
ACODEART integer)
returns SMALLBLOB
external NAME 'udrbouz!splitblob' engine UDR
my problem is solved.
Thank you very much for your help
Activity
aafemt commentedon Aug 3, 2025
If you get this error on temporary BLOB, most likely you try to open it in a different transaction.
zifou1958 commentedon Aug 3, 2025
I am using Firebird version 5.0.3.1693
zifou1958 commentedon Aug 3, 2025
My trigger permanently saves the bob in the article_ft table.
And therefore, it's normal to read the table in a new transaction.
aafemt commentedon Aug 3, 2025
Permanent BLOBs have permanent BLOB IDs. If you see temporary IDs then something is wrong with your application or trigger. And even for permanent BLOBs it is a requirement to open them in the same transactions that received the ID because stability of BLOBs between transactions is not guaranteed in any Firebird version.
zifou1958 commentedon Aug 3, 2025
Here are the functions I use to save the blob:
zifou1958 commentedon Aug 3, 2025
On the application side, when I write my blob to a table, I initially get an id with gds_quad_high = 0, which means that in this transaction it is considered temporary. However, after a commit, its id changes to a value <> 0.
zifou1958 commentedon Aug 3, 2025
This isn't the case on the UDR side, where the ID with gds_quad_high=0 remains even after commit.
I don't know how to make it permanent.
hvlad commentedon Aug 3, 2025
Engine materialize (make permanent) blob when it is assigned to the some table, i.e. when blob id of new blob (temporary of course) is assigned to the some field in INSERT or UPDATE statement. When later you SELECT that blob field value, engine returns permanent blob id.
So, how do you assign blob id in your trigger ?
hvlad commentedon Aug 3, 2025
I mean - how do you assign id of new blob into the NEW message in external trigger ?
zifou1958 commentedon Aug 4, 2025
Indeed I solved my problem with a trigger as follows:
I use a udr function as follows:
my problem is solved.
Thank you very much for your help
zifou1958 commentedon Aug 4, 2025
Here is a summary implementation of my trigger in Pascal.
mrotteveel commentedon Aug 4, 2025
I'm going to move this to discussions.