Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
{"type":"http-log","timestamp":"2020-03-31T00:05:40.203+0000","level":"error","detail":{"operation":{"user_vars":{"x-hasura-role":"admin"},"error":{"internal":{"statement":"DO $$ DECLARE r RECORD; BEGIN FOR r IN (SELECT routine_name FROM information_schema.routines WHERE specific_schema = 'hdb_views' ORDER BY routine_name) LOOP EXECUTE 'DROP FUNCTION hdb_views.' || quote_ident(r.routine_name) || '() CASCADE'; END LOOP; END $$; ","prepared":false,"error":{"exec_status":"FatalError","hint":null,"message":"cannot execute DROP FUNCTION in a read-only transaction","status_code":"25006","description":null},"arguments":[]},"path":"$.args[0].args","error":"postgres query error","code":"unexpected"},"request_id":"51d1a76d-8688-4905-a913-f1be94bc8df5","response_size":566,"query":{"args":[{"args":{"cascade":false,"check_metadata_consistency":null,"sql":"SELECT\n COALESCE(Json_agg(Row_to_json(info)), '[]' :: json) AS tables\nFROM (\n SELECT\n pgn.nspname as table_schema,\n pgc.relname as table_name,\n case\n when pgc.relkind = 'r' then 'BASE TABLE'\n when pgc.relkind = 'v' then 'VIEW'\n when pgc.relkind = 'm' then 'MATERIALIZED VIEW'\n end as table_type,\n obj_description(pgc.oid) AS comment,\n COALESCE(json_agg(DISTINCT row_to_json(isc) :: jsonb || jsonb_build_object('comment', col_description(pga.attrelid, pga.attnum))) filter (WHERE isc.column_name IS NOT NULL), '[]' :: json) AS columns,\n COALESCE(json_agg(DISTINCT row_to_json(ist) :: jsonb || jsonb_build_object('comment', obj_description(pgt.oid))) filter (WHERE ist.trigger_name IS NOT NULL), '[]' :: json) AS triggers,\n row_to_json(isv) AS view_info\n\n FROM pg_class as pgc\n INNER JOIN pg_namespace as pgn\n ON pgc.relnamespace = pgn.oid\n\n /* columns */\n LEFT OUTER JOIN pg_attribute AS pga\n ON pga.attrelid = pgc.oid\n LEFT OUTER JOIN (\n SELECT\n current_database() AS table_catalog,\n nc.nspname AS table_schema,\n c.relname AS table_name,\n a.attname AS column_name,\n a.attnum AS ordinal_position,\n pg_get_expr(ad.adbin, ad.adrelid) AS column_default,\n CASE WHEN a.attnotnull OR (t.typtype = 'd' AND t.typnotnull) THEN 'NO' ELSE 'YES' END AS is_nullable,\n CASE WHEN t.typtype = 'd' THEN\n CASE WHEN bt.typelem <> 0 AND bt.typlen = -1 THEN 'ARRAY'\n WHEN nbt.nspname = 'pg_catalog' THEN format_type(t.typbasetype, null)\n ELSE 'USER-DEFINED' END\n ELSE\n CASE WHEN t.typelem <> 0 AND t.typlen = -1 THEN 'ARRAY'\n WHEN nt.nspname = 'pg_catalog' THEN format_type(a.atttypid, null)\n ELSE 'USER-DEFINED' END\n END AS data_type,\n CASE WHEN nco.nspname IS NOT NULL THEN current_database() END AS collation_catalog,\n nco.nspname AS collation_schema,\n co.collname AS collation_name,\n CASE WHEN t.typtype = 'd' THEN current_database() ELSE null END AS domain_catalog,\n CASE WHEN t.typtype = 'd' THEN nt.nspname ELSE null END AS domain_schema,\n CASE WHEN t.typtype = 'd' THEN t.typname ELSE null END AS domain_name,\n current_database() AS udt_catalog,\n coalesce(nbt.nspname, nt.nspname) AS udt_schema,\n coalesce(bt.typname, t.typname) AS udt_name,\n a.attnum AS dtd_identifier,\n CASE WHEN c.relkind = 'r' OR\n (c.relkind IN ('v', 'f') AND\n pg_column_is_updatable(c.oid, a.attnum, false))\n THEN 'YES' ELSE 'NO' END AS is_updatable\n FROM (pg_attribute a LEFT JOIN pg_attrdef ad ON attrelid = adrelid AND attnum = adnum)\n JOIN (pg_class c JOIN pg_namespace nc ON (c.relnamespace = nc.oid)) ON a.attrelid = c.oid\n JOIN (pg_type t JOIN pg_namespace nt ON (t.typnamespace = nt.oid)) ON a.atttypid = t.oid\n LEFT JOIN (pg_type bt JOIN pg_namespace nbt ON (bt.typnamespace = nbt.oid))\n ON (t.typtype = 'd' AND t.typbasetype = bt.oid)\n LEFT JOIN (pg_collation co JOIN pg_namespace nco ON (co.collnamespace = nco.oid))\n ON a.attcollation = co.oid AND (nco.nspname, co.collname) <> ('pg_catalog', 'default')\n WHERE (NOT pg_is_other_temp_schema(nc.oid))\n AND a.attnum > 0 AND NOT a.attisdropped AND c.relkind in ('r', 'v', 'm')\n AND (pg_has_role(c.relowner, 'USAGE')\n OR has_column_privilege(c.oid, a.attnum,\n 'SELECT, INSERT, UPDATE, REFERENCES'))\n ) AS isc\n ON isc.table_schema = pgn.nspname\n AND isc.table_name = pgc.relname\n AND isc.column_name = pga.attname\n\n /* triggers */\n LEFT OUTER JOIN pg_trigger AS pgt\n ON pgt.tgrelid = pgc.oid\n LEFT OUTER JOIN information_schema.triggers AS ist\n ON ist.event_object_schema = pgn.nspname\n AND ist.event_object_table = pgc.relname\n AND ist.trigger_name = pgt.tgname\n\n /* views */\n LEFT OUTER JOIN information_schema.views AS isv\n ON isv.table_schema = pgn.nspname\n AND isv.table_name = pgc.relname\n WHERE\n pgc.relkind IN ('r', 'v', 'm')\n and (pgn.nspname='public')\n GROUP BY pgc.oid, pgn.nspname, pgc.relname, table_type, isv.*\n) AS info;","read_only":true},"version":1,"type":"run_sql"},{"args":{"where":null,"offset":null,"order_by":[{"type":"asc","column":"table_name"}],"columns":["table_schema","table_name","is_enum","configuration",{"where":null,"offset":null,"alias":null,"name":"primary_key","order_by":null,"columns":["*"],"limit":null},{"where":null,"offset":null,"alias":null,"name":"relationships","order_by":null,"columns":["*"],"limit":null},{"where":null,"offset":null,"alias":null,"name":"permissions","order_by":null,"columns":["*"],"limit":null},{"where":null,"offset":null,"alias":null,"name":"unique_constraints","order_by":null,"columns":["*"],"limit":null},{"where":null,"offset":null,"alias":null,"name":"check_constraints","order_by":[{"type":"asc","column":"constraint_name"}],"columns":["*"],"limit":null},{"where":null,"offset":null,"alias":null,"name":"computed_fields","order_by":[{"type":"asc","column":"computed_field_name"}],"columns":["*"],"limit":null}],"limit":null,"table":{"schema":"hdb_catalog","name":"hdb_table"}},"version":1,"type":"select"},{"args":{"cascade":false,"check_metadata_consistency":null,"sql":"select\n COALESCE(\n json_agg(\n row_to_json(info)\n ),\n '[]' :: JSON\n ) AS tables\nFROM\n (\n select\n hdb_fkc.*,\n fk_ref_table.table_name IS NOT NULL AS is_ref_table_tracked\n from\n hdb_catalog.hdb_table AS ist\n JOIN hdb_catalog.hdb_foreign_key_constraint AS hdb_fkc ON hdb_fkc.table_schema = ist.table_schema\n and hdb_fkc.table_name = ist.table_name\n LEFT OUTER JOIN hdb_catalog.hdb_table AS fk_ref_table ON fk_ref_table.table_schema = hdb_fkc.ref_table_table_schema\n and fk_ref_table.table_name = hdb_fkc.ref_table\n where (ist.table_schema='public')\n ) as info;","read_only":true},"version":1,"type":"run_sql"},{"args":{"cascade":false,"check_metadata_consistency":null,"sql":"select\n COALESCE(\n json_agg(\n row_to_json(info)\n ),\n '[]' :: JSON\n ) AS tables\nFROM\n (\n select DISTINCT ON (hdb_fkc.constraint_oid)\n hdb_fkc.*,\n fk_ref_table.table_name IS NOT NULL AS is_table_tracked,\n hdb_uc.constraint_name IS NOT NULL AS is_unique\n from\n hdb_catalog.hdb_table AS ist\n JOIN hdb_catalog.hdb_foreign_key_constraint AS hdb_fkc ON hdb_fkc.ref_table_table_schema = ist.table_schema\n and hdb_fkc.ref_table = ist.table_name\n LEFT OUTER JOIN hdb_catalog.hdb_table AS fk_ref_table ON fk_ref_table.table_schema = hdb_fkc.table_schema\n and fk_ref_table.table_name = hdb_fkc.table_name\n LEFT OUTER JOIN hdb_catalog.hdb_unique_constraint AS hdb_uc ON hdb_uc.table_schema = hdb_fkc.table_schema\n and hdb_uc.table_name = hdb_fkc.table_name and ARRAY(select json_array_elements_text(hdb_uc.columns) ORDER BY json_array_elements_text) = ARRAY(select json_object_keys(hdb_fkc.column_mapping) ORDER BY json_object_keys)\n where (ist.table_schema='public')\n ) as info;","read_only":true},"version":1,"type":"run_sql"}],"version":1,"type":"bulk"}},"http_info":{"status":500,"http_version":"HTTP/1.1","url":"/v1/query","ip":"127.0.0.1","method":"POST","content_encoding":null}}}
{"type":"http-log","timestamp":"2020-03-31T00:05:40.203+0000","level":"error","detail":{"operation":{"user_vars":{"x-hasura-role":"admin"},"error":{"internal":{"statement":"DO $$ DECLARE r RECORD; BEGIN FOR r IN (SELECT routine_name FROM information_schema.routines WHERE specific_schema = 'hdb_views' ORDER BY routine_name) LOOP EXECUTE 'DROP FUNCTION hdb_views.' || quote_ident(r.routine_name) || '() CASCADE'; END LOOP; END $$; ","prepared":false,"error":{"exec_status":"FatalError","hint":null,"message":"cannot execute DROP FUNCTION in a read-only transaction","status_code":"25006","description":null},"arguments":[]},"path":"$.args[0].args","error":"postgres query error","code":"unexpected"},"request_id":"6e5b472a-c36b-4abd-b7c2-f2af736f5b84","response_size":566,"query":{"args":[{"args":{"cascade":false,"check_metadata_consistency":null,"sql":"SELECT\n COALESCE(Json_agg(Row_to_json(info)), '[]' :: json) AS tables\nFROM (\n SELECT\n pgn.nspname as table_schema,\n pgc.relname as table_name,\n case\n when pgc.relkind = 'r' then 'BASE TABLE'\n when pgc.relkind = 'v' then 'VIEW'\n when pgc.relkind = 'm' then 'MATERIALIZED VIEW'\n end as table_type,\n obj_description(pgc.oid) AS comment,\n COALESCE(json_agg(DISTINCT row_to_json(isc) :: jsonb || jsonb_build_object('comment', col_description(pga.attrelid, pga.attnum))) filter (WHERE isc.column_name IS NOT NULL), '[]' :: json) AS columns,\n COALESCE(json_agg(DISTINCT row_to_json(ist) :: jsonb || jsonb_build_object('comment', obj_description(pgt.oid))) filter (WHERE ist.trigger_name IS NOT NULL), '[]' :: json) AS triggers,\n row_to_json(isv) AS view_info\n\n FROM pg_class as pgc\n INNER JOIN pg_namespace as pgn\n ON pgc.relnamespace = pgn.oid\n\n /* columns */\n LEFT OUTER JOIN pg_attribute AS pga\n ON pga.attrelid = pgc.oid\n LEFT OUTER JOIN (\n SELECT\n current_database() AS table_catalog,\n nc.nspname AS table_schema,\n c.relname AS table_name,\n a.attname AS column_name,\n a.attnum AS ordinal_position,\n pg_get_expr(ad.adbin, ad.adrelid) AS column_default,\n CASE WHEN a.attnotnull OR (t.typtype = 'd' AND t.typnotnull) THEN 'NO' ELSE 'YES' END AS is_nullable,\n CASE WHEN t.typtype = 'd' THEN\n CASE WHEN bt.typelem <> 0 AND bt.typlen = -1 THEN 'ARRAY'\n WHEN nbt.nspname = 'pg_catalog' THEN format_type(t.typbasetype, null)\n ELSE 'USER-DEFINED' END\n ELSE\n CASE WHEN t.typelem <> 0 AND t.typlen = -1 THEN 'ARRAY'\n WHEN nt.nspname = 'pg_catalog' THEN format_type(a.atttypid, null)\n ELSE 'USER-DEFINED' END\n END AS data_type,\n CASE WHEN nco.nspname IS NOT NULL THEN current_database() END AS collation_catalog,\n nco.nspname AS collation_schema,\n co.collname AS collation_name,\n CASE WHEN t.typtype = 'd' THEN current_database() ELSE null END AS domain_catalog,\n CASE WHEN t.typtype = 'd' THEN nt.nspname ELSE null END AS domain_schema,\n CASE WHEN t.typtype = 'd' THEN t.typname ELSE null END AS domain_name,\n current_database() AS udt_catalog,\n coalesce(nbt.nspname, nt.nspname) AS udt_schema,\n coalesce(bt.typname, t.typname) AS udt_name,\n a.attnum AS dtd_identifier,\n CASE WHEN c.relkind = 'r' OR\n (c.relkind IN ('v', 'f') AND\n pg_column_is_updatable(c.oid, a.attnum, false))\n THEN 'YES' ELSE 'NO' END AS is_updatable\n FROM (pg_attribute a LEFT JOIN pg_attrdef ad ON attrelid = adrelid AND attnum = adnum)\n JOIN (pg_class c JOIN pg_namespace nc ON (c.relnamespace = nc.oid)) ON a.attrelid = c.oid\n JOIN (pg_type t JOIN pg_namespace nt ON (t.typnamespace = nt.oid)) ON a.atttypid = t.oid\n LEFT JOIN (pg_type bt JOIN pg_namespace nbt ON (bt.typnamespace = nbt.oid))\n ON (t.typtype = 'd' AND t.typbasetype = bt.oid)\n LEFT JOIN (pg_collation co JOIN pg_namespace nco ON (co.collnamespace = nco.oid))\n ON a.attcollation = co.oid AND (nco.nspname, co.collname) <> ('pg_catalog', 'default')\n WHERE (NOT pg_is_other_temp_schema(nc.oid))\n AND a.attnum > 0 AND NOT a.attisdropped AND c.relkind in ('r', 'v', 'm')\n AND (pg_has_role(c.relowner, 'USAGE')\n OR has_column_privilege(c.oid, a.attnum,\n 'SELECT, INSERT, UPDATE, REFERENCES'))\n ) AS isc\n ON isc.table_schema = pgn.nspname\n AND isc.table_name = pgc.relname\n AND isc.column_name = pga.attname\n\n /* triggers */\n LEFT OUTER JOIN pg_trigger AS pgt\n ON pgt.tgrelid = pgc.oid\n LEFT OUTER JOIN information_schema.triggers AS ist\n ON ist.event_object_schema = pgn.nspname\n AND ist.event_object_table = pgc.relname\n AND ist.trigger_name = pgt.tgname\n\n /* views */\n LEFT OUTER JOIN information_schema.views AS isv\n ON isv.table_schema = pgn.nspname\n AND isv.table_name = pgc.relname\n WHERE\n pgc.relkind IN ('r', 'v', 'm')\n and (pgn.nspname='public')\n GROUP BY pgc.oid, pgn.nspname, pgc.relname, table_type, isv.*\n) AS info;","read_only":true},"version":1,"type":"run_sql"},{"args":{"where":null,"offset":null,"order_by":[{"type":"asc","column":"table_name"}],"columns":["table_schema","table_name","is_enum","configuration",{"where":null,"offset":null,"alias":null,"name":"primary_key","order_by":null,"columns":["*"],"limit":null},{"where":null,"offset":null,"alias":null,"name":"relationships","order_by":null,"columns":["*"],"limit":null},{"where":null,"offset":null,"alias":null,"name":"permissions","order_by":null,"columns":["*"],"limit":null},{"where":null,"offset":null,"alias":null,"name":"unique_constraints","order_by":null,"columns":["*"],"limit":null},{"where":null,"offset":null,"alias":null,"name":"check_constraints","order_by":[{"type":"asc","column":"constraint_name"}],"columns":["*"],"limit":null},{"where":null,"offset":null,"alias":null,"name":"computed_fields","order_by":[{"type":"asc","column":"computed_field_name"}],"columns":["*"],"limit":null}],"limit":null,"table":{"schema":"hdb_catalog","name":"hdb_table"}},"version":1,"type":"select"},{"args":{"cascade":false,"check_metadata_consistency":null,"sql":"select\n COALESCE(\n json_agg(\n row_to_json(info)\n ),\n '[]' :: JSON\n ) AS tables\nFROM\n (\n select\n hdb_fkc.*,\n fk_ref_table.table_name IS NOT NULL AS is_ref_table_tracked\n from\n hdb_catalog.hdb_table AS ist\n JOIN hdb_catalog.hdb_foreign_key_constraint AS hdb_fkc ON hdb_fkc.table_schema = ist.table_schema\n and hdb_fkc.table_name = ist.table_name\n LEFT OUTER JOIN hdb_catalog.hdb_table AS fk_ref_table ON fk_ref_table.table_schema = hdb_fkc.ref_table_table_schema\n and fk_ref_table.table_name = hdb_fkc.ref_table\n where (ist.table_schema='public')\n ) as info;","read_only":true},"version":1,"type":"run_sql"},{"args":{"cascade":false,"check_metadata_consistency":null,"sql":"select\n COALESCE(\n json_agg(\n row_to_json(info)\n ),\n '[]' :: JSON\n ) AS tables\nFROM\n (\n select DISTINCT ON (hdb_fkc.constraint_oid)\n hdb_fkc.*,\n fk_ref_table.table_name IS NOT NULL AS is_table_tracked,\n hdb_uc.constraint_name IS NOT NULL AS is_unique\n from\n hdb_catalog.hdb_table AS ist\n JOIN hdb_catalog.hdb_foreign_key_constraint AS hdb_fkc ON hdb_fkc.ref_table_table_schema = ist.table_schema\n and hdb_fkc.ref_table = ist.table_name\n LEFT OUTER JOIN hdb_catalog.hdb_table AS fk_ref_table ON fk_ref_table.table_schema = hdb_fkc.table_schema\n and fk_ref_table.table_name = hdb_fkc.table_name\n LEFT OUTER JOIN hdb_catalog.hdb_unique_constraint AS hdb_uc ON hdb_uc.table_schema = hdb_fkc.table_schema\n and hdb_uc.table_name = hdb_fkc.table_name and ARRAY(select json_array_elements_text(hdb_uc.columns) ORDER BY json_array_elements_text) = ARRAY(select json_object_keys(hdb_fkc.column_mapping) ORDER BY json_object_keys)\n where (ist.table_schema='public')\n ) as info;","read_only":true},"version":1,"type":"run_sql"}],"version":1,"type":"bulk"}},"http_info":{"status":500,"http_version":"HTTP/1.1","url":"/v1/query","ip":"127.0.0.1","method":"POST","content_encoding":null}}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment