Created
August 28, 2021 17:41
-
-
Save elliotchance/257951d705132134b882258c83297dd6 to your computer and use it in GitHub Desktop.
PostgreSQL (ckolkman.vscode-postgres)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ready on 127.0.0.1:3210 | |
connected | |
query: SELECT current_setting('server_version_num') as ver_num FROM singlerow; | |
response: vsql.Result{ | |
columns: ['VER_NUM'] | |
rows: [vsql.Row{ | |
offset: 0 | |
data: {'VER_NUM': vsql.Value{ | |
typ: CHARACTER VARYING | |
f64_value: 0 | |
string_value: '90310' | |
}} | |
}] | |
idx: 0 | |
} | |
query: SELECT datname FROM pg_database WHERE datistemplate = false; | |
response: vsql.Result{ | |
columns: ['DATNAME'] | |
rows: [vsql.Row{ | |
offset: 0 | |
data: {'DATNAME': vsql.Value{ | |
typ: CHARACTER VARYING | |
f64_value: 0 | |
string_value: 'vsql' | |
}} | |
}] | |
idx: 0 | |
} | |
disconnected | |
connected | |
query: SELECT current_setting('server_version_num') as ver_num FROM singlerow; | |
response: vsql.Result{ | |
columns: ['VER_NUM'] | |
rows: [vsql.Row{ | |
offset: 0 | |
data: {'VER_NUM': vsql.Value{ | |
typ: CHARACTER VARYING | |
f64_value: 0 | |
string_value: '90310' | |
}} | |
}] | |
idx: 0 | |
} | |
query: | |
SELECT nspname as name | |
FROM pg_namespace | |
WHERE | |
nspname not in ('information_schema', 'pg_catalog', 'pg_toast') | |
AND nspname not like 'pg_temp_%' | |
AND nspname not like 'pg_toast_temp_%' | |
AND has_schema_privilege(oid, 'CREATE, USAGE') | |
ORDER BY nspname; | |
error: vsql.SQLState42601: syntax error: near "NAME" | |
query: | |
SELECT | |
tbl.schemaname, | |
tbl.tablename, | |
tbl.quoted_name, | |
tbl.is_table, | |
json_agg(a) as columns | |
FROM | |
( | |
SELECT | |
n.nspname as schemaname, | |
c.relname as tablename, | |
(quote_ident(n.nspname) || '.' || quote_ident(c.relname)) as quoted_name, | |
true as is_table | |
FROM | |
pg_catalog.pg_class c | |
JOIN pg_catalog.pg_namespace n ON n.oid = c.relnamespace | |
WHERE | |
c.relkind = 'r' | |
AND n.nspname not in ('information_schema', 'pg_catalog', 'pg_toast') | |
AND n.nspname not like 'pg_temp_%' | |
AND n.nspname not like 'pg_toast_temp_%' | |
AND has_schema_privilege(n.oid, 'USAGE') = true | |
AND has_table_privilege(quote_ident(n.nspname) || '.' || quote_ident(c.relname), 'SELECT, INSERT, UPDATE, DELETE, TRUNCATE, REFERENCES, TRIGGER') = true | |
union all | |
SELECT | |
n.nspname as schemaname, | |
c.relname as tablename, | |
(quote_ident(n.nspname) || '.' || quote_ident(c.relname)) as quoted_name, | |
false as is_table | |
FROM | |
pg_catalog.pg_class c | |
JOIN pg_catalog.pg_namespace n ON n.oid = c.relnamespace | |
WHERE | |
c.relkind in ('v', 'm') | |
AND n.nspname not in ('information_schema', 'pg_catalog', 'pg_toast') | |
AND n.nspname not like 'pg_temp_%' | |
AND n.nspname not like 'pg_toast_temp_%' | |
AND has_schema_privilege(n.oid, 'USAGE') = true | |
AND has_table_privilege(quote_ident(n.nspname) || '.' || quote_ident(c.relname), 'SELECT, INSERT, UPDATE, DELETE, TRUNCATE, REFERENCES, TRIGGER') = true | |
) as tbl | |
LEFT JOIN ( | |
SELECT | |
attrelid, | |
attname, | |
format_type(atttypid, atttypmod) as data_type, | |
attnum, | |
attisdropped | |
FROM | |
pg_attribute | |
) as a ON ( | |
a.attrelid = tbl.quoted_name::regclass | |
AND a.attnum > 0 | |
AND NOT a.attisdropped | |
AND has_column_privilege(tbl.quoted_name, a.attname, 'SELECT, INSERT, UPDATE, REFERENCES') | |
) | |
GROUP BY schemaname, tablename, quoted_name, is_table; | |
error: vsql.SQLState42601: syntax error: near "." | |
query: | |
SELECT n.nspname as "schema", | |
p.proname as "name", | |
d.description, | |
pg_catalog.pg_get_function_result(p.oid) as "result_type", | |
pg_catalog.pg_get_function_arguments(p.oid) as "argument_types", | |
CASE | |
WHEN p.prokind = 'a' THEN 'agg' | |
WHEN p.prokind = 'w' THEN 'window' | |
WHEN p.prorettype = 'pg_catalog.trigger'::pg_catalog.regtype THEN 'trigger' | |
ELSE 'normal' | |
END as "type" | |
FROM pg_catalog.pg_proc p | |
LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace | |
LEFT JOIN pg_catalog.pg_description d ON p.oid = d.objoid | |
WHERE n.nspname <> 'information_schema' | |
AND pg_catalog.pg_function_is_visible(p.oid) | |
AND p.prorettype <> 'pg_catalog.trigger'::pg_catalog.regtype | |
AND has_schema_privilege(n.oid, 'USAGE') = true | |
AND has_function_privilege(p.oid, 'execute') = true | |
ORDER BY 1, 2, 4; | |
error: vsql.SQLState42601: syntax error: near "." | |
query: select * from pg_get_keywords(); | |
error: vsql.SQLState42601: syntax error: near "(" | |
query: | |
SELECT datname | |
FROM pg_database | |
WHERE | |
datistemplate = false | |
AND has_database_privilege(quote_ident(datname), 'TEMP, CONNECT') = true | |
; | |
error: vsql.SQLState42601: syntax error: near "," | |
V panic: net: op timed out | |
v hash: 51d7aed | |
0 vsql 0x000000010798a9ee main__main + 334 | |
1 vsql 0x000000010798cc1a main + 42 | |
2 vsql 0x00000001078e87f4 start + 52 | |
Elliots-MBP-2:vsql elliot$ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment