Thread: ODBC - adding missing FROM clause entry

ODBC - adding missing FROM clause entry

From
Martin_Hurst@dom.com
Date:
I'm getting this message when I connect from my Win95 pc to my Linux server
running postgres 7.3.
I'm using the latest postgres odbc driver to connect.

The Win95 connection can see and list the tables on the Linux server, but
when I try to open and display the rows, the interface hangs and freezes.

Thanks, for any help and feedback.
-Martin

-------------------------------------------------------

Notice: Adding missing FROM - clause entry for table "pg_namespace"



Re: ODBC - adding missing FROM clause entry

From
Bruce Momjian
Date:
Martin_Hurst@dom.com wrote:
> I'm getting this message when I connect from my Win95 pc to my Linux server
> running postgres 7.3.
> I'm using the latest postgres odbc driver to connect.

I just fixed this in ODBC today:

    ODBC - adding missing FROM clause entry

The next release of ODBC will have the fix.  The message will not affect
your server.

> The Win95 connection can see and list the tables on the Linux server, but
> when I try to open and display the rows, the interface hangs and freezes.

Oh, seems it does affect you.  ODBC patch attached.

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073
Index: info.c
===================================================================
RCS file: /usr/local/cvsroot/psqlodbc/psqlodbc/info.c,v
retrieving revision 1.90
diff -c -c -r1.90 info.c
*** info.c    2 Jan 2003 15:33:19 -0000    1.90
--- info.c    2 Jan 2003 22:22:43 -0000
***************
*** 1668,1674 ****
              " from pg_namespace u, pg_class c, pg_attribute a, pg_type t"
              " where u.oid = c.relnamespace"
              " and (not a.attisdropped)"
!       " and c.oid= a.attrelid and a.atttypid = t.oid and (a.attnum > 0)",
              "a.atttypmod");
      else
          sprintf(columns_query, "select u.usename, c.relname, a.attname, a.atttypid"
--- 1668,1674 ----
              " from pg_namespace u, pg_class c, pg_attribute a, pg_type t"
              " where u.oid = c.relnamespace"
              " and (not a.attisdropped)"
!             " and c.oid= a.attrelid and a.atttypid = t.oid and (a.attnum > 0)",
              "a.atttypmod");
      else
          sprintf(columns_query, "select u.usename, c.relname, a.attname, a.atttypid"
***************
*** 3087,3093 ****
      if (!bError && continueExec)
      {
          if (conn->schema_support)
!             sprintf(query, "select OID from pg_class where relname = '%s' and pg_namespace.oid = relnamespace and
pg_namespace.nspname= '%s'", serverTableName, serverSchemaName); 
          else
              sprintf(query, "select OID from pg_class where relname = '%s'", serverTableName);
          if (res = CC_send_query(conn, query, NULL, CLEAR_RESULT_ON_ABORT), res)
--- 3087,3093 ----
      if (!bError && continueExec)
      {
          if (conn->schema_support)
!             sprintf(query, "select OID from pg_class, pg_namespace where relname = '%s' and pg_namespace.oid =
relnamespaceand pg_namespace.nspname = '%s'", serverTableName, serverSchemaName); 
          else
              sprintf(query, "select OID from pg_class where relname = '%s'", serverTableName);
          if (res = CC_send_query(conn, query, NULL, CLEAR_RESULT_ON_ABORT), res)
***************
*** 3154,3160 ****
      if (!bError && continueExec)
      {
          if (conn->schema_support)
!             sprintf(query, "select attrelid, attnum from pg_class, pg_attribute "
                  "where relname = '%s' and attrelid = pg_class.oid "
                  "and (not attisdropped) "
                  "and attname = '%s' and pg_namespace.oid = relnamespace and pg_namespace.nspname = '%s'",
serverTableName,serverColumnName, serverSchemaName); 
--- 3154,3160 ----
      if (!bError && continueExec)
      {
          if (conn->schema_support)
!             sprintf(query, "select attrelid, attnum from pg_class, pg_attribute, pg_namespace "
                  "where relname = '%s' and attrelid = pg_class.oid "
                  "and (not attisdropped) "
                  "and attname = '%s' and pg_namespace.oid = relnamespace and pg_namespace.nspname = '%s'",
serverTableName,serverColumnName, serverSchemaName); 
***************
*** 3449,3456 ****
                  "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') "
--- 3449,3456 ----
                  "AND pt2.tgfoid = pp2.oid "
                  "AND pt2.tgconstrrelid = pc.oid "
                  "AND ((pc.relname='%s') "
!                 "AND (pn.oid = pc.relnamespace) "
!                 "AND (pn.nspname = '%s') "
                  "AND (pp.proname LIKE '%%ins') "
                  "AND (pp1.proname LIKE '%%upd') "
                  "AND (pp2.proname LIKE '%%del') "
***************
*** 3826,3833 ****
                  "    AND pc2.oid = pt.tgrelid "
                  "    AND ("
                  "         (pc.relname='%s') "
!                 "    AND  (pg_namespace.oid = pc.relnamespace) "
!                 "    AND  (pg_namespace.nspname = '%s') "
                  "    AND  (pp.proname Like '%%upd') "
                  "    AND  (pp1.proname Like '%%del')"
                  "    AND     (pt1.tgrelid = pt.tgconstrrelid) "
--- 3826,3833 ----
                  "    AND pc2.oid = pt.tgrelid "
                  "    AND ("
                  "         (pc.relname='%s') "
!                 "    AND  (pn.oid = pc.relnamespace) "
!                 "    AND  (pn.nspname = '%s') "
                  "    AND  (pp.proname Like '%%upd') "
                  "    AND  (pp1.proname Like '%%del')"
                  "    AND     (pt1.tgrelid = pt.tgconstrrelid) "