|
73 | 73 | },
|
74 | 74 | "queries": {
|
75 | 75 | "desc" : {
|
76 |
| - "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", |
| 76 | + "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", |
77 | 77 | "options": ["--tuples-only", "--no-psqlrc"]
|
78 | 78 | },
|
79 | 79 | "desc table": {
|
|
85 | 85 | "options": ["--no-password"]
|
86 | 86 | },
|
87 | 87 | "columns": {
|
88 |
| - "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", |
| 88 | + "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", |
89 | 89 | "options": ["--no-password", "--tuples-only", "--no-psqlrc"]
|
90 | 90 | },
|
91 | 91 | "functions": {
|
92 |
| - "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')", |
| 92 | + "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')", |
93 | 93 | "options": ["--no-password", "--tuples-only", "--no-psqlrc"]
|
94 | 94 | },
|
95 | 95 | "desc function": {
|
|
156 | 156 | "args_optional": ["--login-path=\"{login-path}\"", "--defaults-extra-file=\"{defaults-extra-file}\"", "-p\"{password}\""],
|
157 | 157 | "queries": {
|
158 | 158 | "desc" : {
|
159 |
| - "query": "select concat('|', table_schema, '.', table_name, '|') from information_schema.tables where table_schema = database() order by table_name;", |
| 159 | + "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;", |
160 | 160 | "options": ["-f", "--silent", "--raw"]
|
161 | 161 | },
|
162 | 162 | "desc table": {
|
|
168 | 168 | "options": ["-f", "--table"]
|
169 | 169 | },
|
170 | 170 | "columns": {
|
171 |
| - "query": "select concat('|', table_name, '.', column_name, '|') from information_schema.columns where table_schema = database() order by table_name, ordinal_position;", |
| 171 | + "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;", |
172 | 172 | "options": ["-f", "--silent", "--raw"]
|
173 | 173 | },
|
174 | 174 | "functions": {
|
175 |
| - "query": "select concat('|', routine_schema, '.', routine_name, '()', '|') from information_schema.routines where routine_schema = database();", |
| 175 | + "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();", |
176 | 176 | "options": ["-f", "--silent", "--raw"]
|
177 | 177 | },
|
178 | 178 | "desc function": {
|
179 |
| - "query": "select routine_definition from information_schema.routines where concat(routine_schema, '.', routine_name) = '%s';", |
| 179 | + "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';", |
180 | 180 | "options": ["-f", "--silent", "--raw"]
|
181 | 181 | },
|
182 | 182 | "explain plan": {
|
|
0 commit comments