From: chriskl Date: Fri, 30 Jan 2004 05:58:44 +0000 (+0000) Subject: add aggregates and opclasses to search results X-Git-Tag: REL_3-3-1~33 X-Git-Url: http://git.postgresql.org/gitweb/static/gitweb.js?a=commitdiff_plain;h=4b82ea4c4aebfaada357ff437ca428bb71421ce0;p=phppgadmin.git add aggregates and opclasses to search results --- diff --git a/BUGS b/BUGS index d5fa5a36..38da6525 100644 --- a/BUGS +++ b/BUGS @@ -11,14 +11,13 @@ need icons and Find for Casts and Conversions, Languages, Aggs and OpClasses submit changes to HTML_TreeMenu maintainer test < 7.3 Find feature for all new objects fix constraint search to get domain and table constraints? +exclude system triggers from Find dump sequences when dumping tables fix dumping clustering info can't edit SELECT results by oid Need to fix: * Variables and processes views for < 7.3 -* Add aggregates and opclasses to Find feature -* Aggregate and opclass support for < 7.3 * The getType function needs to be ported to 7.2 and 7.3 classes to add pretty type name and schema support * Add query start time to processes view for 7.4+ diff --git a/classes/database/Postgres.php b/classes/database/Postgres.php index c0dfe633..9d270ab0 100755 --- a/classes/database/Postgres.php +++ b/classes/database/Postgres.php @@ -4,7 +4,7 @@ * A class that implements the DB interface for Postgres * Note: This class uses ADODB and returns RecordSets. * - * $Id: Postgres.php,v 1.178 2004/01/29 07:30:12 chriskl Exp $ + * $Id: Postgres.php,v 1.179 2004/01/30 05:58:44 chriskl Exp $ */ // @@@ THOUGHT: What about inherits? ie. use of ONLY??? @@ -2194,6 +2194,20 @@ class Postgres extends BaseDB { SELECT 'LANGUAGE', pl.oid, NULL, NULL, pl.lanname FROM pg_language pl WHERE lanname ~* '.*{$term}.*'"; if (!$conf['show_system']) $sql .= " AND pl.lanispl"; + + // Aggregates + $sql .= " + UNION ALL + SELECT DISTINCT ON (a.aggname) 'AGGREGATE', a.oid, NULL, NULL, a.aggname FROM pg_aggregate a + WHERE aggname ~* '.*{$term}.*'"; + if (!$conf['show_system']) $sql .= " AND a.oid > '{$this->_lastSystemOID}'::oid"; + + // Op Classes + $sql .= " + UNION ALL + SELECT DISTINCT ON (po.opcname) 'OPCLASS', po.oid, NULL, NULL, po.opcname FROM pg_opclass po, + WHERE po.opcname ILIKE '%{$term}%'"; + if (!$conf['show_system']) $sql .= " AND po.oid > '{$this->_lastSystemOID}'::oid"; } $sql .= " ORDER BY type, schemaname, relname, name"; diff --git a/classes/database/Postgres73.php b/classes/database/Postgres73.php index 8e4ca007..8dcb7e83 100644 --- a/classes/database/Postgres73.php +++ b/classes/database/Postgres73.php @@ -4,7 +4,7 @@ * A class that implements the DB interface for Postgres * Note: This class uses ADODB and returns RecordSets. * - * $Id: Postgres73.php,v 1.87 2004/01/14 02:14:28 chriskl Exp $ + * $Id: Postgres73.php,v 1.88 2004/01/30 05:58:45 chriskl Exp $ */ // @@@ THOUGHT: What about inherits? ie. use of ONLY??? @@ -1185,7 +1185,7 @@ class Postgres73 extends Postgres72 { AND pa.attname ILIKE '%{$term}%' AND pa.attnum > 0 AND NOT pa.attisdropped AND pc.relkind IN ('r', 'v') {$where} UNION ALL SELECT 'FUNCTION', pp.oid, pn.nspname, NULL, pp.proname FROM pg_catalog.pg_proc pp, pg_catalog.pg_namespace pn - WHERE pp.pronamespace=pn.oid AND proname ILIKE '%{$term}%' {$where} + WHERE pp.pronamespace=pn.oid AND NOT pp.proisagg AND pp.proname ILIKE '%{$term}%' {$where} UNION ALL SELECT 'INDEX', NULL, pn.nspname, pc.relname, pc2.relname FROM pg_catalog.pg_class pc, pg_catalog.pg_namespace pn, pg_catalog.pg_index pi, pg_catalog.pg_class pc2 WHERE pc.relnamespace=pn.oid AND pc.oid=pi.indrelid @@ -1236,6 +1236,14 @@ class Postgres73 extends Postgres72 { UNION ALL SELECT 'LANGUAGE', pl.oid, NULL, NULL, pl.lanname FROM pg_catalog.pg_language pl WHERE lanname ILIKE '%{$term}%' {$lan_where} + UNION ALL + SELECT DISTINCT ON (p.proname) 'AGGREGATE', p.oid, pn.nspname, NULL, p.proname FROM pg_catalog.pg_proc p + LEFT JOIN pg_catalog.pg_namespace pn ON p.pronamespace=pn.oid + WHERE p.proisagg AND p.proname ILIKE '%{$term}%' {$where} + UNION ALL + SELECT DISTINCT ON (po.opcname) 'OPCLASS', po.oid, pn.nspname, NULL, po.opcname FROM pg_catalog.pg_opclass po, + pg_catalog.pg_namespace pn WHERE po.opcnamespace=pn.oid + AND po.opcname ILIKE '%{$term}%' {$where} "; } // Otherwise just add domains diff --git a/database.php b/database.php index 74a5e542..cab50974 100755 --- a/database.php +++ b/database.php @@ -3,7 +3,7 @@ /** * Manage schemas within a database * - * $Id: database.php,v 1.32 2004/01/04 07:30:12 chriskl Exp $ + * $Id: database.php,v 1.33 2004/01/30 05:58:44 chriskl Exp $ */ // Include application functions @@ -95,6 +95,12 @@ case 'LANGUAGE': echo $lang['strlanguages']; break; + case 'AGGREGATE': + echo $lang['straggregates']; + break; + case 'OPCLASS': + echo $lang['stropclasses']; + break; } echo ""; echo "