Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit b688f8f

Browse files
author
Thomas G. Lockhart
committed
Fix query for primary keys to reflect new DISTINCT ON () syntax.
Reported by "Tibor Laszlo" <ltibor@mail.tiszanet.hu> and fix suggested by "Hiroshi Inoue" <Inoue@tpf.co.jp>.
1 parent dcdcada commit b688f8f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/interfaces/odbc/info.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -2135,7 +2135,7 @@ Int2 result_cols;
21352135
return SQL_ERROR;
21362136
}
21372137

2138-
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);
2138+
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);
21392139

21402140
mylog("SQLPrimaryKeys: tables_query='%s'\n", tables_query);
21412141

0 commit comments

Comments
 (0)