GNOME Bugzilla – Bug 74404
Semicolon causes SQL Window in Gnome-DB to Crash
Last modified: 2009-08-15 18:40:50 UTC
When executing a query in the SQL Window witin Gnome-DB, and the query contains a semi-colon at the end; GNOME-DB or one of its components will have a segmentation fault. -- this query will cause an Error: 1873834392 -- do it again, and it will crash. -- this will consistently happen too select * from sometable; -- this query works select * from table i will attach the backtrace later...
Created attachment 7126 [details] Contains debug info from gdb and backtrace
These two select sql statements will cause the SQL Window to crash as well: select 'one' from sometable select 'two' from sometable Notice, i did not have semicolons this time. 'sometable' is just some arbitrary user table. The actual table I had was very simple: two varchar columns, and it had two rows of little data in it. In Gnome-db 0.2.9x, this would execute all the sql statements, but only the last sql statement's result set would show up in the sql_grid.
oops. Let me clarify. In Gnomedb-fe 0.2.9x, the two queries in a row without a semicolon would have produced a SQL error. What I meant to say: SELECT 'ONE' FROM SOMETABLE; SELECT 'TWO' FROM SOMETABLE; This will execute both queries but the only the result set for the second query will show up in the sql_grid.
Appears to be two problems here: 1. handling of the result from g_strsplit in splitting of SQL Command strings. This is in function process_sql_commands of the postgres provider. 2. error handling - any SQL error will cause a segmentation fault in the error handling of possibly libgda or the postgres provider
Created attachment 7431 [details] [review] Solves the problem