↑↓ select ↵ open ⌫ change scope Open full search

PG.CENTER connects PostgreSQL documentation, reference, and ecosystem knowledge. Maintained by Pigsty.

Functions / System Information Functions And Operators

pg_get_viewdef

Read the PG 18 manual

Reconstructs the underlying SELECT command for a view or materialized view.

Reading PG 18current·documented in 26 of 27 versions, 7.2 to 20

Signatures & examples

pg_get_viewdef ( view oid [, pretty boolean ] ) → text
Reconstructs the underlying SELECT command for a view or materialized view. (This is a decompiled reconstruction, not the original text of the command.)
pg_get_viewdef ( view oid, wrap_column integer ) → text
Reconstructs the underlying SELECT command for a view or materialized view. (This is a decompiled reconstruction, not the original text of the command.) In this form of the function, pretty-printing is always enabled, and long lines are wrapped to try to keep them shorter than the specified number of columns.
pg_get_viewdef ( view text [, pretty boolean ] ) → text
Reconstructs the underlying SELECT command for a view or materialized view, working from a textual name for the view rather than its OID. (This is deprecated; use the OID variant instead.)
Version history 8
  1. 12 → 13 changed
  2. 9.2 → 9.3 changed
  3. 9.1 → 9.2 changed
  4. 8.0 → 8.1 changed
  5. 7.4 → 8.0 changed
  6. 7.3 → 7.4 changed
  7. 7.2 → 7.3 changed
  8. 7.1 → 7.2 added

Definition snapshot: b7bd9cda · English manual source