You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Change form of query which used "DISTINCT ON" to help support primary keys.
We still have an internal limit in the ODBC code of 8 columns per key,
but this should lay the groundwork for resolving that.
Includes reformulated query from Tom Lane.
sprintf(index_query, "select c.relname, i.indkey, i.indisunique, i.indisclustered, c.relhasrules from pg_index i, pg_class c, pg_class d where c.oid = i.indexrelid and d.relname = '%s' and d.oid = i.indrelid",
* Retrieve the primary key columns for the specified table.
2071
+
*/
2065
2072
RETCODESQL_APISQLPrimaryKeys(
2066
2073
HSTMThstmt,
2067
2074
UCHARFAR*szTableQualifier,
@@ -2135,7 +2142,23 @@ Int2 result_cols;
2135
2142
returnSQL_ERROR;
2136
2143
}
2137
2144
2145
+
#if0
2138
2146
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);
// I have to hide the table owner from Access, otherwise it
2170
-
// insists on referring to the table as 'owner.table'.
2171
-
// (this is valid according to the ODBC SQL grammar, but
2172
-
// Postgres won't support it.)
2173
-
2192
+
/* I have to hide the table owner from Access, otherwise it
2193
+
* insists on referring to the table as 'owner.table'.
2194
+
* (this is valid according to the ODBC SQL grammar, but
2195
+
* Postgres won't support it.)
2196
+
*/
2174
2197
set_tuplefield_string(&row->tuple[1], "");
2175
2198
set_tuplefield_string(&row->tuple[2], pktab);
2176
2199
set_tuplefield_string(&row->tuple[3], attname);
@@ -2312,8 +2335,11 @@ Int2 result_cols;
2312
2335
*/
2313
2336
if (fktab[0] !='\0') {
2314
2337
2315
-
sprintf(tables_query, "select pg_trigger.tgargs, pg_trigger.tgnargs, pg_trigger.tgname from pg_proc, pg_trigger, pg_class where pg_proc.oid = pg_trigger.tgfoid and pg_trigger.tgrelid = pg_class.oid AND pg_proc.proname = 'check_primary_key' AND pg_class.relname = '%s'",
0 commit comments