Permalink
Browse files

Don't report a column as missing when its type is not visible.

  • Loading branch information...
theory committed Jan 24, 2013
1 parent 870d1ba commit f6fb778e9bcb3800b61278ad915dd5da5932b3b9
Showing with 15 additions and 2 deletions.
  1. +2 −0 Changes
  2. +12 −0 sql/pgtap--0.92.0--0.93.0.sql
  3. +1 −2 sql/pgtap.sql.in
View
@@ -9,6 +9,8 @@ Revision history for pgTAP
the schema name is not specified.
* Fixed constraint- and trigger-checking functions so that they only look at
tables visible in the search path unles the schema is specified.
+* Fixed `col_type_is()` so that it won't report the column as not existing
+ when the column's data type is not in the search path.
0.92.0 2013-01-16T00:41:07Z
---------------------------
@@ -129,3 +129,15 @@ RETURNS BOOLEAN AS $$
AND pg_catalog.pg_table_is_visible(c.oid)
);
$$ LANGUAGE SQL;
+
+CREATE OR REPLACE FUNCTION _get_col_type ( NAME, NAME )
+RETURNS TEXT AS $$
+ SELECT display_type(a.atttypid, a.atttypmod)
+ FROM pg_catalog.pg_attribute a
+ JOIN pg_catalog.pg_class c ON a.attrelid = c.oid
+ WHERE pg_catalog.pg_table_is_visible(c.oid)
+ AND c.relname = $1
+ AND a.attname = $2
+ AND attnum > 0
+ AND NOT a.attisdropped
+$$ LANGUAGE SQL;
View
@@ -1253,12 +1253,11 @@ RETURNS TEXT AS $$
SELECT display_type(a.atttypid, a.atttypmod)
FROM pg_catalog.pg_attribute a
JOIN pg_catalog.pg_class c ON a.attrelid = c.oid
- WHERE pg_table_is_visible(c.oid)
+ WHERE pg_catalog.pg_table_is_visible(c.oid)
AND c.relname = $1
AND a.attname = $2
AND attnum > 0
AND NOT a.attisdropped
- AND pg_type_is_visible(a.atttypid)
$$ LANGUAGE SQL;
CREATE OR REPLACE FUNCTION _get_col_ns_type ( NAME, NAME, NAME )

0 comments on commit f6fb778

Please sign in to comment.