SUMMARY Connecting to a PostgreSQL database I can run SELECT queries without any issue, but trying to run ALTER TABLE queries fails with error ``` ERROR: syntax error at or near "ALTER" LINE 1: PREPARE qpsqlpstmt_7 AS ALTER TABLE ... ^ (42601) QPSQL: Unable to prepare statement ``` I looked the issue up on Qt and some are reporting that when using QPSQL Alter Table statements need to be run without preparing them first (hence, I suppose, the 'Unable to prepare statement' bit). The action within Kate of preparing the statement seems to be inbuilt, but it limits the types of statements that can be run. STEPS TO REPRODUCE 1. Ensure SQL Plugin is enabled 2. Connect to a PostgreSQL database using QPSQL 3. Run a normal SELECT statement to ensure the connection is working 4. Run an ALTER TABLE statement OBSERVED RESULT (see error message above) EXPECTED RESULT It should run the SQL as is. SOFTWARE/OS VERSIONS Linux/KDE Plasma: KDE Plasma Version: 6.2.4 KDE Frameworks Version: 6.8.0 Qt Version: 6.8.1 ADDITIONAL INFORMATION
At the moment nobody really takes care of the SQL plugin, a patch to solve this would be welcome.
A possibly relevant merge request was started @ https://invent.kde.org/utilities/kate/-/merge_requests/1691
Git commit 686aa9225378f3317f887f1e7b7f9f108ab8d416 by Christoph Cullmann, on behalf of Waqar Ahmed. Committed on 16/01/2025 at 20:38. Pushed by cullmann into branch 'master'. Allow ignoring QSqlQuery prepare failure M +15 -5 addons/katesql/sqlmanager.cpp https://invent.kde.org/utilities/kate/-/commit/686aa9225378f3317f887f1e7b7f9f108ab8d416
Git commit 30bac820cb1bfa435f0419039a914caecdcdfe95 by Waqar Ahmed. Committed on 28/01/2025 at 05:34. Pushed by waqar into branch 'release/24.12'. Allow ignoring QSqlQuery prepare failure M +15 -5 addons/katesql/sqlmanager.cpp https://invent.kde.org/utilities/kate/-/commit/30bac820cb1bfa435f0419039a914caecdcdfe95