pg_options_to_table()
A function which returns storage options as a set of rows
pg_options_to_table()
is a system function which returns storage parameters as a set of rows.
pg_options_to_table()
was added in PostgreSQL 8.4.
Usage
pg_options_to_table()
is a convenience function for extracting configuration parameter values stored as an array in various system catalog tables e.g.:
pg_attribute
:attoptions
pg_class
:reloptions
pg_db_role_setting
:setconfig
pg_foreign_server
:srvoptions
pg_user_mapping
:umoptions
Source code
pg_options_to_table()
is defined in src/backend/foreign/foreign.c.
Note that it was initially added as part of the foreign data wrapper implementation, but is not specific to FDW support.
Change history
- PostgreSQL 8.4
- added (commit cae565e5)
Examples
List storage parameters for a table:
postgres=# SELECT option_name, option_value FROM pg_class c, pg_options_to_table(c.reloptions) WHERE c.oid = 'foo'::REGCLASS; option_name | option_value -----------------------------+-------------- log_autovacuum_min_duration | 50 fillfactor | 75 (2 rows)
References
- PostgreSQL documentation: System Catalog Information Functions