diff --git a/veza-backend-api/d_plus_all.txt b/veza-backend-api/d_plus_all.txt new file mode 100644 index 000000000..e493feeb3 --- /dev/null +++ b/veza-backend-api/d_plus_all.txt @@ -0,0 +1,5710 @@ + Table "pg_catalog.pg_aggregate" + Column | Type | Collation | Nullable | Default | Storage | Compression | Stats target | Description +------------------+----------+-----------+----------+---------+----------+-------------+--------------+------------- + aggfnoid | regproc | | not null | | plain | | | + aggkind | "char" | | not null | | plain | | | + aggnumdirectargs | smallint | | not null | | plain | | | + aggtransfn | regproc | | not null | | plain | | | + aggfinalfn | regproc | | not null | | plain | | | + aggcombinefn | regproc | | not null | | plain | | | + aggserialfn | regproc | | not null | | plain | | | + aggdeserialfn | regproc | | not null | | plain | | | + aggmtransfn | regproc | | not null | | plain | | | + aggminvtransfn | regproc | | not null | | plain | | | + aggmfinalfn | regproc | | not null | | plain | | | + aggfinalextra | boolean | | not null | | plain | | | + aggmfinalextra | boolean | | not null | | plain | | | + aggfinalmodify | "char" | | not null | | plain | | | + aggmfinalmodify | "char" | | not null | | plain | | | + aggsortop | oid | | not null | | plain | | | + aggtranstype | oid | | not null | | plain | | | + aggtransspace | integer | | not null | | plain | | | + aggmtranstype | oid | | not null | | plain | | | + aggmtransspace | integer | | not null | | plain | | | + agginitval | text | C | | | extended | | | + aggminitval | text | C | | | extended | | | +Indexes: + "pg_aggregate_fnoid_index" PRIMARY KEY, btree (aggfnoid) +Access method: heap + + Index "pg_catalog.pg_aggregate_fnoid_index" + Column | Type | Key? | Definition | Storage | Stats target +----------+---------+------+------------+---------+-------------- + aggfnoid | regproc | yes | aggfnoid | plain | +primary key, btree, for table "pg_catalog.pg_aggregate" + + Table "pg_catalog.pg_am" + Column | Type | Collation | Nullable | Default | Storage | Compression | Stats target | Description +-----------+---------+-----------+----------+---------+---------+-------------+--------------+------------- + oid | oid | | not null | | plain | | | + amname | name | | not null | | plain | | | + amhandler | regproc | | not null | | plain | | | + amtype | "char" | | not null | | plain | | | +Indexes: + "pg_am_oid_index" PRIMARY KEY, btree (oid) + "pg_am_name_index" UNIQUE CONSTRAINT, btree (amname) +Access method: heap + + Index "pg_catalog.pg_am_name_index" + Column | Type | Key? | Definition | Storage | Stats target +--------+---------+------+------------+---------+-------------- + amname | cstring | yes | amname | plain | +unique, btree, for table "pg_catalog.pg_am" + + Index "pg_catalog.pg_am_oid_index" + Column | Type | Key? | Definition | Storage | Stats target +--------+------+------+------------+---------+-------------- + oid | oid | yes | oid | plain | +primary key, btree, for table "pg_catalog.pg_am" + + Table "pg_catalog.pg_amop" + Column | Type | Collation | Nullable | Default | Storage | Compression | Stats target | Description +----------------+----------+-----------+----------+---------+---------+-------------+--------------+------------- + oid | oid | | not null | | plain | | | + amopfamily | oid | | not null | | plain | | | + amoplefttype | oid | | not null | | plain | | | + amoprighttype | oid | | not null | | plain | | | + amopstrategy | smallint | | not null | | plain | | | + amoppurpose | "char" | | not null | | plain | | | + amopopr | oid | | not null | | plain | | | + amopmethod | oid | | not null | | plain | | | + amopsortfamily | oid | | not null | | plain | | | +Indexes: + "pg_amop_oid_index" PRIMARY KEY, btree (oid) + "pg_amop_fam_strat_index" UNIQUE CONSTRAINT, btree (amopfamily, amoplefttype, amoprighttype, amopstrategy) + "pg_amop_opr_fam_index" UNIQUE CONSTRAINT, btree (amopopr, amoppurpose, amopfamily) +Access method: heap + + Index "pg_catalog.pg_amop_fam_strat_index" + Column | Type | Key? | Definition | Storage | Stats target +---------------+----------+------+---------------+---------+-------------- + amopfamily | oid | yes | amopfamily | plain | + amoplefttype | oid | yes | amoplefttype | plain | + amoprighttype | oid | yes | amoprighttype | plain | + amopstrategy | smallint | yes | amopstrategy | plain | +unique, btree, for table "pg_catalog.pg_amop" + + Index "pg_catalog.pg_amop_oid_index" + Column | Type | Key? | Definition | Storage | Stats target +--------+------+------+------------+---------+-------------- + oid | oid | yes | oid | plain | +primary key, btree, for table "pg_catalog.pg_amop" + + Index "pg_catalog.pg_amop_opr_fam_index" + Column | Type | Key? | Definition | Storage | Stats target +-------------+--------+------+-------------+---------+-------------- + amopopr | oid | yes | amopopr | plain | + amoppurpose | "char" | yes | amoppurpose | plain | + amopfamily | oid | yes | amopfamily | plain | +unique, btree, for table "pg_catalog.pg_amop" + + Table "pg_catalog.pg_amproc" + Column | Type | Collation | Nullable | Default | Storage | Compression | Stats target | Description +-----------------+----------+-----------+----------+---------+---------+-------------+--------------+------------- + oid | oid | | not null | | plain | | | + amprocfamily | oid | | not null | | plain | | | + amproclefttype | oid | | not null | | plain | | | + amprocrighttype | oid | | not null | | plain | | | + amprocnum | smallint | | not null | | plain | | | + amproc | regproc | | not null | | plain | | | +Indexes: + "pg_amproc_oid_index" PRIMARY KEY, btree (oid) + "pg_amproc_fam_proc_index" UNIQUE CONSTRAINT, btree (amprocfamily, amproclefttype, amprocrighttype, amprocnum) +Access method: heap + + Index "pg_catalog.pg_amproc_fam_proc_index" + Column | Type | Key? | Definition | Storage | Stats target +-----------------+----------+------+-----------------+---------+-------------- + amprocfamily | oid | yes | amprocfamily | plain | + amproclefttype | oid | yes | amproclefttype | plain | + amprocrighttype | oid | yes | amprocrighttype | plain | + amprocnum | smallint | yes | amprocnum | plain | +unique, btree, for table "pg_catalog.pg_amproc" + + Index "pg_catalog.pg_amproc_oid_index" + Column | Type | Key? | Definition | Storage | Stats target +--------+------+------+------------+---------+-------------- + oid | oid | yes | oid | plain | +primary key, btree, for table "pg_catalog.pg_amproc" + + Table "pg_catalog.pg_attrdef" + Column | Type | Collation | Nullable | Default | Storage | Compression | Stats target | Description +---------+--------------+-----------+----------+---------+----------+-------------+--------------+------------- + oid | oid | | not null | | plain | | | + adrelid | oid | | not null | | plain | | | + adnum | smallint | | not null | | plain | | | + adbin | pg_node_tree | C | not null | | extended | | | +Indexes: + "pg_attrdef_oid_index" PRIMARY KEY, btree (oid) + "pg_attrdef_adrelid_adnum_index" UNIQUE CONSTRAINT, btree (adrelid, adnum) +Access method: heap + + Index "pg_catalog.pg_attrdef_adrelid_adnum_index" + Column | Type | Key? | Definition | Storage | Stats target +---------+----------+------+------------+---------+-------------- + adrelid | oid | yes | adrelid | plain | + adnum | smallint | yes | adnum | plain | +unique, btree, for table "pg_catalog.pg_attrdef" + + Index "pg_catalog.pg_attrdef_oid_index" + Column | Type | Key? | Definition | Storage | Stats target +--------+------+------+------------+---------+-------------- + oid | oid | yes | oid | plain | +primary key, btree, for table "pg_catalog.pg_attrdef" + + Table "pg_catalog.pg_attribute" + Column | Type | Collation | Nullable | Default | Storage | Compression | Stats target | Description +----------------+-----------+-----------+----------+---------+----------+-------------+--------------+------------- + attrelid | oid | | not null | | plain | | | + attname | name | | not null | | plain | | | + atttypid | oid | | not null | | plain | | | + attlen | smallint | | not null | | plain | | | + attnum | smallint | | not null | | plain | | | + attcacheoff | integer | | not null | | plain | | | + atttypmod | integer | | not null | | plain | | | + attndims | smallint | | not null | | plain | | | + attbyval | boolean | | not null | | plain | | | + attalign | "char" | | not null | | plain | | | + attstorage | "char" | | not null | | plain | | | + attcompression | "char" | | not null | | plain | | | + attnotnull | boolean | | not null | | plain | | | + atthasdef | boolean | | not null | | plain | | | + atthasmissing | boolean | | not null | | plain | | | + attidentity | "char" | | not null | | plain | | | + attgenerated | "char" | | not null | | plain | | | + attisdropped | boolean | | not null | | plain | | | + attislocal | boolean | | not null | | plain | | | + attinhcount | smallint | | not null | | plain | | | + attstattarget | smallint | | not null | | plain | | | + attcollation | oid | | not null | | plain | | | + attacl | aclitem[] | | | | extended | | | + attoptions | text[] | C | | | extended | | | + attfdwoptions | text[] | C | | | extended | | | + attmissingval | anyarray | | | | extended | | | +Indexes: + "pg_attribute_relid_attnum_index" PRIMARY KEY, btree (attrelid, attnum) + "pg_attribute_relid_attnam_index" UNIQUE CONSTRAINT, btree (attrelid, attname) +Access method: heap + + Index "pg_catalog.pg_attribute_relid_attnam_index" + Column | Type | Key? | Definition | Storage | Stats target +----------+---------+------+------------+---------+-------------- + attrelid | oid | yes | attrelid | plain | + attname | cstring | yes | attname | plain | +unique, btree, for table "pg_catalog.pg_attribute" + + Index "pg_catalog.pg_attribute_relid_attnum_index" + Column | Type | Key? | Definition | Storage | Stats target +----------+----------+------+------------+---------+-------------- + attrelid | oid | yes | attrelid | plain | + attnum | smallint | yes | attnum | plain | +primary key, btree, for table "pg_catalog.pg_attribute" + + Table "pg_catalog.pg_auth_members" + Column | Type | Collation | Nullable | Default | Storage | Compression | Stats target | Description +----------------+---------+-----------+----------+---------+---------+-------------+--------------+------------- + oid | oid | | not null | | plain | | | + roleid | oid | | not null | | plain | | | + member | oid | | not null | | plain | | | + grantor | oid | | not null | | plain | | | + admin_option | boolean | | not null | | plain | | | + inherit_option | boolean | | not null | | plain | | | + set_option | boolean | | not null | | plain | | | +Indexes: + "pg_auth_members_oid_index" PRIMARY KEY, btree (oid), tablespace "pg_global" + "pg_auth_members_grantor_index" btree (grantor), tablespace "pg_global" + "pg_auth_members_member_role_index" UNIQUE CONSTRAINT, btree (member, roleid, grantor), tablespace "pg_global" + "pg_auth_members_role_member_index" UNIQUE CONSTRAINT, btree (roleid, member, grantor), tablespace "pg_global" +Tablespace: "pg_global" +Access method: heap + + Index "pg_catalog.pg_auth_members_grantor_index" + Column | Type | Key? | Definition | Storage | Stats target +---------+------+------+------------+---------+-------------- + grantor | oid | yes | grantor | plain | +btree, for table "pg_catalog.pg_auth_members" +Tablespace: "pg_global" + + Index "pg_catalog.pg_auth_members_member_role_index" + Column | Type | Key? | Definition | Storage | Stats target +---------+------+------+------------+---------+-------------- + member | oid | yes | member | plain | + roleid | oid | yes | roleid | plain | + grantor | oid | yes | grantor | plain | +unique, btree, for table "pg_catalog.pg_auth_members" +Tablespace: "pg_global" + + Index "pg_catalog.pg_auth_members_oid_index" + Column | Type | Key? | Definition | Storage | Stats target +--------+------+------+------------+---------+-------------- + oid | oid | yes | oid | plain | +primary key, btree, for table "pg_catalog.pg_auth_members" +Tablespace: "pg_global" + + Index "pg_catalog.pg_auth_members_role_member_index" + Column | Type | Key? | Definition | Storage | Stats target +---------+------+------+------------+---------+-------------- + roleid | oid | yes | roleid | plain | + member | oid | yes | member | plain | + grantor | oid | yes | grantor | plain | +unique, btree, for table "pg_catalog.pg_auth_members" +Tablespace: "pg_global" + + Table "pg_catalog.pg_authid" + Column | Type | Collation | Nullable | Default | Storage | Compression | Stats target | Description +----------------+--------------------------+-----------+----------+---------+----------+-------------+--------------+------------- + oid | oid | | not null | | plain | | | + rolname | name | | not null | | plain | | | + rolsuper | boolean | | not null | | plain | | | + rolinherit | boolean | | not null | | plain | | | + rolcreaterole | boolean | | not null | | plain | | | + rolcreatedb | boolean | | not null | | plain | | | + rolcanlogin | boolean | | not null | | plain | | | + rolreplication | boolean | | not null | | plain | | | + rolbypassrls | boolean | | not null | | plain | | | + rolconnlimit | integer | | not null | | plain | | | + rolpassword | text | C | | | extended | | | + rolvaliduntil | timestamp with time zone | | | | plain | | | +Indexes: + "pg_authid_oid_index" PRIMARY KEY, btree (oid), tablespace "pg_global" + "pg_authid_rolname_index" UNIQUE CONSTRAINT, btree (rolname), tablespace "pg_global" +Tablespace: "pg_global" +Access method: heap + + Index "pg_catalog.pg_authid_oid_index" + Column | Type | Key? | Definition | Storage | Stats target +--------+------+------+------------+---------+-------------- + oid | oid | yes | oid | plain | +primary key, btree, for table "pg_catalog.pg_authid" +Tablespace: "pg_global" + + Index "pg_catalog.pg_authid_rolname_index" + Column | Type | Key? | Definition | Storage | Stats target +---------+---------+------+------------+---------+-------------- + rolname | cstring | yes | rolname | plain | +unique, btree, for table "pg_catalog.pg_authid" +Tablespace: "pg_global" + + View "pg_catalog.pg_available_extension_versions" + Column | Type | Collation | Nullable | Default | Storage | Description +-------------+---------+-----------+----------+---------+----------+------------- + name | name | | | | plain | + version | text | | | | extended | + installed | boolean | | | | plain | + superuser | boolean | | | | plain | + trusted | boolean | | | | plain | + relocatable | boolean | | | | plain | + schema | name | | | | plain | + requires | name[] | | | | extended | + comment | text | | | | extended | +View definition: + SELECT e.name, + e.version, + x.extname IS NOT NULL AS installed, + e.superuser, + e.trusted, + e.relocatable, + e.schema, + e.requires, + e.comment + FROM pg_available_extension_versions() e(name, version, superuser, trusted, relocatable, schema, requires, comment) + LEFT JOIN pg_extension x ON e.name = x.extname AND e.version = x.extversion; + + View "pg_catalog.pg_available_extensions" + Column | Type | Collation | Nullable | Default | Storage | Description +-------------------+------+-----------+----------+---------+----------+------------- + name | name | | | | plain | + default_version | text | | | | extended | + installed_version | text | C | | | extended | + comment | text | | | | extended | +View definition: + SELECT e.name, + e.default_version, + x.extversion AS installed_version, + e.comment + FROM pg_available_extensions() e(name, default_version, comment) + LEFT JOIN pg_extension x ON e.name = x.extname; + + View "pg_catalog.pg_backend_memory_contexts" + Column | Type | Collation | Nullable | Default | Storage | Description +---------------+---------+-----------+----------+---------+----------+------------- + name | text | | | | extended | + ident | text | | | | extended | + parent | text | | | | extended | + level | integer | | | | plain | + total_bytes | bigint | | | | plain | + total_nblocks | bigint | | | | plain | + free_bytes | bigint | | | | plain | + free_chunks | bigint | | | | plain | + used_bytes | bigint | | | | plain | +View definition: + SELECT name, + ident, + parent, + level, + total_bytes, + total_nblocks, + free_bytes, + free_chunks, + used_bytes + FROM pg_get_backend_memory_contexts() pg_get_backend_memory_contexts(name, ident, parent, level, total_bytes, total_nblocks, free_bytes, free_chunks, used_bytes); + + Table "pg_catalog.pg_cast" + Column | Type | Collation | Nullable | Default | Storage | Compression | Stats target | Description +-------------+--------+-----------+----------+---------+---------+-------------+--------------+------------- + oid | oid | | not null | | plain | | | + castsource | oid | | not null | | plain | | | + casttarget | oid | | not null | | plain | | | + castfunc | oid | | not null | | plain | | | + castcontext | "char" | | not null | | plain | | | + castmethod | "char" | | not null | | plain | | | +Indexes: + "pg_cast_oid_index" PRIMARY KEY, btree (oid) + "pg_cast_source_target_index" UNIQUE CONSTRAINT, btree (castsource, casttarget) +Access method: heap + + Index "pg_catalog.pg_cast_oid_index" + Column | Type | Key? | Definition | Storage | Stats target +--------+------+------+------------+---------+-------------- + oid | oid | yes | oid | plain | +primary key, btree, for table "pg_catalog.pg_cast" + + Index "pg_catalog.pg_cast_source_target_index" + Column | Type | Key? | Definition | Storage | Stats target +------------+------+------+------------+---------+-------------- + castsource | oid | yes | castsource | plain | + casttarget | oid | yes | casttarget | plain | +unique, btree, for table "pg_catalog.pg_cast" + + Table "pg_catalog.pg_class" + Column | Type | Collation | Nullable | Default | Storage | Compression | Stats target | Description +---------------------+--------------+-----------+----------+---------+----------+-------------+--------------+------------- + oid | oid | | not null | | plain | | | + relname | name | | not null | | plain | | | + relnamespace | oid | | not null | | plain | | | + reltype | oid | | not null | | plain | | | + reloftype | oid | | not null | | plain | | | + relowner | oid | | not null | | plain | | | + relam | oid | | not null | | plain | | | + relfilenode | oid | | not null | | plain | | | + reltablespace | oid | | not null | | plain | | | + relpages | integer | | not null | | plain | | | + reltuples | real | | not null | | plain | | | + relallvisible | integer | | not null | | plain | | | + reltoastrelid | oid | | not null | | plain | | | + relhasindex | boolean | | not null | | plain | | | + relisshared | boolean | | not null | | plain | | | + relpersistence | "char" | | not null | | plain | | | + relkind | "char" | | not null | | plain | | | + relnatts | smallint | | not null | | plain | | | + relchecks | smallint | | not null | | plain | | | + relhasrules | boolean | | not null | | plain | | | + relhastriggers | boolean | | not null | | plain | | | + relhassubclass | boolean | | not null | | plain | | | + relrowsecurity | boolean | | not null | | plain | | | + relforcerowsecurity | boolean | | not null | | plain | | | + relispopulated | boolean | | not null | | plain | | | + relreplident | "char" | | not null | | plain | | | + relispartition | boolean | | not null | | plain | | | + relrewrite | oid | | not null | | plain | | | + relfrozenxid | xid | | not null | | plain | | | + relminmxid | xid | | not null | | plain | | | + relacl | aclitem[] | | | | extended | | | + reloptions | text[] | C | | | extended | | | + relpartbound | pg_node_tree | C | | | extended | | | +Indexes: + "pg_class_oid_index" PRIMARY KEY, btree (oid) + "pg_class_relname_nsp_index" UNIQUE CONSTRAINT, btree (relname, relnamespace) + "pg_class_tblspc_relfilenode_index" btree (reltablespace, relfilenode) +Access method: heap + + Index "pg_catalog.pg_class_oid_index" + Column | Type | Key? | Definition | Storage | Stats target +--------+------+------+------------+---------+-------------- + oid | oid | yes | oid | plain | +primary key, btree, for table "pg_catalog.pg_class" + + Index "pg_catalog.pg_class_relname_nsp_index" + Column | Type | Key? | Definition | Storage | Stats target +--------------+---------+------+--------------+---------+-------------- + relname | cstring | yes | relname | plain | + relnamespace | oid | yes | relnamespace | plain | +unique, btree, for table "pg_catalog.pg_class" + + Index "pg_catalog.pg_class_tblspc_relfilenode_index" + Column | Type | Key? | Definition | Storage | Stats target +---------------+------+------+---------------+---------+-------------- + reltablespace | oid | yes | reltablespace | plain | + relfilenode | oid | yes | relfilenode | plain | +btree, for table "pg_catalog.pg_class" + + Table "pg_catalog.pg_collation" + Column | Type | Collation | Nullable | Default | Storage | Compression | Stats target | Description +---------------------+---------+-----------+----------+---------+----------+-------------+--------------+------------- + oid | oid | | not null | | plain | | | + collname | name | | not null | | plain | | | + collnamespace | oid | | not null | | plain | | | + collowner | oid | | not null | | plain | | | + collprovider | "char" | | not null | | plain | | | + collisdeterministic | boolean | | not null | | plain | | | + collencoding | integer | | not null | | plain | | | + collcollate | text | C | | | extended | | | + collctype | text | C | | | extended | | | + colliculocale | text | C | | | extended | | | + collicurules | text | C | | | extended | | | + collversion | text | C | | | extended | | | +Indexes: + "pg_collation_oid_index" PRIMARY KEY, btree (oid) + "pg_collation_name_enc_nsp_index" UNIQUE CONSTRAINT, btree (collname, collencoding, collnamespace) +Access method: heap + + Index "pg_catalog.pg_collation_name_enc_nsp_index" + Column | Type | Key? | Definition | Storage | Stats target +---------------+---------+------+---------------+---------+-------------- + collname | cstring | yes | collname | plain | + collencoding | integer | yes | collencoding | plain | + collnamespace | oid | yes | collnamespace | plain | +unique, btree, for table "pg_catalog.pg_collation" + + Index "pg_catalog.pg_collation_oid_index" + Column | Type | Key? | Definition | Storage | Stats target +--------+------+------+------------+---------+-------------- + oid | oid | yes | oid | plain | +primary key, btree, for table "pg_catalog.pg_collation" + + View "pg_catalog.pg_config" + Column | Type | Collation | Nullable | Default | Storage | Description +---------+------+-----------+----------+---------+----------+------------- + name | text | | | | extended | + setting | text | | | | extended | +View definition: + SELECT name, + setting + FROM pg_config() pg_config(name, setting); + + Table "pg_catalog.pg_constraint" + Column | Type | Collation | Nullable | Default | Storage | Compression | Stats target | Description +----------------+--------------+-----------+----------+---------+----------+-------------+--------------+------------- + oid | oid | | not null | | plain | | | + conname | name | | not null | | plain | | | + connamespace | oid | | not null | | plain | | | + contype | "char" | | not null | | plain | | | + condeferrable | boolean | | not null | | plain | | | + condeferred | boolean | | not null | | plain | | | + convalidated | boolean | | not null | | plain | | | + conrelid | oid | | not null | | plain | | | + contypid | oid | | not null | | plain | | | + conindid | oid | | not null | | plain | | | + conparentid | oid | | not null | | plain | | | + confrelid | oid | | not null | | plain | | | + confupdtype | "char" | | not null | | plain | | | + confdeltype | "char" | | not null | | plain | | | + confmatchtype | "char" | | not null | | plain | | | + conislocal | boolean | | not null | | plain | | | + coninhcount | smallint | | not null | | plain | | | + connoinherit | boolean | | not null | | plain | | | + conkey | smallint[] | | | | extended | | | + confkey | smallint[] | | | | extended | | | + conpfeqop | oid[] | | | | extended | | | + conppeqop | oid[] | | | | extended | | | + conffeqop | oid[] | | | | extended | | | + confdelsetcols | smallint[] | | | | extended | | | + conexclop | oid[] | | | | extended | | | + conbin | pg_node_tree | C | | | extended | | | +Indexes: + "pg_constraint_oid_index" PRIMARY KEY, btree (oid) + "pg_constraint_conname_nsp_index" btree (conname, connamespace) + "pg_constraint_conparentid_index" btree (conparentid) + "pg_constraint_conrelid_contypid_conname_index" UNIQUE CONSTRAINT, btree (conrelid, contypid, conname) + "pg_constraint_contypid_index" btree (contypid) +Access method: heap + + Index "pg_catalog.pg_constraint_conname_nsp_index" + Column | Type | Key? | Definition | Storage | Stats target +--------------+---------+------+--------------+---------+-------------- + conname | cstring | yes | conname | plain | + connamespace | oid | yes | connamespace | plain | +btree, for table "pg_catalog.pg_constraint" + + Index "pg_catalog.pg_constraint_conparentid_index" + Column | Type | Key? | Definition | Storage | Stats target +-------------+------+------+-------------+---------+-------------- + conparentid | oid | yes | conparentid | plain | +btree, for table "pg_catalog.pg_constraint" + +Index "pg_catalog.pg_constraint_conrelid_contypid_conname_index" + Column | Type | Key? | Definition | Storage | Stats target +----------+---------+------+------------+---------+-------------- + conrelid | oid | yes | conrelid | plain | + contypid | oid | yes | contypid | plain | + conname | cstring | yes | conname | plain | +unique, btree, for table "pg_catalog.pg_constraint" + + Index "pg_catalog.pg_constraint_contypid_index" + Column | Type | Key? | Definition | Storage | Stats target +----------+------+------+------------+---------+-------------- + contypid | oid | yes | contypid | plain | +btree, for table "pg_catalog.pg_constraint" + + Index "pg_catalog.pg_constraint_oid_index" + Column | Type | Key? | Definition | Storage | Stats target +--------+------+------+------------+---------+-------------- + oid | oid | yes | oid | plain | +primary key, btree, for table "pg_catalog.pg_constraint" + + Table "pg_catalog.pg_conversion" + Column | Type | Collation | Nullable | Default | Storage | Compression | Stats target | Description +----------------+---------+-----------+----------+---------+---------+-------------+--------------+------------- + oid | oid | | not null | | plain | | | + conname | name | | not null | | plain | | | + connamespace | oid | | not null | | plain | | | + conowner | oid | | not null | | plain | | | + conforencoding | integer | | not null | | plain | | | + contoencoding | integer | | not null | | plain | | | + conproc | regproc | | not null | | plain | | | + condefault | boolean | | not null | | plain | | | +Indexes: + "pg_conversion_oid_index" PRIMARY KEY, btree (oid) + "pg_conversion_default_index" UNIQUE CONSTRAINT, btree (connamespace, conforencoding, contoencoding, oid) + "pg_conversion_name_nsp_index" UNIQUE CONSTRAINT, btree (conname, connamespace) +Access method: heap + + Index "pg_catalog.pg_conversion_default_index" + Column | Type | Key? | Definition | Storage | Stats target +----------------+---------+------+----------------+---------+-------------- + connamespace | oid | yes | connamespace | plain | + conforencoding | integer | yes | conforencoding | plain | + contoencoding | integer | yes | contoencoding | plain | + oid | oid | yes | oid | plain | +unique, btree, for table "pg_catalog.pg_conversion" + + Index "pg_catalog.pg_conversion_name_nsp_index" + Column | Type | Key? | Definition | Storage | Stats target +--------------+---------+------+--------------+---------+-------------- + conname | cstring | yes | conname | plain | + connamespace | oid | yes | connamespace | plain | +unique, btree, for table "pg_catalog.pg_conversion" + + Index "pg_catalog.pg_conversion_oid_index" + Column | Type | Key? | Definition | Storage | Stats target +--------+------+------+------------+---------+-------------- + oid | oid | yes | oid | plain | +primary key, btree, for table "pg_catalog.pg_conversion" + + View "pg_catalog.pg_cursors" + Column | Type | Collation | Nullable | Default | Storage | Description +---------------+--------------------------+-----------+----------+---------+----------+------------- + name | text | | | | extended | + statement | text | | | | extended | + is_holdable | boolean | | | | plain | + is_binary | boolean | | | | plain | + is_scrollable | boolean | | | | plain | + creation_time | timestamp with time zone | | | | plain | +View definition: + SELECT name, + statement, + is_holdable, + is_binary, + is_scrollable, + creation_time + FROM pg_cursor() c(name, statement, is_holdable, is_binary, is_scrollable, creation_time); + + Table "pg_catalog.pg_database" + Column | Type | Collation | Nullable | Default | Storage | Compression | Stats target | Description +----------------+-----------+-----------+----------+---------+----------+-------------+--------------+------------- + oid | oid | | not null | | plain | | | + datname | name | | not null | | plain | | | + datdba | oid | | not null | | plain | | | + encoding | integer | | not null | | plain | | | + datlocprovider | "char" | | not null | | plain | | | + datistemplate | boolean | | not null | | plain | | | + datallowconn | boolean | | not null | | plain | | | + datconnlimit | integer | | not null | | plain | | | + datfrozenxid | xid | | not null | | plain | | | + datminmxid | xid | | not null | | plain | | | + dattablespace | oid | | not null | | plain | | | + datcollate | text | C | not null | | extended | | | + datctype | text | C | not null | | extended | | | + daticulocale | text | C | | | extended | | | + daticurules | text | C | | | extended | | | + datcollversion | text | C | | | extended | | | + datacl | aclitem[] | | | | extended | | | +Indexes: + "pg_database_oid_index" PRIMARY KEY, btree (oid), tablespace "pg_global" + "pg_database_datname_index" UNIQUE CONSTRAINT, btree (datname), tablespace "pg_global" +Tablespace: "pg_global" +Access method: heap + + Index "pg_catalog.pg_database_datname_index" + Column | Type | Key? | Definition | Storage | Stats target +---------+---------+------+------------+---------+-------------- + datname | cstring | yes | datname | plain | +unique, btree, for table "pg_catalog.pg_database" +Tablespace: "pg_global" + + Index "pg_catalog.pg_database_oid_index" + Column | Type | Key? | Definition | Storage | Stats target +--------+------+------+------------+---------+-------------- + oid | oid | yes | oid | plain | +primary key, btree, for table "pg_catalog.pg_database" +Tablespace: "pg_global" + + Table "pg_catalog.pg_db_role_setting" + Column | Type | Collation | Nullable | Default | Storage | Compression | Stats target | Description +-------------+--------+-----------+----------+---------+----------+-------------+--------------+------------- + setdatabase | oid | | not null | | plain | | | + setrole | oid | | not null | | plain | | | + setconfig | text[] | C | | | extended | | | +Indexes: + "pg_db_role_setting_databaseid_rol_index" PRIMARY KEY, btree (setdatabase, setrole), tablespace "pg_global" +Tablespace: "pg_global" +Access method: heap + + Index "pg_catalog.pg_db_role_setting_databaseid_rol_index" + Column | Type | Key? | Definition | Storage | Stats target +-------------+------+------+-------------+---------+-------------- + setdatabase | oid | yes | setdatabase | plain | + setrole | oid | yes | setrole | plain | +primary key, btree, for table "pg_catalog.pg_db_role_setting" +Tablespace: "pg_global" + + Table "pg_catalog.pg_default_acl" + Column | Type | Collation | Nullable | Default | Storage | Compression | Stats target | Description +-----------------+-----------+-----------+----------+---------+----------+-------------+--------------+------------- + oid | oid | | not null | | plain | | | + defaclrole | oid | | not null | | plain | | | + defaclnamespace | oid | | not null | | plain | | | + defaclobjtype | "char" | | not null | | plain | | | + defaclacl | aclitem[] | | not null | | extended | | | +Indexes: + "pg_default_acl_oid_index" PRIMARY KEY, btree (oid) + "pg_default_acl_role_nsp_obj_index" UNIQUE CONSTRAINT, btree (defaclrole, defaclnamespace, defaclobjtype) +Access method: heap + + Index "pg_catalog.pg_default_acl_oid_index" + Column | Type | Key? | Definition | Storage | Stats target +--------+------+------+------------+---------+-------------- + oid | oid | yes | oid | plain | +primary key, btree, for table "pg_catalog.pg_default_acl" + + Index "pg_catalog.pg_default_acl_role_nsp_obj_index" + Column | Type | Key? | Definition | Storage | Stats target +-----------------+--------+------+-----------------+---------+-------------- + defaclrole | oid | yes | defaclrole | plain | + defaclnamespace | oid | yes | defaclnamespace | plain | + defaclobjtype | "char" | yes | defaclobjtype | plain | +unique, btree, for table "pg_catalog.pg_default_acl" + + Table "pg_catalog.pg_depend" + Column | Type | Collation | Nullable | Default | Storage | Compression | Stats target | Description +-------------+---------+-----------+----------+---------+---------+-------------+--------------+------------- + classid | oid | | not null | | plain | | | + objid | oid | | not null | | plain | | | + objsubid | integer | | not null | | plain | | | + refclassid | oid | | not null | | plain | | | + refobjid | oid | | not null | | plain | | | + refobjsubid | integer | | not null | | plain | | | + deptype | "char" | | not null | | plain | | | +Indexes: + "pg_depend_depender_index" btree (classid, objid, objsubid) + "pg_depend_reference_index" btree (refclassid, refobjid, refobjsubid) +Access method: heap + + Index "pg_catalog.pg_depend_depender_index" + Column | Type | Key? | Definition | Storage | Stats target +----------+---------+------+------------+---------+-------------- + classid | oid | yes | classid | plain | + objid | oid | yes | objid | plain | + objsubid | integer | yes | objsubid | plain | +btree, for table "pg_catalog.pg_depend" + + Index "pg_catalog.pg_depend_reference_index" + Column | Type | Key? | Definition | Storage | Stats target +-------------+---------+------+-------------+---------+-------------- + refclassid | oid | yes | refclassid | plain | + refobjid | oid | yes | refobjid | plain | + refobjsubid | integer | yes | refobjsubid | plain | +btree, for table "pg_catalog.pg_depend" + + Table "pg_catalog.pg_description" + Column | Type | Collation | Nullable | Default | Storage | Compression | Stats target | Description +-------------+---------+-----------+----------+---------+----------+-------------+--------------+------------- + objoid | oid | | not null | | plain | | | + classoid | oid | | not null | | plain | | | + objsubid | integer | | not null | | plain | | | + description | text | C | not null | | extended | | | +Indexes: + "pg_description_o_c_o_index" PRIMARY KEY, btree (objoid, classoid, objsubid) +Access method: heap + + Index "pg_catalog.pg_description_o_c_o_index" + Column | Type | Key? | Definition | Storage | Stats target +----------+---------+------+------------+---------+-------------- + objoid | oid | yes | objoid | plain | + classoid | oid | yes | classoid | plain | + objsubid | integer | yes | objsubid | plain | +primary key, btree, for table "pg_catalog.pg_description" + + Table "pg_catalog.pg_enum" + Column | Type | Collation | Nullable | Default | Storage | Compression | Stats target | Description +---------------+------+-----------+----------+---------+---------+-------------+--------------+------------- + oid | oid | | not null | | plain | | | + enumtypid | oid | | not null | | plain | | | + enumsortorder | real | | not null | | plain | | | + enumlabel | name | | not null | | plain | | | +Indexes: + "pg_enum_oid_index" PRIMARY KEY, btree (oid) + "pg_enum_typid_label_index" UNIQUE CONSTRAINT, btree (enumtypid, enumlabel) + "pg_enum_typid_sortorder_index" UNIQUE CONSTRAINT, btree (enumtypid, enumsortorder) +Access method: heap + + Index "pg_catalog.pg_enum_oid_index" + Column | Type | Key? | Definition | Storage | Stats target +--------+------+------+------------+---------+-------------- + oid | oid | yes | oid | plain | +primary key, btree, for table "pg_catalog.pg_enum" + + Index "pg_catalog.pg_enum_typid_label_index" + Column | Type | Key? | Definition | Storage | Stats target +-----------+---------+------+------------+---------+-------------- + enumtypid | oid | yes | enumtypid | plain | + enumlabel | cstring | yes | enumlabel | plain | +unique, btree, for table "pg_catalog.pg_enum" + + Index "pg_catalog.pg_enum_typid_sortorder_index" + Column | Type | Key? | Definition | Storage | Stats target +---------------+------+------+---------------+---------+-------------- + enumtypid | oid | yes | enumtypid | plain | + enumsortorder | real | yes | enumsortorder | plain | +unique, btree, for table "pg_catalog.pg_enum" + + Table "pg_catalog.pg_event_trigger" + Column | Type | Collation | Nullable | Default | Storage | Compression | Stats target | Description +------------+--------+-----------+----------+---------+----------+-------------+--------------+------------- + oid | oid | | not null | | plain | | | + evtname | name | | not null | | plain | | | + evtevent | name | | not null | | plain | | | + evtowner | oid | | not null | | plain | | | + evtfoid | oid | | not null | | plain | | | + evtenabled | "char" | | not null | | plain | | | + evttags | text[] | C | | | extended | | | +Indexes: + "pg_event_trigger_oid_index" PRIMARY KEY, btree (oid) + "pg_event_trigger_evtname_index" UNIQUE CONSTRAINT, btree (evtname) +Access method: heap + + Index "pg_catalog.pg_event_trigger_evtname_index" + Column | Type | Key? | Definition | Storage | Stats target +---------+---------+------+------------+---------+-------------- + evtname | cstring | yes | evtname | plain | +unique, btree, for table "pg_catalog.pg_event_trigger" + + Index "pg_catalog.pg_event_trigger_oid_index" + Column | Type | Key? | Definition | Storage | Stats target +--------+------+------+------------+---------+-------------- + oid | oid | yes | oid | plain | +primary key, btree, for table "pg_catalog.pg_event_trigger" + + Table "pg_catalog.pg_extension" + Column | Type | Collation | Nullable | Default | Storage | Compression | Stats target | Description +----------------+---------+-----------+----------+---------+----------+-------------+--------------+------------- + oid | oid | | not null | | plain | | | + extname | name | | not null | | plain | | | + extowner | oid | | not null | | plain | | | + extnamespace | oid | | not null | | plain | | | + extrelocatable | boolean | | not null | | plain | | | + extversion | text | C | not null | | extended | | | + extconfig | oid[] | | | | extended | | | + extcondition | text[] | C | | | extended | | | +Indexes: + "pg_extension_oid_index" PRIMARY KEY, btree (oid) + "pg_extension_name_index" UNIQUE CONSTRAINT, btree (extname) +Access method: heap + + Index "pg_catalog.pg_extension_name_index" + Column | Type | Key? | Definition | Storage | Stats target +---------+---------+------+------------+---------+-------------- + extname | cstring | yes | extname | plain | +unique, btree, for table "pg_catalog.pg_extension" + + Index "pg_catalog.pg_extension_oid_index" + Column | Type | Key? | Definition | Storage | Stats target +--------+------+------+------------+---------+-------------- + oid | oid | yes | oid | plain | +primary key, btree, for table "pg_catalog.pg_extension" + + View "pg_catalog.pg_file_settings" + Column | Type | Collation | Nullable | Default | Storage | Description +------------+---------+-----------+----------+---------+----------+------------- + sourcefile | text | | | | extended | + sourceline | integer | | | | plain | + seqno | integer | | | | plain | + name | text | | | | extended | + setting | text | | | | extended | + applied | boolean | | | | plain | + error | text | | | | extended | +View definition: + SELECT sourcefile, + sourceline, + seqno, + name, + setting, + applied, + error + FROM pg_show_all_file_settings() a(sourcefile, sourceline, seqno, name, setting, applied, error); + + Table "pg_catalog.pg_foreign_data_wrapper" + Column | Type | Collation | Nullable | Default | Storage | Compression | Stats target | Description +--------------+-----------+-----------+----------+---------+----------+-------------+--------------+------------- + oid | oid | | not null | | plain | | | + fdwname | name | | not null | | plain | | | + fdwowner | oid | | not null | | plain | | | + fdwhandler | oid | | not null | | plain | | | + fdwvalidator | oid | | not null | | plain | | | + fdwacl | aclitem[] | | | | extended | | | + fdwoptions | text[] | C | | | extended | | | +Indexes: + "pg_foreign_data_wrapper_oid_index" PRIMARY KEY, btree (oid) + "pg_foreign_data_wrapper_name_index" UNIQUE CONSTRAINT, btree (fdwname) +Access method: heap + + Index "pg_catalog.pg_foreign_data_wrapper_name_index" + Column | Type | Key? | Definition | Storage | Stats target +---------+---------+------+------------+---------+-------------- + fdwname | cstring | yes | fdwname | plain | +unique, btree, for table "pg_catalog.pg_foreign_data_wrapper" + + Index "pg_catalog.pg_foreign_data_wrapper_oid_index" + Column | Type | Key? | Definition | Storage | Stats target +--------+------+------+------------+---------+-------------- + oid | oid | yes | oid | plain | +primary key, btree, for table "pg_catalog.pg_foreign_data_wrapper" + + Table "pg_catalog.pg_foreign_server" + Column | Type | Collation | Nullable | Default | Storage | Compression | Stats target | Description +------------+-----------+-----------+----------+---------+----------+-------------+--------------+------------- + oid | oid | | not null | | plain | | | + srvname | name | | not null | | plain | | | + srvowner | oid | | not null | | plain | | | + srvfdw | oid | | not null | | plain | | | + srvtype | text | C | | | extended | | | + srvversion | text | C | | | extended | | | + srvacl | aclitem[] | | | | extended | | | + srvoptions | text[] | C | | | extended | | | +Indexes: + "pg_foreign_server_oid_index" PRIMARY KEY, btree (oid) + "pg_foreign_server_name_index" UNIQUE CONSTRAINT, btree (srvname) +Access method: heap + + Index "pg_catalog.pg_foreign_server_name_index" + Column | Type | Key? | Definition | Storage | Stats target +---------+---------+------+------------+---------+-------------- + srvname | cstring | yes | srvname | plain | +unique, btree, for table "pg_catalog.pg_foreign_server" + + Index "pg_catalog.pg_foreign_server_oid_index" + Column | Type | Key? | Definition | Storage | Stats target +--------+------+------+------------+---------+-------------- + oid | oid | yes | oid | plain | +primary key, btree, for table "pg_catalog.pg_foreign_server" + + Table "pg_catalog.pg_foreign_table" + Column | Type | Collation | Nullable | Default | Storage | Compression | Stats target | Description +-----------+--------+-----------+----------+---------+----------+-------------+--------------+------------- + ftrelid | oid | | not null | | plain | | | + ftserver | oid | | not null | | plain | | | + ftoptions | text[] | C | | | extended | | | +Indexes: + "pg_foreign_table_relid_index" PRIMARY KEY, btree (ftrelid) +Access method: heap + + Index "pg_catalog.pg_foreign_table_relid_index" + Column | Type | Key? | Definition | Storage | Stats target +---------+------+------+------------+---------+-------------- + ftrelid | oid | yes | ftrelid | plain | +primary key, btree, for table "pg_catalog.pg_foreign_table" + + View "pg_catalog.pg_group" + Column | Type | Collation | Nullable | Default | Storage | Description +----------+-------+-----------+----------+---------+----------+------------- + groname | name | | | | plain | + grosysid | oid | | | | plain | + grolist | oid[] | | | | extended | +View definition: + SELECT rolname AS groname, + oid AS grosysid, + ARRAY( SELECT pg_auth_members.member + FROM pg_auth_members + WHERE pg_auth_members.roleid = pg_authid.oid) AS grolist + FROM pg_authid + WHERE NOT rolcanlogin; + + View "pg_catalog.pg_hba_file_rules" + Column | Type | Collation | Nullable | Default | Storage | Description +-------------+---------+-----------+----------+---------+----------+------------- + rule_number | integer | | | | plain | + file_name | text | | | | extended | + line_number | integer | | | | plain | + type | text | | | | extended | + database | text[] | | | | extended | + user_name | text[] | | | | extended | + address | text | | | | extended | + netmask | text | | | | extended | + auth_method | text | | | | extended | + options | text[] | | | | extended | + error | text | | | | extended | +View definition: + SELECT rule_number, + file_name, + line_number, + type, + database, + user_name, + address, + netmask, + auth_method, + options, + error + FROM pg_hba_file_rules() a(rule_number, file_name, line_number, type, database, user_name, address, netmask, auth_method, options, error); + + View "pg_catalog.pg_ident_file_mappings" + Column | Type | Collation | Nullable | Default | Storage | Description +-------------+---------+-----------+----------+---------+----------+------------- + map_number | integer | | | | plain | + file_name | text | | | | extended | + line_number | integer | | | | plain | + map_name | text | | | | extended | + sys_name | text | | | | extended | + pg_username | text | | | | extended | + error | text | | | | extended | +View definition: + SELECT map_number, + file_name, + line_number, + map_name, + sys_name, + pg_username, + error + FROM pg_ident_file_mappings() a(map_number, file_name, line_number, map_name, sys_name, pg_username, error); + + Table "pg_catalog.pg_index" + Column | Type | Collation | Nullable | Default | Storage | Compression | Stats target | Description +---------------------+--------------+-----------+----------+---------+----------+-------------+--------------+------------- + indexrelid | oid | | not null | | plain | | | + indrelid | oid | | not null | | plain | | | + indnatts | smallint | | not null | | plain | | | + indnkeyatts | smallint | | not null | | plain | | | + indisunique | boolean | | not null | | plain | | | + indnullsnotdistinct | boolean | | not null | | plain | | | + indisprimary | boolean | | not null | | plain | | | + indisexclusion | boolean | | not null | | plain | | | + indimmediate | boolean | | not null | | plain | | | + indisclustered | boolean | | not null | | plain | | | + indisvalid | boolean | | not null | | plain | | | + indcheckxmin | boolean | | not null | | plain | | | + indisready | boolean | | not null | | plain | | | + indislive | boolean | | not null | | plain | | | + indisreplident | boolean | | not null | | plain | | | + indkey | int2vector | | not null | | plain | | | + indcollation | oidvector | | not null | | plain | | | + indclass | oidvector | | not null | | plain | | | + indoption | int2vector | | not null | | plain | | | + indexprs | pg_node_tree | C | | | extended | | | + indpred | pg_node_tree | C | | | extended | | | +Indexes: + "pg_index_indexrelid_index" PRIMARY KEY, btree (indexrelid) + "pg_index_indrelid_index" btree (indrelid) +Access method: heap + + Index "pg_catalog.pg_index_indexrelid_index" + Column | Type | Key? | Definition | Storage | Stats target +------------+------+------+------------+---------+-------------- + indexrelid | oid | yes | indexrelid | plain | +primary key, btree, for table "pg_catalog.pg_index" + + Index "pg_catalog.pg_index_indrelid_index" + Column | Type | Key? | Definition | Storage | Stats target +----------+------+------+------------+---------+-------------- + indrelid | oid | yes | indrelid | plain | +btree, for table "pg_catalog.pg_index" + + View "pg_catalog.pg_indexes" + Column | Type | Collation | Nullable | Default | Storage | Description +------------+------+-----------+----------+---------+----------+------------- + schemaname | name | | | | plain | + tablename | name | | | | plain | + indexname | name | | | | plain | + tablespace | name | | | | plain | + indexdef | text | | | | extended | +View definition: + SELECT n.nspname AS schemaname, + c.relname AS tablename, + i.relname AS indexname, + t.spcname AS tablespace, + pg_get_indexdef(i.oid) AS indexdef + FROM pg_index x + JOIN pg_class c ON c.oid = x.indrelid + JOIN pg_class i ON i.oid = x.indexrelid + LEFT JOIN pg_namespace n ON n.oid = c.relnamespace + LEFT JOIN pg_tablespace t ON t.oid = i.reltablespace + WHERE (c.relkind = ANY (ARRAY['r'::"char", 'm'::"char", 'p'::"char"])) AND (i.relkind = ANY (ARRAY['i'::"char", 'I'::"char"])); + + Table "pg_catalog.pg_inherits" + Column | Type | Collation | Nullable | Default | Storage | Compression | Stats target | Description +------------------+---------+-----------+----------+---------+---------+-------------+--------------+------------- + inhrelid | oid | | not null | | plain | | | + inhparent | oid | | not null | | plain | | | + inhseqno | integer | | not null | | plain | | | + inhdetachpending | boolean | | not null | | plain | | | +Indexes: + "pg_inherits_relid_seqno_index" PRIMARY KEY, btree (inhrelid, inhseqno) + "pg_inherits_parent_index" btree (inhparent) +Access method: heap + + Index "pg_catalog.pg_inherits_parent_index" + Column | Type | Key? | Definition | Storage | Stats target +-----------+------+------+------------+---------+-------------- + inhparent | oid | yes | inhparent | plain | +btree, for table "pg_catalog.pg_inherits" + + Index "pg_catalog.pg_inherits_relid_seqno_index" + Column | Type | Key? | Definition | Storage | Stats target +----------+---------+------+------------+---------+-------------- + inhrelid | oid | yes | inhrelid | plain | + inhseqno | integer | yes | inhseqno | plain | +primary key, btree, for table "pg_catalog.pg_inherits" + + Table "pg_catalog.pg_init_privs" + Column | Type | Collation | Nullable | Default | Storage | Compression | Stats target | Description +-----------+-----------+-----------+----------+---------+----------+-------------+--------------+------------- + objoid | oid | | not null | | plain | | | + classoid | oid | | not null | | plain | | | + objsubid | integer | | not null | | plain | | | + privtype | "char" | | not null | | plain | | | + initprivs | aclitem[] | | not null | | extended | | | +Indexes: + "pg_init_privs_o_c_o_index" PRIMARY KEY, btree (objoid, classoid, objsubid) +Access method: heap + + Index "pg_catalog.pg_init_privs_o_c_o_index" + Column | Type | Key? | Definition | Storage | Stats target +----------+---------+------+------------+---------+-------------- + objoid | oid | yes | objoid | plain | + classoid | oid | yes | classoid | plain | + objsubid | integer | yes | objsubid | plain | +primary key, btree, for table "pg_catalog.pg_init_privs" + + Table "pg_catalog.pg_language" + Column | Type | Collation | Nullable | Default | Storage | Compression | Stats target | Description +---------------+-----------+-----------+----------+---------+----------+-------------+--------------+------------- + oid | oid | | not null | | plain | | | + lanname | name | | not null | | plain | | | + lanowner | oid | | not null | | plain | | | + lanispl | boolean | | not null | | plain | | | + lanpltrusted | boolean | | not null | | plain | | | + lanplcallfoid | oid | | not null | | plain | | | + laninline | oid | | not null | | plain | | | + lanvalidator | oid | | not null | | plain | | | + lanacl | aclitem[] | | | | extended | | | +Indexes: + "pg_language_oid_index" PRIMARY KEY, btree (oid) + "pg_language_name_index" UNIQUE CONSTRAINT, btree (lanname) +Access method: heap + + Index "pg_catalog.pg_language_name_index" + Column | Type | Key? | Definition | Storage | Stats target +---------+---------+------+------------+---------+-------------- + lanname | cstring | yes | lanname | plain | +unique, btree, for table "pg_catalog.pg_language" + + Index "pg_catalog.pg_language_oid_index" + Column | Type | Key? | Definition | Storage | Stats target +--------+------+------+------------+---------+-------------- + oid | oid | yes | oid | plain | +primary key, btree, for table "pg_catalog.pg_language" + + Table "pg_catalog.pg_largeobject" + Column | Type | Collation | Nullable | Default | Storage | Compression | Stats target | Description +--------+---------+-----------+----------+---------+----------+-------------+--------------+------------- + loid | oid | | not null | | plain | | | + pageno | integer | | not null | | plain | | | + data | bytea | | not null | | extended | | | +Indexes: + "pg_largeobject_loid_pn_index" PRIMARY KEY, btree (loid, pageno) +Access method: heap + + Index "pg_catalog.pg_largeobject_loid_pn_index" + Column | Type | Key? | Definition | Storage | Stats target +--------+---------+------+------------+---------+-------------- + loid | oid | yes | loid | plain | + pageno | integer | yes | pageno | plain | +primary key, btree, for table "pg_catalog.pg_largeobject" + + Table "pg_catalog.pg_largeobject_metadata" + Column | Type | Collation | Nullable | Default | Storage | Compression | Stats target | Description +----------+-----------+-----------+----------+---------+----------+-------------+--------------+------------- + oid | oid | | not null | | plain | | | + lomowner | oid | | not null | | plain | | | + lomacl | aclitem[] | | | | extended | | | +Indexes: + "pg_largeobject_metadata_oid_index" PRIMARY KEY, btree (oid) +Access method: heap + + Index "pg_catalog.pg_largeobject_metadata_oid_index" + Column | Type | Key? | Definition | Storage | Stats target +--------+------+------+------------+---------+-------------- + oid | oid | yes | oid | plain | +primary key, btree, for table "pg_catalog.pg_largeobject_metadata" + + View "pg_catalog.pg_locks" + Column | Type | Collation | Nullable | Default | Storage | Description +--------------------+--------------------------+-----------+----------+---------+----------+------------- + locktype | text | | | | extended | + database | oid | | | | plain | + relation | oid | | | | plain | + page | integer | | | | plain | + tuple | smallint | | | | plain | + virtualxid | text | | | | extended | + transactionid | xid | | | | plain | + classid | oid | | | | plain | + objid | oid | | | | plain | + objsubid | smallint | | | | plain | + virtualtransaction | text | | | | extended | + pid | integer | | | | plain | + mode | text | | | | extended | + granted | boolean | | | | plain | + fastpath | boolean | | | | plain | + waitstart | timestamp with time zone | | | | plain | +View definition: + SELECT locktype, + database, + relation, + page, + tuple, + virtualxid, + transactionid, + classid, + objid, + objsubid, + virtualtransaction, + pid, + mode, + granted, + fastpath, + waitstart + FROM pg_lock_status() l(locktype, database, relation, page, tuple, virtualxid, transactionid, classid, objid, objsubid, virtualtransaction, pid, mode, granted, fastpath, waitstart); + + View "pg_catalog.pg_matviews" + Column | Type | Collation | Nullable | Default | Storage | Description +--------------+---------+-----------+----------+---------+----------+------------- + schemaname | name | | | | plain | + matviewname | name | | | | plain | + matviewowner | name | | | | plain | + tablespace | name | | | | plain | + hasindexes | boolean | | | | plain | + ispopulated | boolean | | | | plain | + definition | text | | | | extended | +View definition: + SELECT n.nspname AS schemaname, + c.relname AS matviewname, + pg_get_userbyid(c.relowner) AS matviewowner, + t.spcname AS tablespace, + c.relhasindex AS hasindexes, + c.relispopulated AS ispopulated, + pg_get_viewdef(c.oid) AS definition + FROM pg_class c + LEFT JOIN pg_namespace n ON n.oid = c.relnamespace + LEFT JOIN pg_tablespace t ON t.oid = c.reltablespace + WHERE c.relkind = 'm'::"char"; + + Table "pg_catalog.pg_namespace" + Column | Type | Collation | Nullable | Default | Storage | Compression | Stats target | Description +----------+-----------+-----------+----------+---------+----------+-------------+--------------+------------- + oid | oid | | not null | | plain | | | + nspname | name | | not null | | plain | | | + nspowner | oid | | not null | | plain | | | + nspacl | aclitem[] | | | | extended | | | +Indexes: + "pg_namespace_oid_index" PRIMARY KEY, btree (oid) + "pg_namespace_nspname_index" UNIQUE CONSTRAINT, btree (nspname) +Access method: heap + + Index "pg_catalog.pg_namespace_nspname_index" + Column | Type | Key? | Definition | Storage | Stats target +---------+---------+------+------------+---------+-------------- + nspname | cstring | yes | nspname | plain | +unique, btree, for table "pg_catalog.pg_namespace" + + Index "pg_catalog.pg_namespace_oid_index" + Column | Type | Key? | Definition | Storage | Stats target +--------+------+------+------------+---------+-------------- + oid | oid | yes | oid | plain | +primary key, btree, for table "pg_catalog.pg_namespace" + + Table "pg_catalog.pg_opclass" + Column | Type | Collation | Nullable | Default | Storage | Compression | Stats target | Description +--------------+---------+-----------+----------+---------+---------+-------------+--------------+------------- + oid | oid | | not null | | plain | | | + opcmethod | oid | | not null | | plain | | | + opcname | name | | not null | | plain | | | + opcnamespace | oid | | not null | | plain | | | + opcowner | oid | | not null | | plain | | | + opcfamily | oid | | not null | | plain | | | + opcintype | oid | | not null | | plain | | | + opcdefault | boolean | | not null | | plain | | | + opckeytype | oid | | not null | | plain | | | +Indexes: + "pg_opclass_oid_index" PRIMARY KEY, btree (oid) + "pg_opclass_am_name_nsp_index" UNIQUE CONSTRAINT, btree (opcmethod, opcname, opcnamespace) +Access method: heap + + Index "pg_catalog.pg_opclass_am_name_nsp_index" + Column | Type | Key? | Definition | Storage | Stats target +--------------+---------+------+--------------+---------+-------------- + opcmethod | oid | yes | opcmethod | plain | + opcname | cstring | yes | opcname | plain | + opcnamespace | oid | yes | opcnamespace | plain | +unique, btree, for table "pg_catalog.pg_opclass" + + Index "pg_catalog.pg_opclass_oid_index" + Column | Type | Key? | Definition | Storage | Stats target +--------+------+------+------------+---------+-------------- + oid | oid | yes | oid | plain | +primary key, btree, for table "pg_catalog.pg_opclass" + + Table "pg_catalog.pg_operator" + Column | Type | Collation | Nullable | Default | Storage | Compression | Stats target | Description +--------------+---------+-----------+----------+---------+---------+-------------+--------------+------------- + oid | oid | | not null | | plain | | | + oprname | name | | not null | | plain | | | + oprnamespace | oid | | not null | | plain | | | + oprowner | oid | | not null | | plain | | | + oprkind | "char" | | not null | | plain | | | + oprcanmerge | boolean | | not null | | plain | | | + oprcanhash | boolean | | not null | | plain | | | + oprleft | oid | | not null | | plain | | | + oprright | oid | | not null | | plain | | | + oprresult | oid | | not null | | plain | | | + oprcom | oid | | not null | | plain | | | + oprnegate | oid | | not null | | plain | | | + oprcode | regproc | | not null | | plain | | | + oprrest | regproc | | not null | | plain | | | + oprjoin | regproc | | not null | | plain | | | +Indexes: + "pg_operator_oid_index" PRIMARY KEY, btree (oid) + "pg_operator_oprname_l_r_n_index" UNIQUE CONSTRAINT, btree (oprname, oprleft, oprright, oprnamespace) +Access method: heap + + Index "pg_catalog.pg_operator_oid_index" + Column | Type | Key? | Definition | Storage | Stats target +--------+------+------+------------+---------+-------------- + oid | oid | yes | oid | plain | +primary key, btree, for table "pg_catalog.pg_operator" + + Index "pg_catalog.pg_operator_oprname_l_r_n_index" + Column | Type | Key? | Definition | Storage | Stats target +--------------+---------+------+--------------+---------+-------------- + oprname | cstring | yes | oprname | plain | + oprleft | oid | yes | oprleft | plain | + oprright | oid | yes | oprright | plain | + oprnamespace | oid | yes | oprnamespace | plain | +unique, btree, for table "pg_catalog.pg_operator" + + Table "pg_catalog.pg_opfamily" + Column | Type | Collation | Nullable | Default | Storage | Compression | Stats target | Description +--------------+------+-----------+----------+---------+---------+-------------+--------------+------------- + oid | oid | | not null | | plain | | | + opfmethod | oid | | not null | | plain | | | + opfname | name | | not null | | plain | | | + opfnamespace | oid | | not null | | plain | | | + opfowner | oid | | not null | | plain | | | +Indexes: + "pg_opfamily_oid_index" PRIMARY KEY, btree (oid) + "pg_opfamily_am_name_nsp_index" UNIQUE CONSTRAINT, btree (opfmethod, opfname, opfnamespace) +Access method: heap + + Index "pg_catalog.pg_opfamily_am_name_nsp_index" + Column | Type | Key? | Definition | Storage | Stats target +--------------+---------+------+--------------+---------+-------------- + opfmethod | oid | yes | opfmethod | plain | + opfname | cstring | yes | opfname | plain | + opfnamespace | oid | yes | opfnamespace | plain | +unique, btree, for table "pg_catalog.pg_opfamily" + + Index "pg_catalog.pg_opfamily_oid_index" + Column | Type | Key? | Definition | Storage | Stats target +--------+------+------+------------+---------+-------------- + oid | oid | yes | oid | plain | +primary key, btree, for table "pg_catalog.pg_opfamily" + + Table "pg_catalog.pg_parameter_acl" + Column | Type | Collation | Nullable | Default | Storage | Compression | Stats target | Description +---------+-----------+-----------+----------+---------+----------+-------------+--------------+------------- + oid | oid | | not null | | plain | | | + parname | text | C | not null | | extended | | | + paracl | aclitem[] | | | | extended | | | +Indexes: + "pg_parameter_acl_oid_index" PRIMARY KEY, btree (oid), tablespace "pg_global" + "pg_parameter_acl_parname_index" UNIQUE CONSTRAINT, btree (parname), tablespace "pg_global" +Tablespace: "pg_global" +Access method: heap + + Index "pg_catalog.pg_parameter_acl_oid_index" + Column | Type | Key? | Definition | Storage | Stats target +--------+------+------+------------+---------+-------------- + oid | oid | yes | oid | plain | +primary key, btree, for table "pg_catalog.pg_parameter_acl" +Tablespace: "pg_global" + + Index "pg_catalog.pg_parameter_acl_parname_index" + Column | Type | Key? | Definition | Storage | Stats target +---------+------+------+------------+----------+-------------- + parname | text | yes | parname | extended | +unique, btree, for table "pg_catalog.pg_parameter_acl" +Tablespace: "pg_global" + + Table "pg_catalog.pg_partitioned_table" + Column | Type | Collation | Nullable | Default | Storage | Compression | Stats target | Description +---------------+--------------+-----------+----------+---------+----------+-------------+--------------+------------- + partrelid | oid | | not null | | plain | | | + partstrat | "char" | | not null | | plain | | | + partnatts | smallint | | not null | | plain | | | + partdefid | oid | | not null | | plain | | | + partattrs | int2vector | | not null | | plain | | | + partclass | oidvector | | not null | | plain | | | + partcollation | oidvector | | not null | | plain | | | + partexprs | pg_node_tree | C | | | extended | | | +Indexes: + "pg_partitioned_table_partrelid_index" PRIMARY KEY, btree (partrelid) +Access method: heap + + Index "pg_catalog.pg_partitioned_table_partrelid_index" + Column | Type | Key? | Definition | Storage | Stats target +-----------+------+------+------------+---------+-------------- + partrelid | oid | yes | partrelid | plain | +primary key, btree, for table "pg_catalog.pg_partitioned_table" + + View "pg_catalog.pg_policies" + Column | Type | Collation | Nullable | Default | Storage | Description +------------+--------+-----------+----------+---------+----------+------------- + schemaname | name | | | | plain | + tablename | name | | | | plain | + policyname | name | | | | plain | + permissive | text | | | | extended | + roles | name[] | | | | extended | + cmd | text | | | | extended | + qual | text | C | | | extended | + with_check | text | C | | | extended | +View definition: + SELECT n.nspname AS schemaname, + c.relname AS tablename, + pol.polname AS policyname, + CASE + WHEN pol.polpermissive THEN 'PERMISSIVE'::text + ELSE 'RESTRICTIVE'::text + END AS permissive, + CASE + WHEN pol.polroles = '{0}'::oid[] THEN string_to_array('public'::text, ''::text)::name[] + ELSE ARRAY( SELECT pg_authid.rolname + FROM pg_authid + WHERE pg_authid.oid = ANY (pol.polroles) + ORDER BY pg_authid.rolname) + END AS roles, + CASE pol.polcmd + WHEN 'r'::"char" THEN 'SELECT'::text + WHEN 'a'::"char" THEN 'INSERT'::text + WHEN 'w'::"char" THEN 'UPDATE'::text + WHEN 'd'::"char" THEN 'DELETE'::text + WHEN '*'::"char" THEN 'ALL'::text + ELSE NULL::text + END AS cmd, + pg_get_expr(pol.polqual, pol.polrelid) AS qual, + pg_get_expr(pol.polwithcheck, pol.polrelid) AS with_check + FROM pg_policy pol + JOIN pg_class c ON c.oid = pol.polrelid + LEFT JOIN pg_namespace n ON n.oid = c.relnamespace; + + Table "pg_catalog.pg_policy" + Column | Type | Collation | Nullable | Default | Storage | Compression | Stats target | Description +---------------+--------------+-----------+----------+---------+----------+-------------+--------------+------------- + oid | oid | | not null | | plain | | | + polname | name | | not null | | plain | | | + polrelid | oid | | not null | | plain | | | + polcmd | "char" | | not null | | plain | | | + polpermissive | boolean | | not null | | plain | | | + polroles | oid[] | | not null | | extended | | | + polqual | pg_node_tree | C | | | extended | | | + polwithcheck | pg_node_tree | C | | | extended | | | +Indexes: + "pg_policy_oid_index" PRIMARY KEY, btree (oid) + "pg_policy_polrelid_polname_index" UNIQUE CONSTRAINT, btree (polrelid, polname) +Access method: heap + + Index "pg_catalog.pg_policy_oid_index" + Column | Type | Key? | Definition | Storage | Stats target +--------+------+------+------------+---------+-------------- + oid | oid | yes | oid | plain | +primary key, btree, for table "pg_catalog.pg_policy" + + Index "pg_catalog.pg_policy_polrelid_polname_index" + Column | Type | Key? | Definition | Storage | Stats target +----------+---------+------+------------+---------+-------------- + polrelid | oid | yes | polrelid | plain | + polname | cstring | yes | polname | plain | +unique, btree, for table "pg_catalog.pg_policy" + + View "pg_catalog.pg_prepared_statements" + Column | Type | Collation | Nullable | Default | Storage | Description +-----------------+--------------------------+-----------+----------+---------+----------+------------- + name | text | | | | extended | + statement | text | | | | extended | + prepare_time | timestamp with time zone | | | | plain | + parameter_types | regtype[] | | | | extended | + result_types | regtype[] | | | | extended | + from_sql | boolean | | | | plain | + generic_plans | bigint | | | | plain | + custom_plans | bigint | | | | plain | +View definition: + SELECT name, + statement, + prepare_time, + parameter_types, + result_types, + from_sql, + generic_plans, + custom_plans + FROM pg_prepared_statement() p(name, statement, prepare_time, parameter_types, result_types, from_sql, generic_plans, custom_plans); + + View "pg_catalog.pg_prepared_xacts" + Column | Type | Collation | Nullable | Default | Storage | Description +-------------+--------------------------+-----------+----------+---------+----------+------------- + transaction | xid | | | | plain | + gid | text | | | | extended | + prepared | timestamp with time zone | | | | plain | + owner | name | | | | plain | + database | name | | | | plain | +View definition: + SELECT p.transaction, + p.gid, + p.prepared, + u.rolname AS owner, + d.datname AS database + FROM pg_prepared_xact() p(transaction, gid, prepared, ownerid, dbid) + LEFT JOIN pg_authid u ON p.ownerid = u.oid + LEFT JOIN pg_database d ON p.dbid = d.oid; + + Table "pg_catalog.pg_proc" + Column | Type | Collation | Nullable | Default | Storage | Compression | Stats target | Description +-----------------+--------------+-----------+----------+---------+----------+-------------+--------------+------------- + oid | oid | | not null | | plain | | | + proname | name | | not null | | plain | | | + pronamespace | oid | | not null | | plain | | | + proowner | oid | | not null | | plain | | | + prolang | oid | | not null | | plain | | | + procost | real | | not null | | plain | | | + prorows | real | | not null | | plain | | | + provariadic | oid | | not null | | plain | | | + prosupport | regproc | | not null | | plain | | | + prokind | "char" | | not null | | plain | | | + prosecdef | boolean | | not null | | plain | | | + proleakproof | boolean | | not null | | plain | | | + proisstrict | boolean | | not null | | plain | | | + proretset | boolean | | not null | | plain | | | + provolatile | "char" | | not null | | plain | | | + proparallel | "char" | | not null | | plain | | | + pronargs | smallint | | not null | | plain | | | + pronargdefaults | smallint | | not null | | plain | | | + prorettype | oid | | not null | | plain | | | + proargtypes | oidvector | | not null | | plain | | | + proallargtypes | oid[] | | | | extended | | | + proargmodes | "char"[] | | | | extended | | | + proargnames | text[] | C | | | extended | | | + proargdefaults | pg_node_tree | C | | | extended | | | + protrftypes | oid[] | | | | extended | | | + prosrc | text | C | not null | | extended | | | + probin | text | C | | | extended | | | + prosqlbody | pg_node_tree | C | | | extended | | | + proconfig | text[] | C | | | extended | | | + proacl | aclitem[] | | | | extended | | | +Indexes: + "pg_proc_oid_index" PRIMARY KEY, btree (oid) + "pg_proc_proname_args_nsp_index" UNIQUE CONSTRAINT, btree (proname, proargtypes, pronamespace) +Access method: heap + + Index "pg_catalog.pg_proc_oid_index" + Column | Type | Key? | Definition | Storage | Stats target +--------+------+------+------------+---------+-------------- + oid | oid | yes | oid | plain | +primary key, btree, for table "pg_catalog.pg_proc" + + Index "pg_catalog.pg_proc_proname_args_nsp_index" + Column | Type | Key? | Definition | Storage | Stats target +--------------+-----------+------+--------------+---------+-------------- + proname | cstring | yes | proname | plain | + proargtypes | oidvector | yes | proargtypes | plain | + pronamespace | oid | yes | pronamespace | plain | +unique, btree, for table "pg_catalog.pg_proc" + + Table "pg_catalog.pg_publication" + Column | Type | Collation | Nullable | Default | Storage | Compression | Stats target | Description +--------------+---------+-----------+----------+---------+---------+-------------+--------------+------------- + oid | oid | | not null | | plain | | | + pubname | name | | not null | | plain | | | + pubowner | oid | | not null | | plain | | | + puballtables | boolean | | not null | | plain | | | + pubinsert | boolean | | not null | | plain | | | + pubupdate | boolean | | not null | | plain | | | + pubdelete | boolean | | not null | | plain | | | + pubtruncate | boolean | | not null | | plain | | | + pubviaroot | boolean | | not null | | plain | | | +Indexes: + "pg_publication_oid_index" PRIMARY KEY, btree (oid) + "pg_publication_pubname_index" UNIQUE CONSTRAINT, btree (pubname) +Access method: heap + + Table "pg_catalog.pg_publication_namespace" + Column | Type | Collation | Nullable | Default | Storage | Compression | Stats target | Description +---------+------+-----------+----------+---------+---------+-------------+--------------+------------- + oid | oid | | not null | | plain | | | + pnpubid | oid | | not null | | plain | | | + pnnspid | oid | | not null | | plain | | | +Indexes: + "pg_publication_namespace_oid_index" PRIMARY KEY, btree (oid) + "pg_publication_namespace_pnnspid_pnpubid_index" UNIQUE CONSTRAINT, btree (pnnspid, pnpubid) +Access method: heap + + Index "pg_catalog.pg_publication_namespace_oid_index" + Column | Type | Key? | Definition | Storage | Stats target +--------+------+------+------------+---------+-------------- + oid | oid | yes | oid | plain | +primary key, btree, for table "pg_catalog.pg_publication_namespace" + +Index "pg_catalog.pg_publication_namespace_pnnspid_pnpubid_index" + Column | Type | Key? | Definition | Storage | Stats target +---------+------+------+------------+---------+-------------- + pnnspid | oid | yes | pnnspid | plain | + pnpubid | oid | yes | pnpubid | plain | +unique, btree, for table "pg_catalog.pg_publication_namespace" + + Index "pg_catalog.pg_publication_oid_index" + Column | Type | Key? | Definition | Storage | Stats target +--------+------+------+------------+---------+-------------- + oid | oid | yes | oid | plain | +primary key, btree, for table "pg_catalog.pg_publication" + + Index "pg_catalog.pg_publication_pubname_index" + Column | Type | Key? | Definition | Storage | Stats target +---------+---------+------+------------+---------+-------------- + pubname | cstring | yes | pubname | plain | +unique, btree, for table "pg_catalog.pg_publication" + + Table "pg_catalog.pg_publication_rel" + Column | Type | Collation | Nullable | Default | Storage | Compression | Stats target | Description +---------+--------------+-----------+----------+---------+----------+-------------+--------------+------------- + oid | oid | | not null | | plain | | | + prpubid | oid | | not null | | plain | | | + prrelid | oid | | not null | | plain | | | + prqual | pg_node_tree | C | | | extended | | | + prattrs | int2vector | | | | plain | | | +Indexes: + "pg_publication_rel_oid_index" PRIMARY KEY, btree (oid) + "pg_publication_rel_prpubid_index" btree (prpubid) + "pg_publication_rel_prrelid_prpubid_index" UNIQUE CONSTRAINT, btree (prrelid, prpubid) +Access method: heap + + Index "pg_catalog.pg_publication_rel_oid_index" + Column | Type | Key? | Definition | Storage | Stats target +--------+------+------+------------+---------+-------------- + oid | oid | yes | oid | plain | +primary key, btree, for table "pg_catalog.pg_publication_rel" + + Index "pg_catalog.pg_publication_rel_prpubid_index" + Column | Type | Key? | Definition | Storage | Stats target +---------+------+------+------------+---------+-------------- + prpubid | oid | yes | prpubid | plain | +btree, for table "pg_catalog.pg_publication_rel" + + Index "pg_catalog.pg_publication_rel_prrelid_prpubid_index" + Column | Type | Key? | Definition | Storage | Stats target +---------+------+------+------------+---------+-------------- + prrelid | oid | yes | prrelid | plain | + prpubid | oid | yes | prpubid | plain | +unique, btree, for table "pg_catalog.pg_publication_rel" + + View "pg_catalog.pg_publication_tables" + Column | Type | Collation | Nullable | Default | Storage | Description +------------+--------+-----------+----------+---------+----------+------------- + pubname | name | | | | plain | + schemaname | name | | | | plain | + tablename | name | | | | plain | + attnames | name[] | | | | extended | + rowfilter | text | | | | extended | +View definition: + SELECT p.pubname, + n.nspname AS schemaname, + c.relname AS tablename, + ( SELECT array_agg(a.attname ORDER BY a.attnum) AS array_agg + FROM pg_attribute a + WHERE a.attrelid = gpt.relid AND (a.attnum = ANY (gpt.attrs::smallint[]))) AS attnames, + pg_get_expr(gpt.qual, gpt.relid) AS rowfilter + FROM pg_publication p, + LATERAL pg_get_publication_tables(VARIADIC ARRAY[p.pubname::text]) gpt(pubid, relid, attrs, qual), + pg_class c + JOIN pg_namespace n ON n.oid = c.relnamespace + WHERE c.oid = gpt.relid; + + Table "pg_catalog.pg_range" + Column | Type | Collation | Nullable | Default | Storage | Compression | Stats target | Description +---------------+---------+-----------+----------+---------+---------+-------------+--------------+------------- + rngtypid | oid | | not null | | plain | | | + rngsubtype | oid | | not null | | plain | | | + rngmultitypid | oid | | not null | | plain | | | + rngcollation | oid | | not null | | plain | | | + rngsubopc | oid | | not null | | plain | | | + rngcanonical | regproc | | not null | | plain | | | + rngsubdiff | regproc | | not null | | plain | | | +Indexes: + "pg_range_rngtypid_index" PRIMARY KEY, btree (rngtypid) + "pg_range_rngmultitypid_index" UNIQUE CONSTRAINT, btree (rngmultitypid) +Access method: heap + + Index "pg_catalog.pg_range_rngmultitypid_index" + Column | Type | Key? | Definition | Storage | Stats target +---------------+------+------+---------------+---------+-------------- + rngmultitypid | oid | yes | rngmultitypid | plain | +unique, btree, for table "pg_catalog.pg_range" + + Index "pg_catalog.pg_range_rngtypid_index" + Column | Type | Key? | Definition | Storage | Stats target +----------+------+------+------------+---------+-------------- + rngtypid | oid | yes | rngtypid | plain | +primary key, btree, for table "pg_catalog.pg_range" + + Table "pg_catalog.pg_replication_origin" + Column | Type | Collation | Nullable | Default | Storage | Compression | Stats target | Description +---------+------+-----------+----------+---------+----------+-------------+--------------+------------- + roident | oid | | not null | | plain | | | + roname | text | C | not null | | extended | | | +Indexes: + "pg_replication_origin_roiident_index" PRIMARY KEY, btree (roident), tablespace "pg_global" + "pg_replication_origin_roname_index" UNIQUE CONSTRAINT, btree (roname), tablespace "pg_global" +Tablespace: "pg_global" +Access method: heap + + Index "pg_catalog.pg_replication_origin_roiident_index" + Column | Type | Key? | Definition | Storage | Stats target +---------+------+------+------------+---------+-------------- + roident | oid | yes | roident | plain | +primary key, btree, for table "pg_catalog.pg_replication_origin" +Tablespace: "pg_global" + + Index "pg_catalog.pg_replication_origin_roname_index" + Column | Type | Key? | Definition | Storage | Stats target +--------+------+------+------------+----------+-------------- + roname | text | yes | roname | extended | +unique, btree, for table "pg_catalog.pg_replication_origin" +Tablespace: "pg_global" + + View "pg_catalog.pg_replication_origin_status" + Column | Type | Collation | Nullable | Default | Storage | Description +-------------+--------+-----------+----------+---------+----------+------------- + local_id | oid | | | | plain | + external_id | text | | | | extended | + remote_lsn | pg_lsn | | | | plain | + local_lsn | pg_lsn | | | | plain | +View definition: + SELECT local_id, + external_id, + remote_lsn, + local_lsn + FROM pg_show_replication_origin_status() pg_show_replication_origin_status(local_id, external_id, remote_lsn, local_lsn); + + View "pg_catalog.pg_replication_slots" + Column | Type | Collation | Nullable | Default | Storage | Description +---------------------+---------+-----------+----------+---------+----------+------------- + slot_name | name | | | | plain | + plugin | name | | | | plain | + slot_type | text | | | | extended | + datoid | oid | | | | plain | + database | name | | | | plain | + temporary | boolean | | | | plain | + active | boolean | | | | plain | + active_pid | integer | | | | plain | + xmin | xid | | | | plain | + catalog_xmin | xid | | | | plain | + restart_lsn | pg_lsn | | | | plain | + confirmed_flush_lsn | pg_lsn | | | | plain | + wal_status | text | | | | extended | + safe_wal_size | bigint | | | | plain | + two_phase | boolean | | | | plain | + conflicting | boolean | | | | plain | +View definition: + SELECT l.slot_name, + l.plugin, + l.slot_type, + l.datoid, + d.datname AS database, + l.temporary, + l.active, + l.active_pid, + l.xmin, + l.catalog_xmin, + l.restart_lsn, + l.confirmed_flush_lsn, + l.wal_status, + l.safe_wal_size, + l.two_phase, + l.conflicting + FROM pg_get_replication_slots() l(slot_name, plugin, slot_type, datoid, temporary, active, active_pid, xmin, catalog_xmin, restart_lsn, confirmed_flush_lsn, wal_status, safe_wal_size, two_phase, conflicting) + LEFT JOIN pg_database d ON l.datoid = d.oid; + + Table "pg_catalog.pg_rewrite" + Column | Type | Collation | Nullable | Default | Storage | Compression | Stats target | Description +------------+--------------+-----------+----------+---------+----------+-------------+--------------+------------- + oid | oid | | not null | | plain | | | + rulename | name | | not null | | plain | | | + ev_class | oid | | not null | | plain | | | + ev_type | "char" | | not null | | plain | | | + ev_enabled | "char" | | not null | | plain | | | + is_instead | boolean | | not null | | plain | | | + ev_qual | pg_node_tree | C | not null | | extended | | | + ev_action | pg_node_tree | C | not null | | extended | | | +Indexes: + "pg_rewrite_oid_index" PRIMARY KEY, btree (oid) + "pg_rewrite_rel_rulename_index" UNIQUE CONSTRAINT, btree (ev_class, rulename) +Access method: heap + + Index "pg_catalog.pg_rewrite_oid_index" + Column | Type | Key? | Definition | Storage | Stats target +--------+------+------+------------+---------+-------------- + oid | oid | yes | oid | plain | +primary key, btree, for table "pg_catalog.pg_rewrite" + + Index "pg_catalog.pg_rewrite_rel_rulename_index" + Column | Type | Key? | Definition | Storage | Stats target +----------+---------+------+------------+---------+-------------- + ev_class | oid | yes | ev_class | plain | + rulename | cstring | yes | rulename | plain | +unique, btree, for table "pg_catalog.pg_rewrite" + + View "pg_catalog.pg_roles" + Column | Type | Collation | Nullable | Default | Storage | Description +----------------+--------------------------+-----------+----------+---------+----------+------------- + rolname | name | | | | plain | + rolsuper | boolean | | | | plain | + rolinherit | boolean | | | | plain | + rolcreaterole | boolean | | | | plain | + rolcreatedb | boolean | | | | plain | + rolcanlogin | boolean | | | | plain | + rolreplication | boolean | | | | plain | + rolconnlimit | integer | | | | plain | + rolpassword | text | | | | extended | + rolvaliduntil | timestamp with time zone | | | | plain | + rolbypassrls | boolean | | | | plain | + rolconfig | text[] | C | | | extended | + oid | oid | | | | plain | +View definition: + SELECT pg_authid.rolname, + pg_authid.rolsuper, + pg_authid.rolinherit, + pg_authid.rolcreaterole, + pg_authid.rolcreatedb, + pg_authid.rolcanlogin, + pg_authid.rolreplication, + pg_authid.rolconnlimit, + '********'::text AS rolpassword, + pg_authid.rolvaliduntil, + pg_authid.rolbypassrls, + s.setconfig AS rolconfig, + pg_authid.oid + FROM pg_authid + LEFT JOIN pg_db_role_setting s ON pg_authid.oid = s.setrole AND s.setdatabase = 0::oid; + + View "pg_catalog.pg_rules" + Column | Type | Collation | Nullable | Default | Storage | Description +------------+------+-----------+----------+---------+----------+------------- + schemaname | name | | | | plain | + tablename | name | | | | plain | + rulename | name | | | | plain | + definition | text | | | | extended | +View definition: + SELECT n.nspname AS schemaname, + c.relname AS tablename, + r.rulename, + pg_get_ruledef(r.oid) AS definition + FROM pg_rewrite r + JOIN pg_class c ON c.oid = r.ev_class + LEFT JOIN pg_namespace n ON n.oid = c.relnamespace + WHERE r.rulename <> '_RETURN'::name; + + Table "pg_catalog.pg_seclabel" + Column | Type | Collation | Nullable | Default | Storage | Compression | Stats target | Description +----------+---------+-----------+----------+---------+----------+-------------+--------------+------------- + objoid | oid | | not null | | plain | | | + classoid | oid | | not null | | plain | | | + objsubid | integer | | not null | | plain | | | + provider | text | C | not null | | extended | | | + label | text | C | not null | | extended | | | +Indexes: + "pg_seclabel_object_index" PRIMARY KEY, btree (objoid, classoid, objsubid, provider) +Access method: heap + + Index "pg_catalog.pg_seclabel_object_index" + Column | Type | Key? | Definition | Storage | Stats target +----------+---------+------+------------+----------+-------------- + objoid | oid | yes | objoid | plain | + classoid | oid | yes | classoid | plain | + objsubid | integer | yes | objsubid | plain | + provider | text | yes | provider | extended | +primary key, btree, for table "pg_catalog.pg_seclabel" + + View "pg_catalog.pg_seclabels" + Column | Type | Collation | Nullable | Default | Storage | Description +--------------+---------+-----------+----------+---------+----------+------------- + objoid | oid | | | | plain | + classoid | oid | | | | plain | + objsubid | integer | | | | plain | + objtype | text | | | | extended | + objnamespace | oid | | | | plain | + objname | text | C | | | extended | + provider | text | C | | | extended | + label | text | C | | | extended | +View definition: + SELECT l.objoid, + l.classoid, + l.objsubid, + CASE + WHEN rel.relkind = ANY (ARRAY['r'::"char", 'p'::"char"]) THEN 'table'::text + WHEN rel.relkind = 'v'::"char" THEN 'view'::text + WHEN rel.relkind = 'm'::"char" THEN 'materialized view'::text + WHEN rel.relkind = 'S'::"char" THEN 'sequence'::text + WHEN rel.relkind = 'f'::"char" THEN 'foreign table'::text + ELSE NULL::text + END AS objtype, + rel.relnamespace AS objnamespace, + CASE + WHEN pg_table_is_visible(rel.oid) THEN quote_ident(rel.relname::text) + ELSE (quote_ident(nsp.nspname::text) || '.'::text) || quote_ident(rel.relname::text) + END AS objname, + l.provider, + l.label + FROM pg_seclabel l + JOIN pg_class rel ON l.classoid = rel.tableoid AND l.objoid = rel.oid + JOIN pg_namespace nsp ON rel.relnamespace = nsp.oid + WHERE l.objsubid = 0 +UNION ALL + SELECT l.objoid, + l.classoid, + l.objsubid, + 'column'::text AS objtype, + rel.relnamespace AS objnamespace, + ( + CASE + WHEN pg_table_is_visible(rel.oid) THEN quote_ident(rel.relname::text) + ELSE (quote_ident(nsp.nspname::text) || '.'::text) || quote_ident(rel.relname::text) + END || '.'::text) || att.attname::text AS objname, + l.provider, + l.label + FROM pg_seclabel l + JOIN pg_class rel ON l.classoid = rel.tableoid AND l.objoid = rel.oid + JOIN pg_attribute att ON rel.oid = att.attrelid AND l.objsubid = att.attnum + JOIN pg_namespace nsp ON rel.relnamespace = nsp.oid + WHERE l.objsubid <> 0 +UNION ALL + SELECT l.objoid, + l.classoid, + l.objsubid, + CASE pro.prokind + WHEN 'a'::"char" THEN 'aggregate'::text + WHEN 'f'::"char" THEN 'function'::text + WHEN 'p'::"char" THEN 'procedure'::text + WHEN 'w'::"char" THEN 'window'::text + ELSE NULL::text + END AS objtype, + pro.pronamespace AS objnamespace, + (( + CASE + WHEN pg_function_is_visible(pro.oid) THEN quote_ident(pro.proname::text) + ELSE (quote_ident(nsp.nspname::text) || '.'::text) || quote_ident(pro.proname::text) + END || '('::text) || pg_get_function_arguments(pro.oid)) || ')'::text AS objname, + l.provider, + l.label + FROM pg_seclabel l + JOIN pg_proc pro ON l.classoid = pro.tableoid AND l.objoid = pro.oid + JOIN pg_namespace nsp ON pro.pronamespace = nsp.oid + WHERE l.objsubid = 0 +UNION ALL + SELECT l.objoid, + l.classoid, + l.objsubid, + CASE + WHEN typ.typtype = 'd'::"char" THEN 'domain'::text + ELSE 'type'::text + END AS objtype, + typ.typnamespace AS objnamespace, + CASE + WHEN pg_type_is_visible(typ.oid) THEN quote_ident(typ.typname::text) + ELSE (quote_ident(nsp.nspname::text) || '.'::text) || quote_ident(typ.typname::text) + END AS objname, + l.provider, + l.label + FROM pg_seclabel l + JOIN pg_type typ ON l.classoid = typ.tableoid AND l.objoid = typ.oid + JOIN pg_namespace nsp ON typ.typnamespace = nsp.oid + WHERE l.objsubid = 0 +UNION ALL + SELECT l.objoid, + l.classoid, + l.objsubid, + 'large object'::text AS objtype, + NULL::oid AS objnamespace, + l.objoid::text AS objname, + l.provider, + l.label + FROM pg_seclabel l + JOIN pg_largeobject_metadata lom ON l.objoid = lom.oid + WHERE l.classoid = 'pg_largeobject'::regclass::oid AND l.objsubid = 0 +UNION ALL + SELECT l.objoid, + l.classoid, + l.objsubid, + 'language'::text AS objtype, + NULL::oid AS objnamespace, + quote_ident(lan.lanname::text) AS objname, + l.provider, + l.label + FROM pg_seclabel l + JOIN pg_language lan ON l.classoid = lan.tableoid AND l.objoid = lan.oid + WHERE l.objsubid = 0 +UNION ALL + SELECT l.objoid, + l.classoid, + l.objsubid, + 'schema'::text AS objtype, + nsp.oid AS objnamespace, + quote_ident(nsp.nspname::text) AS objname, + l.provider, + l.label + FROM pg_seclabel l + JOIN pg_namespace nsp ON l.classoid = nsp.tableoid AND l.objoid = nsp.oid + WHERE l.objsubid = 0 +UNION ALL + SELECT l.objoid, + l.classoid, + l.objsubid, + 'event trigger'::text AS objtype, + NULL::oid AS objnamespace, + quote_ident(evt.evtname::text) AS objname, + l.provider, + l.label + FROM pg_seclabel l + JOIN pg_event_trigger evt ON l.classoid = evt.tableoid AND l.objoid = evt.oid + WHERE l.objsubid = 0 +UNION ALL + SELECT l.objoid, + l.classoid, + l.objsubid, + 'publication'::text AS objtype, + NULL::oid AS objnamespace, + quote_ident(p.pubname::text) AS objname, + l.provider, + l.label + FROM pg_seclabel l + JOIN pg_publication p ON l.classoid = p.tableoid AND l.objoid = p.oid + WHERE l.objsubid = 0 +UNION ALL + SELECT l.objoid, + l.classoid, + 0 AS objsubid, + 'subscription'::text AS objtype, + NULL::oid AS objnamespace, + quote_ident(s.subname::text) AS objname, + l.provider, + l.label + FROM pg_shseclabel l + JOIN pg_subscription s ON l.classoid = s.tableoid AND l.objoid = s.oid +UNION ALL + SELECT l.objoid, + l.classoid, + 0 AS objsubid, + 'database'::text AS objtype, + NULL::oid AS objnamespace, + quote_ident(dat.datname::text) AS objname, + l.provider, + l.label + FROM pg_shseclabel l + JOIN pg_database dat ON l.classoid = dat.tableoid AND l.objoid = dat.oid +UNION ALL + SELECT l.objoid, + l.classoid, + 0 AS objsubid, + 'tablespace'::text AS objtype, + NULL::oid AS objnamespace, + quote_ident(spc.spcname::text) AS objname, + l.provider, + l.label + FROM pg_shseclabel l + JOIN pg_tablespace spc ON l.classoid = spc.tableoid AND l.objoid = spc.oid +UNION ALL + SELECT l.objoid, + l.classoid, + 0 AS objsubid, + 'role'::text AS objtype, + NULL::oid AS objnamespace, + quote_ident(rol.rolname::text) AS objname, + l.provider, + l.label + FROM pg_shseclabel l + JOIN pg_authid rol ON l.classoid = rol.tableoid AND l.objoid = rol.oid; + + Table "pg_catalog.pg_sequence" + Column | Type | Collation | Nullable | Default | Storage | Compression | Stats target | Description +--------------+---------+-----------+----------+---------+---------+-------------+--------------+------------- + seqrelid | oid | | not null | | plain | | | + seqtypid | oid | | not null | | plain | | | + seqstart | bigint | | not null | | plain | | | + seqincrement | bigint | | not null | | plain | | | + seqmax | bigint | | not null | | plain | | | + seqmin | bigint | | not null | | plain | | | + seqcache | bigint | | not null | | plain | | | + seqcycle | boolean | | not null | | plain | | | +Indexes: + "pg_sequence_seqrelid_index" PRIMARY KEY, btree (seqrelid) +Access method: heap + + Index "pg_catalog.pg_sequence_seqrelid_index" + Column | Type | Key? | Definition | Storage | Stats target +----------+------+------+------------+---------+-------------- + seqrelid | oid | yes | seqrelid | plain | +primary key, btree, for table "pg_catalog.pg_sequence" + + View "pg_catalog.pg_sequences" + Column | Type | Collation | Nullable | Default | Storage | Description +---------------+---------+-----------+----------+---------+---------+------------- + schemaname | name | | | | plain | + sequencename | name | | | | plain | + sequenceowner | name | | | | plain | + data_type | regtype | | | | plain | + start_value | bigint | | | | plain | + min_value | bigint | | | | plain | + max_value | bigint | | | | plain | + increment_by | bigint | | | | plain | + cycle | boolean | | | | plain | + cache_size | bigint | | | | plain | + last_value | bigint | | | | plain | +View definition: + SELECT n.nspname AS schemaname, + c.relname AS sequencename, + pg_get_userbyid(c.relowner) AS sequenceowner, + s.seqtypid::regtype AS data_type, + s.seqstart AS start_value, + s.seqmin AS min_value, + s.seqmax AS max_value, + s.seqincrement AS increment_by, + s.seqcycle AS cycle, + s.seqcache AS cache_size, + CASE + WHEN has_sequence_privilege(c.oid, 'SELECT,USAGE'::text) THEN pg_sequence_last_value(c.oid::regclass) + ELSE NULL::bigint + END AS last_value + FROM pg_sequence s + JOIN pg_class c ON c.oid = s.seqrelid + LEFT JOIN pg_namespace n ON n.oid = c.relnamespace + WHERE NOT pg_is_other_temp_schema(n.oid) AND c.relkind = 'S'::"char"; + + View "pg_catalog.pg_settings" + Column | Type | Collation | Nullable | Default | Storage | Description +-----------------+---------+-----------+----------+---------+----------+------------- + name | text | | | | extended | + setting | text | | | | extended | + unit | text | | | | extended | + category | text | | | | extended | + short_desc | text | | | | extended | + extra_desc | text | | | | extended | + context | text | | | | extended | + vartype | text | | | | extended | + source | text | | | | extended | + min_val | text | | | | extended | + max_val | text | | | | extended | + enumvals | text[] | | | | extended | + boot_val | text | | | | extended | + reset_val | text | | | | extended | + sourcefile | text | | | | extended | + sourceline | integer | | | | plain | + pending_restart | boolean | | | | plain | +View definition: + SELECT name, + setting, + unit, + category, + short_desc, + extra_desc, + context, + vartype, + source, + min_val, + max_val, + enumvals, + boot_val, + reset_val, + sourcefile, + sourceline, + pending_restart + FROM pg_show_all_settings() a(name, setting, unit, category, short_desc, extra_desc, context, vartype, source, min_val, max_val, enumvals, boot_val, reset_val, sourcefile, sourceline, pending_restart); +Rules: + pg_settings_n AS + ON UPDATE TO pg_settings DO INSTEAD NOTHING + pg_settings_u AS + ON UPDATE TO pg_settings + WHERE new.name = old.name DO SELECT set_config(old.name, new.setting, false) AS set_config + + View "pg_catalog.pg_shadow" + Column | Type | Collation | Nullable | Default | Storage | Description +--------------+--------------------------+-----------+----------+---------+----------+------------- + usename | name | | | | plain | + usesysid | oid | | | | plain | + usecreatedb | boolean | | | | plain | + usesuper | boolean | | | | plain | + userepl | boolean | | | | plain | + usebypassrls | boolean | | | | plain | + passwd | text | C | | | extended | + valuntil | timestamp with time zone | | | | plain | + useconfig | text[] | C | | | extended | +View definition: + SELECT pg_authid.rolname AS usename, + pg_authid.oid AS usesysid, + pg_authid.rolcreatedb AS usecreatedb, + pg_authid.rolsuper AS usesuper, + pg_authid.rolreplication AS userepl, + pg_authid.rolbypassrls AS usebypassrls, + pg_authid.rolpassword AS passwd, + pg_authid.rolvaliduntil AS valuntil, + s.setconfig AS useconfig + FROM pg_authid + LEFT JOIN pg_db_role_setting s ON pg_authid.oid = s.setrole AND s.setdatabase = 0::oid + WHERE pg_authid.rolcanlogin; + + Table "pg_catalog.pg_shdepend" + Column | Type | Collation | Nullable | Default | Storage | Compression | Stats target | Description +------------+---------+-----------+----------+---------+---------+-------------+--------------+------------- + dbid | oid | | not null | | plain | | | + classid | oid | | not null | | plain | | | + objid | oid | | not null | | plain | | | + objsubid | integer | | not null | | plain | | | + refclassid | oid | | not null | | plain | | | + refobjid | oid | | not null | | plain | | | + deptype | "char" | | not null | | plain | | | +Indexes: + "pg_shdepend_depender_index" btree (dbid, classid, objid, objsubid), tablespace "pg_global" + "pg_shdepend_reference_index" btree (refclassid, refobjid), tablespace "pg_global" +Tablespace: "pg_global" +Access method: heap + + Index "pg_catalog.pg_shdepend_depender_index" + Column | Type | Key? | Definition | Storage | Stats target +----------+---------+------+------------+---------+-------------- + dbid | oid | yes | dbid | plain | + classid | oid | yes | classid | plain | + objid | oid | yes | objid | plain | + objsubid | integer | yes | objsubid | plain | +btree, for table "pg_catalog.pg_shdepend" +Tablespace: "pg_global" + + Index "pg_catalog.pg_shdepend_reference_index" + Column | Type | Key? | Definition | Storage | Stats target +------------+------+------+------------+---------+-------------- + refclassid | oid | yes | refclassid | plain | + refobjid | oid | yes | refobjid | plain | +btree, for table "pg_catalog.pg_shdepend" +Tablespace: "pg_global" + + Table "pg_catalog.pg_shdescription" + Column | Type | Collation | Nullable | Default | Storage | Compression | Stats target | Description +-------------+------+-----------+----------+---------+----------+-------------+--------------+------------- + objoid | oid | | not null | | plain | | | + classoid | oid | | not null | | plain | | | + description | text | C | not null | | extended | | | +Indexes: + "pg_shdescription_o_c_index" PRIMARY KEY, btree (objoid, classoid), tablespace "pg_global" +Tablespace: "pg_global" +Access method: heap + + Index "pg_catalog.pg_shdescription_o_c_index" + Column | Type | Key? | Definition | Storage | Stats target +----------+------+------+------------+---------+-------------- + objoid | oid | yes | objoid | plain | + classoid | oid | yes | classoid | plain | +primary key, btree, for table "pg_catalog.pg_shdescription" +Tablespace: "pg_global" + + View "pg_catalog.pg_shmem_allocations" + Column | Type | Collation | Nullable | Default | Storage | Description +----------------+--------+-----------+----------+---------+----------+------------- + name | text | | | | extended | + off | bigint | | | | plain | + size | bigint | | | | plain | + allocated_size | bigint | | | | plain | +View definition: + SELECT name, + off, + size, + allocated_size + FROM pg_get_shmem_allocations() pg_get_shmem_allocations(name, off, size, allocated_size); + + Table "pg_catalog.pg_shseclabel" + Column | Type | Collation | Nullable | Default | Storage | Compression | Stats target | Description +----------+------+-----------+----------+---------+----------+-------------+--------------+------------- + objoid | oid | | not null | | plain | | | + classoid | oid | | not null | | plain | | | + provider | text | C | not null | | extended | | | + label | text | C | not null | | extended | | | +Indexes: + "pg_shseclabel_object_index" PRIMARY KEY, btree (objoid, classoid, provider), tablespace "pg_global" +Tablespace: "pg_global" +Access method: heap + + Index "pg_catalog.pg_shseclabel_object_index" + Column | Type | Key? | Definition | Storage | Stats target +----------+------+------+------------+----------+-------------- + objoid | oid | yes | objoid | plain | + classoid | oid | yes | classoid | plain | + provider | text | yes | provider | extended | +primary key, btree, for table "pg_catalog.pg_shseclabel" +Tablespace: "pg_global" + + View "pg_catalog.pg_stat_activity" + Column | Type | Collation | Nullable | Default | Storage | Description +------------------+--------------------------+-----------+----------+---------+----------+------------- + datid | oid | | | | plain | + datname | name | | | | plain | + pid | integer | | | | plain | + leader_pid | integer | | | | plain | + usesysid | oid | | | | plain | + usename | name | | | | plain | + application_name | text | | | | extended | + client_addr | inet | | | | main | + client_hostname | text | | | | extended | + client_port | integer | | | | plain | + backend_start | timestamp with time zone | | | | plain | + xact_start | timestamp with time zone | | | | plain | + query_start | timestamp with time zone | | | | plain | + state_change | timestamp with time zone | | | | plain | + wait_event_type | text | | | | extended | + wait_event | text | | | | extended | + state | text | | | | extended | + backend_xid | xid | | | | plain | + backend_xmin | xid | | | | plain | + query_id | bigint | | | | plain | + query | text | | | | extended | + backend_type | text | | | | extended | +View definition: + SELECT s.datid, + d.datname, + s.pid, + s.leader_pid, + s.usesysid, + u.rolname AS usename, + s.application_name, + s.client_addr, + s.client_hostname, + s.client_port, + s.backend_start, + s.xact_start, + s.query_start, + s.state_change, + s.wait_event_type, + s.wait_event, + s.state, + s.backend_xid, + s.backend_xmin, + s.query_id, + s.query, + s.backend_type + FROM pg_stat_get_activity(NULL::integer) s(datid, pid, usesysid, application_name, state, query, wait_event_type, wait_event, xact_start, query_start, backend_start, state_change, client_addr, client_hostname, client_port, backend_xid, backend_xmin, backend_type, ssl, sslversion, sslcipher, sslbits, ssl_client_dn, ssl_client_serial, ssl_issuer_dn, gss_auth, gss_princ, gss_enc, gss_delegation, leader_pid, query_id) + LEFT JOIN pg_database d ON s.datid = d.oid + LEFT JOIN pg_authid u ON s.usesysid = u.oid; + + View "pg_catalog.pg_stat_all_indexes" + Column | Type | Collation | Nullable | Default | Storage | Description +---------------+--------------------------+-----------+----------+---------+---------+------------- + relid | oid | | | | plain | + indexrelid | oid | | | | plain | + schemaname | name | | | | plain | + relname | name | | | | plain | + indexrelname | name | | | | plain | + idx_scan | bigint | | | | plain | + last_idx_scan | timestamp with time zone | | | | plain | + idx_tup_read | bigint | | | | plain | + idx_tup_fetch | bigint | | | | plain | +View definition: + SELECT c.oid AS relid, + i.oid AS indexrelid, + n.nspname AS schemaname, + c.relname, + i.relname AS indexrelname, + pg_stat_get_numscans(i.oid) AS idx_scan, + pg_stat_get_lastscan(i.oid) AS last_idx_scan, + pg_stat_get_tuples_returned(i.oid) AS idx_tup_read, + pg_stat_get_tuples_fetched(i.oid) AS idx_tup_fetch + FROM pg_class c + JOIN pg_index x ON c.oid = x.indrelid + JOIN pg_class i ON i.oid = x.indexrelid + LEFT JOIN pg_namespace n ON n.oid = c.relnamespace + WHERE c.relkind = ANY (ARRAY['r'::"char", 't'::"char", 'm'::"char"]); + + View "pg_catalog.pg_stat_all_tables" + Column | Type | Collation | Nullable | Default | Storage | Description +---------------------+--------------------------+-----------+----------+---------+---------+------------- + relid | oid | | | | plain | + schemaname | name | | | | plain | + relname | name | | | | plain | + seq_scan | bigint | | | | plain | + last_seq_scan | timestamp with time zone | | | | plain | + seq_tup_read | bigint | | | | plain | + idx_scan | bigint | | | | plain | + last_idx_scan | timestamp with time zone | | | | plain | + idx_tup_fetch | bigint | | | | plain | + n_tup_ins | bigint | | | | plain | + n_tup_upd | bigint | | | | plain | + n_tup_del | bigint | | | | plain | + n_tup_hot_upd | bigint | | | | plain | + n_tup_newpage_upd | bigint | | | | plain | + n_live_tup | bigint | | | | plain | + n_dead_tup | bigint | | | | plain | + n_mod_since_analyze | bigint | | | | plain | + n_ins_since_vacuum | bigint | | | | plain | + last_vacuum | timestamp with time zone | | | | plain | + last_autovacuum | timestamp with time zone | | | | plain | + last_analyze | timestamp with time zone | | | | plain | + last_autoanalyze | timestamp with time zone | | | | plain | + vacuum_count | bigint | | | | plain | + autovacuum_count | bigint | | | | plain | + analyze_count | bigint | | | | plain | + autoanalyze_count | bigint | | | | plain | +View definition: + SELECT c.oid AS relid, + n.nspname AS schemaname, + c.relname, + pg_stat_get_numscans(c.oid) AS seq_scan, + pg_stat_get_lastscan(c.oid) AS last_seq_scan, + pg_stat_get_tuples_returned(c.oid) AS seq_tup_read, + sum(pg_stat_get_numscans(i.indexrelid))::bigint AS idx_scan, + max(pg_stat_get_lastscan(i.indexrelid)) AS last_idx_scan, + sum(pg_stat_get_tuples_fetched(i.indexrelid))::bigint + pg_stat_get_tuples_fetched(c.oid) AS idx_tup_fetch, + pg_stat_get_tuples_inserted(c.oid) AS n_tup_ins, + pg_stat_get_tuples_updated(c.oid) AS n_tup_upd, + pg_stat_get_tuples_deleted(c.oid) AS n_tup_del, + pg_stat_get_tuples_hot_updated(c.oid) AS n_tup_hot_upd, + pg_stat_get_tuples_newpage_updated(c.oid) AS n_tup_newpage_upd, + pg_stat_get_live_tuples(c.oid) AS n_live_tup, + pg_stat_get_dead_tuples(c.oid) AS n_dead_tup, + pg_stat_get_mod_since_analyze(c.oid) AS n_mod_since_analyze, + pg_stat_get_ins_since_vacuum(c.oid) AS n_ins_since_vacuum, + pg_stat_get_last_vacuum_time(c.oid) AS last_vacuum, + pg_stat_get_last_autovacuum_time(c.oid) AS last_autovacuum, + pg_stat_get_last_analyze_time(c.oid) AS last_analyze, + pg_stat_get_last_autoanalyze_time(c.oid) AS last_autoanalyze, + pg_stat_get_vacuum_count(c.oid) AS vacuum_count, + pg_stat_get_autovacuum_count(c.oid) AS autovacuum_count, + pg_stat_get_analyze_count(c.oid) AS analyze_count, + pg_stat_get_autoanalyze_count(c.oid) AS autoanalyze_count + FROM pg_class c + LEFT JOIN pg_index i ON c.oid = i.indrelid + LEFT JOIN pg_namespace n ON n.oid = c.relnamespace + WHERE c.relkind = ANY (ARRAY['r'::"char", 't'::"char", 'm'::"char", 'p'::"char"]) + GROUP BY c.oid, n.nspname, c.relname; + + View "pg_catalog.pg_stat_archiver" + Column | Type | Collation | Nullable | Default | Storage | Description +--------------------+--------------------------+-----------+----------+---------+----------+------------- + archived_count | bigint | | | | plain | + last_archived_wal | text | | | | extended | + last_archived_time | timestamp with time zone | | | | plain | + failed_count | bigint | | | | plain | + last_failed_wal | text | | | | extended | + last_failed_time | timestamp with time zone | | | | plain | + stats_reset | timestamp with time zone | | | | plain | +View definition: + SELECT archived_count, + last_archived_wal, + last_archived_time, + failed_count, + last_failed_wal, + last_failed_time, + stats_reset + FROM pg_stat_get_archiver() s(archived_count, last_archived_wal, last_archived_time, failed_count, last_failed_wal, last_failed_time, stats_reset); + + View "pg_catalog.pg_stat_bgwriter" + Column | Type | Collation | Nullable | Default | Storage | Description +-----------------------+--------------------------+-----------+----------+---------+---------+------------- + checkpoints_timed | bigint | | | | plain | + checkpoints_req | bigint | | | | plain | + checkpoint_write_time | double precision | | | | plain | + checkpoint_sync_time | double precision | | | | plain | + buffers_checkpoint | bigint | | | | plain | + buffers_clean | bigint | | | | plain | + maxwritten_clean | bigint | | | | plain | + buffers_backend | bigint | | | | plain | + buffers_backend_fsync | bigint | | | | plain | + buffers_alloc | bigint | | | | plain | + stats_reset | timestamp with time zone | | | | plain | +View definition: + SELECT pg_stat_get_bgwriter_timed_checkpoints() AS checkpoints_timed, + pg_stat_get_bgwriter_requested_checkpoints() AS checkpoints_req, + pg_stat_get_checkpoint_write_time() AS checkpoint_write_time, + pg_stat_get_checkpoint_sync_time() AS checkpoint_sync_time, + pg_stat_get_bgwriter_buf_written_checkpoints() AS buffers_checkpoint, + pg_stat_get_bgwriter_buf_written_clean() AS buffers_clean, + pg_stat_get_bgwriter_maxwritten_clean() AS maxwritten_clean, + pg_stat_get_buf_written_backend() AS buffers_backend, + pg_stat_get_buf_fsync_backend() AS buffers_backend_fsync, + pg_stat_get_buf_alloc() AS buffers_alloc, + pg_stat_get_bgwriter_stat_reset_time() AS stats_reset; + + View "pg_catalog.pg_stat_database" + Column | Type | Collation | Nullable | Default | Storage | Description +--------------------------+--------------------------+-----------+----------+---------+---------+------------- + datid | oid | | | | plain | + datname | name | | | | plain | + numbackends | integer | | | | plain | + xact_commit | bigint | | | | plain | + xact_rollback | bigint | | | | plain | + blks_read | bigint | | | | plain | + blks_hit | bigint | | | | plain | + tup_returned | bigint | | | | plain | + tup_fetched | bigint | | | | plain | + tup_inserted | bigint | | | | plain | + tup_updated | bigint | | | | plain | + tup_deleted | bigint | | | | plain | + conflicts | bigint | | | | plain | + temp_files | bigint | | | | plain | + temp_bytes | bigint | | | | plain | + deadlocks | bigint | | | | plain | + checksum_failures | bigint | | | | plain | + checksum_last_failure | timestamp with time zone | | | | plain | + blk_read_time | double precision | | | | plain | + blk_write_time | double precision | | | | plain | + session_time | double precision | | | | plain | + active_time | double precision | | | | plain | + idle_in_transaction_time | double precision | | | | plain | + sessions | bigint | | | | plain | + sessions_abandoned | bigint | | | | plain | + sessions_fatal | bigint | | | | plain | + sessions_killed | bigint | | | | plain | + stats_reset | timestamp with time zone | | | | plain | +View definition: + SELECT oid AS datid, + datname, + CASE + WHEN oid = 0::oid THEN 0 + ELSE pg_stat_get_db_numbackends(oid) + END AS numbackends, + pg_stat_get_db_xact_commit(oid) AS xact_commit, + pg_stat_get_db_xact_rollback(oid) AS xact_rollback, + pg_stat_get_db_blocks_fetched(oid) - pg_stat_get_db_blocks_hit(oid) AS blks_read, + pg_stat_get_db_blocks_hit(oid) AS blks_hit, + pg_stat_get_db_tuples_returned(oid) AS tup_returned, + pg_stat_get_db_tuples_fetched(oid) AS tup_fetched, + pg_stat_get_db_tuples_inserted(oid) AS tup_inserted, + pg_stat_get_db_tuples_updated(oid) AS tup_updated, + pg_stat_get_db_tuples_deleted(oid) AS tup_deleted, + pg_stat_get_db_conflict_all(oid) AS conflicts, + pg_stat_get_db_temp_files(oid) AS temp_files, + pg_stat_get_db_temp_bytes(oid) AS temp_bytes, + pg_stat_get_db_deadlocks(oid) AS deadlocks, + pg_stat_get_db_checksum_failures(oid) AS checksum_failures, + pg_stat_get_db_checksum_last_failure(oid) AS checksum_last_failure, + pg_stat_get_db_blk_read_time(oid) AS blk_read_time, + pg_stat_get_db_blk_write_time(oid) AS blk_write_time, + pg_stat_get_db_session_time(oid) AS session_time, + pg_stat_get_db_active_time(oid) AS active_time, + pg_stat_get_db_idle_in_transaction_time(oid) AS idle_in_transaction_time, + pg_stat_get_db_sessions(oid) AS sessions, + pg_stat_get_db_sessions_abandoned(oid) AS sessions_abandoned, + pg_stat_get_db_sessions_fatal(oid) AS sessions_fatal, + pg_stat_get_db_sessions_killed(oid) AS sessions_killed, + pg_stat_get_db_stat_reset_time(oid) AS stats_reset + FROM ( SELECT 0 AS oid, + NULL::name AS datname + UNION ALL + SELECT pg_database.oid, + pg_database.datname + FROM pg_database) d; + + View "pg_catalog.pg_stat_database_conflicts" + Column | Type | Collation | Nullable | Default | Storage | Description +--------------------------+--------+-----------+----------+---------+---------+------------- + datid | oid | | | | plain | + datname | name | | | | plain | + confl_tablespace | bigint | | | | plain | + confl_lock | bigint | | | | plain | + confl_snapshot | bigint | | | | plain | + confl_bufferpin | bigint | | | | plain | + confl_deadlock | bigint | | | | plain | + confl_active_logicalslot | bigint | | | | plain | +View definition: + SELECT oid AS datid, + datname, + pg_stat_get_db_conflict_tablespace(oid) AS confl_tablespace, + pg_stat_get_db_conflict_lock(oid) AS confl_lock, + pg_stat_get_db_conflict_snapshot(oid) AS confl_snapshot, + pg_stat_get_db_conflict_bufferpin(oid) AS confl_bufferpin, + pg_stat_get_db_conflict_startup_deadlock(oid) AS confl_deadlock, + pg_stat_get_db_conflict_logicalslot(oid) AS confl_active_logicalslot + FROM pg_database d; + + View "pg_catalog.pg_stat_gssapi" + Column | Type | Collation | Nullable | Default | Storage | Description +-----------------------+---------+-----------+----------+---------+----------+------------- + pid | integer | | | | plain | + gss_authenticated | boolean | | | | plain | + principal | text | | | | extended | + encrypted | boolean | | | | plain | + credentials_delegated | boolean | | | | plain | +View definition: + SELECT pid, + gss_auth AS gss_authenticated, + gss_princ AS principal, + gss_enc AS encrypted, + gss_delegation AS credentials_delegated + FROM pg_stat_get_activity(NULL::integer) s(datid, pid, usesysid, application_name, state, query, wait_event_type, wait_event, xact_start, query_start, backend_start, state_change, client_addr, client_hostname, client_port, backend_xid, backend_xmin, backend_type, ssl, sslversion, sslcipher, sslbits, ssl_client_dn, ssl_client_serial, ssl_issuer_dn, gss_auth, gss_princ, gss_enc, gss_delegation, leader_pid, query_id) + WHERE client_port IS NOT NULL; + + View "pg_catalog.pg_stat_io" + Column | Type | Collation | Nullable | Default | Storage | Description +----------------+--------------------------+-----------+----------+---------+----------+------------- + backend_type | text | | | | extended | + object | text | | | | extended | + context | text | | | | extended | + reads | bigint | | | | plain | + read_time | double precision | | | | plain | + writes | bigint | | | | plain | + write_time | double precision | | | | plain | + writebacks | bigint | | | | plain | + writeback_time | double precision | | | | plain | + extends | bigint | | | | plain | + extend_time | double precision | | | | plain | + op_bytes | bigint | | | | plain | + hits | bigint | | | | plain | + evictions | bigint | | | | plain | + reuses | bigint | | | | plain | + fsyncs | bigint | | | | plain | + fsync_time | double precision | | | | plain | + stats_reset | timestamp with time zone | | | | plain | +View definition: + SELECT backend_type, + object, + context, + reads, + read_time, + writes, + write_time, + writebacks, + writeback_time, + extends, + extend_time, + op_bytes, + hits, + evictions, + reuses, + fsyncs, + fsync_time, + stats_reset + FROM pg_stat_get_io() b(backend_type, object, context, reads, read_time, writes, write_time, writebacks, writeback_time, extends, extend_time, op_bytes, hits, evictions, reuses, fsyncs, fsync_time, stats_reset); + + View "pg_catalog.pg_stat_progress_analyze" + Column | Type | Collation | Nullable | Default | Storage | Description +---------------------------+---------+-----------+----------+---------+----------+------------- + pid | integer | | | | plain | + datid | oid | | | | plain | + datname | name | | | | plain | + relid | oid | | | | plain | + phase | text | | | | extended | + sample_blks_total | bigint | | | | plain | + sample_blks_scanned | bigint | | | | plain | + ext_stats_total | bigint | | | | plain | + ext_stats_computed | bigint | | | | plain | + child_tables_total | bigint | | | | plain | + child_tables_done | bigint | | | | plain | + current_child_table_relid | oid | | | | plain | +View definition: + SELECT s.pid, + s.datid, + d.datname, + s.relid, + CASE s.param1 + WHEN 0 THEN 'initializing'::text + WHEN 1 THEN 'acquiring sample rows'::text + WHEN 2 THEN 'acquiring inherited sample rows'::text + WHEN 3 THEN 'computing statistics'::text + WHEN 4 THEN 'computing extended statistics'::text + WHEN 5 THEN 'finalizing analyze'::text + ELSE NULL::text + END AS phase, + s.param2 AS sample_blks_total, + s.param3 AS sample_blks_scanned, + s.param4 AS ext_stats_total, + s.param5 AS ext_stats_computed, + s.param6 AS child_tables_total, + s.param7 AS child_tables_done, + s.param8::oid AS current_child_table_relid + FROM pg_stat_get_progress_info('ANALYZE'::text) s(pid, datid, relid, param1, param2, param3, param4, param5, param6, param7, param8, param9, param10, param11, param12, param13, param14, param15, param16, param17, param18, param19, param20) + LEFT JOIN pg_database d ON s.datid = d.oid; + + View "pg_catalog.pg_stat_progress_basebackup" + Column | Type | Collation | Nullable | Default | Storage | Description +----------------------+---------+-----------+----------+---------+----------+------------- + pid | integer | | | | plain | + phase | text | | | | extended | + backup_total | bigint | | | | plain | + backup_streamed | bigint | | | | plain | + tablespaces_total | bigint | | | | plain | + tablespaces_streamed | bigint | | | | plain | +View definition: + SELECT pid, + CASE param1 + WHEN 0 THEN 'initializing'::text + WHEN 1 THEN 'waiting for checkpoint to finish'::text + WHEN 2 THEN 'estimating backup size'::text + WHEN 3 THEN 'streaming database files'::text + WHEN 4 THEN 'waiting for wal archiving to finish'::text + WHEN 5 THEN 'transferring wal files'::text + ELSE NULL::text + END AS phase, + CASE param2 + WHEN '-1'::integer THEN NULL::bigint + ELSE param2 + END AS backup_total, + param3 AS backup_streamed, + param4 AS tablespaces_total, + param5 AS tablespaces_streamed + FROM pg_stat_get_progress_info('BASEBACKUP'::text) s(pid, datid, relid, param1, param2, param3, param4, param5, param6, param7, param8, param9, param10, param11, param12, param13, param14, param15, param16, param17, param18, param19, param20); + + View "pg_catalog.pg_stat_progress_cluster" + Column | Type | Collation | Nullable | Default | Storage | Description +---------------------+---------+-----------+----------+---------+----------+------------- + pid | integer | | | | plain | + datid | oid | | | | plain | + datname | name | | | | plain | + relid | oid | | | | plain | + command | text | | | | extended | + phase | text | | | | extended | + cluster_index_relid | oid | | | | plain | + heap_tuples_scanned | bigint | | | | plain | + heap_tuples_written | bigint | | | | plain | + heap_blks_total | bigint | | | | plain | + heap_blks_scanned | bigint | | | | plain | + index_rebuild_count | bigint | | | | plain | +View definition: + SELECT s.pid, + s.datid, + d.datname, + s.relid, + CASE s.param1 + WHEN 1 THEN 'CLUSTER'::text + WHEN 2 THEN 'VACUUM FULL'::text + ELSE NULL::text + END AS command, + CASE s.param2 + WHEN 0 THEN 'initializing'::text + WHEN 1 THEN 'seq scanning heap'::text + WHEN 2 THEN 'index scanning heap'::text + WHEN 3 THEN 'sorting tuples'::text + WHEN 4 THEN 'writing new heap'::text + WHEN 5 THEN 'swapping relation files'::text + WHEN 6 THEN 'rebuilding index'::text + WHEN 7 THEN 'performing final cleanup'::text + ELSE NULL::text + END AS phase, + s.param3::oid AS cluster_index_relid, + s.param4 AS heap_tuples_scanned, + s.param5 AS heap_tuples_written, + s.param6 AS heap_blks_total, + s.param7 AS heap_blks_scanned, + s.param8 AS index_rebuild_count + FROM pg_stat_get_progress_info('CLUSTER'::text) s(pid, datid, relid, param1, param2, param3, param4, param5, param6, param7, param8, param9, param10, param11, param12, param13, param14, param15, param16, param17, param18, param19, param20) + LEFT JOIN pg_database d ON s.datid = d.oid; + + View "pg_catalog.pg_stat_progress_copy" + Column | Type | Collation | Nullable | Default | Storage | Description +------------------+---------+-----------+----------+---------+----------+------------- + pid | integer | | | | plain | + datid | oid | | | | plain | + datname | name | | | | plain | + relid | oid | | | | plain | + command | text | | | | extended | + type | text | | | | extended | + bytes_processed | bigint | | | | plain | + bytes_total | bigint | | | | plain | + tuples_processed | bigint | | | | plain | + tuples_excluded | bigint | | | | plain | +View definition: + SELECT s.pid, + s.datid, + d.datname, + s.relid, + CASE s.param5 + WHEN 1 THEN 'COPY FROM'::text + WHEN 2 THEN 'COPY TO'::text + ELSE NULL::text + END AS command, + CASE s.param6 + WHEN 1 THEN 'FILE'::text + WHEN 2 THEN 'PROGRAM'::text + WHEN 3 THEN 'PIPE'::text + WHEN 4 THEN 'CALLBACK'::text + ELSE NULL::text + END AS type, + s.param1 AS bytes_processed, + s.param2 AS bytes_total, + s.param3 AS tuples_processed, + s.param4 AS tuples_excluded + FROM pg_stat_get_progress_info('COPY'::text) s(pid, datid, relid, param1, param2, param3, param4, param5, param6, param7, param8, param9, param10, param11, param12, param13, param14, param15, param16, param17, param18, param19, param20) + LEFT JOIN pg_database d ON s.datid = d.oid; + + View "pg_catalog.pg_stat_progress_create_index" + Column | Type | Collation | Nullable | Default | Storage | Description +--------------------+---------+-----------+----------+---------+----------+------------- + pid | integer | | | | plain | + datid | oid | | | | plain | + datname | name | | | | plain | + relid | oid | | | | plain | + index_relid | oid | | | | plain | + command | text | | | | extended | + phase | text | | | | extended | + lockers_total | bigint | | | | plain | + lockers_done | bigint | | | | plain | + current_locker_pid | bigint | | | | plain | + blocks_total | bigint | | | | plain | + blocks_done | bigint | | | | plain | + tuples_total | bigint | | | | plain | + tuples_done | bigint | | | | plain | + partitions_total | bigint | | | | plain | + partitions_done | bigint | | | | plain | +View definition: + SELECT s.pid, + s.datid, + d.datname, + s.relid, + s.param7::oid AS index_relid, + CASE s.param1 + WHEN 1 THEN 'CREATE INDEX'::text + WHEN 2 THEN 'CREATE INDEX CONCURRENTLY'::text + WHEN 3 THEN 'REINDEX'::text + WHEN 4 THEN 'REINDEX CONCURRENTLY'::text + ELSE NULL::text + END AS command, + CASE s.param10 + WHEN 0 THEN 'initializing'::text + WHEN 1 THEN 'waiting for writers before build'::text + WHEN 2 THEN 'building index'::text || COALESCE(': '::text || pg_indexam_progress_phasename(s.param9::oid, s.param11), ''::text) + WHEN 3 THEN 'waiting for writers before validation'::text + WHEN 4 THEN 'index validation: scanning index'::text + WHEN 5 THEN 'index validation: sorting tuples'::text + WHEN 6 THEN 'index validation: scanning table'::text + WHEN 7 THEN 'waiting for old snapshots'::text + WHEN 8 THEN 'waiting for readers before marking dead'::text + WHEN 9 THEN 'waiting for readers before dropping'::text + ELSE NULL::text + END AS phase, + s.param4 AS lockers_total, + s.param5 AS lockers_done, + s.param6 AS current_locker_pid, + s.param16 AS blocks_total, + s.param17 AS blocks_done, + s.param12 AS tuples_total, + s.param13 AS tuples_done, + s.param14 AS partitions_total, + s.param15 AS partitions_done + FROM pg_stat_get_progress_info('CREATE INDEX'::text) s(pid, datid, relid, param1, param2, param3, param4, param5, param6, param7, param8, param9, param10, param11, param12, param13, param14, param15, param16, param17, param18, param19, param20) + LEFT JOIN pg_database d ON s.datid = d.oid; + + View "pg_catalog.pg_stat_progress_vacuum" + Column | Type | Collation | Nullable | Default | Storage | Description +--------------------+---------+-----------+----------+---------+----------+------------- + pid | integer | | | | plain | + datid | oid | | | | plain | + datname | name | | | | plain | + relid | oid | | | | plain | + phase | text | | | | extended | + heap_blks_total | bigint | | | | plain | + heap_blks_scanned | bigint | | | | plain | + heap_blks_vacuumed | bigint | | | | plain | + index_vacuum_count | bigint | | | | plain | + max_dead_tuples | bigint | | | | plain | + num_dead_tuples | bigint | | | | plain | +View definition: + SELECT s.pid, + s.datid, + d.datname, + s.relid, + CASE s.param1 + WHEN 0 THEN 'initializing'::text + WHEN 1 THEN 'scanning heap'::text + WHEN 2 THEN 'vacuuming indexes'::text + WHEN 3 THEN 'vacuuming heap'::text + WHEN 4 THEN 'cleaning up indexes'::text + WHEN 5 THEN 'truncating heap'::text + WHEN 6 THEN 'performing final cleanup'::text + ELSE NULL::text + END AS phase, + s.param2 AS heap_blks_total, + s.param3 AS heap_blks_scanned, + s.param4 AS heap_blks_vacuumed, + s.param5 AS index_vacuum_count, + s.param6 AS max_dead_tuples, + s.param7 AS num_dead_tuples + FROM pg_stat_get_progress_info('VACUUM'::text) s(pid, datid, relid, param1, param2, param3, param4, param5, param6, param7, param8, param9, param10, param11, param12, param13, param14, param15, param16, param17, param18, param19, param20) + LEFT JOIN pg_database d ON s.datid = d.oid; + + View "pg_catalog.pg_stat_recovery_prefetch" + Column | Type | Collation | Nullable | Default | Storage | Description +----------------+--------------------------+-----------+----------+---------+---------+------------- + stats_reset | timestamp with time zone | | | | plain | + prefetch | bigint | | | | plain | + hit | bigint | | | | plain | + skip_init | bigint | | | | plain | + skip_new | bigint | | | | plain | + skip_fpw | bigint | | | | plain | + skip_rep | bigint | | | | plain | + wal_distance | integer | | | | plain | + block_distance | integer | | | | plain | + io_depth | integer | | | | plain | +View definition: + SELECT stats_reset, + prefetch, + hit, + skip_init, + skip_new, + skip_fpw, + skip_rep, + wal_distance, + block_distance, + io_depth + FROM pg_stat_get_recovery_prefetch() s(stats_reset, prefetch, hit, skip_init, skip_new, skip_fpw, skip_rep, wal_distance, block_distance, io_depth); + + View "pg_catalog.pg_stat_replication" + Column | Type | Collation | Nullable | Default | Storage | Description +------------------+--------------------------+-----------+----------+---------+----------+------------- + pid | integer | | | | plain | + usesysid | oid | | | | plain | + usename | name | | | | plain | + application_name | text | | | | extended | + client_addr | inet | | | | main | + client_hostname | text | | | | extended | + client_port | integer | | | | plain | + backend_start | timestamp with time zone | | | | plain | + backend_xmin | xid | | | | plain | + state | text | | | | extended | + sent_lsn | pg_lsn | | | | plain | + write_lsn | pg_lsn | | | | plain | + flush_lsn | pg_lsn | | | | plain | + replay_lsn | pg_lsn | | | | plain | + write_lag | interval | | | | plain | + flush_lag | interval | | | | plain | + replay_lag | interval | | | | plain | + sync_priority | integer | | | | plain | + sync_state | text | | | | extended | + reply_time | timestamp with time zone | | | | plain | +View definition: + SELECT s.pid, + s.usesysid, + u.rolname AS usename, + s.application_name, + s.client_addr, + s.client_hostname, + s.client_port, + s.backend_start, + s.backend_xmin, + w.state, + w.sent_lsn, + w.write_lsn, + w.flush_lsn, + w.replay_lsn, + w.write_lag, + w.flush_lag, + w.replay_lag, + w.sync_priority, + w.sync_state, + w.reply_time + FROM pg_stat_get_activity(NULL::integer) s(datid, pid, usesysid, application_name, state, query, wait_event_type, wait_event, xact_start, query_start, backend_start, state_change, client_addr, client_hostname, client_port, backend_xid, backend_xmin, backend_type, ssl, sslversion, sslcipher, sslbits, ssl_client_dn, ssl_client_serial, ssl_issuer_dn, gss_auth, gss_princ, gss_enc, gss_delegation, leader_pid, query_id) + JOIN pg_stat_get_wal_senders() w(pid, state, sent_lsn, write_lsn, flush_lsn, replay_lsn, write_lag, flush_lag, replay_lag, sync_priority, sync_state, reply_time) ON s.pid = w.pid + LEFT JOIN pg_authid u ON s.usesysid = u.oid; + + View "pg_catalog.pg_stat_replication_slots" + Column | Type | Collation | Nullable | Default | Storage | Description +--------------+--------------------------+-----------+----------+---------+----------+------------- + slot_name | text | | | | extended | + spill_txns | bigint | | | | plain | + spill_count | bigint | | | | plain | + spill_bytes | bigint | | | | plain | + stream_txns | bigint | | | | plain | + stream_count | bigint | | | | plain | + stream_bytes | bigint | | | | plain | + total_txns | bigint | | | | plain | + total_bytes | bigint | | | | plain | + stats_reset | timestamp with time zone | | | | plain | +View definition: + SELECT s.slot_name, + s.spill_txns, + s.spill_count, + s.spill_bytes, + s.stream_txns, + s.stream_count, + s.stream_bytes, + s.total_txns, + s.total_bytes, + s.stats_reset + FROM pg_replication_slots r, + LATERAL pg_stat_get_replication_slot(r.slot_name::text) s(slot_name, spill_txns, spill_count, spill_bytes, stream_txns, stream_count, stream_bytes, total_txns, total_bytes, stats_reset) + WHERE r.datoid IS NOT NULL; + + View "pg_catalog.pg_stat_slru" + Column | Type | Collation | Nullable | Default | Storage | Description +--------------+--------------------------+-----------+----------+---------+----------+------------- + name | text | | | | extended | + blks_zeroed | bigint | | | | plain | + blks_hit | bigint | | | | plain | + blks_read | bigint | | | | plain | + blks_written | bigint | | | | plain | + blks_exists | bigint | | | | plain | + flushes | bigint | | | | plain | + truncates | bigint | | | | plain | + stats_reset | timestamp with time zone | | | | plain | +View definition: + SELECT name, + blks_zeroed, + blks_hit, + blks_read, + blks_written, + blks_exists, + flushes, + truncates, + stats_reset + FROM pg_stat_get_slru() s(name, blks_zeroed, blks_hit, blks_read, blks_written, blks_exists, flushes, truncates, stats_reset); + + View "pg_catalog.pg_stat_ssl" + Column | Type | Collation | Nullable | Default | Storage | Description +---------------+---------+-----------+----------+---------+----------+------------- + pid | integer | | | | plain | + ssl | boolean | | | | plain | + version | text | | | | extended | + cipher | text | | | | extended | + bits | integer | | | | plain | + client_dn | text | | | | extended | + client_serial | numeric | | | | main | + issuer_dn | text | | | | extended | +View definition: + SELECT pid, + ssl, + sslversion AS version, + sslcipher AS cipher, + sslbits AS bits, + ssl_client_dn AS client_dn, + ssl_client_serial AS client_serial, + ssl_issuer_dn AS issuer_dn + FROM pg_stat_get_activity(NULL::integer) s(datid, pid, usesysid, application_name, state, query, wait_event_type, wait_event, xact_start, query_start, backend_start, state_change, client_addr, client_hostname, client_port, backend_xid, backend_xmin, backend_type, ssl, sslversion, sslcipher, sslbits, ssl_client_dn, ssl_client_serial, ssl_issuer_dn, gss_auth, gss_princ, gss_enc, gss_delegation, leader_pid, query_id) + WHERE client_port IS NOT NULL; + + View "pg_catalog.pg_stat_subscription" + Column | Type | Collation | Nullable | Default | Storage | Description +-----------------------+--------------------------+-----------+----------+---------+---------+------------- + subid | oid | | | | plain | + subname | name | | | | plain | + pid | integer | | | | plain | + leader_pid | integer | | | | plain | + relid | oid | | | | plain | + received_lsn | pg_lsn | | | | plain | + last_msg_send_time | timestamp with time zone | | | | plain | + last_msg_receipt_time | timestamp with time zone | | | | plain | + latest_end_lsn | pg_lsn | | | | plain | + latest_end_time | timestamp with time zone | | | | plain | +View definition: + SELECT su.oid AS subid, + su.subname, + st.pid, + st.leader_pid, + st.relid, + st.received_lsn, + st.last_msg_send_time, + st.last_msg_receipt_time, + st.latest_end_lsn, + st.latest_end_time + FROM pg_subscription su + LEFT JOIN pg_stat_get_subscription(NULL::oid) st(subid, relid, pid, leader_pid, received_lsn, last_msg_send_time, last_msg_receipt_time, latest_end_lsn, latest_end_time) ON st.subid = su.oid; + + View "pg_catalog.pg_stat_subscription_stats" + Column | Type | Collation | Nullable | Default | Storage | Description +-------------------+--------------------------+-----------+----------+---------+---------+------------- + subid | oid | | | | plain | + subname | name | | | | plain | + apply_error_count | bigint | | | | plain | + sync_error_count | bigint | | | | plain | + stats_reset | timestamp with time zone | | | | plain | +View definition: + SELECT ss.subid, + s.subname, + ss.apply_error_count, + ss.sync_error_count, + ss.stats_reset + FROM pg_subscription s, + LATERAL pg_stat_get_subscription_stats(s.oid) ss(subid, apply_error_count, sync_error_count, stats_reset); + + View "pg_catalog.pg_stat_sys_indexes" + Column | Type | Collation | Nullable | Default | Storage | Description +---------------+--------------------------+-----------+----------+---------+---------+------------- + relid | oid | | | | plain | + indexrelid | oid | | | | plain | + schemaname | name | | | | plain | + relname | name | | | | plain | + indexrelname | name | | | | plain | + idx_scan | bigint | | | | plain | + last_idx_scan | timestamp with time zone | | | | plain | + idx_tup_read | bigint | | | | plain | + idx_tup_fetch | bigint | | | | plain | +View definition: + SELECT relid, + indexrelid, + schemaname, + relname, + indexrelname, + idx_scan, + last_idx_scan, + idx_tup_read, + idx_tup_fetch + FROM pg_stat_all_indexes + WHERE (schemaname = ANY (ARRAY['pg_catalog'::name, 'information_schema'::name])) OR schemaname ~ '^pg_toast'::text; + + View "pg_catalog.pg_stat_sys_tables" + Column | Type | Collation | Nullable | Default | Storage | Description +---------------------+--------------------------+-----------+----------+---------+---------+------------- + relid | oid | | | | plain | + schemaname | name | | | | plain | + relname | name | | | | plain | + seq_scan | bigint | | | | plain | + last_seq_scan | timestamp with time zone | | | | plain | + seq_tup_read | bigint | | | | plain | + idx_scan | bigint | | | | plain | + last_idx_scan | timestamp with time zone | | | | plain | + idx_tup_fetch | bigint | | | | plain | + n_tup_ins | bigint | | | | plain | + n_tup_upd | bigint | | | | plain | + n_tup_del | bigint | | | | plain | + n_tup_hot_upd | bigint | | | | plain | + n_tup_newpage_upd | bigint | | | | plain | + n_live_tup | bigint | | | | plain | + n_dead_tup | bigint | | | | plain | + n_mod_since_analyze | bigint | | | | plain | + n_ins_since_vacuum | bigint | | | | plain | + last_vacuum | timestamp with time zone | | | | plain | + last_autovacuum | timestamp with time zone | | | | plain | + last_analyze | timestamp with time zone | | | | plain | + last_autoanalyze | timestamp with time zone | | | | plain | + vacuum_count | bigint | | | | plain | + autovacuum_count | bigint | | | | plain | + analyze_count | bigint | | | | plain | + autoanalyze_count | bigint | | | | plain | +View definition: + SELECT relid, + schemaname, + relname, + seq_scan, + last_seq_scan, + seq_tup_read, + idx_scan, + last_idx_scan, + idx_tup_fetch, + n_tup_ins, + n_tup_upd, + n_tup_del, + n_tup_hot_upd, + n_tup_newpage_upd, + n_live_tup, + n_dead_tup, + n_mod_since_analyze, + n_ins_since_vacuum, + last_vacuum, + last_autovacuum, + last_analyze, + last_autoanalyze, + vacuum_count, + autovacuum_count, + analyze_count, + autoanalyze_count + FROM pg_stat_all_tables + WHERE (schemaname = ANY (ARRAY['pg_catalog'::name, 'information_schema'::name])) OR schemaname ~ '^pg_toast'::text; + + View "pg_catalog.pg_stat_user_functions" + Column | Type | Collation | Nullable | Default | Storage | Description +------------+------------------+-----------+----------+---------+---------+------------- + funcid | oid | | | | plain | + schemaname | name | | | | plain | + funcname | name | | | | plain | + calls | bigint | | | | plain | + total_time | double precision | | | | plain | + self_time | double precision | | | | plain | +View definition: + SELECT p.oid AS funcid, + n.nspname AS schemaname, + p.proname AS funcname, + pg_stat_get_function_calls(p.oid) AS calls, + pg_stat_get_function_total_time(p.oid) AS total_time, + pg_stat_get_function_self_time(p.oid) AS self_time + FROM pg_proc p + LEFT JOIN pg_namespace n ON n.oid = p.pronamespace + WHERE p.prolang <> 12::oid AND pg_stat_get_function_calls(p.oid) IS NOT NULL; + + View "pg_catalog.pg_stat_user_indexes" + Column | Type | Collation | Nullable | Default | Storage | Description +---------------+--------------------------+-----------+----------+---------+---------+------------- + relid | oid | | | | plain | + indexrelid | oid | | | | plain | + schemaname | name | | | | plain | + relname | name | | | | plain | + indexrelname | name | | | | plain | + idx_scan | bigint | | | | plain | + last_idx_scan | timestamp with time zone | | | | plain | + idx_tup_read | bigint | | | | plain | + idx_tup_fetch | bigint | | | | plain | +View definition: + SELECT relid, + indexrelid, + schemaname, + relname, + indexrelname, + idx_scan, + last_idx_scan, + idx_tup_read, + idx_tup_fetch + FROM pg_stat_all_indexes + WHERE (schemaname <> ALL (ARRAY['pg_catalog'::name, 'information_schema'::name])) AND schemaname !~ '^pg_toast'::text; + + View "pg_catalog.pg_stat_user_tables" + Column | Type | Collation | Nullable | Default | Storage | Description +---------------------+--------------------------+-----------+----------+---------+---------+------------- + relid | oid | | | | plain | + schemaname | name | | | | plain | + relname | name | | | | plain | + seq_scan | bigint | | | | plain | + last_seq_scan | timestamp with time zone | | | | plain | + seq_tup_read | bigint | | | | plain | + idx_scan | bigint | | | | plain | + last_idx_scan | timestamp with time zone | | | | plain | + idx_tup_fetch | bigint | | | | plain | + n_tup_ins | bigint | | | | plain | + n_tup_upd | bigint | | | | plain | + n_tup_del | bigint | | | | plain | + n_tup_hot_upd | bigint | | | | plain | + n_tup_newpage_upd | bigint | | | | plain | + n_live_tup | bigint | | | | plain | + n_dead_tup | bigint | | | | plain | + n_mod_since_analyze | bigint | | | | plain | + n_ins_since_vacuum | bigint | | | | plain | + last_vacuum | timestamp with time zone | | | | plain | + last_autovacuum | timestamp with time zone | | | | plain | + last_analyze | timestamp with time zone | | | | plain | + last_autoanalyze | timestamp with time zone | | | | plain | + vacuum_count | bigint | | | | plain | + autovacuum_count | bigint | | | | plain | + analyze_count | bigint | | | | plain | + autoanalyze_count | bigint | | | | plain | +View definition: + SELECT relid, + schemaname, + relname, + seq_scan, + last_seq_scan, + seq_tup_read, + idx_scan, + last_idx_scan, + idx_tup_fetch, + n_tup_ins, + n_tup_upd, + n_tup_del, + n_tup_hot_upd, + n_tup_newpage_upd, + n_live_tup, + n_dead_tup, + n_mod_since_analyze, + n_ins_since_vacuum, + last_vacuum, + last_autovacuum, + last_analyze, + last_autoanalyze, + vacuum_count, + autovacuum_count, + analyze_count, + autoanalyze_count + FROM pg_stat_all_tables + WHERE (schemaname <> ALL (ARRAY['pg_catalog'::name, 'information_schema'::name])) AND schemaname !~ '^pg_toast'::text; + + View "pg_catalog.pg_stat_wal" + Column | Type | Collation | Nullable | Default | Storage | Description +------------------+--------------------------+-----------+----------+---------+---------+------------- + wal_records | bigint | | | | plain | + wal_fpi | bigint | | | | plain | + wal_bytes | numeric | | | | main | + wal_buffers_full | bigint | | | | plain | + wal_write | bigint | | | | plain | + wal_sync | bigint | | | | plain | + wal_write_time | double precision | | | | plain | + wal_sync_time | double precision | | | | plain | + stats_reset | timestamp with time zone | | | | plain | +View definition: + SELECT wal_records, + wal_fpi, + wal_bytes, + wal_buffers_full, + wal_write, + wal_sync, + wal_write_time, + wal_sync_time, + stats_reset + FROM pg_stat_get_wal() w(wal_records, wal_fpi, wal_bytes, wal_buffers_full, wal_write, wal_sync, wal_write_time, wal_sync_time, stats_reset); + + View "pg_catalog.pg_stat_wal_receiver" + Column | Type | Collation | Nullable | Default | Storage | Description +-----------------------+--------------------------+-----------+----------+---------+----------+------------- + pid | integer | | | | plain | + status | text | | | | extended | + receive_start_lsn | pg_lsn | | | | plain | + receive_start_tli | integer | | | | plain | + written_lsn | pg_lsn | | | | plain | + flushed_lsn | pg_lsn | | | | plain | + received_tli | integer | | | | plain | + last_msg_send_time | timestamp with time zone | | | | plain | + last_msg_receipt_time | timestamp with time zone | | | | plain | + latest_end_lsn | pg_lsn | | | | plain | + latest_end_time | timestamp with time zone | | | | plain | + slot_name | text | | | | extended | + sender_host | text | | | | extended | + sender_port | integer | | | | plain | + conninfo | text | | | | extended | +View definition: + SELECT pid, + status, + receive_start_lsn, + receive_start_tli, + written_lsn, + flushed_lsn, + received_tli, + last_msg_send_time, + last_msg_receipt_time, + latest_end_lsn, + latest_end_time, + slot_name, + sender_host, + sender_port, + conninfo + FROM pg_stat_get_wal_receiver() s(pid, status, receive_start_lsn, receive_start_tli, written_lsn, flushed_lsn, received_tli, last_msg_send_time, last_msg_receipt_time, latest_end_lsn, latest_end_time, slot_name, sender_host, sender_port, conninfo) + WHERE pid IS NOT NULL; + + View "pg_catalog.pg_stat_xact_all_tables" + Column | Type | Collation | Nullable | Default | Storage | Description +-------------------+--------+-----------+----------+---------+---------+------------- + relid | oid | | | | plain | + schemaname | name | | | | plain | + relname | name | | | | plain | + seq_scan | bigint | | | | plain | + seq_tup_read | bigint | | | | plain | + idx_scan | bigint | | | | plain | + idx_tup_fetch | bigint | | | | plain | + n_tup_ins | bigint | | | | plain | + n_tup_upd | bigint | | | | plain | + n_tup_del | bigint | | | | plain | + n_tup_hot_upd | bigint | | | | plain | + n_tup_newpage_upd | bigint | | | | plain | +View definition: + SELECT c.oid AS relid, + n.nspname AS schemaname, + c.relname, + pg_stat_get_xact_numscans(c.oid) AS seq_scan, + pg_stat_get_xact_tuples_returned(c.oid) AS seq_tup_read, + sum(pg_stat_get_xact_numscans(i.indexrelid))::bigint AS idx_scan, + sum(pg_stat_get_xact_tuples_fetched(i.indexrelid))::bigint + pg_stat_get_xact_tuples_fetched(c.oid) AS idx_tup_fetch, + pg_stat_get_xact_tuples_inserted(c.oid) AS n_tup_ins, + pg_stat_get_xact_tuples_updated(c.oid) AS n_tup_upd, + pg_stat_get_xact_tuples_deleted(c.oid) AS n_tup_del, + pg_stat_get_xact_tuples_hot_updated(c.oid) AS n_tup_hot_upd, + pg_stat_get_xact_tuples_newpage_updated(c.oid) AS n_tup_newpage_upd + FROM pg_class c + LEFT JOIN pg_index i ON c.oid = i.indrelid + LEFT JOIN pg_namespace n ON n.oid = c.relnamespace + WHERE c.relkind = ANY (ARRAY['r'::"char", 't'::"char", 'm'::"char", 'p'::"char"]) + GROUP BY c.oid, n.nspname, c.relname; + + View "pg_catalog.pg_stat_xact_sys_tables" + Column | Type | Collation | Nullable | Default | Storage | Description +-------------------+--------+-----------+----------+---------+---------+------------- + relid | oid | | | | plain | + schemaname | name | | | | plain | + relname | name | | | | plain | + seq_scan | bigint | | | | plain | + seq_tup_read | bigint | | | | plain | + idx_scan | bigint | | | | plain | + idx_tup_fetch | bigint | | | | plain | + n_tup_ins | bigint | | | | plain | + n_tup_upd | bigint | | | | plain | + n_tup_del | bigint | | | | plain | + n_tup_hot_upd | bigint | | | | plain | + n_tup_newpage_upd | bigint | | | | plain | +View definition: + SELECT relid, + schemaname, + relname, + seq_scan, + seq_tup_read, + idx_scan, + idx_tup_fetch, + n_tup_ins, + n_tup_upd, + n_tup_del, + n_tup_hot_upd, + n_tup_newpage_upd + FROM pg_stat_xact_all_tables + WHERE (schemaname = ANY (ARRAY['pg_catalog'::name, 'information_schema'::name])) OR schemaname ~ '^pg_toast'::text; + + View "pg_catalog.pg_stat_xact_user_functions" + Column | Type | Collation | Nullable | Default | Storage | Description +------------+------------------+-----------+----------+---------+---------+------------- + funcid | oid | | | | plain | + schemaname | name | | | | plain | + funcname | name | | | | plain | + calls | bigint | | | | plain | + total_time | double precision | | | | plain | + self_time | double precision | | | | plain | +View definition: + SELECT p.oid AS funcid, + n.nspname AS schemaname, + p.proname AS funcname, + pg_stat_get_xact_function_calls(p.oid) AS calls, + pg_stat_get_xact_function_total_time(p.oid) AS total_time, + pg_stat_get_xact_function_self_time(p.oid) AS self_time + FROM pg_proc p + LEFT JOIN pg_namespace n ON n.oid = p.pronamespace + WHERE p.prolang <> 12::oid AND pg_stat_get_xact_function_calls(p.oid) IS NOT NULL; + + View "pg_catalog.pg_stat_xact_user_tables" + Column | Type | Collation | Nullable | Default | Storage | Description +-------------------+--------+-----------+----------+---------+---------+------------- + relid | oid | | | | plain | + schemaname | name | | | | plain | + relname | name | | | | plain | + seq_scan | bigint | | | | plain | + seq_tup_read | bigint | | | | plain | + idx_scan | bigint | | | | plain | + idx_tup_fetch | bigint | | | | plain | + n_tup_ins | bigint | | | | plain | + n_tup_upd | bigint | | | | plain | + n_tup_del | bigint | | | | plain | + n_tup_hot_upd | bigint | | | | plain | + n_tup_newpage_upd | bigint | | | | plain | +View definition: + SELECT relid, + schemaname, + relname, + seq_scan, + seq_tup_read, + idx_scan, + idx_tup_fetch, + n_tup_ins, + n_tup_upd, + n_tup_del, + n_tup_hot_upd, + n_tup_newpage_upd + FROM pg_stat_xact_all_tables + WHERE (schemaname <> ALL (ARRAY['pg_catalog'::name, 'information_schema'::name])) AND schemaname !~ '^pg_toast'::text; + + View "pg_catalog.pg_statio_all_indexes" + Column | Type | Collation | Nullable | Default | Storage | Description +---------------+--------+-----------+----------+---------+---------+------------- + relid | oid | | | | plain | + indexrelid | oid | | | | plain | + schemaname | name | | | | plain | + relname | name | | | | plain | + indexrelname | name | | | | plain | + idx_blks_read | bigint | | | | plain | + idx_blks_hit | bigint | | | | plain | +View definition: + SELECT c.oid AS relid, + i.oid AS indexrelid, + n.nspname AS schemaname, + c.relname, + i.relname AS indexrelname, + pg_stat_get_blocks_fetched(i.oid) - pg_stat_get_blocks_hit(i.oid) AS idx_blks_read, + pg_stat_get_blocks_hit(i.oid) AS idx_blks_hit + FROM pg_class c + JOIN pg_index x ON c.oid = x.indrelid + JOIN pg_class i ON i.oid = x.indexrelid + LEFT JOIN pg_namespace n ON n.oid = c.relnamespace + WHERE c.relkind = ANY (ARRAY['r'::"char", 't'::"char", 'm'::"char"]); + + View "pg_catalog.pg_statio_all_sequences" + Column | Type | Collation | Nullable | Default | Storage | Description +------------+--------+-----------+----------+---------+---------+------------- + relid | oid | | | | plain | + schemaname | name | | | | plain | + relname | name | | | | plain | + blks_read | bigint | | | | plain | + blks_hit | bigint | | | | plain | +View definition: + SELECT c.oid AS relid, + n.nspname AS schemaname, + c.relname, + pg_stat_get_blocks_fetched(c.oid) - pg_stat_get_blocks_hit(c.oid) AS blks_read, + pg_stat_get_blocks_hit(c.oid) AS blks_hit + FROM pg_class c + LEFT JOIN pg_namespace n ON n.oid = c.relnamespace + WHERE c.relkind = 'S'::"char"; + + View "pg_catalog.pg_statio_all_tables" + Column | Type | Collation | Nullable | Default | Storage | Description +-----------------+--------+-----------+----------+---------+---------+------------- + relid | oid | | | | plain | + schemaname | name | | | | plain | + relname | name | | | | plain | + heap_blks_read | bigint | | | | plain | + heap_blks_hit | bigint | | | | plain | + idx_blks_read | bigint | | | | plain | + idx_blks_hit | bigint | | | | plain | + toast_blks_read | bigint | | | | plain | + toast_blks_hit | bigint | | | | plain | + tidx_blks_read | bigint | | | | plain | + tidx_blks_hit | bigint | | | | plain | +View definition: + SELECT c.oid AS relid, + n.nspname AS schemaname, + c.relname, + pg_stat_get_blocks_fetched(c.oid) - pg_stat_get_blocks_hit(c.oid) AS heap_blks_read, + pg_stat_get_blocks_hit(c.oid) AS heap_blks_hit, + i.idx_blks_read, + i.idx_blks_hit, + pg_stat_get_blocks_fetched(t.oid) - pg_stat_get_blocks_hit(t.oid) AS toast_blks_read, + pg_stat_get_blocks_hit(t.oid) AS toast_blks_hit, + x.idx_blks_read AS tidx_blks_read, + x.idx_blks_hit AS tidx_blks_hit + FROM pg_class c + LEFT JOIN pg_class t ON c.reltoastrelid = t.oid + LEFT JOIN pg_namespace n ON n.oid = c.relnamespace + LEFT JOIN LATERAL ( SELECT sum(pg_stat_get_blocks_fetched(pg_index.indexrelid) - pg_stat_get_blocks_hit(pg_index.indexrelid))::bigint AS idx_blks_read, + sum(pg_stat_get_blocks_hit(pg_index.indexrelid))::bigint AS idx_blks_hit + FROM pg_index + WHERE pg_index.indrelid = c.oid) i ON true + LEFT JOIN LATERAL ( SELECT sum(pg_stat_get_blocks_fetched(pg_index.indexrelid) - pg_stat_get_blocks_hit(pg_index.indexrelid))::bigint AS idx_blks_read, + sum(pg_stat_get_blocks_hit(pg_index.indexrelid))::bigint AS idx_blks_hit + FROM pg_index + WHERE pg_index.indrelid = t.oid) x ON true + WHERE c.relkind = ANY (ARRAY['r'::"char", 't'::"char", 'm'::"char"]); + + View "pg_catalog.pg_statio_sys_indexes" + Column | Type | Collation | Nullable | Default | Storage | Description +---------------+--------+-----------+----------+---------+---------+------------- + relid | oid | | | | plain | + indexrelid | oid | | | | plain | + schemaname | name | | | | plain | + relname | name | | | | plain | + indexrelname | name | | | | plain | + idx_blks_read | bigint | | | | plain | + idx_blks_hit | bigint | | | | plain | +View definition: + SELECT relid, + indexrelid, + schemaname, + relname, + indexrelname, + idx_blks_read, + idx_blks_hit + FROM pg_statio_all_indexes + WHERE (schemaname = ANY (ARRAY['pg_catalog'::name, 'information_schema'::name])) OR schemaname ~ '^pg_toast'::text; + + View "pg_catalog.pg_statio_sys_sequences" + Column | Type | Collation | Nullable | Default | Storage | Description +------------+--------+-----------+----------+---------+---------+------------- + relid | oid | | | | plain | + schemaname | name | | | | plain | + relname | name | | | | plain | + blks_read | bigint | | | | plain | + blks_hit | bigint | | | | plain | +View definition: + SELECT relid, + schemaname, + relname, + blks_read, + blks_hit + FROM pg_statio_all_sequences + WHERE (schemaname = ANY (ARRAY['pg_catalog'::name, 'information_schema'::name])) OR schemaname ~ '^pg_toast'::text; + + View "pg_catalog.pg_statio_sys_tables" + Column | Type | Collation | Nullable | Default | Storage | Description +-----------------+--------+-----------+----------+---------+---------+------------- + relid | oid | | | | plain | + schemaname | name | | | | plain | + relname | name | | | | plain | + heap_blks_read | bigint | | | | plain | + heap_blks_hit | bigint | | | | plain | + idx_blks_read | bigint | | | | plain | + idx_blks_hit | bigint | | | | plain | + toast_blks_read | bigint | | | | plain | + toast_blks_hit | bigint | | | | plain | + tidx_blks_read | bigint | | | | plain | + tidx_blks_hit | bigint | | | | plain | +View definition: + SELECT relid, + schemaname, + relname, + heap_blks_read, + heap_blks_hit, + idx_blks_read, + idx_blks_hit, + toast_blks_read, + toast_blks_hit, + tidx_blks_read, + tidx_blks_hit + FROM pg_statio_all_tables + WHERE (schemaname = ANY (ARRAY['pg_catalog'::name, 'information_schema'::name])) OR schemaname ~ '^pg_toast'::text; + + View "pg_catalog.pg_statio_user_indexes" + Column | Type | Collation | Nullable | Default | Storage | Description +---------------+--------+-----------+----------+---------+---------+------------- + relid | oid | | | | plain | + indexrelid | oid | | | | plain | + schemaname | name | | | | plain | + relname | name | | | | plain | + indexrelname | name | | | | plain | + idx_blks_read | bigint | | | | plain | + idx_blks_hit | bigint | | | | plain | +View definition: + SELECT relid, + indexrelid, + schemaname, + relname, + indexrelname, + idx_blks_read, + idx_blks_hit + FROM pg_statio_all_indexes + WHERE (schemaname <> ALL (ARRAY['pg_catalog'::name, 'information_schema'::name])) AND schemaname !~ '^pg_toast'::text; + + View "pg_catalog.pg_statio_user_sequences" + Column | Type | Collation | Nullable | Default | Storage | Description +------------+--------+-----------+----------+---------+---------+------------- + relid | oid | | | | plain | + schemaname | name | | | | plain | + relname | name | | | | plain | + blks_read | bigint | | | | plain | + blks_hit | bigint | | | | plain | +View definition: + SELECT relid, + schemaname, + relname, + blks_read, + blks_hit + FROM pg_statio_all_sequences + WHERE (schemaname <> ALL (ARRAY['pg_catalog'::name, 'information_schema'::name])) AND schemaname !~ '^pg_toast'::text; + + View "pg_catalog.pg_statio_user_tables" + Column | Type | Collation | Nullable | Default | Storage | Description +-----------------+--------+-----------+----------+---------+---------+------------- + relid | oid | | | | plain | + schemaname | name | | | | plain | + relname | name | | | | plain | + heap_blks_read | bigint | | | | plain | + heap_blks_hit | bigint | | | | plain | + idx_blks_read | bigint | | | | plain | + idx_blks_hit | bigint | | | | plain | + toast_blks_read | bigint | | | | plain | + toast_blks_hit | bigint | | | | plain | + tidx_blks_read | bigint | | | | plain | + tidx_blks_hit | bigint | | | | plain | +View definition: + SELECT relid, + schemaname, + relname, + heap_blks_read, + heap_blks_hit, + idx_blks_read, + idx_blks_hit, + toast_blks_read, + toast_blks_hit, + tidx_blks_read, + tidx_blks_hit + FROM pg_statio_all_tables + WHERE (schemaname <> ALL (ARRAY['pg_catalog'::name, 'information_schema'::name])) AND schemaname !~ '^pg_toast'::text; + + Table "pg_catalog.pg_statistic" + Column | Type | Collation | Nullable | Default | Storage | Compression | Stats target | Description +-------------+----------+-----------+----------+---------+----------+-------------+--------------+------------- + starelid | oid | | not null | | plain | | | + staattnum | smallint | | not null | | plain | | | + stainherit | boolean | | not null | | plain | | | + stanullfrac | real | | not null | | plain | | | + stawidth | integer | | not null | | plain | | | + stadistinct | real | | not null | | plain | | | + stakind1 | smallint | | not null | | plain | | | + stakind2 | smallint | | not null | | plain | | | + stakind3 | smallint | | not null | | plain | | | + stakind4 | smallint | | not null | | plain | | | + stakind5 | smallint | | not null | | plain | | | + staop1 | oid | | not null | | plain | | | + staop2 | oid | | not null | | plain | | | + staop3 | oid | | not null | | plain | | | + staop4 | oid | | not null | | plain | | | + staop5 | oid | | not null | | plain | | | + stacoll1 | oid | | not null | | plain | | | + stacoll2 | oid | | not null | | plain | | | + stacoll3 | oid | | not null | | plain | | | + stacoll4 | oid | | not null | | plain | | | + stacoll5 | oid | | not null | | plain | | | + stanumbers1 | real[] | | | | extended | | | + stanumbers2 | real[] | | | | extended | | | + stanumbers3 | real[] | | | | extended | | | + stanumbers4 | real[] | | | | extended | | | + stanumbers5 | real[] | | | | extended | | | + stavalues1 | anyarray | | | | extended | | | + stavalues2 | anyarray | | | | extended | | | + stavalues3 | anyarray | | | | extended | | | + stavalues4 | anyarray | | | | extended | | | + stavalues5 | anyarray | | | | extended | | | +Indexes: + "pg_statistic_relid_att_inh_index" PRIMARY KEY, btree (starelid, staattnum, stainherit) +Access method: heap + + Table "pg_catalog.pg_statistic_ext" + Column | Type | Collation | Nullable | Default | Storage | Compression | Stats target | Description +---------------+--------------+-----------+----------+---------+----------+-------------+--------------+------------- + oid | oid | | not null | | plain | | | + stxrelid | oid | | not null | | plain | | | + stxname | name | | not null | | plain | | | + stxnamespace | oid | | not null | | plain | | | + stxowner | oid | | not null | | plain | | | + stxstattarget | integer | | not null | | plain | | | + stxkeys | int2vector | | not null | | plain | | | + stxkind | "char"[] | | not null | | extended | | | + stxexprs | pg_node_tree | C | | | extended | | | +Indexes: + "pg_statistic_ext_oid_index" PRIMARY KEY, btree (oid) + "pg_statistic_ext_name_index" UNIQUE CONSTRAINT, btree (stxname, stxnamespace) + "pg_statistic_ext_relid_index" btree (stxrelid) +Access method: heap + + Table "pg_catalog.pg_statistic_ext_data" + Column | Type | Collation | Nullable | Default | Storage | Compression | Stats target | Description +------------------+-----------------+-----------+----------+---------+----------+-------------+--------------+------------- + stxoid | oid | | not null | | plain | | | + stxdinherit | boolean | | not null | | plain | | | + stxdndistinct | pg_ndistinct | C | | | extended | | | + stxddependencies | pg_dependencies | C | | | extended | | | + stxdmcv | pg_mcv_list | C | | | extended | | | + stxdexpr | pg_statistic[] | | | | extended | | | +Indexes: + "pg_statistic_ext_data_stxoid_inh_index" PRIMARY KEY, btree (stxoid, stxdinherit) +Access method: heap + + Index "pg_catalog.pg_statistic_ext_data_stxoid_inh_index" + Column | Type | Key? | Definition | Storage | Stats target +-------------+---------+------+-------------+---------+-------------- + stxoid | oid | yes | stxoid | plain | + stxdinherit | boolean | yes | stxdinherit | plain | +primary key, btree, for table "pg_catalog.pg_statistic_ext_data" + + Index "pg_catalog.pg_statistic_ext_name_index" + Column | Type | Key? | Definition | Storage | Stats target +--------------+---------+------+--------------+---------+-------------- + stxname | cstring | yes | stxname | plain | + stxnamespace | oid | yes | stxnamespace | plain | +unique, btree, for table "pg_catalog.pg_statistic_ext" + + Index "pg_catalog.pg_statistic_ext_oid_index" + Column | Type | Key? | Definition | Storage | Stats target +--------+------+------+------------+---------+-------------- + oid | oid | yes | oid | plain | +primary key, btree, for table "pg_catalog.pg_statistic_ext" + + Index "pg_catalog.pg_statistic_ext_relid_index" + Column | Type | Key? | Definition | Storage | Stats target +----------+------+------+------------+---------+-------------- + stxrelid | oid | yes | stxrelid | plain | +btree, for table "pg_catalog.pg_statistic_ext" + + Index "pg_catalog.pg_statistic_relid_att_inh_index" + Column | Type | Key? | Definition | Storage | Stats target +------------+----------+------+------------+---------+-------------- + starelid | oid | yes | starelid | plain | + staattnum | smallint | yes | staattnum | plain | + stainherit | boolean | yes | stainherit | plain | +primary key, btree, for table "pg_catalog.pg_statistic" + + View "pg_catalog.pg_stats" + Column | Type | Collation | Nullable | Default | Storage | Description +------------------------+----------+-----------+----------+---------+----------+------------- + schemaname | name | | | | plain | + tablename | name | | | | plain | + attname | name | | | | plain | + inherited | boolean | | | | plain | + null_frac | real | | | | plain | + avg_width | integer | | | | plain | + n_distinct | real | | | | plain | + most_common_vals | anyarray | | | | extended | + most_common_freqs | real[] | | | | extended | + histogram_bounds | anyarray | | | | extended | + correlation | real | | | | plain | + most_common_elems | anyarray | | | | extended | + most_common_elem_freqs | real[] | | | | extended | + elem_count_histogram | real[] | | | | extended | +View definition: + SELECT n.nspname AS schemaname, + c.relname AS tablename, + a.attname, + s.stainherit AS inherited, + s.stanullfrac AS null_frac, + s.stawidth AS avg_width, + s.stadistinct AS n_distinct, + CASE + WHEN s.stakind1 = 1 THEN s.stavalues1 + WHEN s.stakind2 = 1 THEN s.stavalues2 + WHEN s.stakind3 = 1 THEN s.stavalues3 + WHEN s.stakind4 = 1 THEN s.stavalues4 + WHEN s.stakind5 = 1 THEN s.stavalues5 + ELSE NULL::anyarray + END AS most_common_vals, + CASE + WHEN s.stakind1 = 1 THEN s.stanumbers1 + WHEN s.stakind2 = 1 THEN s.stanumbers2 + WHEN s.stakind3 = 1 THEN s.stanumbers3 + WHEN s.stakind4 = 1 THEN s.stanumbers4 + WHEN s.stakind5 = 1 THEN s.stanumbers5 + ELSE NULL::real[] + END AS most_common_freqs, + CASE + WHEN s.stakind1 = 2 THEN s.stavalues1 + WHEN s.stakind2 = 2 THEN s.stavalues2 + WHEN s.stakind3 = 2 THEN s.stavalues3 + WHEN s.stakind4 = 2 THEN s.stavalues4 + WHEN s.stakind5 = 2 THEN s.stavalues5 + ELSE NULL::anyarray + END AS histogram_bounds, + CASE + WHEN s.stakind1 = 3 THEN s.stanumbers1[1] + WHEN s.stakind2 = 3 THEN s.stanumbers2[1] + WHEN s.stakind3 = 3 THEN s.stanumbers3[1] + WHEN s.stakind4 = 3 THEN s.stanumbers4[1] + WHEN s.stakind5 = 3 THEN s.stanumbers5[1] + ELSE NULL::real + END AS correlation, + CASE + WHEN s.stakind1 = 4 THEN s.stavalues1 + WHEN s.stakind2 = 4 THEN s.stavalues2 + WHEN s.stakind3 = 4 THEN s.stavalues3 + WHEN s.stakind4 = 4 THEN s.stavalues4 + WHEN s.stakind5 = 4 THEN s.stavalues5 + ELSE NULL::anyarray + END AS most_common_elems, + CASE + WHEN s.stakind1 = 4 THEN s.stanumbers1 + WHEN s.stakind2 = 4 THEN s.stanumbers2 + WHEN s.stakind3 = 4 THEN s.stanumbers3 + WHEN s.stakind4 = 4 THEN s.stanumbers4 + WHEN s.stakind5 = 4 THEN s.stanumbers5 + ELSE NULL::real[] + END AS most_common_elem_freqs, + CASE + WHEN s.stakind1 = 5 THEN s.stanumbers1 + WHEN s.stakind2 = 5 THEN s.stanumbers2 + WHEN s.stakind3 = 5 THEN s.stanumbers3 + WHEN s.stakind4 = 5 THEN s.stanumbers4 + WHEN s.stakind5 = 5 THEN s.stanumbers5 + ELSE NULL::real[] + END AS elem_count_histogram + FROM pg_statistic s + JOIN pg_class c ON c.oid = s.starelid + JOIN pg_attribute a ON c.oid = a.attrelid AND a.attnum = s.staattnum + LEFT JOIN pg_namespace n ON n.oid = c.relnamespace + WHERE NOT a.attisdropped AND has_column_privilege(c.oid, a.attnum, 'select'::text) AND (c.relrowsecurity = false OR NOT row_security_active(c.oid)); +Options: security_barrier=true + + View "pg_catalog.pg_stats_ext" + Column | Type | Collation | Nullable | Default | Storage | Description +------------------------+--------------------+-----------+----------+---------+----------+------------- + schemaname | name | | | | plain | + tablename | name | | | | plain | + statistics_schemaname | name | | | | plain | + statistics_name | name | | | | plain | + statistics_owner | name | | | | plain | + attnames | name[] | | | | extended | + exprs | text[] | | | | extended | + kinds | "char"[] | | | | extended | + inherited | boolean | | | | plain | + n_distinct | pg_ndistinct | C | | | extended | + dependencies | pg_dependencies | C | | | extended | + most_common_vals | text[] | | | | extended | + most_common_val_nulls | boolean[] | | | | extended | + most_common_freqs | double precision[] | | | | extended | + most_common_base_freqs | double precision[] | | | | extended | +View definition: + SELECT cn.nspname AS schemaname, + c.relname AS tablename, + sn.nspname AS statistics_schemaname, + s.stxname AS statistics_name, + pg_get_userbyid(s.stxowner) AS statistics_owner, + ( SELECT array_agg(a.attname ORDER BY a.attnum) AS array_agg + FROM unnest(s.stxkeys) k(k) + JOIN pg_attribute a ON a.attrelid = s.stxrelid AND a.attnum = k.k) AS attnames, + pg_get_statisticsobjdef_expressions(s.oid) AS exprs, + s.stxkind AS kinds, + sd.stxdinherit AS inherited, + sd.stxdndistinct AS n_distinct, + sd.stxddependencies AS dependencies, + m.most_common_vals, + m.most_common_val_nulls, + m.most_common_freqs, + m.most_common_base_freqs + FROM pg_statistic_ext s + JOIN pg_class c ON c.oid = s.stxrelid + JOIN pg_statistic_ext_data sd ON s.oid = sd.stxoid + LEFT JOIN pg_namespace cn ON cn.oid = c.relnamespace + LEFT JOIN pg_namespace sn ON sn.oid = s.stxnamespace + LEFT JOIN LATERAL ( SELECT array_agg(pg_mcv_list_items."values") AS most_common_vals, + array_agg(pg_mcv_list_items.nulls) AS most_common_val_nulls, + array_agg(pg_mcv_list_items.frequency) AS most_common_freqs, + array_agg(pg_mcv_list_items.base_frequency) AS most_common_base_freqs + FROM pg_mcv_list_items(sd.stxdmcv) pg_mcv_list_items(index, "values", nulls, frequency, base_frequency)) m ON sd.stxdmcv IS NOT NULL + WHERE pg_has_role(c.relowner, 'USAGE'::text) AND (c.relrowsecurity = false OR NOT row_security_active(c.oid)); +Options: security_barrier=true + + View "pg_catalog.pg_stats_ext_exprs" + Column | Type | Collation | Nullable | Default | Storage | Description +------------------------+----------+-----------+----------+---------+----------+------------- + schemaname | name | | | | plain | + tablename | name | | | | plain | + statistics_schemaname | name | | | | plain | + statistics_name | name | | | | plain | + statistics_owner | name | | | | plain | + expr | text | | | | extended | + inherited | boolean | | | | plain | + null_frac | real | | | | plain | + avg_width | integer | | | | plain | + n_distinct | real | | | | plain | + most_common_vals | anyarray | | | | extended | + most_common_freqs | real[] | | | | extended | + histogram_bounds | anyarray | | | | extended | + correlation | real | | | | plain | + most_common_elems | anyarray | | | | extended | + most_common_elem_freqs | real[] | | | | extended | + elem_count_histogram | real[] | | | | extended | +View definition: + SELECT cn.nspname AS schemaname, + c.relname AS tablename, + sn.nspname AS statistics_schemaname, + s.stxname AS statistics_name, + pg_get_userbyid(s.stxowner) AS statistics_owner, + stat.expr, + sd.stxdinherit AS inherited, + (stat.a).stanullfrac AS null_frac, + (stat.a).stawidth AS avg_width, + (stat.a).stadistinct AS n_distinct, + CASE + WHEN (stat.a).stakind1 = 1 THEN (stat.a).stavalues1 + WHEN (stat.a).stakind2 = 1 THEN (stat.a).stavalues2 + WHEN (stat.a).stakind3 = 1 THEN (stat.a).stavalues3 + WHEN (stat.a).stakind4 = 1 THEN (stat.a).stavalues4 + WHEN (stat.a).stakind5 = 1 THEN (stat.a).stavalues5 + ELSE NULL::anyarray + END AS most_common_vals, + CASE + WHEN (stat.a).stakind1 = 1 THEN (stat.a).stanumbers1 + WHEN (stat.a).stakind2 = 1 THEN (stat.a).stanumbers2 + WHEN (stat.a).stakind3 = 1 THEN (stat.a).stanumbers3 + WHEN (stat.a).stakind4 = 1 THEN (stat.a).stanumbers4 + WHEN (stat.a).stakind5 = 1 THEN (stat.a).stanumbers5 + ELSE NULL::real[] + END AS most_common_freqs, + CASE + WHEN (stat.a).stakind1 = 2 THEN (stat.a).stavalues1 + WHEN (stat.a).stakind2 = 2 THEN (stat.a).stavalues2 + WHEN (stat.a).stakind3 = 2 THEN (stat.a).stavalues3 + WHEN (stat.a).stakind4 = 2 THEN (stat.a).stavalues4 + WHEN (stat.a).stakind5 = 2 THEN (stat.a).stavalues5 + ELSE NULL::anyarray + END AS histogram_bounds, + CASE + WHEN (stat.a).stakind1 = 3 THEN (stat.a).stanumbers1[1] + WHEN (stat.a).stakind2 = 3 THEN (stat.a).stanumbers2[1] + WHEN (stat.a).stakind3 = 3 THEN (stat.a).stanumbers3[1] + WHEN (stat.a).stakind4 = 3 THEN (stat.a).stanumbers4[1] + WHEN (stat.a).stakind5 = 3 THEN (stat.a).stanumbers5[1] + ELSE NULL::real + END AS correlation, + CASE + WHEN (stat.a).stakind1 = 4 THEN (stat.a).stavalues1 + WHEN (stat.a).stakind2 = 4 THEN (stat.a).stavalues2 + WHEN (stat.a).stakind3 = 4 THEN (stat.a).stavalues3 + WHEN (stat.a).stakind4 = 4 THEN (stat.a).stavalues4 + WHEN (stat.a).stakind5 = 4 THEN (stat.a).stavalues5 + ELSE NULL::anyarray + END AS most_common_elems, + CASE + WHEN (stat.a).stakind1 = 4 THEN (stat.a).stanumbers1 + WHEN (stat.a).stakind2 = 4 THEN (stat.a).stanumbers2 + WHEN (stat.a).stakind3 = 4 THEN (stat.a).stanumbers3 + WHEN (stat.a).stakind4 = 4 THEN (stat.a).stanumbers4 + WHEN (stat.a).stakind5 = 4 THEN (stat.a).stanumbers5 + ELSE NULL::real[] + END AS most_common_elem_freqs, + CASE + WHEN (stat.a).stakind1 = 5 THEN (stat.a).stanumbers1 + WHEN (stat.a).stakind2 = 5 THEN (stat.a).stanumbers2 + WHEN (stat.a).stakind3 = 5 THEN (stat.a).stanumbers3 + WHEN (stat.a).stakind4 = 5 THEN (stat.a).stanumbers4 + WHEN (stat.a).stakind5 = 5 THEN (stat.a).stanumbers5 + ELSE NULL::real[] + END AS elem_count_histogram + FROM pg_statistic_ext s + JOIN pg_class c ON c.oid = s.stxrelid + LEFT JOIN pg_statistic_ext_data sd ON s.oid = sd.stxoid + LEFT JOIN pg_namespace cn ON cn.oid = c.relnamespace + LEFT JOIN pg_namespace sn ON sn.oid = s.stxnamespace + JOIN LATERAL ( SELECT unnest(pg_get_statisticsobjdef_expressions(s.oid)) AS expr, + unnest(sd.stxdexpr) AS a) stat ON stat.expr IS NOT NULL + WHERE pg_has_role(c.relowner, 'USAGE'::text) AND (c.relrowsecurity = false OR NOT row_security_active(c.oid)); +Options: security_barrier=true + + Table "pg_catalog.pg_subscription" + Column | Type | Collation | Nullable | Default | Storage | Compression | Stats target | Description +---------------------+---------+-----------+----------+---------+----------+-------------+--------------+------------- + oid | oid | | not null | | plain | | | + subdbid | oid | | not null | | plain | | | + subskiplsn | pg_lsn | | not null | | plain | | | + subname | name | | not null | | plain | | | + subowner | oid | | not null | | plain | | | + subenabled | boolean | | not null | | plain | | | + subbinary | boolean | | not null | | plain | | | + substream | "char" | | not null | | plain | | | + subtwophasestate | "char" | | not null | | plain | | | + subdisableonerr | boolean | | not null | | plain | | | + subpasswordrequired | boolean | | not null | | plain | | | + subrunasowner | boolean | | not null | | plain | | | + subconninfo | text | C | not null | | extended | | | + subslotname | name | | | | plain | | | + subsynccommit | text | C | not null | | extended | | | + subpublications | text[] | C | not null | | extended | | | + suborigin | text | C | | | extended | | | +Indexes: + "pg_subscription_oid_index" PRIMARY KEY, btree (oid), tablespace "pg_global" + "pg_subscription_subname_index" UNIQUE CONSTRAINT, btree (subdbid, subname), tablespace "pg_global" +Tablespace: "pg_global" +Access method: heap + + Index "pg_catalog.pg_subscription_oid_index" + Column | Type | Key? | Definition | Storage | Stats target +--------+------+------+------------+---------+-------------- + oid | oid | yes | oid | plain | +primary key, btree, for table "pg_catalog.pg_subscription" +Tablespace: "pg_global" + + Table "pg_catalog.pg_subscription_rel" + Column | Type | Collation | Nullable | Default | Storage | Compression | Stats target | Description +------------+--------+-----------+----------+---------+---------+-------------+--------------+------------- + srsubid | oid | | not null | | plain | | | + srrelid | oid | | not null | | plain | | | + srsubstate | "char" | | not null | | plain | | | + srsublsn | pg_lsn | | | | plain | | | +Indexes: + "pg_subscription_rel_srrelid_srsubid_index" PRIMARY KEY, btree (srrelid, srsubid) +Access method: heap + +Index "pg_catalog.pg_subscription_rel_srrelid_srsubid_index" + Column | Type | Key? | Definition | Storage | Stats target +---------+------+------+------------+---------+-------------- + srrelid | oid | yes | srrelid | plain | + srsubid | oid | yes | srsubid | plain | +primary key, btree, for table "pg_catalog.pg_subscription_rel" + + Index "pg_catalog.pg_subscription_subname_index" + Column | Type | Key? | Definition | Storage | Stats target +---------+---------+------+------------+---------+-------------- + subdbid | oid | yes | subdbid | plain | + subname | cstring | yes | subname | plain | +unique, btree, for table "pg_catalog.pg_subscription" +Tablespace: "pg_global" + + View "pg_catalog.pg_tables" + Column | Type | Collation | Nullable | Default | Storage | Description +-------------+---------+-----------+----------+---------+---------+------------- + schemaname | name | | | | plain | + tablename | name | | | | plain | + tableowner | name | | | | plain | + tablespace | name | | | | plain | + hasindexes | boolean | | | | plain | + hasrules | boolean | | | | plain | + hastriggers | boolean | | | | plain | + rowsecurity | boolean | | | | plain | +View definition: + SELECT n.nspname AS schemaname, + c.relname AS tablename, + pg_get_userbyid(c.relowner) AS tableowner, + t.spcname AS tablespace, + c.relhasindex AS hasindexes, + c.relhasrules AS hasrules, + c.relhastriggers AS hastriggers, + c.relrowsecurity AS rowsecurity + FROM pg_class c + LEFT JOIN pg_namespace n ON n.oid = c.relnamespace + LEFT JOIN pg_tablespace t ON t.oid = c.reltablespace + WHERE c.relkind = ANY (ARRAY['r'::"char", 'p'::"char"]); + + Table "pg_catalog.pg_tablespace" + Column | Type | Collation | Nullable | Default | Storage | Compression | Stats target | Description +------------+-----------+-----------+----------+---------+----------+-------------+--------------+------------- + oid | oid | | not null | | plain | | | + spcname | name | | not null | | plain | | | + spcowner | oid | | not null | | plain | | | + spcacl | aclitem[] | | | | extended | | | + spcoptions | text[] | C | | | extended | | | +Indexes: + "pg_tablespace_oid_index" PRIMARY KEY, btree (oid), tablespace "pg_global" + "pg_tablespace_spcname_index" UNIQUE CONSTRAINT, btree (spcname), tablespace "pg_global" +Tablespace: "pg_global" +Access method: heap + + Index "pg_catalog.pg_tablespace_oid_index" + Column | Type | Key? | Definition | Storage | Stats target +--------+------+------+------------+---------+-------------- + oid | oid | yes | oid | plain | +primary key, btree, for table "pg_catalog.pg_tablespace" +Tablespace: "pg_global" + + Index "pg_catalog.pg_tablespace_spcname_index" + Column | Type | Key? | Definition | Storage | Stats target +---------+---------+------+------------+---------+-------------- + spcname | cstring | yes | spcname | plain | +unique, btree, for table "pg_catalog.pg_tablespace" +Tablespace: "pg_global" + + View "pg_catalog.pg_timezone_abbrevs" + Column | Type | Collation | Nullable | Default | Storage | Description +------------+----------+-----------+----------+---------+----------+------------- + abbrev | text | | | | extended | + utc_offset | interval | | | | plain | + is_dst | boolean | | | | plain | +View definition: + SELECT abbrev, + utc_offset, + is_dst + FROM pg_timezone_abbrevs() pg_timezone_abbrevs(abbrev, utc_offset, is_dst); + + View "pg_catalog.pg_timezone_names" + Column | Type | Collation | Nullable | Default | Storage | Description +------------+----------+-----------+----------+---------+----------+------------- + name | text | | | | extended | + abbrev | text | | | | extended | + utc_offset | interval | | | | plain | + is_dst | boolean | | | | plain | +View definition: + SELECT name, + abbrev, + utc_offset, + is_dst + FROM pg_timezone_names() pg_timezone_names(name, abbrev, utc_offset, is_dst); + + Table "pg_catalog.pg_transform" + Column | Type | Collation | Nullable | Default | Storage | Compression | Stats target | Description +------------+---------+-----------+----------+---------+---------+-------------+--------------+------------- + oid | oid | | not null | | plain | | | + trftype | oid | | not null | | plain | | | + trflang | oid | | not null | | plain | | | + trffromsql | regproc | | not null | | plain | | | + trftosql | regproc | | not null | | plain | | | +Indexes: + "pg_transform_oid_index" PRIMARY KEY, btree (oid) + "pg_transform_type_lang_index" UNIQUE CONSTRAINT, btree (trftype, trflang) +Access method: heap + + Index "pg_catalog.pg_transform_oid_index" + Column | Type | Key? | Definition | Storage | Stats target +--------+------+------+------------+---------+-------------- + oid | oid | yes | oid | plain | +primary key, btree, for table "pg_catalog.pg_transform" + + Index "pg_catalog.pg_transform_type_lang_index" + Column | Type | Key? | Definition | Storage | Stats target +---------+------+------+------------+---------+-------------- + trftype | oid | yes | trftype | plain | + trflang | oid | yes | trflang | plain | +unique, btree, for table "pg_catalog.pg_transform" + + Table "pg_catalog.pg_trigger" + Column | Type | Collation | Nullable | Default | Storage | Compression | Stats target | Description +----------------+--------------+-----------+----------+---------+----------+-------------+--------------+------------- + oid | oid | | not null | | plain | | | + tgrelid | oid | | not null | | plain | | | + tgparentid | oid | | not null | | plain | | | + tgname | name | | not null | | plain | | | + tgfoid | oid | | not null | | plain | | | + tgtype | smallint | | not null | | plain | | | + tgenabled | "char" | | not null | | plain | | | + tgisinternal | boolean | | not null | | plain | | | + tgconstrrelid | oid | | not null | | plain | | | + tgconstrindid | oid | | not null | | plain | | | + tgconstraint | oid | | not null | | plain | | | + tgdeferrable | boolean | | not null | | plain | | | + tginitdeferred | boolean | | not null | | plain | | | + tgnargs | smallint | | not null | | plain | | | + tgattr | int2vector | | not null | | plain | | | + tgargs | bytea | | not null | | extended | | | + tgqual | pg_node_tree | C | | | extended | | | + tgoldtable | name | | | | plain | | | + tgnewtable | name | | | | plain | | | +Indexes: + "pg_trigger_oid_index" PRIMARY KEY, btree (oid) + "pg_trigger_tgconstraint_index" btree (tgconstraint) + "pg_trigger_tgrelid_tgname_index" UNIQUE CONSTRAINT, btree (tgrelid, tgname) +Access method: heap + + Index "pg_catalog.pg_trigger_oid_index" + Column | Type | Key? | Definition | Storage | Stats target +--------+------+------+------------+---------+-------------- + oid | oid | yes | oid | plain | +primary key, btree, for table "pg_catalog.pg_trigger" + + Index "pg_catalog.pg_trigger_tgconstraint_index" + Column | Type | Key? | Definition | Storage | Stats target +--------------+------+------+--------------+---------+-------------- + tgconstraint | oid | yes | tgconstraint | plain | +btree, for table "pg_catalog.pg_trigger" + + Index "pg_catalog.pg_trigger_tgrelid_tgname_index" + Column | Type | Key? | Definition | Storage | Stats target +---------+---------+------+------------+---------+-------------- + tgrelid | oid | yes | tgrelid | plain | + tgname | cstring | yes | tgname | plain | +unique, btree, for table "pg_catalog.pg_trigger" + + Table "pg_catalog.pg_ts_config" + Column | Type | Collation | Nullable | Default | Storage | Compression | Stats target | Description +--------------+------+-----------+----------+---------+---------+-------------+--------------+------------- + oid | oid | | not null | | plain | | | + cfgname | name | | not null | | plain | | | + cfgnamespace | oid | | not null | | plain | | | + cfgowner | oid | | not null | | plain | | | + cfgparser | oid | | not null | | plain | | | +Indexes: + "pg_ts_config_oid_index" PRIMARY KEY, btree (oid) + "pg_ts_config_cfgname_index" UNIQUE CONSTRAINT, btree (cfgname, cfgnamespace) +Access method: heap + + Index "pg_catalog.pg_ts_config_cfgname_index" + Column | Type | Key? | Definition | Storage | Stats target +--------------+---------+------+--------------+---------+-------------- + cfgname | cstring | yes | cfgname | plain | + cfgnamespace | oid | yes | cfgnamespace | plain | +unique, btree, for table "pg_catalog.pg_ts_config" + + Table "pg_catalog.pg_ts_config_map" + Column | Type | Collation | Nullable | Default | Storage | Compression | Stats target | Description +--------------+---------+-----------+----------+---------+---------+-------------+--------------+------------- + mapcfg | oid | | not null | | plain | | | + maptokentype | integer | | not null | | plain | | | + mapseqno | integer | | not null | | plain | | | + mapdict | oid | | not null | | plain | | | +Indexes: + "pg_ts_config_map_index" PRIMARY KEY, btree (mapcfg, maptokentype, mapseqno) +Access method: heap + + Index "pg_catalog.pg_ts_config_map_index" + Column | Type | Key? | Definition | Storage | Stats target +--------------+---------+------+--------------+---------+-------------- + mapcfg | oid | yes | mapcfg | plain | + maptokentype | integer | yes | maptokentype | plain | + mapseqno | integer | yes | mapseqno | plain | +primary key, btree, for table "pg_catalog.pg_ts_config_map" + + Index "pg_catalog.pg_ts_config_oid_index" + Column | Type | Key? | Definition | Storage | Stats target +--------+------+------+------------+---------+-------------- + oid | oid | yes | oid | plain | +primary key, btree, for table "pg_catalog.pg_ts_config" + + Table "pg_catalog.pg_ts_dict" + Column | Type | Collation | Nullable | Default | Storage | Compression | Stats target | Description +----------------+------+-----------+----------+---------+----------+-------------+--------------+------------- + oid | oid | | not null | | plain | | | + dictname | name | | not null | | plain | | | + dictnamespace | oid | | not null | | plain | | | + dictowner | oid | | not null | | plain | | | + dicttemplate | oid | | not null | | plain | | | + dictinitoption | text | C | | | extended | | | +Indexes: + "pg_ts_dict_oid_index" PRIMARY KEY, btree (oid) + "pg_ts_dict_dictname_index" UNIQUE CONSTRAINT, btree (dictname, dictnamespace) +Access method: heap + + Index "pg_catalog.pg_ts_dict_dictname_index" + Column | Type | Key? | Definition | Storage | Stats target +---------------+---------+------+---------------+---------+-------------- + dictname | cstring | yes | dictname | plain | + dictnamespace | oid | yes | dictnamespace | plain | +unique, btree, for table "pg_catalog.pg_ts_dict" + + Index "pg_catalog.pg_ts_dict_oid_index" + Column | Type | Key? | Definition | Storage | Stats target +--------+------+------+------------+---------+-------------- + oid | oid | yes | oid | plain | +primary key, btree, for table "pg_catalog.pg_ts_dict" + + Table "pg_catalog.pg_ts_parser" + Column | Type | Collation | Nullable | Default | Storage | Compression | Stats target | Description +--------------+---------+-----------+----------+---------+---------+-------------+--------------+------------- + oid | oid | | not null | | plain | | | + prsname | name | | not null | | plain | | | + prsnamespace | oid | | not null | | plain | | | + prsstart | regproc | | not null | | plain | | | + prstoken | regproc | | not null | | plain | | | + prsend | regproc | | not null | | plain | | | + prsheadline | regproc | | not null | | plain | | | + prslextype | regproc | | not null | | plain | | | +Indexes: + "pg_ts_parser_oid_index" PRIMARY KEY, btree (oid) + "pg_ts_parser_prsname_index" UNIQUE CONSTRAINT, btree (prsname, prsnamespace) +Access method: heap + + Index "pg_catalog.pg_ts_parser_oid_index" + Column | Type | Key? | Definition | Storage | Stats target +--------+------+------+------------+---------+-------------- + oid | oid | yes | oid | plain | +primary key, btree, for table "pg_catalog.pg_ts_parser" + + Index "pg_catalog.pg_ts_parser_prsname_index" + Column | Type | Key? | Definition | Storage | Stats target +--------------+---------+------+--------------+---------+-------------- + prsname | cstring | yes | prsname | plain | + prsnamespace | oid | yes | prsnamespace | plain | +unique, btree, for table "pg_catalog.pg_ts_parser" + + Table "pg_catalog.pg_ts_template" + Column | Type | Collation | Nullable | Default | Storage | Compression | Stats target | Description +---------------+---------+-----------+----------+---------+---------+-------------+--------------+------------- + oid | oid | | not null | | plain | | | + tmplname | name | | not null | | plain | | | + tmplnamespace | oid | | not null | | plain | | | + tmplinit | regproc | | not null | | plain | | | + tmpllexize | regproc | | not null | | plain | | | +Indexes: + "pg_ts_template_oid_index" PRIMARY KEY, btree (oid) + "pg_ts_template_tmplname_index" UNIQUE CONSTRAINT, btree (tmplname, tmplnamespace) +Access method: heap + + Index "pg_catalog.pg_ts_template_oid_index" + Column | Type | Key? | Definition | Storage | Stats target +--------+------+------+------------+---------+-------------- + oid | oid | yes | oid | plain | +primary key, btree, for table "pg_catalog.pg_ts_template" + + Index "pg_catalog.pg_ts_template_tmplname_index" + Column | Type | Key? | Definition | Storage | Stats target +---------------+---------+------+---------------+---------+-------------- + tmplname | cstring | yes | tmplname | plain | + tmplnamespace | oid | yes | tmplnamespace | plain | +unique, btree, for table "pg_catalog.pg_ts_template" + + Table "pg_catalog.pg_type" + Column | Type | Collation | Nullable | Default | Storage | Compression | Stats target | Description +----------------+--------------+-----------+----------+---------+----------+-------------+--------------+------------- + oid | oid | | not null | | plain | | | + typname | name | | not null | | plain | | | + typnamespace | oid | | not null | | plain | | | + typowner | oid | | not null | | plain | | | + typlen | smallint | | not null | | plain | | | + typbyval | boolean | | not null | | plain | | | + typtype | "char" | | not null | | plain | | | + typcategory | "char" | | not null | | plain | | | + typispreferred | boolean | | not null | | plain | | | + typisdefined | boolean | | not null | | plain | | | + typdelim | "char" | | not null | | plain | | | + typrelid | oid | | not null | | plain | | | + typsubscript | regproc | | not null | | plain | | | + typelem | oid | | not null | | plain | | | + typarray | oid | | not null | | plain | | | + typinput | regproc | | not null | | plain | | | + typoutput | regproc | | not null | | plain | | | + typreceive | regproc | | not null | | plain | | | + typsend | regproc | | not null | | plain | | | + typmodin | regproc | | not null | | plain | | | + typmodout | regproc | | not null | | plain | | | + typanalyze | regproc | | not null | | plain | | | + typalign | "char" | | not null | | plain | | | + typstorage | "char" | | not null | | plain | | | + typnotnull | boolean | | not null | | plain | | | + typbasetype | oid | | not null | | plain | | | + typtypmod | integer | | not null | | plain | | | + typndims | integer | | not null | | plain | | | + typcollation | oid | | not null | | plain | | | + typdefaultbin | pg_node_tree | C | | | extended | | | + typdefault | text | C | | | extended | | | + typacl | aclitem[] | | | | extended | | | +Indexes: + "pg_type_oid_index" PRIMARY KEY, btree (oid) + "pg_type_typname_nsp_index" UNIQUE CONSTRAINT, btree (typname, typnamespace) +Access method: heap + + Index "pg_catalog.pg_type_oid_index" + Column | Type | Key? | Definition | Storage | Stats target +--------+------+------+------------+---------+-------------- + oid | oid | yes | oid | plain | +primary key, btree, for table "pg_catalog.pg_type" + + Index "pg_catalog.pg_type_typname_nsp_index" + Column | Type | Key? | Definition | Storage | Stats target +--------------+---------+------+--------------+---------+-------------- + typname | cstring | yes | typname | plain | + typnamespace | oid | yes | typnamespace | plain | +unique, btree, for table "pg_catalog.pg_type" + + View "pg_catalog.pg_user" + Column | Type | Collation | Nullable | Default | Storage | Description +--------------+--------------------------+-----------+----------+---------+----------+------------- + usename | name | | | | plain | + usesysid | oid | | | | plain | + usecreatedb | boolean | | | | plain | + usesuper | boolean | | | | plain | + userepl | boolean | | | | plain | + usebypassrls | boolean | | | | plain | + passwd | text | | | | extended | + valuntil | timestamp with time zone | | | | plain | + useconfig | text[] | C | | | extended | +View definition: + SELECT usename, + usesysid, + usecreatedb, + usesuper, + userepl, + usebypassrls, + '********'::text AS passwd, + valuntil, + useconfig + FROM pg_shadow; + + Table "pg_catalog.pg_user_mapping" + Column | Type | Collation | Nullable | Default | Storage | Compression | Stats target | Description +-----------+--------+-----------+----------+---------+----------+-------------+--------------+------------- + oid | oid | | not null | | plain | | | + umuser | oid | | not null | | plain | | | + umserver | oid | | not null | | plain | | | + umoptions | text[] | C | | | extended | | | +Indexes: + "pg_user_mapping_oid_index" PRIMARY KEY, btree (oid) + "pg_user_mapping_user_server_index" UNIQUE CONSTRAINT, btree (umuser, umserver) +Access method: heap + + Index "pg_catalog.pg_user_mapping_oid_index" + Column | Type | Key? | Definition | Storage | Stats target +--------+------+------+------------+---------+-------------- + oid | oid | yes | oid | plain | +primary key, btree, for table "pg_catalog.pg_user_mapping" + + Index "pg_catalog.pg_user_mapping_user_server_index" + Column | Type | Key? | Definition | Storage | Stats target +----------+------+------+------------+---------+-------------- + umuser | oid | yes | umuser | plain | + umserver | oid | yes | umserver | plain | +unique, btree, for table "pg_catalog.pg_user_mapping" + + View "pg_catalog.pg_user_mappings" + Column | Type | Collation | Nullable | Default | Storage | Description +-----------+--------+-----------+----------+---------+----------+------------- + umid | oid | | | | plain | + srvid | oid | | | | plain | + srvname | name | | | | plain | + umuser | oid | | | | plain | + usename | name | | | | plain | + umoptions | text[] | C | | | extended | +View definition: + SELECT u.oid AS umid, + s.oid AS srvid, + s.srvname, + u.umuser, + CASE + WHEN u.umuser = 0::oid THEN 'public'::name + ELSE a.rolname + END AS usename, + CASE + WHEN u.umuser <> 0::oid AND a.rolname = CURRENT_USER AND (pg_has_role(s.srvowner, 'USAGE'::text) OR has_server_privilege(s.oid, 'USAGE'::text)) OR u.umuser = 0::oid AND pg_has_role(s.srvowner, 'USAGE'::text) OR ( SELECT pg_authid.rolsuper + FROM pg_authid + WHERE pg_authid.rolname = CURRENT_USER) THEN u.umoptions + ELSE NULL::text[] + END AS umoptions + FROM pg_user_mapping u + JOIN pg_foreign_server s ON u.umserver = s.oid + LEFT JOIN pg_authid a ON a.oid = u.umuser; + + View "pg_catalog.pg_views" + Column | Type | Collation | Nullable | Default | Storage | Description +------------+------+-----------+----------+---------+----------+------------- + schemaname | name | | | | plain | + viewname | name | | | | plain | + viewowner | name | | | | plain | + definition | text | | | | extended | +View definition: + SELECT n.nspname AS schemaname, + c.relname AS viewname, + pg_get_userbyid(c.relowner) AS viewowner, + pg_get_viewdef(c.oid) AS definition + FROM pg_class c + LEFT JOIN pg_namespace n ON n.oid = c.relnamespace + WHERE c.relkind = 'v'::"char"; + + Table "public.admin_settings" + Column | Type | Collation | Nullable | Default | Storage | Compression | Stats target | Description +-------------+--------------------------+-----------+----------+-------------------+----------+-------------+--------------+------------- + id | uuid | | not null | gen_random_uuid() | plain | | | + key | character varying(255) | | not null | | extended | | | + value | text | | | | extended | | | + type | character varying(50) | | | | extended | | | + description | text | | | | extended | | | + category | character varying(50) | | | | extended | | | + is_public | boolean | | | false | plain | | | + updated_by | uuid | | | | plain | | | + updated_at | timestamp with time zone | | | CURRENT_TIMESTAMP | plain | | | +Indexes: + "admin_settings_pkey" PRIMARY KEY, btree (id) + "admin_settings_key_key" UNIQUE CONSTRAINT, btree (key) +Access method: heap + + Index "public.admin_settings_key_key" + Column | Type | Key? | Definition | Storage | Stats target +--------+------------------------+------+------------+----------+-------------- + key | character varying(255) | yes | key | extended | +unique, btree, for table "public.admin_settings" + + Index "public.admin_settings_pkey" + Column | Type | Key? | Definition | Storage | Stats target +--------+------+------+------------+---------+-------------- + id | uuid | yes | id | plain | +primary key, btree, for table "public.admin_settings" + + Table "public.bitrate_adaptation_logs" + Column | Type | Collation | Nullable | Default | Storage | Compression | Stats target | Description +-------------------+-----------------------------+-----------+----------+-----------------------------------------------------+----------+-------------+--------------+------------- + id | bigint | | not null | nextval('bitrate_adaptation_logs_id_seq'::regclass) | plain | | | + old_bitrate | integer | | not null | | plain | | | + new_bitrate | integer | | not null | | plain | | | + reason | character varying(50) | | not null | | extended | | | + network_bandwidth | integer | | | | plain | | | + created_at | timestamp without time zone | | not null | now() | plain | | | + track_id | uuid | | not null | | plain | | | + user_id | uuid | | not null | | plain | | | +Indexes: + "bitrate_adaptation_logs_pkey" PRIMARY KEY, btree (id) + "idx_bitrate_adaptation_created_at" btree (created_at) +Foreign-key constraints: + "fk_bitrate_adaptation_logs_track" FOREIGN KEY (track_id) REFERENCES tracks(id) ON DELETE CASCADE + "fk_bitrate_adaptation_logs_users" FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE +Access method: heap + + Sequence "public.bitrate_adaptation_logs_id_seq" + Type | Start | Minimum | Maximum | Increment | Cycles? | Cache +--------+-------+---------+---------------------+-----------+---------+------- + bigint | 1 | 1 | 9223372036854775807 | 1 | no | 1 +Owned by: public.bitrate_adaptation_logs.id + + Index "public.bitrate_adaptation_logs_pkey" + Column | Type | Key? | Definition | Storage | Stats target +--------+--------+------+------------+---------+-------------- + id | bigint | yes | id | plain | +primary key, btree, for table "public.bitrate_adaptation_logs" + + Table "public.email_verification_tokens" + Column | Type | Collation | Nullable | Default | Storage | Compression | Stats target | Description +------------+-----------------------------+-----------+----------+-------------------------------------------------------+----------+-------------+--------------+------------- + id | bigint | | not null | nextval('email_verification_tokens_id_seq'::regclass) | plain | | | + token | character varying(255) | | not null | | extended | | | + expires_at | timestamp without time zone | | not null | | plain | | | + used | boolean | | not null | false | plain | | | + created_at | timestamp without time zone | | not null | now() | plain | | | + user_id | uuid | | not null | | plain | | | +Indexes: + "email_verification_tokens_pkey" PRIMARY KEY, btree (id) + "email_verification_tokens_token_key" UNIQUE CONSTRAINT, btree (token) + "idx_email_verification_tokens_expires_at" btree (expires_at) + "idx_email_verification_tokens_token" btree (token) +Foreign-key constraints: + "fk_email_verification_tokens_users" FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE +Access method: heap + + Sequence "public.email_verification_tokens_id_seq" + Type | Start | Minimum | Maximum | Increment | Cycles? | Cache +--------+-------+---------+---------------------+-----------+---------+------- + bigint | 1 | 1 | 9223372036854775807 | 1 | no | 1 +Owned by: public.email_verification_tokens.id + + Index "public.email_verification_tokens_pkey" + Column | Type | Key? | Definition | Storage | Stats target +--------+--------+------+------------+---------+-------------- + id | bigint | yes | id | plain | +primary key, btree, for table "public.email_verification_tokens" + + Index "public.email_verification_tokens_token_key" + Column | Type | Key? | Definition | Storage | Stats target +--------+------------------------+------+------------+----------+-------------- + token | character varying(255) | yes | token | extended | +unique, btree, for table "public.email_verification_tokens" + + Table "public.federated_identities" + Column | Type | Collation | Nullable | Default | Storage | Compression | Stats target | Description +---------------+--------------------------+-----------+----------+-------------------+----------+-------------+--------------+------------- + id | uuid | | not null | gen_random_uuid() | plain | | | + user_id | uuid | | not null | | plain | | | + provider | text | | not null | | extended | | | + provider_id | text | | not null | | extended | | | + email | text | | | | extended | | | + display_name | text | | | | extended | | | + avatar_url | text | | | | extended | | | + access_token | text | | | | extended | | | + refresh_token | text | | | | extended | | | + expires_at | timestamp with time zone | | | | plain | | | + created_at | timestamp with time zone | | | now() | plain | | | + updated_at | timestamp with time zone | | | now() | plain | | | +Indexes: + "federated_identities_pkey" PRIMARY KEY, btree (id) + "idx_federated_identities_provider_id" btree (provider, provider_id) + "idx_federated_identities_user_id" btree (user_id) +Foreign-key constraints: + "federated_identities_user_id_fkey" FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE +Access method: heap + + Index "public.federated_identities_pkey" + Column | Type | Key? | Definition | Storage | Stats target +--------+------+------+------------+---------+-------------- + id | uuid | yes | id | plain | +primary key, btree, for table "public.federated_identities" + + Table "public.hls_streams" + Column | Type | Collation | Nullable | Default | Storage | Compression | Stats target | Description +----------------+-----------------------------+-----------+----------+-----------------------------------------+----------+-------------+--------------+------------- + id | bigint | | not null | nextval('hls_streams_id_seq'::regclass) | plain | | | + playlist_url | character varying(500) | | not null | | extended | | | + segments_count | integer | | not null | 0 | plain | | | + bitrates | jsonb | | not null | '[]'::jsonb | extended | | | + status | character varying(20) | | not null | 'pending'::character varying | extended | | | + created_at | timestamp without time zone | | not null | CURRENT_TIMESTAMP | plain | | | + updated_at | timestamp without time zone | | not null | CURRENT_TIMESTAMP | plain | | | + track_id | uuid | | not null | | plain | | | +Indexes: + "hls_streams_pkey" PRIMARY KEY, btree (id) + "idx_hls_streams_status" btree (status) +Foreign-key constraints: + "fk_hls_streams_track" FOREIGN KEY (track_id) REFERENCES tracks(id) ON DELETE CASCADE +Access method: heap + + Sequence "public.hls_streams_id_seq" + Type | Start | Minimum | Maximum | Increment | Cycles? | Cache +--------+-------+---------+---------------------+-----------+---------+------- + bigint | 1 | 1 | 9223372036854775807 | 1 | no | 1 +Owned by: public.hls_streams.id + + Index "public.hls_streams_pkey" + Column | Type | Key? | Definition | Storage | Stats target +--------+--------+------+------------+---------+-------------- + id | bigint | yes | id | plain | +primary key, btree, for table "public.hls_streams" + + Table "public.hls_transcode_queue" + Column | Type | Collation | Nullable | Default | Storage | Compression | Stats target | Description +---------------+-----------------------------+-----------+----------+-------------------------------------------------+----------+-------------+--------------+------------- + id | bigint | | not null | nextval('hls_transcode_queue_id_seq'::regclass) | plain | | | + priority | integer | | not null | 5 | plain | | | + status | character varying(20) | | not null | 'pending'::character varying | extended | | | + retry_count | integer | | not null | 0 | plain | | | + max_retries | integer | | not null | 3 | plain | | | + error_message | text | | | | extended | | | + created_at | timestamp without time zone | | not null | now() | plain | | | + started_at | timestamp without time zone | | | | plain | | | + completed_at | timestamp without time zone | | | | plain | | | + track_id | uuid | | not null | | plain | | | +Indexes: + "hls_transcode_queue_pkey" PRIMARY KEY, btree (id) + "idx_hls_transcode_queue_status" btree (status, priority DESC) +Foreign-key constraints: + "fk_hls_transcode_queue_track" FOREIGN KEY (track_id) REFERENCES tracks(id) ON DELETE CASCADE +Access method: heap + + Sequence "public.hls_transcode_queue_id_seq" + Type | Start | Minimum | Maximum | Increment | Cycles? | Cache +--------+-------+---------+---------------------+-----------+---------+------- + bigint | 1 | 1 | 9223372036854775807 | 1 | no | 1 +Owned by: public.hls_transcode_queue.id + + Index "public.hls_transcode_queue_pkey" + Column | Type | Key? | Definition | Storage | Stats target +--------+--------+------+------------+---------+-------------- + id | bigint | yes | id | plain | +primary key, btree, for table "public.hls_transcode_queue" + + Index "public.idx_bitrate_adaptation_created_at" + Column | Type | Key? | Definition | Storage | Stats target +------------+-----------------------------+------+------------+---------+-------------- + created_at | timestamp without time zone | yes | created_at | plain | +btree, for table "public.bitrate_adaptation_logs" + + Index "public.idx_email_verification_tokens_expires_at" + Column | Type | Key? | Definition | Storage | Stats target +------------+-----------------------------+------+------------+---------+-------------- + expires_at | timestamp without time zone | yes | expires_at | plain | +btree, for table "public.email_verification_tokens" + + Index "public.idx_email_verification_tokens_token" + Column | Type | Key? | Definition | Storage | Stats target +--------+------------------------+------+------------+----------+-------------- + token | character varying(255) | yes | token | extended | +btree, for table "public.email_verification_tokens" + + Index "public.idx_federated_identities_provider_id" + Column | Type | Key? | Definition | Storage | Stats target +-------------+------+------+-------------+----------+-------------- + provider | text | yes | provider | extended | + provider_id | text | yes | provider_id | extended | +btree, for table "public.federated_identities" + + Index "public.idx_federated_identities_user_id" + Column | Type | Key? | Definition | Storage | Stats target +---------+------+------+------------+---------+-------------- + user_id | uuid | yes | user_id | plain | +btree, for table "public.federated_identities" + + Index "public.idx_hls_streams_status" + Column | Type | Key? | Definition | Storage | Stats target +--------+-----------------------+------+------------+----------+-------------- + status | character varying(20) | yes | status | extended | +btree, for table "public.hls_streams" + + Index "public.idx_hls_transcode_queue_status" + Column | Type | Key? | Definition | Storage | Stats target +----------+-----------------------+------+------------+----------+-------------- + status | character varying(20) | yes | status | extended | + priority | integer | yes | priority | plain | +btree, for table "public.hls_transcode_queue" + + Index "public.idx_password_reset_tokens_expires_at" + Column | Type | Key? | Definition | Storage | Stats target +------------+-----------------------------+------+------------+---------+-------------- + expires_at | timestamp without time zone | yes | expires_at | plain | +btree, for table "public.password_reset_tokens" + + Index "public.idx_password_reset_tokens_token" + Column | Type | Key? | Definition | Storage | Stats target +--------+------------------------+------+------------+----------+-------------- + token | character varying(255) | yes | token | extended | +btree, for table "public.password_reset_tokens" + + Index "public.idx_playback_analytics_completion" + Column | Type | Key? | Definition | Storage | Stats target +-----------------+--------------+------+-----------------+---------+-------------- + completion_rate | numeric(5,2) | yes | completion_rate | main | +btree, for table "public.playback_analytics" + + Index "public.idx_playback_analytics_created_at" + Column | Type | Key? | Definition | Storage | Stats target +------------+-----------------------------+------+------------+---------+-------------- + created_at | timestamp without time zone | yes | created_at | plain | +btree, for table "public.playback_analytics" + + Index "public.idx_playlist_collaborators_deleted_at" + Column | Type | Key? | Definition | Storage | Stats target +------------+-----------------------------+------+------------+---------+-------------- + deleted_at | timestamp without time zone | yes | deleted_at | plain | +btree, for table "public.playlist_collaborators" + + Index "public.idx_playlist_collaborators_user_id" + Column | Type | Key? | Definition | Storage | Stats target +---------+------+------+------------+---------+-------------- + user_id | uuid | yes | user_id | plain | +btree, for table "public.playlist_collaborators" + + Index "public.idx_playlist_follows_deleted_at" + Column | Type | Key? | Definition | Storage | Stats target +------------+-----------------------------+------+------------+---------+-------------- + deleted_at | timestamp without time zone | yes | deleted_at | plain | +btree, for table "public.playlist_follows" + + Index "public.idx_playlist_follows_user_id" + Column | Type | Key? | Definition | Storage | Stats target +---------+------+------+------------+---------+-------------- + user_id | uuid | yes | user_id | plain | +btree, for table "public.playlist_follows" + + Index "public.idx_playlists_deleted_at" + Column | Type | Key? | Definition | Storage | Stats target +------------+--------------------------+------+------------+---------+-------------- + deleted_at | timestamp with time zone | yes | deleted_at | plain | +btree, for table "public.playlists" + + Index "public.idx_playlists_follower_count" + Column | Type | Key? | Definition | Storage | Stats target +----------------+---------+------+----------------+---------+-------------- + follower_count | integer | yes | follower_count | plain | +btree, for table "public.playlists" + + Index "public.idx_playlists_user_id" + Column | Type | Key? | Definition | Storage | Stats target +---------+------+------+------------+---------+-------------- + user_id | uuid | yes | user_id | plain | +btree, for table "public.playlists" + + Index "public.idx_refresh_tokens_deleted_at" + Column | Type | Key? | Definition | Storage | Stats target +------------+--------------------------+------+------------+---------+-------------- + deleted_at | timestamp with time zone | yes | deleted_at | plain | +btree, for table "public.refresh_tokens" + + Index "public.idx_refresh_tokens_expires_at" + Column | Type | Key? | Definition | Storage | Stats target +------------+--------------------------+------+------------+---------+-------------- + expires_at | timestamp with time zone | yes | expires_at | plain | +btree, for table "public.refresh_tokens", predicate (deleted_at IS NULL) + + Index "public.idx_refresh_tokens_token_hash" + Column | Type | Key? | Definition | Storage | Stats target +------------+------------------------+------+------------+----------+-------------- + token_hash | character varying(255) | yes | token_hash | extended | +btree, for table "public.refresh_tokens" + + Index "public.idx_refresh_tokens_user_id" + Column | Type | Key? | Definition | Storage | Stats target +---------+------+------+------------+---------+-------------- + user_id | uuid | yes | user_id | plain | +btree, for table "public.refresh_tokens" + + Index "public.idx_role_permissions_permission_id" + Column | Type | Key? | Definition | Storage | Stats target +---------------+------+------+---------------+---------+-------------- + permission_id | uuid | yes | permission_id | plain | +btree, for table "public.role_permissions" + + Index "public.idx_role_permissions_role_id" + Column | Type | Key? | Definition | Storage | Stats target +---------+------+------+------------+---------+-------------- + role_id | uuid | yes | role_id | plain | +btree, for table "public.role_permissions" + + Index "public.idx_rooms_created_at" + Column | Type | Key? | Definition | Storage | Stats target +------------+--------------------------+------+------------+---------+-------------- + created_at | timestamp with time zone | yes | created_at | plain | +btree, for table "public.rooms" + + Index "public.idx_rooms_deleted_at" + Column | Type | Key? | Definition | Storage | Stats target +------------+--------------------------+------+------------+---------+-------------- + deleted_at | timestamp with time zone | yes | deleted_at | plain | +btree, for table "public.rooms" + + Index "public.idx_rooms_is_active" + Column | Type | Key? | Definition | Storage | Stats target +-----------+---------+------+------------+---------+-------------- + is_active | boolean | yes | is_active | plain | +btree, for table "public.rooms", predicate (deleted_at IS NULL) + + Index "public.idx_rooms_room_type" + Column | Type | Key? | Definition | Storage | Stats target +-----------+-----------------------+------+------------+----------+-------------- + room_type | character varying(50) | yes | room_type | extended | +btree, for table "public.rooms" + + Index "public.idx_track_comments_created_at" + Column | Type | Key? | Definition | Storage | Stats target +------------+-----------------------------+------+------------+---------+-------------- + created_at | timestamp without time zone | yes | created_at | plain | +btree, for table "public.track_comments" + + Index "public.idx_track_comments_parent_id" + Column | Type | Key? | Definition | Storage | Stats target +-----------+--------+------+------------+---------+-------------- + parent_id | bigint | yes | parent_id | plain | +btree, for table "public.track_comments" + + Index "public.idx_track_comments_user_id" + Column | Type | Key? | Definition | Storage | Stats target +---------+------+------+------------+---------+-------------- + user_id | uuid | yes | user_id | plain | +btree, for table "public.track_comments" + + Index "public.idx_track_history_action" + Column | Type | Key? | Definition | Storage | Stats target +--------+-----------------------+------+------------+----------+-------------- + action | character varying(50) | yes | action | extended | +btree, for table "public.track_history" + + Index "public.idx_track_history_created_at" + Column | Type | Key? | Definition | Storage | Stats target +------------+-----------------------------+------+------------+---------+-------------- + created_at | timestamp without time zone | yes | created_at | plain | +btree, for table "public.track_history" + + Index "public.idx_track_likes_user_id" + Column | Type | Key? | Definition | Storage | Stats target +---------+------+------+------------+---------+-------------- + user_id | uuid | yes | user_id | plain | +btree, for table "public.track_likes" + + Index "public.idx_track_plays_deleted_at" + Column | Type | Key? | Definition | Storage | Stats target +------------+-----------------------------+------+------------+---------+-------------- + deleted_at | timestamp without time zone | yes | deleted_at | plain | +btree, for table "public.track_plays" + + Index "public.idx_track_plays_played_at" + Column | Type | Key? | Definition | Storage | Stats target +-----------+-----------------------------+------+------------+---------+-------------- + played_at | timestamp without time zone | yes | played_at | plain | +btree, for table "public.track_plays" + + Index "public.idx_track_shares_deleted_at" + Column | Type | Key? | Definition | Storage | Stats target +------------+-----------------------------+------+------------+---------+-------------- + deleted_at | timestamp without time zone | yes | deleted_at | plain | +btree, for table "public.track_shares" + + Index "public.idx_track_shares_share_token" + Column | Type | Key? | Definition | Storage | Stats target +-------------+------------------------+------+-------------+----------+-------------- + share_token | character varying(255) | yes | share_token | extended | +btree, for table "public.track_shares" + + Index "public.idx_track_shares_user_id" + Column | Type | Key? | Definition | Storage | Stats target +---------+------+------+------------+---------+-------------- + user_id | uuid | yes | user_id | plain | +btree, for table "public.track_shares" + + Index "public.idx_track_versions_created_at" + Column | Type | Key? | Definition | Storage | Stats target +------------+-----------------------------+------+------------+---------+-------------- + created_at | timestamp without time zone | yes | created_at | plain | +btree, for table "public.track_versions" + + Index "public.idx_track_versions_deleted_at" + Column | Type | Key? | Definition | Storage | Stats target +------------+-----------------------------+------+------------+---------+-------------- + deleted_at | timestamp without time zone | yes | deleted_at | plain | +btree, for table "public.track_versions" + + Index "public.idx_tracks_created_at" + Column | Type | Key? | Definition | Storage | Stats target +------------+-----------------------------+------+------------+---------+-------------- + created_at | timestamp without time zone | yes | created_at | plain | +btree, for table "public.tracks" + + Index "public.idx_tracks_is_public" + Column | Type | Key? | Definition | Storage | Stats target +-----------+---------+------+------------+---------+-------------- + is_public | boolean | yes | is_public | plain | +btree, for table "public.tracks" + + Index "public.idx_tracks_status" + Column | Type | Key? | Definition | Storage | Stats target +--------+-----------------------+------+------------+----------+-------------- + status | character varying(20) | yes | status | extended | +btree, for table "public.tracks" + + Index "public.idx_tracks_user_id" + Column | Type | Key? | Definition | Storage | Stats target +---------+------+------+------------+---------+-------------- + user_id | uuid | yes | user_id | plain | +btree, for table "public.tracks" + + Index "public.idx_user_roles_role_id" + Column | Type | Key? | Definition | Storage | Stats target +---------+------+------+------------+---------+-------------- + role_id | uuid | yes | role_id | plain | +btree, for table "public.user_roles" + + Index "public.idx_user_roles_user_id" + Column | Type | Key? | Definition | Storage | Stats target +---------+------+------+------------+---------+-------------- + user_id | uuid | yes | user_id | plain | +btree, for table "public.user_roles" + + Index "public.idx_user_sessions_expires_at" + Column | Type | Key? | Definition | Storage | Stats target +------------+--------------------------+------+------------+---------+-------------- + expires_at | timestamp with time zone | yes | expires_at | plain | +btree, for table "public.user_sessions" + + Index "public.idx_user_sessions_is_active" + Column | Type | Key? | Definition | Storage | Stats target +-----------+---------+------+------------+---------+-------------- + is_active | boolean | yes | is_active | plain | +btree, for table "public.user_sessions", predicate (is_active = true) + + Index "public.idx_user_sessions_last_activity" + Column | Type | Key? | Definition | Storage | Stats target +---------------+--------------------------+------+---------------+---------+-------------- + last_activity | timestamp with time zone | yes | last_activity | plain | +btree, for table "public.user_sessions" + + Index "public.idx_user_sessions_token" + Column | Type | Key? | Definition | Storage | Stats target +---------------+------------------------+------+---------------+----------+-------------- + session_token | character varying(255) | yes | session_token | extended | +unique, btree, for table "public.user_sessions" + + Index "public.idx_users_created_at" + Column | Type | Key? | Definition | Storage | Stats target +------------+--------------------------+------+------------+---------+-------------- + created_at | timestamp with time zone | yes | created_at | plain | +btree, for table "public.users" + + Index "public.idx_users_deleted_at" + Column | Type | Key? | Definition | Storage | Stats target +------------+--------------------------+------+------------+---------+-------------- + deleted_at | timestamp with time zone | yes | deleted_at | plain | +btree, for table "public.users" + + Index "public.idx_users_email" + Column | Type | Key? | Definition | Storage | Stats target +--------+------------------------+------+------------+----------+-------------- + email | character varying(255) | yes | email | extended | +unique, btree, for table "public.users", predicate (deleted_at IS NULL) + + Index "public.idx_users_is_active" + Column | Type | Key? | Definition | Storage | Stats target +-----------+---------+------+------------+---------+-------------- + is_active | boolean | yes | is_active | plain | +btree, for table "public.users", predicate (deleted_at IS NULL) + + Index "public.idx_users_is_public" + Column | Type | Key? | Definition | Storage | Stats target +-----------+---------+------+------------+---------+-------------- + is_public | boolean | yes | is_public | plain | +btree, for table "public.users" + + Index "public.idx_users_slug" + Column | Type | Key? | Definition | Storage | Stats target +--------+------------------------+------+------------+----------+-------------- + slug | character varying(255) | yes | slug | extended | +unique, btree, for table "public.users", predicate (deleted_at IS NULL) + + Index "public.idx_users_username" + Column | Type | Key? | Definition | Storage | Stats target +----------+-----------------------+------+------------+----------+-------------- + username | character varying(30) | yes | username | extended | +unique, btree, for table "public.users", predicate (deleted_at IS NULL) + + Table "public.password_reset_tokens" + Column | Type | Collation | Nullable | Default | Storage | Compression | Stats target | Description +------------+-----------------------------+-----------+----------+---------------------------------------------------+----------+-------------+--------------+------------- + id | bigint | | not null | nextval('password_reset_tokens_id_seq'::regclass) | plain | | | + token | character varying(255) | | not null | | extended | | | + expires_at | timestamp without time zone | | not null | | plain | | | + used | boolean | | not null | false | plain | | | + created_at | timestamp without time zone | | not null | now() | plain | | | + user_id | uuid | | not null | | plain | | | +Indexes: + "password_reset_tokens_pkey" PRIMARY KEY, btree (id) + "idx_password_reset_tokens_expires_at" btree (expires_at) + "idx_password_reset_tokens_token" btree (token) + "password_reset_tokens_token_key" UNIQUE CONSTRAINT, btree (token) +Foreign-key constraints: + "fk_password_reset_tokens_users" FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE +Access method: heap + + Sequence "public.password_reset_tokens_id_seq" + Type | Start | Minimum | Maximum | Increment | Cycles? | Cache +--------+-------+---------+---------------------+-----------+---------+------- + bigint | 1 | 1 | 9223372036854775807 | 1 | no | 1 +Owned by: public.password_reset_tokens.id + + Index "public.password_reset_tokens_pkey" + Column | Type | Key? | Definition | Storage | Stats target +--------+--------+------+------------+---------+-------------- + id | bigint | yes | id | plain | +primary key, btree, for table "public.password_reset_tokens" + + Index "public.password_reset_tokens_token_key" + Column | Type | Key? | Definition | Storage | Stats target +--------+------------------------+------+------------+----------+-------------- + token | character varying(255) | yes | token | extended | +unique, btree, for table "public.password_reset_tokens" + + Table "public.permissions" + Column | Type | Collation | Nullable | Default | Storage | Compression | Stats target | Description +-------------+-----------------------------+-----------+----------+-------------------+----------+-------------+--------------+------------- + name | character varying(100) | | not null | | extended | | | + resource | character varying(50) | | not null | | extended | | | + action | character varying(50) | | not null | | extended | | | + description | text | | | | extended | | | + created_at | timestamp without time zone | | | CURRENT_TIMESTAMP | plain | | | + id | uuid | | not null | gen_random_uuid() | plain | | | +Indexes: + "permissions_pkey" PRIMARY KEY, btree (id) + "permissions_name_key" UNIQUE CONSTRAINT, btree (name) +Referenced by: + TABLE "role_permissions" CONSTRAINT "role_permissions_permission_id_fkey" FOREIGN KEY (permission_id) REFERENCES permissions(id) ON DELETE CASCADE +Access method: heap + + Index "public.permissions_name_key" + Column | Type | Key? | Definition | Storage | Stats target +--------+------------------------+------+------------+----------+-------------- + name | character varying(100) | yes | name | extended | +unique, btree, for table "public.permissions" + + Index "public.permissions_pkey" + Column | Type | Key? | Definition | Storage | Stats target +--------+------+------+------------+---------+-------------- + id | uuid | yes | id | plain | +primary key, btree, for table "public.permissions" + + Table "public.playback_analytics" + Column | Type | Collation | Nullable | Default | Storage | Compression | Stats target | Description +-----------------+-----------------------------+-----------+----------+------------------------------------------------+---------+-------------+--------------+------------- + id | bigint | | not null | nextval('playback_analytics_id_seq'::regclass) | plain | | | + play_time | integer | | not null | 0 | plain | | | + pause_count | integer | | not null | 0 | plain | | | + seek_count | integer | | not null | 0 | plain | | | + completion_rate | numeric(5,2) | | not null | 0 | main | | | + started_at | timestamp without time zone | | not null | | plain | | | + ended_at | timestamp without time zone | | | | plain | | | + created_at | timestamp without time zone | | not null | now() | plain | | | + track_id | uuid | | not null | | plain | | | + user_id | uuid | | not null | | plain | | | +Indexes: + "playback_analytics_pkey" PRIMARY KEY, btree (id) + "idx_playback_analytics_completion" btree (completion_rate) + "idx_playback_analytics_created_at" btree (created_at) +Foreign-key constraints: + "fk_playback_analytics_track" FOREIGN KEY (track_id) REFERENCES tracks(id) ON DELETE CASCADE + "fk_playback_analytics_users" FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE +Access method: heap + + Sequence "public.playback_analytics_id_seq" + Type | Start | Minimum | Maximum | Increment | Cycles? | Cache +--------+-------+---------+---------------------+-----------+---------+------- + bigint | 1 | 1 | 9223372036854775807 | 1 | no | 1 +Owned by: public.playback_analytics.id + + Index "public.playback_analytics_pkey" + Column | Type | Key? | Definition | Storage | Stats target +--------+--------+------+------------+---------+-------------- + id | bigint | yes | id | plain | +primary key, btree, for table "public.playback_analytics" + + Table "public.playlist_collaborators" + Column | Type | Collation | Nullable | Default | Storage | Compression | Stats target | Description +-------------+-----------------------------+-----------+----------+----------------------------------------------------+----------+-------------+--------------+--------------------------------------------------------------------------------------- + id | bigint | | not null | nextval('playlist_collaborators_id_seq'::regclass) | plain | | | + permission | character varying(20) | | not null | 'read'::character varying | extended | | | Permission du collaborateur: read (lecture), write (écriture), admin (administration) + created_at | timestamp without time zone | | not null | CURRENT_TIMESTAMP | plain | | | + updated_at | timestamp without time zone | | not null | CURRENT_TIMESTAMP | plain | | | + deleted_at | timestamp without time zone | | | | plain | | | + user_id | uuid | | not null | | plain | | | + playlist_id | uuid | | not null | | plain | | | +Indexes: + "playlist_collaborators_pkey" PRIMARY KEY, btree (id) + "idx_playlist_collaborators_deleted_at" btree (deleted_at) + "idx_playlist_collaborators_user_id" btree (user_id) +Check constraints: + "chk_playlist_collaborators_permission" CHECK (permission::text = ANY (ARRAY['read'::character varying, 'write'::character varying, 'admin'::character varying]::text[])) +Foreign-key constraints: + "fk_playlist_collaborators_playlist" FOREIGN KEY (playlist_id) REFERENCES playlists(id) ON DELETE CASCADE +Access method: heap + + Sequence "public.playlist_collaborators_id_seq" + Type | Start | Minimum | Maximum | Increment | Cycles? | Cache +--------+-------+---------+---------------------+-----------+---------+------- + bigint | 1 | 1 | 9223372036854775807 | 1 | no | 1 +Owned by: public.playlist_collaborators.id + + Index "public.playlist_collaborators_pkey" + Column | Type | Key? | Definition | Storage | Stats target +--------+--------+------+------------+---------+-------------- + id | bigint | yes | id | plain | +primary key, btree, for table "public.playlist_collaborators" + + Table "public.playlist_follows" + Column | Type | Collation | Nullable | Default | Storage | Compression | Stats target | Description +-------------+-----------------------------+-----------+----------+----------------------------------------------+---------+-------------+--------------+------------- + id | bigint | | not null | nextval('playlist_follows_id_seq'::regclass) | plain | | | + created_at | timestamp without time zone | | not null | CURRENT_TIMESTAMP | plain | | | + updated_at | timestamp without time zone | | not null | CURRENT_TIMESTAMP | plain | | | + deleted_at | timestamp without time zone | | | | plain | | | + user_id | uuid | | not null | | plain | | | + playlist_id | uuid | | not null | | plain | | | +Indexes: + "playlist_follows_pkey" PRIMARY KEY, btree (id) + "idx_playlist_follows_deleted_at" btree (deleted_at) + "idx_playlist_follows_user_id" btree (user_id) +Foreign-key constraints: + "fk_playlist_follows_playlist" FOREIGN KEY (playlist_id) REFERENCES playlists(id) ON DELETE CASCADE +Access method: heap + + Sequence "public.playlist_follows_id_seq" + Type | Start | Minimum | Maximum | Increment | Cycles? | Cache +--------+-------+---------+---------------------+-----------+---------+------- + bigint | 1 | 1 | 9223372036854775807 | 1 | no | 1 +Owned by: public.playlist_follows.id + + Index "public.playlist_follows_pkey" + Column | Type | Key? | Definition | Storage | Stats target +--------+--------+------+------------+---------+-------------- + id | bigint | yes | id | plain | +primary key, btree, for table "public.playlist_follows" + + Table "public.playlist_tracks" + Column | Type | Collation | Nullable | Default | Storage | Compression | Stats target | Description +-------------+-----------------------------+-----------+----------+-------------------+---------+-------------+--------------+------------- + position | integer | | not null | | plain | | | + added_at | timestamp without time zone | | not null | CURRENT_TIMESTAMP | plain | | | + track_id | uuid | | not null | | plain | | | + playlist_id | uuid | | not null | | plain | | | + id | uuid | | not null | gen_random_uuid() | plain | | | +Indexes: + "playlist_tracks_pkey" PRIMARY KEY, btree (id) +Foreign-key constraints: + "fk_playlist_tracks_playlist" FOREIGN KEY (playlist_id) REFERENCES playlists(id) ON DELETE CASCADE + "fk_playlist_tracks_track" FOREIGN KEY (track_id) REFERENCES tracks(id) ON DELETE CASCADE +Access method: heap + + Index "public.playlist_tracks_pkey" + Column | Type | Key? | Definition | Storage | Stats target +--------+------+------+------------+---------+-------------- + id | uuid | yes | id | plain | +primary key, btree, for table "public.playlist_tracks" + + Table "public.playlists" + Column | Type | Collation | Nullable | Default | Storage | Compression | Stats target | Description +----------------+-----------------------------+-----------+----------+-------------------+----------+-------------+--------------+------------- + title | character varying(200) | | not null | | extended | | | + description | text | | | | extended | | | + is_public | boolean | | | true | plain | | | + cover_url | character varying(500) | | | | extended | | | + track_count | integer | | | 0 | plain | | | + created_at | timestamp without time zone | | not null | CURRENT_TIMESTAMP | plain | | | + updated_at | timestamp without time zone | | not null | CURRENT_TIMESTAMP | plain | | | + follower_count | integer | | | 0 | plain | | | + deleted_at | timestamp with time zone | | | | plain | | | + user_id | uuid | | not null | | plain | | | + id | uuid | | not null | gen_random_uuid() | plain | | | +Indexes: + "playlists_pkey" PRIMARY KEY, btree (id) + "idx_playlists_deleted_at" btree (deleted_at) + "idx_playlists_follower_count" btree (follower_count) + "idx_playlists_user_id" btree (user_id) +Foreign-key constraints: + "fk_playlists_users" FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE +Referenced by: + TABLE "playlist_collaborators" CONSTRAINT "fk_playlist_collaborators_playlist" FOREIGN KEY (playlist_id) REFERENCES playlists(id) ON DELETE CASCADE + TABLE "playlist_follows" CONSTRAINT "fk_playlist_follows_playlist" FOREIGN KEY (playlist_id) REFERENCES playlists(id) ON DELETE CASCADE + TABLE "playlist_tracks" CONSTRAINT "fk_playlist_tracks_playlist" FOREIGN KEY (playlist_id) REFERENCES playlists(id) ON DELETE CASCADE +Access method: heap + + Index "public.playlists_pkey" + Column | Type | Key? | Definition | Storage | Stats target +--------+------+------+------------+---------+-------------- + id | uuid | yes | id | plain | +primary key, btree, for table "public.playlists" + + Table "public.refresh_tokens" + Column | Type | Collation | Nullable | Default | Storage | Compression | Stats target | Description +------------+--------------------------+-----------+----------+--------------------------------------------+----------+-------------+--------------+----------------------------------- + id | bigint | | not null | nextval('refresh_tokens_id_seq'::regclass) | plain | | | + token_hash | character varying(255) | | not null | | extended | | | SHA-256 hash of the refresh token + expires_at | timestamp with time zone | | not null | | plain | | | Token expiration timestamp + created_at | timestamp with time zone | | | CURRENT_TIMESTAMP | plain | | | + deleted_at | timestamp with time zone | | | | plain | | | + user_id | uuid | | not null | | plain | | | +Indexes: + "refresh_tokens_pkey" PRIMARY KEY, btree (id) + "idx_refresh_tokens_deleted_at" btree (deleted_at) + "idx_refresh_tokens_expires_at" btree (expires_at) WHERE deleted_at IS NULL + "idx_refresh_tokens_token_hash" btree (token_hash) + "idx_refresh_tokens_user_id" btree (user_id) +Access method: heap + + Sequence "public.refresh_tokens_id_seq" + Type | Start | Minimum | Maximum | Increment | Cycles? | Cache +--------+-------+---------+---------------------+-----------+---------+------- + bigint | 1 | 1 | 9223372036854775807 | 1 | no | 1 +Owned by: public.refresh_tokens.id + + Index "public.refresh_tokens_pkey" + Column | Type | Key? | Definition | Storage | Stats target +--------+--------+------+------------+---------+-------------- + id | bigint | yes | id | plain | +primary key, btree, for table "public.refresh_tokens" + + Table "public.role_permissions" + Column | Type | Collation | Nullable | Default | Storage | Compression | Stats target | Description +---------------+------+-----------+----------+---------+---------+-------------+--------------+------------- + role_id | uuid | | not null | | plain | | | + permission_id | uuid | | not null | | plain | | | +Indexes: + "role_permissions_pkey" PRIMARY KEY, btree (role_id, permission_id) + "idx_role_permissions_permission_id" btree (permission_id) + "idx_role_permissions_role_id" btree (role_id) +Foreign-key constraints: + "role_permissions_permission_id_fkey" FOREIGN KEY (permission_id) REFERENCES permissions(id) ON DELETE CASCADE + "role_permissions_role_id_fkey" FOREIGN KEY (role_id) REFERENCES roles(id) ON DELETE CASCADE +Access method: heap + + Index "public.role_permissions_pkey" + Column | Type | Key? | Definition | Storage | Stats target +---------------+------+------+---------------+---------+-------------- + role_id | uuid | yes | role_id | plain | + permission_id | uuid | yes | permission_id | plain | +primary key, btree, for table "public.role_permissions" + + Table "public.roles" + Column | Type | Collation | Nullable | Default | Storage | Compression | Stats target | Description +--------------+-----------------------------+-----------+----------+-------------------+----------+-------------+--------------+------------- + name | character varying(50) | | not null | | extended | | | + display_name | character varying(100) | | not null | | extended | | | + description | text | | | | extended | | | + is_system | boolean | | | false | plain | | | + is_active | boolean | | | true | plain | | | + created_at | timestamp without time zone | | | CURRENT_TIMESTAMP | plain | | | + updated_at | timestamp without time zone | | | CURRENT_TIMESTAMP | plain | | | + id | uuid | | not null | gen_random_uuid() | plain | | | +Indexes: + "roles_pkey" PRIMARY KEY, btree (id) + "roles_name_key" UNIQUE CONSTRAINT, btree (name) +Referenced by: + TABLE "role_permissions" CONSTRAINT "role_permissions_role_id_fkey" FOREIGN KEY (role_id) REFERENCES roles(id) ON DELETE CASCADE + TABLE "user_roles" CONSTRAINT "user_roles_role_id_fkey" FOREIGN KEY (role_id) REFERENCES roles(id) ON DELETE CASCADE +Access method: heap + + Index "public.roles_name_key" + Column | Type | Key? | Definition | Storage | Stats target +--------+-----------------------+------+------------+----------+-------------- + name | character varying(50) | yes | name | extended | +unique, btree, for table "public.roles" + + Index "public.roles_pkey" + Column | Type | Key? | Definition | Storage | Stats target +--------+------+------+------------+---------+-------------- + id | uuid | yes | id | plain | +primary key, btree, for table "public.roles" + + Table "public.rooms" + Column | Type | Collation | Nullable | Default | Storage | Compression | Stats target | Description +-------------+--------------------------+-----------+----------+-----------------------------------+----------+-------------+--------------+----------------------------------------------- + id | bigint | | not null | nextval('rooms_id_seq'::regclass) | plain | | | + name | character varying(255) | | not null | | extended | | | + description | text | | | | extended | | | + room_type | character varying(50) | | not null | 'public'::character varying | extended | | | Type of room: public, private, or direct + is_active | boolean | | | true | plain | | | + max_members | integer | | | 100 | plain | | | Maximum number of members allowed in the room + created_at | timestamp with time zone | | | CURRENT_TIMESTAMP | plain | | | + updated_at | timestamp with time zone | | | CURRENT_TIMESTAMP | plain | | | + deleted_at | timestamp with time zone | | | | plain | | | + creator_id | uuid | | not null | | plain | | | + owner_id | uuid | | not null | | plain | | | +Indexes: + "rooms_pkey" PRIMARY KEY, btree (id) + "idx_rooms_created_at" btree (created_at DESC) + "idx_rooms_deleted_at" btree (deleted_at) + "idx_rooms_is_active" btree (is_active) WHERE deleted_at IS NULL + "idx_rooms_room_type" btree (room_type) +Foreign-key constraints: + "rooms_creator_id_fkey" FOREIGN KEY (creator_id) REFERENCES users(id) ON DELETE CASCADE + "rooms_owner_id_fkey" FOREIGN KEY (owner_id) REFERENCES users(id) ON DELETE CASCADE +Access method: heap + + Sequence "public.rooms_id_seq" + Type | Start | Minimum | Maximum | Increment | Cycles? | Cache +--------+-------+---------+---------------------+-----------+---------+------- + bigint | 1 | 1 | 9223372036854775807 | 1 | no | 1 +Owned by: public.rooms.id + + Index "public.rooms_pkey" + Column | Type | Key? | Definition | Storage | Stats target +--------+--------+------+------------+---------+-------------- + id | bigint | yes | id | plain | +primary key, btree, for table "public.rooms" + + Table "public.schema_migrations" + Column | Type | Collation | Nullable | Default | Storage | Compression | Stats target | Description +---------+---------+-----------+----------+---------+---------+-------------+--------------+------------- + version | bigint | | not null | | plain | | | + dirty | boolean | | not null | | plain | | | +Indexes: + "schema_migrations_pkey" PRIMARY KEY, btree (version) +Access method: heap + + Index "public.schema_migrations_pkey" + Column | Type | Key? | Definition | Storage | Stats target +---------+--------+------+------------+---------+-------------- + version | bigint | yes | version | plain | +primary key, btree, for table "public.schema_migrations" + + Table "public.track_comments" + Column | Type | Collation | Nullable | Default | Storage | Compression | Stats target | Description +------------+-----------------------------+-----------+----------+--------------------------------------------+----------+-------------+--------------+------------- + id | bigint | | not null | nextval('track_comments_id_seq'::regclass) | plain | | | + parent_id | bigint | | | | plain | | | + content | text | | not null | | extended | | | + is_edited | boolean | | | false | plain | | | + created_at | timestamp without time zone | | | CURRENT_TIMESTAMP | plain | | | + updated_at | timestamp without time zone | | | CURRENT_TIMESTAMP | plain | | | + deleted_at | timestamp without time zone | | | | plain | | | + user_id | uuid | | not null | | plain | | | + track_id | uuid | | not null | | plain | | | +Indexes: + "track_comments_pkey" PRIMARY KEY, btree (id) + "idx_track_comments_created_at" btree (created_at DESC) + "idx_track_comments_parent_id" btree (parent_id) + "idx_track_comments_user_id" btree (user_id) +Foreign-key constraints: + "fk_track_comments_track" FOREIGN KEY (track_id) REFERENCES tracks(id) ON DELETE CASCADE + "track_comments_parent_id_fkey" FOREIGN KEY (parent_id) REFERENCES track_comments(id) ON DELETE CASCADE +Referenced by: + TABLE "track_comments" CONSTRAINT "track_comments_parent_id_fkey" FOREIGN KEY (parent_id) REFERENCES track_comments(id) ON DELETE CASCADE +Access method: heap + + Sequence "public.track_comments_id_seq" + Type | Start | Minimum | Maximum | Increment | Cycles? | Cache +--------+-------+---------+---------------------+-----------+---------+------- + bigint | 1 | 1 | 9223372036854775807 | 1 | no | 1 +Owned by: public.track_comments.id + + Index "public.track_comments_pkey" + Column | Type | Key? | Definition | Storage | Stats target +--------+--------+------+------------+---------+-------------- + id | bigint | yes | id | plain | +primary key, btree, for table "public.track_comments" + + Table "public.track_history" + Column | Type | Collation | Nullable | Default | Storage | Compression | Stats target | Description +------------+-----------------------------+-----------+----------+-------------------------------------------+----------+-------------+--------------+------------- + id | bigint | | not null | nextval('track_history_id_seq'::regclass) | plain | | | + action | character varying(50) | | not null | | extended | | | + old_value | text | | | | extended | | | + new_value | text | | | | extended | | | + created_at | timestamp without time zone | | not null | CURRENT_TIMESTAMP | plain | | | + track_id | uuid | | not null | | plain | | | + user_id | uuid | | not null | | plain | | | +Indexes: + "track_history_pkey" PRIMARY KEY, btree (id) + "idx_track_history_action" btree (action) + "idx_track_history_created_at" btree (created_at DESC) +Foreign-key constraints: + "fk_track_history_track" FOREIGN KEY (track_id) REFERENCES tracks(id) ON DELETE CASCADE + "fk_track_history_users" FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE +Access method: heap + + Sequence "public.track_history_id_seq" + Type | Start | Minimum | Maximum | Increment | Cycles? | Cache +--------+-------+---------+---------------------+-----------+---------+------- + bigint | 1 | 1 | 9223372036854775807 | 1 | no | 1 +Owned by: public.track_history.id + + Index "public.track_history_pkey" + Column | Type | Key? | Definition | Storage | Stats target +--------+--------+------+------------+---------+-------------- + id | bigint | yes | id | plain | +primary key, btree, for table "public.track_history" + + Table "public.track_likes" + Column | Type | Collation | Nullable | Default | Storage | Compression | Stats target | Description +------------+-----------------------------+-----------+----------+-----------------------------------------+---------+-------------+--------------+------------- + id | bigint | | not null | nextval('track_likes_id_seq'::regclass) | plain | | | + created_at | timestamp without time zone | | | CURRENT_TIMESTAMP | plain | | | + user_id | uuid | | not null | | plain | | | + track_id | uuid | | not null | | plain | | | +Indexes: + "track_likes_pkey" PRIMARY KEY, btree (id) + "idx_track_likes_user_id" btree (user_id) +Foreign-key constraints: + "fk_track_likes_track" FOREIGN KEY (track_id) REFERENCES tracks(id) ON DELETE CASCADE +Access method: heap + + Sequence "public.track_likes_id_seq" + Type | Start | Minimum | Maximum | Increment | Cycles? | Cache +--------+-------+---------+---------------------+-----------+---------+------- + bigint | 1 | 1 | 9223372036854775807 | 1 | no | 1 +Owned by: public.track_likes.id + + Index "public.track_likes_pkey" + Column | Type | Key? | Definition | Storage | Stats target +--------+--------+------+------------+---------+-------------- + id | bigint | yes | id | plain | +primary key, btree, for table "public.track_likes" + + Table "public.track_plays" + Column | Type | Collation | Nullable | Default | Storage | Compression | Stats target | Description +------------+-----------------------------+-----------+----------+-----------------------------------------+----------+-------------+--------------+------------- + id | bigint | | not null | nextval('track_plays_id_seq'::regclass) | plain | | | + duration | integer | | not null | | plain | | | + played_at | timestamp without time zone | | not null | CURRENT_TIMESTAMP | plain | | | + device | character varying(100) | | | | extended | | | + ip_address | character varying(45) | | | | extended | | | + created_at | timestamp without time zone | | not null | CURRENT_TIMESTAMP | plain | | | + updated_at | timestamp without time zone | | not null | CURRENT_TIMESTAMP | plain | | | + deleted_at | timestamp without time zone | | | | plain | | | + track_id | uuid | | not null | | plain | | | + user_id | uuid | | not null | | plain | | | +Indexes: + "track_plays_pkey" PRIMARY KEY, btree (id) + "idx_track_plays_deleted_at" btree (deleted_at) + "idx_track_plays_played_at" btree (played_at DESC) +Foreign-key constraints: + "fk_track_plays_track" FOREIGN KEY (track_id) REFERENCES tracks(id) ON DELETE CASCADE + "fk_track_plays_users" FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE +Access method: heap + + Sequence "public.track_plays_id_seq" + Type | Start | Minimum | Maximum | Increment | Cycles? | Cache +--------+-------+---------+---------------------+-----------+---------+------- + bigint | 1 | 1 | 9223372036854775807 | 1 | no | 1 +Owned by: public.track_plays.id + + Index "public.track_plays_pkey" + Column | Type | Key? | Definition | Storage | Stats target +--------+--------+------+------------+---------+-------------- + id | bigint | yes | id | plain | +primary key, btree, for table "public.track_plays" + + Table "public.track_shares" + Column | Type | Collation | Nullable | Default | Storage | Compression | Stats target | Description +--------------+-----------------------------+-----------+----------+------------------------------------------+----------+-------------+--------------+------------- + id | bigint | | not null | nextval('track_shares_id_seq'::regclass) | plain | | | + share_token | character varying(255) | | not null | | extended | | | + permissions | character varying(50) | | | 'read'::character varying | extended | | | + expires_at | timestamp without time zone | | | | plain | | | + access_count | bigint | | | 0 | plain | | | + created_at | timestamp without time zone | | | CURRENT_TIMESTAMP | plain | | | + updated_at | timestamp without time zone | | | CURRENT_TIMESTAMP | plain | | | + deleted_at | timestamp without time zone | | | | plain | | | + user_id | uuid | | not null | | plain | | | + track_id | uuid | | not null | | plain | | | +Indexes: + "track_shares_pkey" PRIMARY KEY, btree (id) + "idx_track_shares_deleted_at" btree (deleted_at) + "idx_track_shares_share_token" btree (share_token) + "idx_track_shares_user_id" btree (user_id) + "track_shares_share_token_key" UNIQUE CONSTRAINT, btree (share_token) +Foreign-key constraints: + "fk_track_shares_track" FOREIGN KEY (track_id) REFERENCES tracks(id) ON DELETE CASCADE +Access method: heap + + Sequence "public.track_shares_id_seq" + Type | Start | Minimum | Maximum | Increment | Cycles? | Cache +--------+-------+---------+---------------------+-----------+---------+------- + bigint | 1 | 1 | 9223372036854775807 | 1 | no | 1 +Owned by: public.track_shares.id + + Index "public.track_shares_pkey" + Column | Type | Key? | Definition | Storage | Stats target +--------+--------+------+------------+---------+-------------- + id | bigint | yes | id | plain | +primary key, btree, for table "public.track_shares" + + Index "public.track_shares_share_token_key" + Column | Type | Key? | Definition | Storage | Stats target +-------------+------------------------+------+-------------+----------+-------------- + share_token | character varying(255) | yes | share_token | extended | +unique, btree, for table "public.track_shares" + + Table "public.track_versions" + Column | Type | Collation | Nullable | Default | Storage | Compression | Stats target | Description +----------------+-----------------------------+-----------+----------+--------------------------------------------+----------+-------------+--------------+------------- + id | bigint | | not null | nextval('track_versions_id_seq'::regclass) | plain | | | + version_number | integer | | not null | | plain | | | + file_path | character varying(500) | | not null | | extended | | | + file_size | bigint | | not null | | plain | | | + changelog | text | | | | extended | | | + created_at | timestamp without time zone | | not null | CURRENT_TIMESTAMP | plain | | | + updated_at | timestamp without time zone | | not null | CURRENT_TIMESTAMP | plain | | | + deleted_at | timestamp without time zone | | | | plain | | | + track_id | uuid | | not null | | plain | | | +Indexes: + "track_versions_pkey" PRIMARY KEY, btree (id) + "idx_track_versions_created_at" btree (created_at DESC) + "idx_track_versions_deleted_at" btree (deleted_at) +Foreign-key constraints: + "fk_track_versions_track" FOREIGN KEY (track_id) REFERENCES tracks(id) ON DELETE CASCADE +Access method: heap + + Sequence "public.track_versions_id_seq" + Type | Start | Minimum | Maximum | Increment | Cycles? | Cache +--------+-------+---------+---------------------+-----------+---------+------- + bigint | 1 | 1 | 9223372036854775807 | 1 | no | 1 +Owned by: public.track_versions.id + + Index "public.track_versions_pkey" + Column | Type | Key? | Definition | Storage | Stats target +--------+--------+------+------------+---------+-------------- + id | bigint | yes | id | plain | +primary key, btree, for table "public.track_versions" + + Table "public.tracks" + Column | Type | Collation | Nullable | Default | Storage | Compression | Stats target | Description +----------------+-----------------------------+-----------+----------+--------------------------------+----------+-------------+--------------+------------- + title | character varying(255) | | not null | | extended | | | + artist | character varying(255) | | | | extended | | | + album | character varying(255) | | | | extended | | | + duration | integer | | not null | | plain | | | + genre | character varying(100) | | | | extended | | | + year | integer | | | 0 | plain | | | + file_path | character varying(500) | | not null | | extended | | | + file_size | bigint | | not null | | plain | | | + format | character varying(10) | | | | extended | | | + bitrate | integer | | | 0 | plain | | | + sample_rate | integer | | | 0 | plain | | | + waveform_path | character varying(500) | | | | extended | | | + cover_art_path | character varying(500) | | | | extended | | | + is_public | boolean | | | true | plain | | | + play_count | bigint | | | 0 | plain | | | + like_count | bigint | | | 0 | plain | | | + created_at | timestamp without time zone | | | CURRENT_TIMESTAMP | plain | | | + updated_at | timestamp without time zone | | | CURRENT_TIMESTAMP | plain | | | + deleted_at | timestamp without time zone | | | | plain | | | + status | character varying(20) | | | 'uploading'::character varying | extended | | | + status_message | text | | | | extended | | | + user_id | uuid | | not null | | plain | | | + id | uuid | | not null | gen_random_uuid() | plain | | | +Indexes: + "tracks_pkey" PRIMARY KEY, btree (id) + "idx_tracks_created_at" btree (created_at) + "idx_tracks_is_public" btree (is_public) + "idx_tracks_status" btree (status) + "idx_tracks_user_id" btree (user_id) +Foreign-key constraints: + "fk_tracks_users" FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE +Referenced by: + TABLE "bitrate_adaptation_logs" CONSTRAINT "fk_bitrate_adaptation_logs_track" FOREIGN KEY (track_id) REFERENCES tracks(id) ON DELETE CASCADE + TABLE "hls_streams" CONSTRAINT "fk_hls_streams_track" FOREIGN KEY (track_id) REFERENCES tracks(id) ON DELETE CASCADE + TABLE "hls_transcode_queue" CONSTRAINT "fk_hls_transcode_queue_track" FOREIGN KEY (track_id) REFERENCES tracks(id) ON DELETE CASCADE + TABLE "playback_analytics" CONSTRAINT "fk_playback_analytics_track" FOREIGN KEY (track_id) REFERENCES tracks(id) ON DELETE CASCADE + TABLE "playlist_tracks" CONSTRAINT "fk_playlist_tracks_track" FOREIGN KEY (track_id) REFERENCES tracks(id) ON DELETE CASCADE + TABLE "track_comments" CONSTRAINT "fk_track_comments_track" FOREIGN KEY (track_id) REFERENCES tracks(id) ON DELETE CASCADE + TABLE "track_history" CONSTRAINT "fk_track_history_track" FOREIGN KEY (track_id) REFERENCES tracks(id) ON DELETE CASCADE + TABLE "track_likes" CONSTRAINT "fk_track_likes_track" FOREIGN KEY (track_id) REFERENCES tracks(id) ON DELETE CASCADE + TABLE "track_plays" CONSTRAINT "fk_track_plays_track" FOREIGN KEY (track_id) REFERENCES tracks(id) ON DELETE CASCADE + TABLE "track_shares" CONSTRAINT "fk_track_shares_track" FOREIGN KEY (track_id) REFERENCES tracks(id) ON DELETE CASCADE + TABLE "track_versions" CONSTRAINT "fk_track_versions_track" FOREIGN KEY (track_id) REFERENCES tracks(id) ON DELETE CASCADE +Access method: heap + + Index "public.tracks_pkey" + Column | Type | Key? | Definition | Storage | Stats target +--------+------+------+------------+---------+-------------- + id | uuid | yes | id | plain | +primary key, btree, for table "public.tracks" + + Table "public.user_roles" + Column | Type | Collation | Nullable | Default | Storage | Compression | Stats target | Description +-------------+-----------------------------+-----------+----------+-------------------+---------+-------------+--------------+------------- + assigned_at | timestamp without time zone | | | CURRENT_TIMESTAMP | plain | | | + expires_at | timestamp without time zone | | | | plain | | | + is_active | boolean | | | true | plain | | | + user_id | uuid | | not null | | plain | | | + role_id | uuid | | | | plain | | | + id | uuid | | not null | gen_random_uuid() | plain | | | + assigned_by | uuid | | | | plain | | | +Indexes: + "user_roles_pkey" PRIMARY KEY, btree (id) + "idx_user_roles_role_id" btree (role_id) + "idx_user_roles_user_id" btree (user_id) +Foreign-key constraints: + "fk_user_roles_users" FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE + "user_roles_assigned_by_fkey" FOREIGN KEY (assigned_by) REFERENCES users(id) ON DELETE SET NULL + "user_roles_role_id_fkey" FOREIGN KEY (role_id) REFERENCES roles(id) ON DELETE CASCADE +Access method: heap + + Index "public.user_roles_pkey" + Column | Type | Key? | Definition | Storage | Stats target +--------+------+------+------------+---------+-------------- + id | uuid | yes | id | plain | +primary key, btree, for table "public.user_roles" + + Table "public.user_sessions" + Column | Type | Collation | Nullable | Default | Storage | Compression | Stats target | Description +---------------+--------------------------+-----------+----------+-------------------------------------------+----------+-------------+--------------+-------------------------------------------------------------- + id | bigint | | not null | nextval('user_sessions_id_seq'::regclass) | plain | | | + session_token | character varying(255) | | not null | | extended | | | Unique session token (hashed) + ip_address | character varying(45) | | | | extended | | | + user_agent | text | | | | extended | | | + is_active | boolean | | | true | plain | | | + last_activity | timestamp with time zone | | | CURRENT_TIMESTAMP | plain | | | Last activity timestamp (updated periodically with debounce) + expires_at | timestamp with time zone | | not null | | plain | | | + revoked_at | timestamp with time zone | | | | plain | | | Timestamp when session was revoked + created_at | timestamp with time zone | | | CURRENT_TIMESTAMP | plain | | | + updated_at | timestamp with time zone | | | CURRENT_TIMESTAMP | plain | | | + user_id | uuid | | not null | | plain | | | +Indexes: + "user_sessions_pkey" PRIMARY KEY, btree (id) + "idx_user_sessions_expires_at" btree (expires_at) + "idx_user_sessions_is_active" btree (is_active) WHERE is_active = true + "idx_user_sessions_last_activity" btree (last_activity DESC) + "idx_user_sessions_token" UNIQUE, btree (session_token) +Foreign-key constraints: + "fk_user_sessions_users" FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE +Access method: heap + + Sequence "public.user_sessions_id_seq" + Type | Start | Minimum | Maximum | Increment | Cycles? | Cache +--------+-------+---------+---------------------+-----------+---------+------- + bigint | 1 | 1 | 9223372036854775807 | 1 | no | 1 +Owned by: public.user_sessions.id + + Index "public.user_sessions_pkey" + Column | Type | Key? | Definition | Storage | Stats target +--------+--------+------+------------+---------+-------------- + id | bigint | yes | id | plain | +primary key, btree, for table "public.user_sessions" + + Table "public.users" + Column | Type | Collation | Nullable | Default | Storage | Compression | Stats target | Description +---------------------+--------------------------+-----------+----------+---------------------------+----------+-------------+--------------+------------------------------------------------- + username | character varying(30) | | not null | | extended | | | + slug | character varying(255) | | | | extended | | | URL-friendly unique identifier for user profile + email | character varying(255) | | not null | | extended | | | + password_hash | character varying(255) | | | | extended | | | + token_version | integer | | not null | 0 | plain | | | Version number for JWT token invalidation + first_name | character varying(100) | | | | extended | | | + last_name | character varying(100) | | | | extended | | | + avatar | text | | | | extended | | | + bio | text | | | | extended | | | + location | character varying(100) | | | | extended | | | + birthdate | timestamp with time zone | | | | plain | | | + gender | character varying(20) | | | | extended | | | + username_changed_at | timestamp with time zone | | | | plain | | | + role | character varying(50) | | not null | 'user'::character varying | extended | | | + is_active | boolean | | | true | plain | | | + is_verified | boolean | | | false | plain | | | + is_admin | boolean | | | false | plain | | | + is_public | boolean | | | true | plain | | | + last_login_at | timestamp with time zone | | | | plain | | | + created_at | timestamp with time zone | | | CURRENT_TIMESTAMP | plain | | | + updated_at | timestamp with time zone | | | CURRENT_TIMESTAMP | plain | | | + deleted_at | timestamp with time zone | | | | plain | | | + id | uuid | | not null | | plain | | | +Indexes: + "users_pkey" PRIMARY KEY, btree (id) + "idx_users_created_at" btree (created_at DESC) + "idx_users_deleted_at" btree (deleted_at) + "idx_users_email" UNIQUE, btree (email) WHERE deleted_at IS NULL + "idx_users_is_active" btree (is_active) WHERE deleted_at IS NULL + "idx_users_is_public" btree (is_public) + "idx_users_slug" UNIQUE, btree (slug) WHERE deleted_at IS NULL + "idx_users_username" UNIQUE, btree (username) WHERE deleted_at IS NULL +Referenced by: + TABLE "federated_identities" CONSTRAINT "federated_identities_user_id_fkey" FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE + TABLE "bitrate_adaptation_logs" CONSTRAINT "fk_bitrate_adaptation_logs_users" FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE + TABLE "email_verification_tokens" CONSTRAINT "fk_email_verification_tokens_users" FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE + TABLE "password_reset_tokens" CONSTRAINT "fk_password_reset_tokens_users" FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE + TABLE "playback_analytics" CONSTRAINT "fk_playback_analytics_users" FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE + TABLE "playlists" CONSTRAINT "fk_playlists_users" FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE + TABLE "track_history" CONSTRAINT "fk_track_history_users" FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE + TABLE "track_plays" CONSTRAINT "fk_track_plays_users" FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE + TABLE "tracks" CONSTRAINT "fk_tracks_users" FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE + TABLE "user_roles" CONSTRAINT "fk_user_roles_users" FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE + TABLE "user_sessions" CONSTRAINT "fk_user_sessions_users" FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE + TABLE "rooms" CONSTRAINT "rooms_creator_id_fkey" FOREIGN KEY (creator_id) REFERENCES users(id) ON DELETE CASCADE + TABLE "rooms" CONSTRAINT "rooms_owner_id_fkey" FOREIGN KEY (owner_id) REFERENCES users(id) ON DELETE CASCADE + TABLE "user_roles" CONSTRAINT "user_roles_assigned_by_fkey" FOREIGN KEY (assigned_by) REFERENCES users(id) ON DELETE SET NULL +Access method: heap + + Index "public.users_pkey" + Column | Type | Key? | Definition | Storage | Stats target +--------+------+------+------------+---------+-------------- + id | uuid | yes | id | plain | +primary key, btree, for table "public.users" + diff --git a/veza-backend-api/migrations/070_fix_users_user_roles_uuid.sql b/veza-backend-api/migrations/070_fix_users_user_roles_uuid.sql new file mode 100644 index 000000000..bbc3d18dd --- /dev/null +++ b/veza-backend-api/migrations/070_fix_users_user_roles_uuid.sql @@ -0,0 +1,157 @@ +-- Migration: 070_fix_users_user_roles_uuid.sql +-- Description: Finalisation de la migration UUID pour users et user_roles + Création federated_identities +-- Context: Lab Environment (Destructive changes authorized) + +CREATE EXTENSION IF NOT EXISTS "uuid-ossp"; +CREATE EXTENSION IF NOT EXISTS "pgcrypto"; + +-- ================================================================= +-- 1. NETTOYAGE ET MIGRATION TABLE USERS +-- ================================================================= + +-- On commence par supprimer la PK 'users_pkey' en CASCADE. +-- Cela va supprimer toutes les Foreign Keys (FK) qui pointaient vers l'ancien users.id (bigint). +-- C'est la méthode "Clean Slate" pour le lab. +ALTER TABLE users DROP CONSTRAINT IF EXISTS users_pkey CASCADE; + +-- Si la colonne id_uuid n'existe pas (cas où migration rejouée ou etat bizarre), on s'assure d'en avoir une +DO $$ +BEGIN + IF NOT EXISTS (SELECT 1 FROM information_schema.columns WHERE table_name = 'users' AND column_name = 'id_uuid') THEN + ALTER TABLE users ADD COLUMN id_uuid UUID DEFAULT gen_random_uuid(); + END IF; +END $$; + +-- On s'assure que tout le monde a un UUID +UPDATE users SET id_uuid = gen_random_uuid() WHERE id_uuid IS NULL; + +-- Suppression de l'ancien ID (BigInt) +ALTER TABLE users DROP COLUMN IF EXISTS id; + +-- Renommage id_uuid -> id +DO $$ +BEGIN + IF EXISTS (SELECT 1 FROM information_schema.columns WHERE table_name = 'users' AND column_name = 'id_uuid') THEN + ALTER TABLE users RENAME COLUMN id_uuid TO id; + END IF; +END $$; + +-- Définition de la nouvelle Primary Key UUID +ALTER TABLE users ADD PRIMARY KEY (id); + +-- ================================================================= +-- 2. RÉPARATION DES TABLES ENFANTS (Int -> UUID) +-- ================================================================= +-- Pour ces tables, on supprime l'ancienne colonne user_id (int) et on la recrée en UUID. +-- Comme c'est un lab sans data, on ne cherche pas à migrer la valeur int. + +DO $$ +DECLARE + tables_to_fix text[] := ARRAY[ + 'email_verification_tokens', + 'password_reset_tokens', + 'sessions', + 'user_sessions', + 'track_plays', + 'track_history', + 'bitrate_adaptation_logs', + 'playback_analytics' + ]; + tbl text; +BEGIN + FOREACH tbl IN ARRAY tables_to_fix LOOP + IF EXISTS (SELECT 1 FROM information_schema.tables WHERE table_name = tbl) THEN + -- Supprimer l'ancienne colonne (et ses contraintes résiduelles si cascade a raté) + EXECUTE 'ALTER TABLE ' || quote_ident(tbl) || ' DROP COLUMN IF EXISTS user_id CASCADE'; + + -- Créer la nouvelle colonne + EXECUTE 'ALTER TABLE ' || quote_ident(tbl) || ' ADD COLUMN user_id UUID NOT NULL'; + + -- Ajouter la FK + EXECUTE 'ALTER TABLE ' || quote_ident(tbl) || ' ADD CONSTRAINT fk_' || tbl || '_users FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE'; + + RAISE NOTICE 'Table % : user_id migré en UUID', tbl; + END IF; + END LOOP; +END $$; + +-- Cas spécifique : Rooms (creator_id ou owner_id selon versions) +DO $$ +BEGIN + IF EXISTS (SELECT 1 FROM information_schema.columns WHERE table_name = 'rooms' AND column_name = 'creator_id') THEN + ALTER TABLE rooms DROP COLUMN creator_id CASCADE; + ALTER TABLE rooms ADD COLUMN creator_id UUID NOT NULL REFERENCES users(id) ON DELETE CASCADE; + END IF; + + IF EXISTS (SELECT 1 FROM information_schema.columns WHERE table_name = 'rooms' AND column_name = 'owner_id') THEN + ALTER TABLE rooms DROP COLUMN owner_id CASCADE; + ALTER TABLE rooms ADD COLUMN owner_id UUID NOT NULL REFERENCES users(id) ON DELETE CASCADE; + END IF; +END $$; + + +-- ================================================================= +-- 3. MIGRATION TABLE USER_ROLES +-- ================================================================= +-- id (pk bigint -> uuid) +-- assigned_by (bigint -> uuid) +-- user_id (déjà uuid mais FK à vérifier) + +-- Drop PK +ALTER TABLE user_roles DROP CONSTRAINT IF EXISTS user_roles_pkey CASCADE; + +-- Fix ID (PK) +ALTER TABLE user_roles DROP COLUMN IF EXISTS id; +ALTER TABLE user_roles ADD COLUMN id UUID PRIMARY KEY DEFAULT gen_random_uuid(); + +-- Fix Assigned By +ALTER TABLE user_roles DROP COLUMN IF EXISTS assigned_by; +ALTER TABLE user_roles ADD COLUMN assigned_by UUID REFERENCES users(id) ON DELETE SET NULL; + +-- Fix User ID (S'assurer que la FK pointe bien vers le nouvel ID UUID de users) +-- Note: La colonne user_id est déjà UUID d'après le prompt, on recrée juste la FK pour être sûr. +ALTER TABLE user_roles DROP CONSTRAINT IF EXISTS user_roles_user_id_fkey; -- nom standard probable +ALTER TABLE user_roles ADD CONSTRAINT fk_user_roles_users FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE; + +-- ================================================================= +-- 4. CRÉATION TABLE FEDERATED_IDENTITIES +-- ================================================================= +-- Attendue par oauth_service.go + +CREATE TABLE IF NOT EXISTS federated_identities ( + id UUID PRIMARY KEY DEFAULT gen_random_uuid(), + user_id UUID NOT NULL REFERENCES users(id) ON DELETE CASCADE, + provider TEXT NOT NULL, + provider_id TEXT NOT NULL, + email TEXT, + display_name TEXT, + avatar_url TEXT, + access_token TEXT, + refresh_token TEXT, + expires_at TIMESTAMP WITH TIME ZONE, + created_at TIMESTAMP WITH TIME ZONE DEFAULT NOW(), + updated_at TIMESTAMP WITH TIME ZONE DEFAULT NOW() +); + +-- Indexs utiles +CREATE INDEX IF NOT EXISTS idx_federated_identities_user_id ON federated_identities(user_id); +CREATE INDEX IF NOT EXISTS idx_federated_identities_provider_id ON federated_identities(provider, provider_id); + +-- ================================================================= +-- 5. VÉRIFICATION FINALE (Tracks & Playlists) +-- ================================================================= +-- On s'assure que les tables critiques Tracks et Playlists ont bien leurs FKs attachées +-- (Au cas où le CASCADE du début aurait sauté leurs FKs) + +DO $$ +BEGIN + -- Tracks + IF NOT EXISTS (SELECT 1 FROM information_schema.table_constraints WHERE table_name = 'tracks' AND constraint_type = 'FOREIGN KEY') THEN + ALTER TABLE tracks ADD CONSTRAINT fk_tracks_users FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE; + END IF; + + -- Playlists + IF NOT EXISTS (SELECT 1 FROM information_schema.table_constraints WHERE table_name = 'playlists' AND constraint_type = 'FOREIGN KEY') THEN + ALTER TABLE playlists ADD CONSTRAINT fk_playlists_users FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE; + END IF; +END $$; diff --git a/veza-backend-api/veza_uuid_lab_schema.sql b/veza-backend-api/veza_uuid_lab_schema.sql new file mode 100644 index 000000000..d1fdf679a --- /dev/null +++ b/veza-backend-api/veza_uuid_lab_schema.sql @@ -0,0 +1,2144 @@ +-- +-- PostgreSQL database dump +-- + +-- Dumped from database version 16.11 (Debian 16.11-1.pgdg13+1) +-- Dumped by pg_dump version 16.8 + +SET statement_timeout = 0; +SET lock_timeout = 0; +SET idle_in_transaction_session_timeout = 0; +SET client_encoding = 'UTF8'; +SET standard_conforming_strings = on; +SELECT pg_catalog.set_config('search_path', '', false); +SET check_function_bodies = false; +SET xmloption = content; +SET client_min_messages = warning; +SET row_security = off; + +-- +-- Name: pgcrypto; Type: EXTENSION; Schema: -; Owner: - +-- + +CREATE EXTENSION IF NOT EXISTS pgcrypto WITH SCHEMA public; + + +-- +-- Name: EXTENSION pgcrypto; Type: COMMENT; Schema: -; Owner: +-- + +COMMENT ON EXTENSION pgcrypto IS 'cryptographic functions'; + + +-- +-- Name: uuid-ossp; Type: EXTENSION; Schema: -; Owner: - +-- + +CREATE EXTENSION IF NOT EXISTS "uuid-ossp" WITH SCHEMA public; + + +-- +-- Name: EXTENSION "uuid-ossp"; Type: COMMENT; Schema: -; Owner: +-- + +COMMENT ON EXTENSION "uuid-ossp" IS 'generate universally unique identifiers (UUIDs)'; + + +-- +-- Name: playlist_permission; Type: TYPE; Schema: public; Owner: postgres +-- + +CREATE TYPE public.playlist_permission AS ENUM ( + 'read', + 'write', + 'admin' +); + + +ALTER TYPE public.playlist_permission OWNER TO postgres; + +SET default_tablespace = ''; + +SET default_table_access_method = heap; + +-- +-- Name: admin_settings; Type: TABLE; Schema: public; Owner: postgres +-- + +CREATE TABLE public.admin_settings ( + id uuid DEFAULT gen_random_uuid() NOT NULL, + key character varying(255) NOT NULL, + value text, + type character varying(50), + description text, + category character varying(50), + is_public boolean DEFAULT false, + updated_by uuid, + updated_at timestamp with time zone DEFAULT CURRENT_TIMESTAMP +); + + +ALTER TABLE public.admin_settings OWNER TO postgres; + +-- +-- Name: bitrate_adaptation_logs; Type: TABLE; Schema: public; Owner: postgres +-- + +CREATE TABLE public.bitrate_adaptation_logs ( + id bigint NOT NULL, + old_bitrate integer NOT NULL, + new_bitrate integer NOT NULL, + reason character varying(50) NOT NULL, + network_bandwidth integer, + created_at timestamp without time zone DEFAULT now() NOT NULL, + track_id uuid NOT NULL, + user_id uuid NOT NULL +); + + +ALTER TABLE public.bitrate_adaptation_logs OWNER TO postgres; + +-- +-- Name: bitrate_adaptation_logs_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres +-- + +CREATE SEQUENCE public.bitrate_adaptation_logs_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +ALTER SEQUENCE public.bitrate_adaptation_logs_id_seq OWNER TO postgres; + +-- +-- Name: bitrate_adaptation_logs_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres +-- + +ALTER SEQUENCE public.bitrate_adaptation_logs_id_seq OWNED BY public.bitrate_adaptation_logs.id; + + +-- +-- Name: email_verification_tokens; Type: TABLE; Schema: public; Owner: postgres +-- + +CREATE TABLE public.email_verification_tokens ( + id bigint NOT NULL, + token character varying(255) NOT NULL, + expires_at timestamp without time zone NOT NULL, + used boolean DEFAULT false NOT NULL, + created_at timestamp without time zone DEFAULT now() NOT NULL, + user_id uuid NOT NULL +); + + +ALTER TABLE public.email_verification_tokens OWNER TO postgres; + +-- +-- Name: email_verification_tokens_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres +-- + +CREATE SEQUENCE public.email_verification_tokens_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +ALTER SEQUENCE public.email_verification_tokens_id_seq OWNER TO postgres; + +-- +-- Name: email_verification_tokens_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres +-- + +ALTER SEQUENCE public.email_verification_tokens_id_seq OWNED BY public.email_verification_tokens.id; + + +-- +-- Name: federated_identities; Type: TABLE; Schema: public; Owner: postgres +-- + +CREATE TABLE public.federated_identities ( + id uuid DEFAULT gen_random_uuid() NOT NULL, + user_id uuid NOT NULL, + provider text NOT NULL, + provider_id text NOT NULL, + email text, + display_name text, + avatar_url text, + access_token text, + refresh_token text, + expires_at timestamp with time zone, + created_at timestamp with time zone DEFAULT now(), + updated_at timestamp with time zone DEFAULT now() +); + + +ALTER TABLE public.federated_identities OWNER TO postgres; + +-- +-- Name: hls_streams; Type: TABLE; Schema: public; Owner: postgres +-- + +CREATE TABLE public.hls_streams ( + id bigint NOT NULL, + playlist_url character varying(500) NOT NULL, + segments_count integer DEFAULT 0 NOT NULL, + bitrates jsonb DEFAULT '[]'::jsonb NOT NULL, + status character varying(20) DEFAULT 'pending'::character varying NOT NULL, + created_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL, + updated_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL, + track_id uuid NOT NULL +); + + +ALTER TABLE public.hls_streams OWNER TO postgres; + +-- +-- Name: hls_streams_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres +-- + +CREATE SEQUENCE public.hls_streams_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +ALTER SEQUENCE public.hls_streams_id_seq OWNER TO postgres; + +-- +-- Name: hls_streams_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres +-- + +ALTER SEQUENCE public.hls_streams_id_seq OWNED BY public.hls_streams.id; + + +-- +-- Name: hls_transcode_queue; Type: TABLE; Schema: public; Owner: postgres +-- + +CREATE TABLE public.hls_transcode_queue ( + id bigint NOT NULL, + priority integer DEFAULT 5 NOT NULL, + status character varying(20) DEFAULT 'pending'::character varying NOT NULL, + retry_count integer DEFAULT 0 NOT NULL, + max_retries integer DEFAULT 3 NOT NULL, + error_message text, + created_at timestamp without time zone DEFAULT now() NOT NULL, + started_at timestamp without time zone, + completed_at timestamp without time zone, + track_id uuid NOT NULL +); + + +ALTER TABLE public.hls_transcode_queue OWNER TO postgres; + +-- +-- Name: hls_transcode_queue_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres +-- + +CREATE SEQUENCE public.hls_transcode_queue_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +ALTER SEQUENCE public.hls_transcode_queue_id_seq OWNER TO postgres; + +-- +-- Name: hls_transcode_queue_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres +-- + +ALTER SEQUENCE public.hls_transcode_queue_id_seq OWNED BY public.hls_transcode_queue.id; + + +-- +-- Name: password_reset_tokens; Type: TABLE; Schema: public; Owner: postgres +-- + +CREATE TABLE public.password_reset_tokens ( + id bigint NOT NULL, + token character varying(255) NOT NULL, + expires_at timestamp without time zone NOT NULL, + used boolean DEFAULT false NOT NULL, + created_at timestamp without time zone DEFAULT now() NOT NULL, + user_id uuid NOT NULL +); + + +ALTER TABLE public.password_reset_tokens OWNER TO postgres; + +-- +-- Name: password_reset_tokens_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres +-- + +CREATE SEQUENCE public.password_reset_tokens_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +ALTER SEQUENCE public.password_reset_tokens_id_seq OWNER TO postgres; + +-- +-- Name: password_reset_tokens_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres +-- + +ALTER SEQUENCE public.password_reset_tokens_id_seq OWNED BY public.password_reset_tokens.id; + + +-- +-- Name: permissions; Type: TABLE; Schema: public; Owner: postgres +-- + +CREATE TABLE public.permissions ( + name character varying(100) NOT NULL, + resource character varying(50) NOT NULL, + action character varying(50) NOT NULL, + description text, + created_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP, + id uuid DEFAULT gen_random_uuid() NOT NULL +); + + +ALTER TABLE public.permissions OWNER TO postgres; + +-- +-- Name: TABLE permissions; Type: COMMENT; Schema: public; Owner: postgres +-- + +COMMENT ON TABLE public.permissions IS 'System permissions for RBAC (migrated to UUID)'; + + +-- +-- Name: playback_analytics; Type: TABLE; Schema: public; Owner: postgres +-- + +CREATE TABLE public.playback_analytics ( + id bigint NOT NULL, + play_time integer DEFAULT 0 NOT NULL, + pause_count integer DEFAULT 0 NOT NULL, + seek_count integer DEFAULT 0 NOT NULL, + completion_rate numeric(5,2) DEFAULT 0 NOT NULL, + started_at timestamp without time zone NOT NULL, + ended_at timestamp without time zone, + created_at timestamp without time zone DEFAULT now() NOT NULL, + track_id uuid NOT NULL, + user_id uuid NOT NULL +); + + +ALTER TABLE public.playback_analytics OWNER TO postgres; + +-- +-- Name: playback_analytics_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres +-- + +CREATE SEQUENCE public.playback_analytics_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +ALTER SEQUENCE public.playback_analytics_id_seq OWNER TO postgres; + +-- +-- Name: playback_analytics_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres +-- + +ALTER SEQUENCE public.playback_analytics_id_seq OWNED BY public.playback_analytics.id; + + +-- +-- Name: playlist_collaborators; Type: TABLE; Schema: public; Owner: postgres +-- + +CREATE TABLE public.playlist_collaborators ( + id bigint NOT NULL, + permission character varying(20) DEFAULT 'read'::character varying NOT NULL, + created_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL, + updated_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL, + deleted_at timestamp without time zone, + user_id uuid NOT NULL, + playlist_id uuid NOT NULL, + CONSTRAINT chk_playlist_collaborators_permission CHECK (((permission)::text = ANY ((ARRAY['read'::character varying, 'write'::character varying, 'admin'::character varying])::text[]))) +); + + +ALTER TABLE public.playlist_collaborators OWNER TO postgres; + +-- +-- Name: TABLE playlist_collaborators; Type: COMMENT; Schema: public; Owner: postgres +-- + +COMMENT ON TABLE public.playlist_collaborators IS 'Table des collaborateurs de playlists avec leurs permissions'; + + +-- +-- Name: COLUMN playlist_collaborators.permission; Type: COMMENT; Schema: public; Owner: postgres +-- + +COMMENT ON COLUMN public.playlist_collaborators.permission IS 'Permission du collaborateur: read (lecture), write (écriture), admin (administration)'; + + +-- +-- Name: playlist_collaborators_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres +-- + +CREATE SEQUENCE public.playlist_collaborators_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +ALTER SEQUENCE public.playlist_collaborators_id_seq OWNER TO postgres; + +-- +-- Name: playlist_collaborators_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres +-- + +ALTER SEQUENCE public.playlist_collaborators_id_seq OWNED BY public.playlist_collaborators.id; + + +-- +-- Name: playlist_follows; Type: TABLE; Schema: public; Owner: postgres +-- + +CREATE TABLE public.playlist_follows ( + id bigint NOT NULL, + created_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL, + updated_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL, + deleted_at timestamp without time zone, + user_id uuid NOT NULL, + playlist_id uuid NOT NULL +); + + +ALTER TABLE public.playlist_follows OWNER TO postgres; + +-- +-- Name: TABLE playlist_follows; Type: COMMENT; Schema: public; Owner: postgres +-- + +COMMENT ON TABLE public.playlist_follows IS 'Table des follows de playlists par les utilisateurs'; + + +-- +-- Name: playlist_follows_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres +-- + +CREATE SEQUENCE public.playlist_follows_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +ALTER SEQUENCE public.playlist_follows_id_seq OWNER TO postgres; + +-- +-- Name: playlist_follows_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres +-- + +ALTER SEQUENCE public.playlist_follows_id_seq OWNED BY public.playlist_follows.id; + + +-- +-- Name: playlist_tracks; Type: TABLE; Schema: public; Owner: postgres +-- + +CREATE TABLE public.playlist_tracks ( + "position" integer NOT NULL, + added_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL, + track_id uuid NOT NULL, + playlist_id uuid NOT NULL, + id uuid DEFAULT gen_random_uuid() NOT NULL +); + + +ALTER TABLE public.playlist_tracks OWNER TO postgres; + +-- +-- Name: playlists; Type: TABLE; Schema: public; Owner: postgres +-- + +CREATE TABLE public.playlists ( + title character varying(200) NOT NULL, + description text, + is_public boolean DEFAULT true, + cover_url character varying(500), + track_count integer DEFAULT 0, + created_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL, + updated_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL, + follower_count integer DEFAULT 0, + deleted_at timestamp with time zone, + user_id uuid NOT NULL, + id uuid DEFAULT gen_random_uuid() NOT NULL +); + + +ALTER TABLE public.playlists OWNER TO postgres; + +-- +-- Name: refresh_tokens; Type: TABLE; Schema: public; Owner: postgres +-- + +CREATE TABLE public.refresh_tokens ( + id bigint NOT NULL, + token_hash character varying(255) NOT NULL, + expires_at timestamp with time zone NOT NULL, + created_at timestamp with time zone DEFAULT CURRENT_TIMESTAMP, + deleted_at timestamp with time zone, + user_id uuid NOT NULL +); + + +ALTER TABLE public.refresh_tokens OWNER TO postgres; + +-- +-- Name: TABLE refresh_tokens; Type: COMMENT; Schema: public; Owner: postgres +-- + +COMMENT ON TABLE public.refresh_tokens IS 'JWT refresh tokens for persistent authentication (T0165)'; + + +-- +-- Name: COLUMN refresh_tokens.token_hash; Type: COMMENT; Schema: public; Owner: postgres +-- + +COMMENT ON COLUMN public.refresh_tokens.token_hash IS 'SHA-256 hash of the refresh token'; + + +-- +-- Name: COLUMN refresh_tokens.expires_at; Type: COMMENT; Schema: public; Owner: postgres +-- + +COMMENT ON COLUMN public.refresh_tokens.expires_at IS 'Token expiration timestamp'; + + +-- +-- Name: refresh_tokens_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres +-- + +CREATE SEQUENCE public.refresh_tokens_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +ALTER SEQUENCE public.refresh_tokens_id_seq OWNER TO postgres; + +-- +-- Name: refresh_tokens_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres +-- + +ALTER SEQUENCE public.refresh_tokens_id_seq OWNED BY public.refresh_tokens.id; + + +-- +-- Name: role_permissions; Type: TABLE; Schema: public; Owner: postgres +-- + +CREATE TABLE public.role_permissions ( + role_id uuid NOT NULL, + permission_id uuid NOT NULL +); + + +ALTER TABLE public.role_permissions OWNER TO postgres; + +-- +-- Name: TABLE role_permissions; Type: COMMENT; Schema: public; Owner: postgres +-- + +COMMENT ON TABLE public.role_permissions IS 'Role permission mappings (migrated to UUID)'; + + +-- +-- Name: roles; Type: TABLE; Schema: public; Owner: postgres +-- + +CREATE TABLE public.roles ( + name character varying(50) NOT NULL, + display_name character varying(100) NOT NULL, + description text, + is_system boolean DEFAULT false, + is_active boolean DEFAULT true, + created_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP, + updated_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP, + id uuid DEFAULT gen_random_uuid() NOT NULL +); + + +ALTER TABLE public.roles OWNER TO postgres; + +-- +-- Name: TABLE roles; Type: COMMENT; Schema: public; Owner: postgres +-- + +COMMENT ON TABLE public.roles IS 'System roles for RBAC (migrated to UUID)'; + + +-- +-- Name: rooms; Type: TABLE; Schema: public; Owner: postgres +-- + +CREATE TABLE public.rooms ( + id bigint NOT NULL, + name character varying(255) NOT NULL, + description text, + room_type character varying(50) DEFAULT 'public'::character varying NOT NULL, + is_active boolean DEFAULT true, + max_members integer DEFAULT 100, + created_at timestamp with time zone DEFAULT CURRENT_TIMESTAMP, + updated_at timestamp with time zone DEFAULT CURRENT_TIMESTAMP, + deleted_at timestamp with time zone, + creator_id uuid NOT NULL, + owner_id uuid NOT NULL +); + + +ALTER TABLE public.rooms OWNER TO postgres; + +-- +-- Name: TABLE rooms; Type: COMMENT; Schema: public; Owner: postgres +-- + +COMMENT ON TABLE public.rooms IS 'Chat rooms for real-time messaging'; + + +-- +-- Name: COLUMN rooms.room_type; Type: COMMENT; Schema: public; Owner: postgres +-- + +COMMENT ON COLUMN public.rooms.room_type IS 'Type of room: public, private, or direct'; + + +-- +-- Name: COLUMN rooms.max_members; Type: COMMENT; Schema: public; Owner: postgres +-- + +COMMENT ON COLUMN public.rooms.max_members IS 'Maximum number of members allowed in the room'; + + +-- +-- Name: rooms_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres +-- + +CREATE SEQUENCE public.rooms_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +ALTER SEQUENCE public.rooms_id_seq OWNER TO postgres; + +-- +-- Name: rooms_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres +-- + +ALTER SEQUENCE public.rooms_id_seq OWNED BY public.rooms.id; + + +-- +-- Name: schema_migrations; Type: TABLE; Schema: public; Owner: postgres +-- + +CREATE TABLE public.schema_migrations ( + version bigint NOT NULL, + dirty boolean NOT NULL +); + + +ALTER TABLE public.schema_migrations OWNER TO postgres; + +-- +-- Name: track_comments; Type: TABLE; Schema: public; Owner: postgres +-- + +CREATE TABLE public.track_comments ( + id bigint NOT NULL, + parent_id bigint, + content text NOT NULL, + is_edited boolean DEFAULT false, + created_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP, + updated_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP, + deleted_at timestamp without time zone, + user_id uuid NOT NULL, + track_id uuid NOT NULL +); + + +ALTER TABLE public.track_comments OWNER TO postgres; + +-- +-- Name: track_comments_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres +-- + +CREATE SEQUENCE public.track_comments_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +ALTER SEQUENCE public.track_comments_id_seq OWNER TO postgres; + +-- +-- Name: track_comments_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres +-- + +ALTER SEQUENCE public.track_comments_id_seq OWNED BY public.track_comments.id; + + +-- +-- Name: track_history; Type: TABLE; Schema: public; Owner: postgres +-- + +CREATE TABLE public.track_history ( + id bigint NOT NULL, + action character varying(50) NOT NULL, + old_value text, + new_value text, + created_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL, + track_id uuid NOT NULL, + user_id uuid NOT NULL +); + + +ALTER TABLE public.track_history OWNER TO postgres; + +-- +-- Name: track_history_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres +-- + +CREATE SEQUENCE public.track_history_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +ALTER SEQUENCE public.track_history_id_seq OWNER TO postgres; + +-- +-- Name: track_history_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres +-- + +ALTER SEQUENCE public.track_history_id_seq OWNED BY public.track_history.id; + + +-- +-- Name: track_likes; Type: TABLE; Schema: public; Owner: postgres +-- + +CREATE TABLE public.track_likes ( + id bigint NOT NULL, + created_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP, + user_id uuid NOT NULL, + track_id uuid NOT NULL +); + + +ALTER TABLE public.track_likes OWNER TO postgres; + +-- +-- Name: track_likes_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres +-- + +CREATE SEQUENCE public.track_likes_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +ALTER SEQUENCE public.track_likes_id_seq OWNER TO postgres; + +-- +-- Name: track_likes_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres +-- + +ALTER SEQUENCE public.track_likes_id_seq OWNED BY public.track_likes.id; + + +-- +-- Name: track_plays; Type: TABLE; Schema: public; Owner: postgres +-- + +CREATE TABLE public.track_plays ( + id bigint NOT NULL, + duration integer NOT NULL, + played_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL, + device character varying(100), + ip_address character varying(45), + created_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL, + updated_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL, + deleted_at timestamp without time zone, + track_id uuid NOT NULL, + user_id uuid NOT NULL +); + + +ALTER TABLE public.track_plays OWNER TO postgres; + +-- +-- Name: track_plays_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres +-- + +CREATE SEQUENCE public.track_plays_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +ALTER SEQUENCE public.track_plays_id_seq OWNER TO postgres; + +-- +-- Name: track_plays_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres +-- + +ALTER SEQUENCE public.track_plays_id_seq OWNED BY public.track_plays.id; + + +-- +-- Name: track_shares; Type: TABLE; Schema: public; Owner: postgres +-- + +CREATE TABLE public.track_shares ( + id bigint NOT NULL, + share_token character varying(255) NOT NULL, + permissions character varying(50) DEFAULT 'read'::character varying, + expires_at timestamp without time zone, + access_count bigint DEFAULT 0, + created_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP, + updated_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP, + deleted_at timestamp without time zone, + user_id uuid NOT NULL, + track_id uuid NOT NULL +); + + +ALTER TABLE public.track_shares OWNER TO postgres; + +-- +-- Name: track_shares_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres +-- + +CREATE SEQUENCE public.track_shares_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +ALTER SEQUENCE public.track_shares_id_seq OWNER TO postgres; + +-- +-- Name: track_shares_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres +-- + +ALTER SEQUENCE public.track_shares_id_seq OWNED BY public.track_shares.id; + + +-- +-- Name: track_versions; Type: TABLE; Schema: public; Owner: postgres +-- + +CREATE TABLE public.track_versions ( + id bigint NOT NULL, + version_number integer NOT NULL, + file_path character varying(500) NOT NULL, + file_size bigint NOT NULL, + changelog text, + created_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL, + updated_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL, + deleted_at timestamp without time zone, + track_id uuid NOT NULL +); + + +ALTER TABLE public.track_versions OWNER TO postgres; + +-- +-- Name: track_versions_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres +-- + +CREATE SEQUENCE public.track_versions_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +ALTER SEQUENCE public.track_versions_id_seq OWNER TO postgres; + +-- +-- Name: track_versions_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres +-- + +ALTER SEQUENCE public.track_versions_id_seq OWNED BY public.track_versions.id; + + +-- +-- Name: tracks; Type: TABLE; Schema: public; Owner: postgres +-- + +CREATE TABLE public.tracks ( + title character varying(255) NOT NULL, + artist character varying(255), + album character varying(255), + duration integer NOT NULL, + genre character varying(100), + year integer DEFAULT 0, + file_path character varying(500) NOT NULL, + file_size bigint NOT NULL, + format character varying(10), + bitrate integer DEFAULT 0, + sample_rate integer DEFAULT 0, + waveform_path character varying(500), + cover_art_path character varying(500), + is_public boolean DEFAULT true, + play_count bigint DEFAULT 0, + like_count bigint DEFAULT 0, + created_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP, + updated_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP, + deleted_at timestamp without time zone, + status character varying(20) DEFAULT 'uploading'::character varying, + status_message text, + user_id uuid NOT NULL, + id uuid DEFAULT gen_random_uuid() NOT NULL +); + + +ALTER TABLE public.tracks OWNER TO postgres; + +-- +-- Name: user_roles; Type: TABLE; Schema: public; Owner: postgres +-- + +CREATE TABLE public.user_roles ( + assigned_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP, + expires_at timestamp without time zone, + is_active boolean DEFAULT true, + user_id uuid NOT NULL, + role_id uuid, + id uuid DEFAULT gen_random_uuid() NOT NULL, + assigned_by uuid +); + + +ALTER TABLE public.user_roles OWNER TO postgres; + +-- +-- Name: TABLE user_roles; Type: COMMENT; Schema: public; Owner: postgres +-- + +COMMENT ON TABLE public.user_roles IS 'User role assignments (migrated to UUID)'; + + +-- +-- Name: user_sessions; Type: TABLE; Schema: public; Owner: postgres +-- + +CREATE TABLE public.user_sessions ( + id bigint NOT NULL, + session_token character varying(255) NOT NULL, + ip_address character varying(45), + user_agent text, + is_active boolean DEFAULT true, + last_activity timestamp with time zone DEFAULT CURRENT_TIMESTAMP, + expires_at timestamp with time zone NOT NULL, + revoked_at timestamp with time zone, + created_at timestamp with time zone DEFAULT CURRENT_TIMESTAMP, + updated_at timestamp with time zone DEFAULT CURRENT_TIMESTAMP, + user_id uuid NOT NULL +); + + +ALTER TABLE public.user_sessions OWNER TO postgres; + +-- +-- Name: TABLE user_sessions; Type: COMMENT; Schema: public; Owner: postgres +-- + +COMMENT ON TABLE public.user_sessions IS 'User sessions for authentication tracking (alternative to sessions table)'; + + +-- +-- Name: COLUMN user_sessions.session_token; Type: COMMENT; Schema: public; Owner: postgres +-- + +COMMENT ON COLUMN public.user_sessions.session_token IS 'Unique session token (hashed)'; + + +-- +-- Name: COLUMN user_sessions.last_activity; Type: COMMENT; Schema: public; Owner: postgres +-- + +COMMENT ON COLUMN public.user_sessions.last_activity IS 'Last activity timestamp (updated periodically with debounce)'; + + +-- +-- Name: COLUMN user_sessions.revoked_at; Type: COMMENT; Schema: public; Owner: postgres +-- + +COMMENT ON COLUMN public.user_sessions.revoked_at IS 'Timestamp when session was revoked'; + + +-- +-- Name: user_sessions_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres +-- + +CREATE SEQUENCE public.user_sessions_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +ALTER SEQUENCE public.user_sessions_id_seq OWNER TO postgres; + +-- +-- Name: user_sessions_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres +-- + +ALTER SEQUENCE public.user_sessions_id_seq OWNED BY public.user_sessions.id; + + +-- +-- Name: users; Type: TABLE; Schema: public; Owner: postgres +-- + +CREATE TABLE public.users ( + username character varying(30) NOT NULL, + slug character varying(255), + email character varying(255) NOT NULL, + password_hash character varying(255), + token_version integer DEFAULT 0 NOT NULL, + first_name character varying(100), + last_name character varying(100), + avatar text, + bio text, + location character varying(100), + birthdate timestamp with time zone, + gender character varying(20), + username_changed_at timestamp with time zone, + role character varying(50) DEFAULT 'user'::character varying NOT NULL, + is_active boolean DEFAULT true, + is_verified boolean DEFAULT false, + is_admin boolean DEFAULT false, + is_public boolean DEFAULT true, + last_login_at timestamp with time zone, + created_at timestamp with time zone DEFAULT CURRENT_TIMESTAMP, + updated_at timestamp with time zone DEFAULT CURRENT_TIMESTAMP, + deleted_at timestamp with time zone, + id uuid NOT NULL +); + + +ALTER TABLE public.users OWNER TO postgres; + +-- +-- Name: TABLE users; Type: COMMENT; Schema: public; Owner: postgres +-- + +COMMENT ON TABLE public.users IS 'Core user accounts for authentication and profiles'; + + +-- +-- Name: COLUMN users.slug; Type: COMMENT; Schema: public; Owner: postgres +-- + +COMMENT ON COLUMN public.users.slug IS 'URL-friendly unique identifier for user profile'; + + +-- +-- Name: COLUMN users.token_version; Type: COMMENT; Schema: public; Owner: postgres +-- + +COMMENT ON COLUMN public.users.token_version IS 'Version number for JWT token invalidation'; + + +-- +-- Name: bitrate_adaptation_logs id; Type: DEFAULT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.bitrate_adaptation_logs ALTER COLUMN id SET DEFAULT nextval('public.bitrate_adaptation_logs_id_seq'::regclass); + + +-- +-- Name: email_verification_tokens id; Type: DEFAULT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.email_verification_tokens ALTER COLUMN id SET DEFAULT nextval('public.email_verification_tokens_id_seq'::regclass); + + +-- +-- Name: hls_streams id; Type: DEFAULT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.hls_streams ALTER COLUMN id SET DEFAULT nextval('public.hls_streams_id_seq'::regclass); + + +-- +-- Name: hls_transcode_queue id; Type: DEFAULT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.hls_transcode_queue ALTER COLUMN id SET DEFAULT nextval('public.hls_transcode_queue_id_seq'::regclass); + + +-- +-- Name: password_reset_tokens id; Type: DEFAULT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.password_reset_tokens ALTER COLUMN id SET DEFAULT nextval('public.password_reset_tokens_id_seq'::regclass); + + +-- +-- Name: playback_analytics id; Type: DEFAULT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.playback_analytics ALTER COLUMN id SET DEFAULT nextval('public.playback_analytics_id_seq'::regclass); + + +-- +-- Name: playlist_collaborators id; Type: DEFAULT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.playlist_collaborators ALTER COLUMN id SET DEFAULT nextval('public.playlist_collaborators_id_seq'::regclass); + + +-- +-- Name: playlist_follows id; Type: DEFAULT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.playlist_follows ALTER COLUMN id SET DEFAULT nextval('public.playlist_follows_id_seq'::regclass); + + +-- +-- Name: refresh_tokens id; Type: DEFAULT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.refresh_tokens ALTER COLUMN id SET DEFAULT nextval('public.refresh_tokens_id_seq'::regclass); + + +-- +-- Name: rooms id; Type: DEFAULT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.rooms ALTER COLUMN id SET DEFAULT nextval('public.rooms_id_seq'::regclass); + + +-- +-- Name: track_comments id; Type: DEFAULT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.track_comments ALTER COLUMN id SET DEFAULT nextval('public.track_comments_id_seq'::regclass); + + +-- +-- Name: track_history id; Type: DEFAULT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.track_history ALTER COLUMN id SET DEFAULT nextval('public.track_history_id_seq'::regclass); + + +-- +-- Name: track_likes id; Type: DEFAULT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.track_likes ALTER COLUMN id SET DEFAULT nextval('public.track_likes_id_seq'::regclass); + + +-- +-- Name: track_plays id; Type: DEFAULT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.track_plays ALTER COLUMN id SET DEFAULT nextval('public.track_plays_id_seq'::regclass); + + +-- +-- Name: track_shares id; Type: DEFAULT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.track_shares ALTER COLUMN id SET DEFAULT nextval('public.track_shares_id_seq'::regclass); + + +-- +-- Name: track_versions id; Type: DEFAULT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.track_versions ALTER COLUMN id SET DEFAULT nextval('public.track_versions_id_seq'::regclass); + + +-- +-- Name: user_sessions id; Type: DEFAULT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.user_sessions ALTER COLUMN id SET DEFAULT nextval('public.user_sessions_id_seq'::regclass); + + +-- +-- Name: admin_settings admin_settings_key_key; Type: CONSTRAINT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.admin_settings + ADD CONSTRAINT admin_settings_key_key UNIQUE (key); + + +-- +-- Name: admin_settings admin_settings_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.admin_settings + ADD CONSTRAINT admin_settings_pkey PRIMARY KEY (id); + + +-- +-- Name: bitrate_adaptation_logs bitrate_adaptation_logs_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.bitrate_adaptation_logs + ADD CONSTRAINT bitrate_adaptation_logs_pkey PRIMARY KEY (id); + + +-- +-- Name: email_verification_tokens email_verification_tokens_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.email_verification_tokens + ADD CONSTRAINT email_verification_tokens_pkey PRIMARY KEY (id); + + +-- +-- Name: email_verification_tokens email_verification_tokens_token_key; Type: CONSTRAINT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.email_verification_tokens + ADD CONSTRAINT email_verification_tokens_token_key UNIQUE (token); + + +-- +-- Name: federated_identities federated_identities_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.federated_identities + ADD CONSTRAINT federated_identities_pkey PRIMARY KEY (id); + + +-- +-- Name: hls_streams hls_streams_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.hls_streams + ADD CONSTRAINT hls_streams_pkey PRIMARY KEY (id); + + +-- +-- Name: hls_transcode_queue hls_transcode_queue_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.hls_transcode_queue + ADD CONSTRAINT hls_transcode_queue_pkey PRIMARY KEY (id); + + +-- +-- Name: password_reset_tokens password_reset_tokens_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.password_reset_tokens + ADD CONSTRAINT password_reset_tokens_pkey PRIMARY KEY (id); + + +-- +-- Name: password_reset_tokens password_reset_tokens_token_key; Type: CONSTRAINT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.password_reset_tokens + ADD CONSTRAINT password_reset_tokens_token_key UNIQUE (token); + + +-- +-- Name: permissions permissions_name_key; Type: CONSTRAINT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.permissions + ADD CONSTRAINT permissions_name_key UNIQUE (name); + + +-- +-- Name: permissions permissions_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.permissions + ADD CONSTRAINT permissions_pkey PRIMARY KEY (id); + + +-- +-- Name: playback_analytics playback_analytics_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.playback_analytics + ADD CONSTRAINT playback_analytics_pkey PRIMARY KEY (id); + + +-- +-- Name: playlist_collaborators playlist_collaborators_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.playlist_collaborators + ADD CONSTRAINT playlist_collaborators_pkey PRIMARY KEY (id); + + +-- +-- Name: playlist_follows playlist_follows_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.playlist_follows + ADD CONSTRAINT playlist_follows_pkey PRIMARY KEY (id); + + +-- +-- Name: playlist_tracks playlist_tracks_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.playlist_tracks + ADD CONSTRAINT playlist_tracks_pkey PRIMARY KEY (id); + + +-- +-- Name: playlists playlists_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.playlists + ADD CONSTRAINT playlists_pkey PRIMARY KEY (id); + + +-- +-- Name: refresh_tokens refresh_tokens_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.refresh_tokens + ADD CONSTRAINT refresh_tokens_pkey PRIMARY KEY (id); + + +-- +-- Name: role_permissions role_permissions_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.role_permissions + ADD CONSTRAINT role_permissions_pkey PRIMARY KEY (role_id, permission_id); + + +-- +-- Name: roles roles_name_key; Type: CONSTRAINT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.roles + ADD CONSTRAINT roles_name_key UNIQUE (name); + + +-- +-- Name: roles roles_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.roles + ADD CONSTRAINT roles_pkey PRIMARY KEY (id); + + +-- +-- Name: rooms rooms_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.rooms + ADD CONSTRAINT rooms_pkey PRIMARY KEY (id); + + +-- +-- Name: schema_migrations schema_migrations_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.schema_migrations + ADD CONSTRAINT schema_migrations_pkey PRIMARY KEY (version); + + +-- +-- Name: track_comments track_comments_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.track_comments + ADD CONSTRAINT track_comments_pkey PRIMARY KEY (id); + + +-- +-- Name: track_history track_history_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.track_history + ADD CONSTRAINT track_history_pkey PRIMARY KEY (id); + + +-- +-- Name: track_likes track_likes_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.track_likes + ADD CONSTRAINT track_likes_pkey PRIMARY KEY (id); + + +-- +-- Name: track_plays track_plays_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.track_plays + ADD CONSTRAINT track_plays_pkey PRIMARY KEY (id); + + +-- +-- Name: track_shares track_shares_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.track_shares + ADD CONSTRAINT track_shares_pkey PRIMARY KEY (id); + + +-- +-- Name: track_shares track_shares_share_token_key; Type: CONSTRAINT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.track_shares + ADD CONSTRAINT track_shares_share_token_key UNIQUE (share_token); + + +-- +-- Name: track_versions track_versions_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.track_versions + ADD CONSTRAINT track_versions_pkey PRIMARY KEY (id); + + +-- +-- Name: tracks tracks_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.tracks + ADD CONSTRAINT tracks_pkey PRIMARY KEY (id); + + +-- +-- Name: user_roles user_roles_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.user_roles + ADD CONSTRAINT user_roles_pkey PRIMARY KEY (id); + + +-- +-- Name: user_sessions user_sessions_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.user_sessions + ADD CONSTRAINT user_sessions_pkey PRIMARY KEY (id); + + +-- +-- Name: users users_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.users + ADD CONSTRAINT users_pkey PRIMARY KEY (id); + + +-- +-- Name: idx_bitrate_adaptation_created_at; Type: INDEX; Schema: public; Owner: postgres +-- + +CREATE INDEX idx_bitrate_adaptation_created_at ON public.bitrate_adaptation_logs USING btree (created_at); + + +-- +-- Name: idx_email_verification_tokens_expires_at; Type: INDEX; Schema: public; Owner: postgres +-- + +CREATE INDEX idx_email_verification_tokens_expires_at ON public.email_verification_tokens USING btree (expires_at); + + +-- +-- Name: idx_email_verification_tokens_token; Type: INDEX; Schema: public; Owner: postgres +-- + +CREATE INDEX idx_email_verification_tokens_token ON public.email_verification_tokens USING btree (token); + + +-- +-- Name: idx_federated_identities_provider_id; Type: INDEX; Schema: public; Owner: postgres +-- + +CREATE INDEX idx_federated_identities_provider_id ON public.federated_identities USING btree (provider, provider_id); + + +-- +-- Name: idx_federated_identities_user_id; Type: INDEX; Schema: public; Owner: postgres +-- + +CREATE INDEX idx_federated_identities_user_id ON public.federated_identities USING btree (user_id); + + +-- +-- Name: idx_hls_streams_status; Type: INDEX; Schema: public; Owner: postgres +-- + +CREATE INDEX idx_hls_streams_status ON public.hls_streams USING btree (status); + + +-- +-- Name: idx_hls_transcode_queue_status; Type: INDEX; Schema: public; Owner: postgres +-- + +CREATE INDEX idx_hls_transcode_queue_status ON public.hls_transcode_queue USING btree (status, priority DESC); + + +-- +-- Name: idx_password_reset_tokens_expires_at; Type: INDEX; Schema: public; Owner: postgres +-- + +CREATE INDEX idx_password_reset_tokens_expires_at ON public.password_reset_tokens USING btree (expires_at); + + +-- +-- Name: idx_password_reset_tokens_token; Type: INDEX; Schema: public; Owner: postgres +-- + +CREATE INDEX idx_password_reset_tokens_token ON public.password_reset_tokens USING btree (token); + + +-- +-- Name: idx_playback_analytics_completion; Type: INDEX; Schema: public; Owner: postgres +-- + +CREATE INDEX idx_playback_analytics_completion ON public.playback_analytics USING btree (completion_rate); + + +-- +-- Name: idx_playback_analytics_created_at; Type: INDEX; Schema: public; Owner: postgres +-- + +CREATE INDEX idx_playback_analytics_created_at ON public.playback_analytics USING btree (created_at); + + +-- +-- Name: idx_playlist_collaborators_deleted_at; Type: INDEX; Schema: public; Owner: postgres +-- + +CREATE INDEX idx_playlist_collaborators_deleted_at ON public.playlist_collaborators USING btree (deleted_at); + + +-- +-- Name: idx_playlist_collaborators_user_id; Type: INDEX; Schema: public; Owner: postgres +-- + +CREATE INDEX idx_playlist_collaborators_user_id ON public.playlist_collaborators USING btree (user_id); + + +-- +-- Name: idx_playlist_follows_deleted_at; Type: INDEX; Schema: public; Owner: postgres +-- + +CREATE INDEX idx_playlist_follows_deleted_at ON public.playlist_follows USING btree (deleted_at); + + +-- +-- Name: idx_playlist_follows_user_id; Type: INDEX; Schema: public; Owner: postgres +-- + +CREATE INDEX idx_playlist_follows_user_id ON public.playlist_follows USING btree (user_id); + + +-- +-- Name: idx_playlists_deleted_at; Type: INDEX; Schema: public; Owner: postgres +-- + +CREATE INDEX idx_playlists_deleted_at ON public.playlists USING btree (deleted_at); + + +-- +-- Name: idx_playlists_follower_count; Type: INDEX; Schema: public; Owner: postgres +-- + +CREATE INDEX idx_playlists_follower_count ON public.playlists USING btree (follower_count); + + +-- +-- Name: idx_playlists_user_id; Type: INDEX; Schema: public; Owner: postgres +-- + +CREATE INDEX idx_playlists_user_id ON public.playlists USING btree (user_id); + + +-- +-- Name: idx_refresh_tokens_deleted_at; Type: INDEX; Schema: public; Owner: postgres +-- + +CREATE INDEX idx_refresh_tokens_deleted_at ON public.refresh_tokens USING btree (deleted_at); + + +-- +-- Name: idx_refresh_tokens_expires_at; Type: INDEX; Schema: public; Owner: postgres +-- + +CREATE INDEX idx_refresh_tokens_expires_at ON public.refresh_tokens USING btree (expires_at) WHERE (deleted_at IS NULL); + + +-- +-- Name: idx_refresh_tokens_token_hash; Type: INDEX; Schema: public; Owner: postgres +-- + +CREATE INDEX idx_refresh_tokens_token_hash ON public.refresh_tokens USING btree (token_hash); + + +-- +-- Name: idx_refresh_tokens_user_id; Type: INDEX; Schema: public; Owner: postgres +-- + +CREATE INDEX idx_refresh_tokens_user_id ON public.refresh_tokens USING btree (user_id); + + +-- +-- Name: idx_role_permissions_permission_id; Type: INDEX; Schema: public; Owner: postgres +-- + +CREATE INDEX idx_role_permissions_permission_id ON public.role_permissions USING btree (permission_id); + + +-- +-- Name: idx_role_permissions_role_id; Type: INDEX; Schema: public; Owner: postgres +-- + +CREATE INDEX idx_role_permissions_role_id ON public.role_permissions USING btree (role_id); + + +-- +-- Name: idx_rooms_created_at; Type: INDEX; Schema: public; Owner: postgres +-- + +CREATE INDEX idx_rooms_created_at ON public.rooms USING btree (created_at DESC); + + +-- +-- Name: idx_rooms_deleted_at; Type: INDEX; Schema: public; Owner: postgres +-- + +CREATE INDEX idx_rooms_deleted_at ON public.rooms USING btree (deleted_at); + + +-- +-- Name: idx_rooms_is_active; Type: INDEX; Schema: public; Owner: postgres +-- + +CREATE INDEX idx_rooms_is_active ON public.rooms USING btree (is_active) WHERE (deleted_at IS NULL); + + +-- +-- Name: idx_rooms_room_type; Type: INDEX; Schema: public; Owner: postgres +-- + +CREATE INDEX idx_rooms_room_type ON public.rooms USING btree (room_type); + + +-- +-- Name: idx_track_comments_created_at; Type: INDEX; Schema: public; Owner: postgres +-- + +CREATE INDEX idx_track_comments_created_at ON public.track_comments USING btree (created_at DESC); + + +-- +-- Name: idx_track_comments_parent_id; Type: INDEX; Schema: public; Owner: postgres +-- + +CREATE INDEX idx_track_comments_parent_id ON public.track_comments USING btree (parent_id); + + +-- +-- Name: idx_track_comments_user_id; Type: INDEX; Schema: public; Owner: postgres +-- + +CREATE INDEX idx_track_comments_user_id ON public.track_comments USING btree (user_id); + + +-- +-- Name: idx_track_history_action; Type: INDEX; Schema: public; Owner: postgres +-- + +CREATE INDEX idx_track_history_action ON public.track_history USING btree (action); + + +-- +-- Name: idx_track_history_created_at; Type: INDEX; Schema: public; Owner: postgres +-- + +CREATE INDEX idx_track_history_created_at ON public.track_history USING btree (created_at DESC); + + +-- +-- Name: idx_track_likes_user_id; Type: INDEX; Schema: public; Owner: postgres +-- + +CREATE INDEX idx_track_likes_user_id ON public.track_likes USING btree (user_id); + + +-- +-- Name: idx_track_plays_deleted_at; Type: INDEX; Schema: public; Owner: postgres +-- + +CREATE INDEX idx_track_plays_deleted_at ON public.track_plays USING btree (deleted_at); + + +-- +-- Name: idx_track_plays_played_at; Type: INDEX; Schema: public; Owner: postgres +-- + +CREATE INDEX idx_track_plays_played_at ON public.track_plays USING btree (played_at DESC); + + +-- +-- Name: idx_track_shares_deleted_at; Type: INDEX; Schema: public; Owner: postgres +-- + +CREATE INDEX idx_track_shares_deleted_at ON public.track_shares USING btree (deleted_at); + + +-- +-- Name: idx_track_shares_share_token; Type: INDEX; Schema: public; Owner: postgres +-- + +CREATE INDEX idx_track_shares_share_token ON public.track_shares USING btree (share_token); + + +-- +-- Name: idx_track_shares_user_id; Type: INDEX; Schema: public; Owner: postgres +-- + +CREATE INDEX idx_track_shares_user_id ON public.track_shares USING btree (user_id); + + +-- +-- Name: idx_track_versions_created_at; Type: INDEX; Schema: public; Owner: postgres +-- + +CREATE INDEX idx_track_versions_created_at ON public.track_versions USING btree (created_at DESC); + + +-- +-- Name: idx_track_versions_deleted_at; Type: INDEX; Schema: public; Owner: postgres +-- + +CREATE INDEX idx_track_versions_deleted_at ON public.track_versions USING btree (deleted_at); + + +-- +-- Name: idx_tracks_created_at; Type: INDEX; Schema: public; Owner: postgres +-- + +CREATE INDEX idx_tracks_created_at ON public.tracks USING btree (created_at); + + +-- +-- Name: idx_tracks_is_public; Type: INDEX; Schema: public; Owner: postgres +-- + +CREATE INDEX idx_tracks_is_public ON public.tracks USING btree (is_public); + + +-- +-- Name: idx_tracks_status; Type: INDEX; Schema: public; Owner: postgres +-- + +CREATE INDEX idx_tracks_status ON public.tracks USING btree (status); + + +-- +-- Name: idx_tracks_user_id; Type: INDEX; Schema: public; Owner: postgres +-- + +CREATE INDEX idx_tracks_user_id ON public.tracks USING btree (user_id); + + +-- +-- Name: idx_user_roles_role_id; Type: INDEX; Schema: public; Owner: postgres +-- + +CREATE INDEX idx_user_roles_role_id ON public.user_roles USING btree (role_id); + + +-- +-- Name: idx_user_roles_user_id; Type: INDEX; Schema: public; Owner: postgres +-- + +CREATE INDEX idx_user_roles_user_id ON public.user_roles USING btree (user_id); + + +-- +-- Name: idx_user_sessions_expires_at; Type: INDEX; Schema: public; Owner: postgres +-- + +CREATE INDEX idx_user_sessions_expires_at ON public.user_sessions USING btree (expires_at); + + +-- +-- Name: idx_user_sessions_is_active; Type: INDEX; Schema: public; Owner: postgres +-- + +CREATE INDEX idx_user_sessions_is_active ON public.user_sessions USING btree (is_active) WHERE (is_active = true); + + +-- +-- Name: idx_user_sessions_last_activity; Type: INDEX; Schema: public; Owner: postgres +-- + +CREATE INDEX idx_user_sessions_last_activity ON public.user_sessions USING btree (last_activity DESC); + + +-- +-- Name: idx_user_sessions_token; Type: INDEX; Schema: public; Owner: postgres +-- + +CREATE UNIQUE INDEX idx_user_sessions_token ON public.user_sessions USING btree (session_token); + + +-- +-- Name: idx_users_created_at; Type: INDEX; Schema: public; Owner: postgres +-- + +CREATE INDEX idx_users_created_at ON public.users USING btree (created_at DESC); + + +-- +-- Name: idx_users_deleted_at; Type: INDEX; Schema: public; Owner: postgres +-- + +CREATE INDEX idx_users_deleted_at ON public.users USING btree (deleted_at); + + +-- +-- Name: idx_users_email; Type: INDEX; Schema: public; Owner: postgres +-- + +CREATE UNIQUE INDEX idx_users_email ON public.users USING btree (email) WHERE (deleted_at IS NULL); + + +-- +-- Name: idx_users_is_active; Type: INDEX; Schema: public; Owner: postgres +-- + +CREATE INDEX idx_users_is_active ON public.users USING btree (is_active) WHERE (deleted_at IS NULL); + + +-- +-- Name: idx_users_is_public; Type: INDEX; Schema: public; Owner: postgres +-- + +CREATE INDEX idx_users_is_public ON public.users USING btree (is_public); + + +-- +-- Name: idx_users_slug; Type: INDEX; Schema: public; Owner: postgres +-- + +CREATE UNIQUE INDEX idx_users_slug ON public.users USING btree (slug) WHERE (deleted_at IS NULL); + + +-- +-- Name: idx_users_username; Type: INDEX; Schema: public; Owner: postgres +-- + +CREATE UNIQUE INDEX idx_users_username ON public.users USING btree (username) WHERE (deleted_at IS NULL); + + +-- +-- Name: federated_identities federated_identities_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.federated_identities + ADD CONSTRAINT federated_identities_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id) ON DELETE CASCADE; + + +-- +-- Name: bitrate_adaptation_logs fk_bitrate_adaptation_logs_track; Type: FK CONSTRAINT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.bitrate_adaptation_logs + ADD CONSTRAINT fk_bitrate_adaptation_logs_track FOREIGN KEY (track_id) REFERENCES public.tracks(id) ON DELETE CASCADE; + + +-- +-- Name: bitrate_adaptation_logs fk_bitrate_adaptation_logs_users; Type: FK CONSTRAINT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.bitrate_adaptation_logs + ADD CONSTRAINT fk_bitrate_adaptation_logs_users FOREIGN KEY (user_id) REFERENCES public.users(id) ON DELETE CASCADE; + + +-- +-- Name: email_verification_tokens fk_email_verification_tokens_users; Type: FK CONSTRAINT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.email_verification_tokens + ADD CONSTRAINT fk_email_verification_tokens_users FOREIGN KEY (user_id) REFERENCES public.users(id) ON DELETE CASCADE; + + +-- +-- Name: hls_streams fk_hls_streams_track; Type: FK CONSTRAINT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.hls_streams + ADD CONSTRAINT fk_hls_streams_track FOREIGN KEY (track_id) REFERENCES public.tracks(id) ON DELETE CASCADE; + + +-- +-- Name: hls_transcode_queue fk_hls_transcode_queue_track; Type: FK CONSTRAINT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.hls_transcode_queue + ADD CONSTRAINT fk_hls_transcode_queue_track FOREIGN KEY (track_id) REFERENCES public.tracks(id) ON DELETE CASCADE; + + +-- +-- Name: password_reset_tokens fk_password_reset_tokens_users; Type: FK CONSTRAINT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.password_reset_tokens + ADD CONSTRAINT fk_password_reset_tokens_users FOREIGN KEY (user_id) REFERENCES public.users(id) ON DELETE CASCADE; + + +-- +-- Name: playback_analytics fk_playback_analytics_track; Type: FK CONSTRAINT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.playback_analytics + ADD CONSTRAINT fk_playback_analytics_track FOREIGN KEY (track_id) REFERENCES public.tracks(id) ON DELETE CASCADE; + + +-- +-- Name: playback_analytics fk_playback_analytics_users; Type: FK CONSTRAINT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.playback_analytics + ADD CONSTRAINT fk_playback_analytics_users FOREIGN KEY (user_id) REFERENCES public.users(id) ON DELETE CASCADE; + + +-- +-- Name: playlist_collaborators fk_playlist_collaborators_playlist; Type: FK CONSTRAINT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.playlist_collaborators + ADD CONSTRAINT fk_playlist_collaborators_playlist FOREIGN KEY (playlist_id) REFERENCES public.playlists(id) ON DELETE CASCADE; + + +-- +-- Name: playlist_follows fk_playlist_follows_playlist; Type: FK CONSTRAINT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.playlist_follows + ADD CONSTRAINT fk_playlist_follows_playlist FOREIGN KEY (playlist_id) REFERENCES public.playlists(id) ON DELETE CASCADE; + + +-- +-- Name: playlist_tracks fk_playlist_tracks_playlist; Type: FK CONSTRAINT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.playlist_tracks + ADD CONSTRAINT fk_playlist_tracks_playlist FOREIGN KEY (playlist_id) REFERENCES public.playlists(id) ON DELETE CASCADE; + + +-- +-- Name: playlist_tracks fk_playlist_tracks_track; Type: FK CONSTRAINT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.playlist_tracks + ADD CONSTRAINT fk_playlist_tracks_track FOREIGN KEY (track_id) REFERENCES public.tracks(id) ON DELETE CASCADE; + + +-- +-- Name: playlists fk_playlists_users; Type: FK CONSTRAINT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.playlists + ADD CONSTRAINT fk_playlists_users FOREIGN KEY (user_id) REFERENCES public.users(id) ON DELETE CASCADE; + + +-- +-- Name: track_comments fk_track_comments_track; Type: FK CONSTRAINT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.track_comments + ADD CONSTRAINT fk_track_comments_track FOREIGN KEY (track_id) REFERENCES public.tracks(id) ON DELETE CASCADE; + + +-- +-- Name: track_history fk_track_history_track; Type: FK CONSTRAINT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.track_history + ADD CONSTRAINT fk_track_history_track FOREIGN KEY (track_id) REFERENCES public.tracks(id) ON DELETE CASCADE; + + +-- +-- Name: track_history fk_track_history_users; Type: FK CONSTRAINT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.track_history + ADD CONSTRAINT fk_track_history_users FOREIGN KEY (user_id) REFERENCES public.users(id) ON DELETE CASCADE; + + +-- +-- Name: track_likes fk_track_likes_track; Type: FK CONSTRAINT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.track_likes + ADD CONSTRAINT fk_track_likes_track FOREIGN KEY (track_id) REFERENCES public.tracks(id) ON DELETE CASCADE; + + +-- +-- Name: track_plays fk_track_plays_track; Type: FK CONSTRAINT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.track_plays + ADD CONSTRAINT fk_track_plays_track FOREIGN KEY (track_id) REFERENCES public.tracks(id) ON DELETE CASCADE; + + +-- +-- Name: track_plays fk_track_plays_users; Type: FK CONSTRAINT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.track_plays + ADD CONSTRAINT fk_track_plays_users FOREIGN KEY (user_id) REFERENCES public.users(id) ON DELETE CASCADE; + + +-- +-- Name: track_shares fk_track_shares_track; Type: FK CONSTRAINT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.track_shares + ADD CONSTRAINT fk_track_shares_track FOREIGN KEY (track_id) REFERENCES public.tracks(id) ON DELETE CASCADE; + + +-- +-- Name: track_versions fk_track_versions_track; Type: FK CONSTRAINT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.track_versions + ADD CONSTRAINT fk_track_versions_track FOREIGN KEY (track_id) REFERENCES public.tracks(id) ON DELETE CASCADE; + + +-- +-- Name: tracks fk_tracks_users; Type: FK CONSTRAINT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.tracks + ADD CONSTRAINT fk_tracks_users FOREIGN KEY (user_id) REFERENCES public.users(id) ON DELETE CASCADE; + + +-- +-- Name: user_roles fk_user_roles_users; Type: FK CONSTRAINT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.user_roles + ADD CONSTRAINT fk_user_roles_users FOREIGN KEY (user_id) REFERENCES public.users(id) ON DELETE CASCADE; + + +-- +-- Name: user_sessions fk_user_sessions_users; Type: FK CONSTRAINT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.user_sessions + ADD CONSTRAINT fk_user_sessions_users FOREIGN KEY (user_id) REFERENCES public.users(id) ON DELETE CASCADE; + + +-- +-- Name: role_permissions role_permissions_permission_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.role_permissions + ADD CONSTRAINT role_permissions_permission_id_fkey FOREIGN KEY (permission_id) REFERENCES public.permissions(id) ON DELETE CASCADE; + + +-- +-- Name: role_permissions role_permissions_role_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.role_permissions + ADD CONSTRAINT role_permissions_role_id_fkey FOREIGN KEY (role_id) REFERENCES public.roles(id) ON DELETE CASCADE; + + +-- +-- Name: rooms rooms_creator_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.rooms + ADD CONSTRAINT rooms_creator_id_fkey FOREIGN KEY (creator_id) REFERENCES public.users(id) ON DELETE CASCADE; + + +-- +-- Name: rooms rooms_owner_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.rooms + ADD CONSTRAINT rooms_owner_id_fkey FOREIGN KEY (owner_id) REFERENCES public.users(id) ON DELETE CASCADE; + + +-- +-- Name: track_comments track_comments_parent_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.track_comments + ADD CONSTRAINT track_comments_parent_id_fkey FOREIGN KEY (parent_id) REFERENCES public.track_comments(id) ON DELETE CASCADE; + + +-- +-- Name: user_roles user_roles_assigned_by_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.user_roles + ADD CONSTRAINT user_roles_assigned_by_fkey FOREIGN KEY (assigned_by) REFERENCES public.users(id) ON DELETE SET NULL; + + +-- +-- Name: user_roles user_roles_role_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.user_roles + ADD CONSTRAINT user_roles_role_id_fkey FOREIGN KEY (role_id) REFERENCES public.roles(id) ON DELETE CASCADE; + + +-- +-- PostgreSQL database dump complete +-- +