http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54214
--- Comment #15 from Denis Kolesnik <lirex.software at gmail dot com> 2012-08-19 00:45:56 UTC --- (In reply to comment #13) > This line contains a bug: > > strcpy(SQL1,"select id, ' ', regexp_replace(str_last_name,' ','') as lastname, > ' ', regexp_replace(str_first_name,' ','') as firstname, ' ', age(dt_birth) as > age from tbl_owners_individual;"); > > SQL1 only has capacity for 150 chars, but you write more than 170 to it. This > is a serious bug in your program (not in GCC or postgresql). > > When you use the "order by" clause you write even more characters to the > array, > which is still a bug. > > Either learn to use dynamically-allocated memory or ensure your arrays are big > enough to hold the strings you write to them. > > This is the same issue as PR 54180 > > *** This bug has been marked as a duplicate of bug 54180 *** now my CHAR SQL1[350] as you see is 350 characters long, but the problem is the same: if I choose a field from the combobox with the id 1 in the database table the second query, which also ends with the clause "...order by str_last_name..." returns the field with the id 111(if I remember correct), but should with 1.