Home Explore Blog CI



postgresql

19th chunk of `doc/src/sgml/ref/psql-ref.sgml`
e7c7eaa12fb73d0729f102109ebc7c832853886c5b8e8d330000000100000faa
 identifies a column whose values must be integer numbers, and the
        values from <replaceable class="parameter">colH</replaceable> will
        appear in the horizontal header sorted according to the
        corresponding <replaceable class="parameter">sortcolH</replaceable> values.
        </para>

        <para>
        Inside the crosstab grid, for each distinct value <literal>x</literal>
        of <replaceable class="parameter">colH</replaceable> and each distinct
        value <literal>y</literal>
        of <replaceable class="parameter">colV</replaceable>, the cell located
        at the intersection <literal>(x,y)</literal> contains the value of
        the <literal>colD</literal> column in the query result row for which
        the value of <replaceable class="parameter">colH</replaceable>
        is <literal>x</literal> and the value
        of <replaceable class="parameter">colV</replaceable>
        is <literal>y</literal>.  If there is no such row, the cell is empty.  If
        there are multiple such rows, an error is reported.
        </para>
        </listitem>
      </varlistentry>


      <varlistentry id="app-psql-meta-command-d">
        <term><literal>\d[Sx+] [ <link linkend="app-psql-patterns"><replaceable class="parameter">pattern</replaceable></link> ]</literal></term>

        <listitem>
        <para>
        For each relation (table, view, materialized view, index, sequence,
        or foreign table)
        or composite type matching the
        <replaceable class="parameter">pattern</replaceable>, show all
        columns, their types, the tablespace (if not the default) and any
        special attributes such as <literal>NOT NULL</literal> or defaults.
        Associated indexes, constraints, rules, and triggers are
        also shown.  For foreign tables, the associated foreign
        server is shown as well.
        (<quote>Matching the pattern</quote> is defined in
        <xref linkend="app-psql-patterns"/> below.)
        </para>

        <para>
        For some types of relation, <literal>\d</literal> shows additional information
        for each column: column values for sequences, indexed expressions for
        indexes, and foreign data wrapper options for foreign tables.
        </para>

        <para>
        The command form <literal>\d+</literal> is identical, except that
        more information is displayed: any comments associated with the
        columns of the table are shown, as is the presence of OIDs in the
        table, the view definition if the relation is a view, a non-default
        <link linkend="sql-altertable-replica-identity">replica
         identity</link> setting and the
        <link linkend="sql-create-access-method">access method</link> name
        if the relation has an access method.
        </para>

        <para>
        By default, only user-created objects are shown;  supply a
        pattern or the <literal>S</literal> modifier to include system
        objects.
        </para>

        <note>
        <para>
        If <command>\d</command> is used without a
        <replaceable class="parameter">pattern</replaceable> argument, it is
        equivalent to <command>\dtvmsE</command> which will show a list of
        all visible tables, views, materialized views, sequences and
        foreign tables.
        This is purely a convenience measure.
        </para>
        <para>
        As with many other commands, if <literal>x</literal> is appended to
        the command name, the results are displayed in expanded mode, but note
        that this only applies when <command>\d</command> is used without a
        <replaceable class="parameter">pattern</replaceable> argument, and
        the <literal>x</literal> modifier cannot appear immediately after the
        <command>\d</command> (because <command>\dx</command> is a different
        command); the <literal>x</literal> modifier may only appear after an
        <literal>S</literal> or <literal>+</literal>

Title: psql Meta-Commands: \crosstabview (Continued), \d
Summary
This section continues the \crosstabview meta-command explanation, detailing how data from the query result populates the crosstab grid. It defines how values from colH and colV determine the cell's location and how the colD value fills the cell. If multiple rows match the cell's coordinates, an error is reported. Then, the section describes the \d meta-command. It shows details for relations (tables, views, etc.) matching a given pattern, including columns, types, tablespace, and attributes. \d+ shows more information like comments, OIDs, replica identity, and access method. The S modifier includes system objects. Without a pattern, \d is equivalent to \dtvmsE, showing visible tables, views, sequences, and foreign tables. Appending 'x' to \d (without a pattern) displays results in expanded mode.