eZPublish  3.9
ezpgsqlschema.php File Reference

Classes

class  eZPgsqlSchema
 Handles schemas for PostgreSQL. More...
 

Variables

const FETCH_INDEX_COL_NAMES_QUERY <<<END SELECT a.attnum, a.attname FROM pg_catalog.pg_attribute a WHERE a.attrelid = '<<indexrelid>>' AND a.attnum IN (<<attids>>) AND NOT a.attisdropped ORDER BY a.attnum END
 
const FETCH_INDEX_DEF_QUERY <<<END SELECT c.relname, i.* FROM pg_catalog.pg_index i, pg_catalog.pg_class c WHERE indrelid = '<<oid>>' AND i.indexrelid = c.oid END
 
const FETCH_TABLE_DEF_QUERY <<<END SELECT a.attname, pg_catalog.format_type(a.atttypid, a.atttypmod), (SELECT substring(d.adsrc for 128) FROM pg_catalog.pg_attrdef d WHERE d.adrelid = a.attrelid AND d.adnum = a.attnum AND a.atthasdef) as default, a.attnotnull, a.attnum FROM pg_catalog.pg_attribute a WHERE a.attrelid = '<<oid>>' AND a.attnum > 0 AND NOT a.attisdropped ORDER BY a.attnum END
 
const FETCH_TABLE_OID_QUERY <<<END SELECT c.oid, n.nspname, c.relname FROM pg_catalog.pg_class c LEFT JOIN pg_catalog.pg_namespace n ON n.oid = c.relnamespace WHERE pg_catalog.pg_table_is_visible(c.oid) AND c.relname ~ '^<<tablename>>$' ORDER BY 2, 3; END
 
const SHOW_TABLES_QUERY <<<END SELECT n.nspname as "Schema", c.relname as "Name", CASE c.relkind WHEN 'r' THEN 'table' WHEN 'v' THEN 'view' WHEN 'i' THEN 'index' WHEN 'S' THEN 'sequence' WHEN 's' THEN 'special' END as "Type", u.usename as "Owner" FROM pg_catalog.pg_class c LEFT JOIN pg_catalog.pg_user u ON u.usesysid = c.relowner LEFT JOIN pg_catalog.pg_namespace n ON n.oid = c.relnamespace WHERE c.relkind IN ('r','') AND n.nspname NOT IN ('pg_catalog', 'pg_toast') AND pg_catalog.pg_table_is_visible(c.oid) ORDER BY 1,2 END
 

Variable Documentation

const FETCH_INDEX_COL_NAMES_QUERY <<<END SELECT a.attnum, a.attname FROM pg_catalog.pg_attribute a WHERE a.attrelid = '<<indexrelid>>' AND a.attnum IN (<<attids>>) AND NOT a.attisdropped ORDER BY a.attnum END
const FETCH_INDEX_DEF_QUERY <<<END SELECT c.relname, i.* FROM pg_catalog.pg_index i, pg_catalog.pg_class c WHERE indrelid = '<<oid>>' AND i.indexrelid = c.oid END
const FETCH_TABLE_DEF_QUERY <<<END SELECT a.attname, pg_catalog.format_type(a.atttypid, a.atttypmod), (SELECT substring(d.adsrc for 128) FROM pg_catalog.pg_attrdef d WHERE d.adrelid = a.attrelid AND d.adnum = a.attnum AND a.atthasdef) as default, a.attnotnull, a.attnum FROM pg_catalog.pg_attribute a WHERE a.attrelid = '<<oid>>' AND a.attnum > 0 AND NOT a.attisdropped ORDER BY a.attnum END
const FETCH_TABLE_OID_QUERY <<<END SELECT c.oid, n.nspname, c.relname FROM pg_catalog.pg_class c LEFT JOIN pg_catalog.pg_namespace n ON n.oid = c.relnamespace WHERE pg_catalog.pg_table_is_visible(c.oid) AND c.relname ~ '^<<tablename>>$' ORDER BY 2, 3; END
const SHOW_TABLES_QUERY <<<END SELECT n.nspname as "Schema", c.relname as "Name", CASE c.relkind WHEN 'r' THEN 'table' WHEN 'v' THEN 'view' WHEN 'i' THEN 'index' WHEN 'S' THEN 'sequence' WHEN 's' THEN 'special' END as "Type", u.usename as "Owner" FROM pg_catalog.pg_class c LEFT JOIN pg_catalog.pg_user u ON u.usesysid = c.relowner LEFT JOIN pg_catalog.pg_namespace n ON n.oid = c.relnamespace WHERE c.relkind IN ('r','') AND n.nspname NOT IN ('pg_catalog', 'pg_toast') AND pg_catalog.pg_table_is_visible(c.oid) ORDER BY 1,2 END

Referenced by eZPgsqlSchema\schema().