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

Nick Gorham nick.gorham at easysoft.com
Thu Feb 24 20:13:58 GMT 2005


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 ?

-- 
Nick



More information about the unixODBC-support mailing list