summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas G. Lockhart2000-03-21 06:02:22 +0000
committerThomas G. Lockhart2000-03-21 06:02:22 +0000
commitb688f8f0349c35f391f953b5bffef211472c6f1e (patch)
treee953208e9eee48d63f41b2b8089219be8ea621ff
parentdcdcada7e9d76f8d7a1d04ac7f9184f286f401cd (diff)
Fix query for primary keys to reflect new DISTINCT ON () syntax.
Reported by "Tibor Laszlo" <[email protected]> and fix suggested by "Hiroshi Inoue" <[email protected]>.
-rw-r--r--src/interfaces/odbc/info.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/interfaces/odbc/info.c b/src/interfaces/odbc/info.c
index 4d544d42ce2..9ff52a9309d 100644
--- a/src/interfaces/odbc/info.c
+++ b/src/interfaces/odbc/info.c
@@ -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);