From 02d6d17080dfa4fb9e805eed8088d2fae54d72d4 Mon Sep 17 00:00:00 2001 From: Nicolas Boisselier Date: Mon, 4 Dec 2017 21:33:19 +0000 Subject: [PATCH] lib/php/db/types/pgsql.php --- lib/php/db/types/pgsql.php | 30 +----------------------------- 1 file changed, 1 insertion(+), 29 deletions(-) diff --git a/lib/php/db/types/pgsql.php b/lib/php/db/types/pgsql.php index 703df8d9..f267337c 100644 --- a/lib/php/db/types/pgsql.php +++ b/lib/php/db/types/pgsql.php @@ -3,7 +3,7 @@ $DB_TYPES['pgsql'] = array ( 'extra_where' => 'denorm', 'regexp' => '~', # NB 04.12.17: Overwrite db->quote because of bugs with INSERT INTO -# NB 04.12.17 'quote_name' => "'", +# NB 04.12.17 'quote_name' => '"', # NB 04.12.17 'quote' => function($str) { # NB 04.12.17 global $DB_TYPES; # NB 04.12.17 $chr = $DB_TYPES['pgsql']['quote_name']; @@ -18,38 +18,11 @@ $DB_TYPES['pgsql'] = array ( 'localFile' => array (getenv('HOME').'/.pgpass','^[^:]+:[^:]+::(?P[^:]+):(?[^:]+)'), -/* -'databases' => "SELECT d.datname as 'Name', - pg_catalog.pg_get_userbyid(d.datdba) as 'Owner', - pg_catalog.pg_encoding_d.encoding) as 'Encoding', - d.datcollate as 'Collate', - d.datctype as 'Ctype', - pg_catalog.array_to_string(d.datacl, E'\n') AS 'Access privileges', - CASE WHEN pg_catalog.has_database_privilege(d.datname, 'CONNECT') - THEN pg_catalog.pg_size_pretty(pg_catalog.pg_database_size(d.datname)) - ELSE 'No Access' - END as 'Size', - t.spcname as 'Tablespace', - pg_catalog.shobj_description(d.oid, 'pg_database') as 'Description' -FROM pg_catalog.pg_database d - JOIN pg_catalog.pg_tablespace t on d.dattablespace = t.oid -ORDER BY 1", -*/ 'databases' => 'SELECT datname as name,pg_catalog.pg_get_userbyid(datdba) as owner,pg_catalog.pg_encoding_encoding) as encoding, datcollate as "collate",datctype as "Ctype" FROM pg_catalog.pg_database', 'sql.drop' => 'DROP IF EXISTS "" CASCADE', -#'tables' => "SELECT table_name as name,LOWER(CASE table_type WHEN 'BASE TABLE' THEN 'TABLE' ELSE table_type END) as type,table_type FROM information_schema.tables WHERE table_type in('BASE TABLE','VIEW') AND table_schema NOT IN ('pg_catalog', 'information_schema')", 'tables' => "SELECT table_name as name,LOWER(CASE table_type WHEN 'BASE TABLE' THEN 'TABLE' ELSE table_type END) as type,table_type FROM information_schema.tables WHERE table_type in('BASE TABLE','VIEW') AND table_schema = 'public'", -# NB 02.08.16 'create' => function(&$field) { -# NB 02.08.16 $r = array( -# NB 02.08.16 '/datetime/i' => 'timestamp', -# NB 02.08.16 '/float/i' => 'numeric', -# NB 02.08.16 '/ COLLATE NOCASE/i' => '', -# NB 02.08.16 ); -# NB 02.08.16 $field->type = preg_replace(array_keys($r),array_values($r),$field->type); -# NB 02.08.16 }, - 'table.sql.create' => function($sql) { $sql = preg_replace('/ESCAPE \'.*?\'/','',$sql); $r = array( @@ -62,7 +35,6 @@ ORDER BY 1", return $sql; }, - #,(SELECT attname FROM pg_catalog.pg_attribute a WHERE a.attrelid = i.indrelid AND a.attnum = ANY(i.indkey)) as field 'table.sql.index' => [ "SELECT c.relname as name -- 2.47.3