Sample Header Ad - 728x90

dbeaver check sql for syntax without running

4 votes
1 answer
5810 views
Using the dbeaver tool, I want to check a script for syntax errors without actually running it. Purpose: For a long insert query (postgresql syntax, PostgreSQL 10.15) in the form of: INSERT INTO schema1.table1 (t1_id, fk1_id, fk_2_id, col1, col2) VALUES (nextval('schema1.sq_table1'), fk1_id_1, fk1_id_2,col1_val_1, col1_val_2), -- etc, literally thousands of lines I cannot run the prod-version of the query in a not-prod region, because the foreign keys are different. So is there a way to just check the SQL's syntax without running it. It throws foreign key constraint errors in the not-prod region, so I think that verifies the syntax, but I'd like to be doubly sure. As per comment below, I think for the case here (insert with foreign-key), a foreign-key-violation-error would verify the syntax, but there is still the general case: Is it possible to **verify the syntax of the SQL query without actually running it**? I would think that there are probably several cases that this would be useful.
Asked by JosephDoggie (203 rep)
Aug 5, 2021, 03:53 PM
Last activity: Jan 31, 2023, 05:26 AM