--
-- database abstraction layer on system catalog for postgresql 7.3
--
-- If your database setup is using a default table prefix, add it
-- to the name of the view, e.g. 'prefix_drupal_system_catalog'.
--
-- DROP VIEW drupal_system_catalog;

CREATE VIEW drupal_system_catalog (
  dbname,
  tabname,
  colname,
  coltype,
  colnull,
  coldefault,
  colextra
) AS
SELECT
  pg_tables.tableowner,
  pg_class.relname,
  pg_attribute.attname,
  pg_type.typname,
  pg_attribute.attnotnull,
  pg_attribute.atthasdef,
  pg_attribute.attnum
FROM
  pg_type,
  pg_attribute,
  pg_class,
  pg_tables
WHERE
    pg_attribute.attnum > 0
and pg_attribute.atttypid = pg_type.oid
and pg_attribute.attrelid = pg_class.oid
and pg_class.relname = pg_tables.tablename
and pg_tables.tableowner NOT IN ( 'postgres', 'pgsql' )
;

