Re: bug in info.c file - incorrect SQL - Mailing list pgsql-odbc

From Jim Holliday
Subject Re: bug in info.c file - incorrect SQL
Date
Msg-id 56510AAEF435D240958D1CE8C6B1770AE09401@mailc03.aurigin.com
Whole thread Raw
Responses Re: bug in info.c file - incorrect SQL
Re: bug in info.c file - incorrect SQL
List pgsql-odbc
For the ODBC driver psqlodbc.dll version 7.02.0003 there is an error in
the info.c.  In 2 places the SQL contains an alias in the FROM clause
for the pg_namespace table and then references the table in the where
clause.  The below cut from the info.c file should replace all instances
on pg_namespace. in the where clause with pn.

    This should be done in both places.
    I modified this code, but was unable to compile a new version of
the odbc driver.
     
    When you re-compile, could you reply email to me please.
    Thanks
     
    >    sprintf(tables_query, "SELECT pt.tgargs, "
    >     "  pt.tgnargs, "
    >     "  pt.tgdeferrable, "
    >     "  pt.tginitdeferred, "
    >     "  pp1.proname, "
    >     "  pp2.proname, "
    >     "  pc.oid, "
    >     "  pc1.oid, "
    >     "  pc1.relname, "
    >     "  pn.nspname "
    >     "FROM pg_class pc, "
    >     "  pg_proc pp1, "
    >     "  pg_proc pp2, "
    >     "  pg_trigger pt1, "
    >     "  pg_trigger pt2, "
    >     "  pg_proc pp, "
    >     "  pg_trigger pt, "
    >     "  pg_class pc1, "
    >     "  pg_namespace pn "
    >     "WHERE pt.tgrelid = pc.oid "
    >     "AND pp.oid = pt.tgfoid "
    >     "AND pt1.tgconstrrelid = pc.oid "
    >     "AND pp1.oid = pt1.tgfoid "
    >     "AND pt2.tgfoid = pp2.oid "
    >     "AND pt2.tgconstrrelid = pc.oid "
    >     "AND ((pc.relname='%s') "
    >     "AND (pg_namespace.oid = pc.relnamespace) "
    >     "AND (pg_namespace.nspname = '%s') "
    >     "AND (pp.proname LIKE '%%ins') "
    >     "AND (pp1.proname LIKE '%%upd') "
    >     "AND (pp2.proname LIKE '%%del') "
    >     "AND (pt1.tgrelid=pt.tgconstrrelid) "
    >     "AND (pt1.tgconstrname=pt.tgconstrname) "
    >     "AND (pt2.tgrelid=pt.tgconstrrelid) "
    >     "AND (pt2.tgconstrname=pt.tgconstrname) "
    >     "AND (pt.tgconstrrelid=pc1.oid) "
    >     "AND (pc1.relnamespace=pn.oid))",
    >     fk_table_needed, schema_needed);
    >   }
    


Attachment

pgsql-odbc by date:

Previous
From: jaydip rathod
Date:
Subject: help
Next
From: "William S. Bear"
Date:
Subject: datetime to timestamp