Home Explore Blog CI



postgresql

10th chunk of `doc/src/sgml/system-views.sgml`
8950919c41cd8741cc4d8a9689ac735bf8e9273a42e371790000000100000fad
 SELECT * FROM pg_backend_memory_contexts
)
SELECT sum(c1.total_bytes)
FROM memory_contexts c1, memory_contexts c2
WHERE c2.name = 'CacheMemoryContext'
AND c1.path[c2.level] = c2.path[c2.level];
</programlisting>

   The <link linkend="queries-with">Common Table Expression</link> is used
   to ensure the context IDs in the <structfield>path</structfield> column
   match between both evaluations of the view.
  </para>
 </sect1>

 <sect1 id="view-pg-config">
  <title><structname>pg_config</structname></title>

  <indexterm zone="view-pg-config">
   <primary>pg_config</primary>
  </indexterm>

  <para>
   The view <structname>pg_config</structname> describes the
   compile-time configuration parameters of the currently installed
   version of <productname>PostgreSQL</productname>. It is intended, for example, to
   be used by software packages that want to interface to
   <productname>PostgreSQL</productname> to facilitate finding the required header
   files and libraries. It provides the same basic information as the
   <xref linkend="app-pgconfig"/> <productname>PostgreSQL</productname> client
   application.
  </para>

  <para>
   By default, the <structname>pg_config</structname> view can be read
   only by superusers.
  </para>

  <table>
   <title><structname>pg_config</structname> Columns</title>
   <tgroup cols="1">
    <thead>
     <row>
      <entry role="catalog_table_entry"><para role="column_definition">
       Column Type
      </para>
      <para>
       Description
      </para></entry>
     </row>
    </thead>

    <tbody>
     <row>
      <entry role="catalog_table_entry"><para role="column_definition">
       <structfield>name</structfield> <type>text</type>
      </para>
      <para>
       The parameter name
      </para></entry>
     </row>

     <row>
      <entry role="catalog_table_entry"><para role="column_definition">
       <structfield>setting</structfield> <type>text</type>
      </para>
      <para>
       The parameter value
      </para></entry>
     </row>
    </tbody>
   </tgroup>
  </table>

 </sect1>

 <sect1 id="view-pg-cursors">
  <title><structname>pg_cursors</structname></title>

  <indexterm zone="view-pg-cursors">
   <primary>pg_cursors</primary>
  </indexterm>

  <para>
   The <structname>pg_cursors</structname> view lists the cursors that
   are currently available. Cursors can be defined in several ways:
   <itemizedlist>
    <listitem>
     <para>
      via the <link linkend="sql-declare"><command>DECLARE</command></link>
      statement in SQL
     </para>
    </listitem>

    <listitem>
     <para>
      via the Bind message in the frontend/backend protocol, as
      described in <xref linkend="protocol-flow-ext-query"/>
     </para>
    </listitem>

    <listitem>
     <para>
      via the Server Programming Interface (SPI), as described in
      <xref linkend="spi-interface"/>
     </para>
    </listitem>
   </itemizedlist>

   The <structname>pg_cursors</structname> view displays cursors
   created by any of these means. Cursors only exist for the duration
   of the transaction that defines them, unless they have been
   declared <literal>WITH HOLD</literal>. Therefore non-holdable
   cursors are only present in the view until the end of their
   creating transaction.

   <note>
    <para>
     Cursors are used internally to implement some of the components
     of <productname>PostgreSQL</productname>, such as procedural languages.
     Therefore, the <structname>pg_cursors</structname> view might include cursors
     that have not been explicitly created by the user.
    </para>
   </note>
  </para>

  <table>
   <title><structname>pg_cursors</structname> Columns</title>
   <tgroup cols="1">
    <thead>
     <row>
      <entry role="catalog_table_entry"><para role="column_definition">
       Column Type
      </para>
      <para>
       Description
      </para></entry>
     </row>
    </thead>

    <tbody>
     <row>
      <entry role="catalog_table_entry"><para role="column_definition">

Title: PostgreSQL System Views: pg_config and pg_cursors
Summary
This section describes two PostgreSQL system views: pg_config and pg_cursors. The pg_config view provides information about the compile-time configuration parameters of the currently installed PostgreSQL version, and can be read only by superusers. The pg_cursors view lists the cursors that are currently available, including those created via SQL, the frontend/backend protocol, or the Server Programming Interface (SPI). The view displays cursors created by any of these means, but non-holdable cursors are only present until the end of their creating transaction.