|
74 | 74 | }, |
75 | 75 | "queries": { |
76 | 76 | "desc" : { |
77 | | - "query": "select '|' || quote_ident(table_schema)||'.'||quote_ident(table_name) ||'|' as tblname from information_schema.tables where table_schema = any(current_schemas(false)) and table_schema not in ('pg_catalog', 'information_schema') order by table_schema = current_schema() desc, table_schema, table_name", |
| 77 | + "query": "select '|' || quote_ident(table_schema)||'.'||quote_ident(table_name) ||'|' as tblname from information_schema.tables where table_schema not in ('pg_catalog', 'information_schema') order by table_schema = current_schema() desc, table_schema, table_name", |
78 | 78 | "options": ["--tuples-only", "--no-psqlrc"] |
79 | 79 | }, |
80 | 80 | "desc table": { |
|
86 | 86 | "options": ["--no-password"] |
87 | 87 | }, |
88 | 88 | "columns": { |
89 | | - "query": "select '|' || quote_ident(table_name) || '.' || quote_ident(column_name) || '|' from information_schema.columns where table_schema = any(current_schemas(false)) and table_schema not in ('pg_catalog', 'information_schema') order by table_name, ordinal_position", |
| 89 | + "query": "select '|' || quote_ident(table_name) || '.' || quote_ident(column_name) || '|' from information_schema.columns where table_schema not in ('pg_catalog', 'information_schema') order by table_name, ordinal_position", |
90 | 90 | "options": ["--no-password", "--tuples-only", "--no-psqlrc"] |
91 | 91 | }, |
92 | 92 | "functions": { |
93 | | - "query": "select '|' || quote_ident(n.nspname)||'.'||quote_ident(f.proname) || '(' || pg_get_function_identity_arguments(f.oid) || ')' || '|' as funname from pg_catalog.pg_proc as f inner join pg_catalog.pg_namespace as n on n.oid = f.pronamespace where f.proisagg = false and n.nspname = any(current_schemas(false)) and n.nspname not in ('pg_catalog', 'information_schema')", |
| 93 | + "query": "select '|' || quote_ident(n.nspname)||'.'||quote_ident(f.proname) || '(' || pg_get_function_identity_arguments(f.oid) || ')' || '|' as funname from pg_catalog.pg_proc as f inner join pg_catalog.pg_namespace as n on n.oid = f.pronamespace where f.proisagg = false and n.nspname not in ('pg_catalog', 'information_schema')", |
94 | 94 | "options": ["--no-password", "--tuples-only", "--no-psqlrc"] |
95 | 95 | }, |
96 | 96 | "desc function": { |
|
157 | 157 | "args_optional": ["--login-path=\"{login-path}\"", "--defaults-extra-file=\"{defaults-extra-file}\"", "-p\"{password}\""], |
158 | 158 | "queries": { |
159 | 159 | "desc" : { |
160 | | - "query": "select concat('|', table_schema, '.', table_name, '|') from information_schema.tables where table_schema = database() order by table_name;", |
| 160 | + "query": "select concat('|', case when table_schema REGEXP '[^0-9a-zA-Z$_]' then concat('`',table_schema,'`') else table_schema end, '.', case when table_name REGEXP '[^0-9a-zA-Z$_]' then concat('`',table_name,'`') else table_name end, '|') from information_schema.tables where table_schema = database() order by table_name;", |
161 | 161 | "options": ["-f", "--silent", "--raw"] |
162 | 162 | }, |
163 | 163 | "desc table": { |
|
169 | 169 | "options": ["-f", "--table"] |
170 | 170 | }, |
171 | 171 | "columns": { |
172 | | - "query": "select concat('|', table_name, '.', column_name, '|') from information_schema.columns where table_schema = database() order by table_name, ordinal_position;", |
| 172 | + "query": "select concat('|', case when table_name REGEXP '[^0-9a-zA-Z$_]' then concat('`',table_name,'`') else table_name end, '.', case when column_name REGEXP '[^0-9a-zA-Z$_]' then concat('`',column_name,'`') else column_name end, '|') from information_schema.columns where table_schema = database() order by table_name, ordinal_position;", |
173 | 173 | "options": ["-f", "--silent", "--raw"] |
174 | 174 | }, |
175 | 175 | "functions": { |
176 | | - "query": "select concat('|', routine_schema, '.', routine_name, '()', '|') from information_schema.routines where routine_schema = database();", |
| 176 | + "query": "select concat('|', case when routine_schema REGEXP '[^0-9a-zA-Z$_]' then concat('`',routine_schema,'`') else routine_schema end, '.', case when routine_name REGEXP '[^0-9a-zA-Z$_]' then concat('`',routine_name,'`') else routine_name end, '()', '|') from information_schema.routines where routine_schema = database();", |
177 | 177 | "options": ["-f", "--silent", "--raw"] |
178 | 178 | }, |
179 | 179 | "desc function": { |
180 | | - "query": "select routine_definition from information_schema.routines where concat(routine_schema, '.', routine_name) = '%s';", |
| 180 | + "query": "select routine_definition from information_schema.routines where concat(case when routine_schema REGEXP '[^0-9a-zA-Z$_]' then concat('`',routine_schema,'`') else routine_schema end, '.', case when routine_name REGEXP '[^0-9a-zA-Z$_]' then concat('`',routine_name,'`') else routine_name end) = '%s';", |
181 | 181 | "options": ["-f", "--silent", "--raw"] |
182 | 182 | }, |
183 | 183 | "explain plan": { |
|
0 commit comments