From 6b1a27a09b8eb0612df534099f976f558da457d1 Mon Sep 17 00:00:00 2001 From: Dave Page Date: Fri, 6 Dec 2002 14:07:06 +0000 Subject: [PATCH] Ignore dropped columns for 7.3 databases. --- info.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/info.c b/info.c index 9db0804..ea0d483 100644 --- a/info.c +++ b/info.c @@ -1665,7 +1665,7 @@ PGAPI_Columns( ", t.typname, a.attnum, a.attlen, %s, a.attnotnull, c.relhasrules" " from pg_namespace u, pg_class c, pg_attribute a, pg_type t" " where u.oid = c.relnamespace" - " and c.oid= a.attrelid and a.atttypid = t.oid and (a.attnum > 0)", + " and c.oid= a.attrelid and a.atttypid = t.oid and (a.attnum > 0) and not(attisdropped)", "a.atttypmod"); else sprintf(columns_query, "select u.usename, c.relname, a.attname, a.atttypid" @@ -2898,6 +2898,8 @@ PGAPI_PrimaryKeys( " AND ia.attrelid = i.indexrelid" " AND ta.attrelid = i.indrelid" " AND ta.attnum = i.indkey[ia.attnum-1]" + " AND NOT(ta.attisdropped)" + " AND NOT(ia.attisdropped)" " order by ia.attnum", pktab, pkscm); else sprintf(tables_query, "select ta.attname, ia.attnum" @@ -2925,6 +2927,8 @@ PGAPI_PrimaryKeys( " AND ia.attrelid = i.indexrelid" " AND ta.attrelid = i.indrelid" " AND ta.attnum = i.indkey[ia.attnum-1]" + " AND NOT(ta.attisdropped)" + " AND NOT(ia.attisdropped)" " order by ia.attnum", pktab, pkscm); else sprintf(tables_query, "select ta.attname, ia.attnum" @@ -3119,7 +3123,7 @@ getClientColumnName(ConnectionClass *conn, const char * serverSchemaName, const if (conn->schema_support) sprintf(query, "select attrelid, attnum from pg_class, pg_attribute " "where relname = '%s' and attrelid = pg_class.oid " - "and attname = '%s' and pg_namespace.oid = relnamespace and pg_namespace.nspname = '%s'", serverTableName, serverColumnName, serverSchemaName); + "and attname = '%s' and pg_namespace.oid = relnamespace and pg_namespace.nspname = '%s' and not(attisdropped)", serverTableName, serverColumnName, serverSchemaName); else sprintf(query, "select attrelid, attnum from pg_class, pg_attribute " "where relname = '%s' and attrelid = pg_class.oid " -- 2.39.5