Fix query for primary keys to reflect new DISTINCT ON () syntax.
authorThomas G. Lockhart
Tue, 21 Mar 2000 06:02:22 +0000 (06:02 +0000)
committerThomas G. Lockhart
Tue, 21 Mar 2000 06:02:22 +0000 (06:02 +0000)
Reported by "Tibor Laszlo"  and fix suggested by
 "Hiroshi Inoue" .

src/interfaces/odbc/info.c

index 4d544d42ce27b219db3654d89d3f1882a684e927..9ff52a9309db672b07550754f04a1900329e95be 100644 (file)
@@ -2135,7 +2135,7 @@ Int2 result_cols;
        return SQL_ERROR;
    }
 
-   sprintf(tables_query, "select distinct on attnum a2.attname, a2.attnum from pg_attribute a1, pg_attribute a2, pg_class c, pg_index i where c.relname = '%s_pkey' AND c.oid = i.indexrelid AND a1.attrelid = c.oid AND a2.attrelid = c.oid AND (i.indkey[0] = a1.attnum OR i.indkey[1] = a1.attnum OR i.indkey[2] = a1.attnum OR i.indkey[3] = a1.attnum OR i.indkey[4] = a1.attnum OR i.indkey[5] = a1.attnum OR i.indkey[6] = a1.attnum OR i.indkey[7] = a1.attnum) order by a2.attnum", pktab);
+   sprintf(tables_query, "select distinct on (attnum) a2.attname, a2.attnum from pg_attribute a1, pg_attribute a2, pg_class c, pg_index i where c.relname = '%s_pkey' AND c.oid = i.indexrelid AND a1.attrelid = c.oid AND a2.attrelid = c.oid AND (i.indkey[0] = a1.attnum OR i.indkey[1] = a1.attnum OR i.indkey[2] = a1.attnum OR i.indkey[3] = a1.attnum OR i.indkey[4] = a1.attnum OR i.indkey[5] = a1.attnum OR i.indkey[6] = a1.attnum OR i.indkey[7] = a1.attnum) order by a2.attnum", pktab);
 
    mylog("SQLPrimaryKeys: tables_query='%s'\n", tables_query);