dba:postgresql:postgresql_basic_querys
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
dba:postgresql:postgresql_basic_querys [2023/10/23 07:24] – [Locks] dodger | dba:postgresql:postgresql_basic_querys [2024/04/19 07:37] (current) – [Section: EMPTY] dodger | ||
---|---|---|---|
Line 235: | Line 235: | ||
===== list objects in schema ===== | ===== list objects in schema ===== | ||
- | Change ''< | + | Change ''< |
+ | |||
<code sql> | <code sql> | ||
select n.nspname as schema_name, | select n.nspname as schema_name, | ||
Line 412: | Line 414: | ||
===== show object source ===== | ===== show object source ===== | ||
Change '' | Change '' | ||
+ | |||
+ | |||
<code sql> | <code sql> | ||
select prosrc from pg_proc where proname=' | select prosrc from pg_proc where proname=' | ||
Line 604: | Line 608: | ||
</ | </ | ||
- | This query will list all //blocking sessions//: | + | This query will list all //blocking sessions//, see [[https:// |
<code sql> | <code sql> | ||
SET application_name=' | SET application_name=' | ||
Line 639: | Line 643: | ||
</ | </ | ||
+ | |||
+ | ===== dump/export all users with password ===== | ||
+ | <code bash> | ||
+ | pg_dumpall --globals-only --file=all_roles_and_users.sql -h 127.0.0.1 | ||
+ | </ | ||
===== List extensions installed ===== | ===== List extensions installed ===== | ||
Line 876: | Line 885: | ||
- | ====== Section: | + | ====== Section: |
+ | This is an example on how to use XMLTABLE function to extract data from a XML column: | ||
+ | <code sql> | ||
+ | select | ||
+ | bdef.build_definition_id as build_definition_id, | ||
+ | tasks.task_definition_id as task_definition_id, | ||
+ | tasks.user_description as user_description, | ||
+ | tasks.is_enabled as is_enabled, | ||
+ | tasks.plugin_key as plugin_key, | ||
+ | tasks.finalising as finalising, | ||
+ | config_items.item_key as item_key, | ||
+ | config_items.item_value as item_value | ||
+ | FROM | ||
+ | build_definition bdef, | ||
+ | XMLTABLE('// | ||
+ | COLUMNS | ||
+ | task_definition_id integer PATH ' | ||
+ | user_description text PATH ' | ||
+ | is_enabled boolean PATH ' | ||
+ | plugin_key text PATH ' | ||
+ | finalising boolean PATH ' | ||
+ | config XML PATH ' | ||
+ | left join XMLTABLE('// | ||
+ | on true | ||
+ | where xml_definition_data LIKE ' | ||
+ | order by 1 | ||
+ | ; | ||
+ | </ | ||
+ | ====== Section: EMPTY ====== | ||
- | + | < | |
- | + | ||
- | + | ||
- | < | + | |
</ | </ | ||
dba/postgresql/postgresql_basic_querys.1698045871.txt.gz · Last modified: 2023/10/23 07:24 by dodger