[unixODBC-support] missing semicolon in query generated of postgresql SQLForeignKeys() ?

Paul Novorolsky paul.novorolsky at base2capital.com
Thu Feb 24 20:21:17 GMT 2005

Hi Nick,
Thanks for the followup. Forgive my naivete, but I'm not sure what's 
involved with changing postgres drivers. Is it an upgrade to postgresql, 
or is the ODBC driver interchangeable?


Nick Gorham wrote:

> Paul Novorolsky wrote:
>> Please be tolerant if I'm in the wrong place for this, but I've 
>> scoured the web looking for a FAQ or some other indication of what 
>> could be wrong here. I'm not exactly a DB or ODBC guru, and I just 
>> recently set up postgresql and unixODBC under Redhat.
>> I'm running unixODBC 2.2.8-2 and postgreSQL 6.3.6-RH, which are the 
>> versions supplied with my version of Redhat.
>> What I'm trying to do is make use of the ability to query the 
>> database structure in C++, specifically the relationships between the 
>> tables using SQLForeignKeys(). The command succeeds, but returns no 
>> data (SQLFetch returns SQL_NO_DATA)
>> I am also unable to get any results back from SQLPrimaryKeys().
>> For SQLPrimaryKeys, my call is: SQLPrimary(hstmt, 0, 0, NULL, 0, 
>> (SQLCHAR *)tableName, SQL_NTS);
>> and SQLForeignKeys(hstmt, NULL, 0, NULL, 0, NULL, 0, NULL, 0, NULL, 
>> 0, (SQLCHAR *)tableName, SQL_NTS);
>> The command executes OK (returns SQL_SUCCESS), but results in no 
>> data. I tried using DataManager, and odbctest with similar results.
>> I enabled the trace logging on postgreSQL, and found that the SQL 
>> statements that are generated to fulfill these requests. For each 
>> attempt at either SQLForeignKeys() or SQLPrimaryKeys(), I see the SQL 
>> statement logged, but without a semicolon  terminator to the query. 
>> Executing these SQL statements by hand does select the attributes I 
>> am interested in. (So I know that the relationships exist, and can be 
>> queried.)
>> Is this likely to be my problem? If so, is there some way  to 
>> configure unixODBC to terminate these queries with a semicolon?
>> Is there any other advice anyone has to offer on how I might be able 
>> to get this to work?
>> Thanks in advance...
> Maybe worth trying a different postgres driver ?

More information about the unixODBC-support mailing list