DBeaver @include using a variable for filename not working
2
votes
1
answer
59
views
I am trying to write a script to run in DBeaver (Version 24.0.0) it determines what schema update scripts to run based on a table in the database that records the schema updates already run. It then tries to use the dbeaver @include to run the needed update scripts.
It looks something like:
**
**@set db_dir = ''
do $$
DECLARE
file upgrade_file%ROWTYPE;
file_location text;
BEGIN
FOR file in (select * from upgrade_files) loop
file_location = ${db_dir} ||file.filename;
raise info 'file: %', file_location;
@include ${file_location}
end loop;
end $$**;
**
If I run this I get "Syntax error at or near @".If I comment out the @include statement in the for loop it runs fine and prints out the correct filenames, including path, to be run. Any help figuring out what I am doing wrong or another approach would be appreciated.
Asked by Sarah Holley
(21 rep)
Jun 26, 2025, 05:09 PM
Last activity: Jun 26, 2025, 05:49 PM
Last activity: Jun 26, 2025, 05:49 PM