Add note about pg_stats to pg_statistic entry; add sections for
authorTom Lane
Mon, 15 Oct 2001 22:47:47 +0000 (22:47 +0000)
committerTom Lane
Mon, 15 Oct 2001 22:47:47 +0000 (22:47 +0000)
pg_largeobject, pg_listener, pg_rewrite, pg_trigger; miscellaneous
small improvements.

doc/src/sgml/catalogs.sgml

index 0b9c10d3bb06e5dd9f1993c5a49089434d43c729..b5e7fffe8edfb9a01c2ad3b6d2fb2ff9cd8faf99 100644 (file)
@@ -1,6 +1,6 @@
 
 
 
@@ -63,7 +63,7 @@
 
      
       pg_attribute
-      table columns (attributes, fields)
+      table columns (attributesfields)
      
 
      
@@ -73,7 +73,7 @@
 
      
       pg_database
-      databases
+      databases within this database cluster
      
 
      
@@ -83,7 +83,7 @@
 
      
       pg_group
-      user groups
+      groups of database users
      
 
      
   
    More detailed documentation of most catalogs follow below.  The
    catalogs that relate to index access methods are explained in the
-   Programmer's Guide.  Some catalogs don't
-   have any documentation, yet.
+   Programmer's Guide.
   
 
  
      
       aggtransfn
       regproc (function)
-      
+      pg_proc.oid
       Transition function
      
      
       aggfinalfn
       regproc (function)
-      
+      pg_proc.oid
       Final function
      
      
       
       
        Always -1 in storage, but when loaded into a tuple descriptor
-       in memory this may be updated cache the offset of the attribute
+       in memory this may be updated to cache the offset of the attribute
        within the tuple.
       
      
       bool
       
       True if this table is shared across all databases in the
-      cluster.
+      cluster.  Only certain system catalogs (such as
+      pg_database) are shared.
      
 
      
       relhasrules
       bool
       
-      Table has rules
+      Table has rules; see
+       pg_rewrite catalog
+      
      
 
      
 
   
    The pg_database catalog stores information
-   about the available databases.  The
-   pg_database table is shared between all
-   databases of a cluster.  Databases are created with the
-   CREATE DATABASE.  Consult the
+   about the available databases.  Databases are created with the
+   CREATE DATABASE command.  Consult the
    Administrator's Guide for details about the
    meaning of some of the parameters.
   
 
+  
+   Unlike most system catalogs, pg_database
+   is shared across all databases of a cluster: there is only one
+   copy of pg_database per cluster, not
+   one per database.
+  
+
   
    pg_database Columns
 
    Guide for information about user permission management.
   
 
+  
+   Because user and group identities are cluster-wide,
+   pg_group
+   is shared across all databases of a cluster: there is only one
+   copy of pg_group per cluster, not
+   one per database.
+  
+
   
    pg_group Columns
 
 
      
       indproc
-      oid
+      regproc
       pg_proc.oid
       The registered procedure if this is a functional index
      
       indisprimary
       bool
       
-      If true, this index is a unique index that represents the primary key of the table.
+      If true, this index represents the primary key of the table.
+      (indisunique should always be true when this is true.)
      
 
      
       oid
       pg_class.oid
       
-       This is the reference to the parent table, from which the table
+       This is the reference to the parent table, which the table
        referenced by inhrelid inherited
        from.
       
       int4
       
       
-       If there is more than one subtable/parent pair (multiple
+       If there is more than one parent for a subtable (multiple
        inheritance), this number tells the order in which the
        inherited columns are to be arranged.  The count starts at 1.
       
  
 
 
+  pg_largeobject
+
+  
+   pg_largeobject holds the data making up
+   large objects.  A large object is identified by an
+   OID assigned when it is created.  Each large object is broken into
+   segments or pages small enough to be conveniently stored as rows
+   in pg_largeobject.
+   The amount of data per page is defined to be LOBLKSIZE (which is currently
+   BLCKSZ/4, or typically 2Kbytes).
+  
+
+  
+   pg_largeobject Columns
+
+   
+    
+     
+      Name
+      Type
+      References
+      Description
+     
+    
+
+    
+     
+      loid
+      oid
+      
+      Identifier of the large object that includes this page
+     
+
+     
+      pageno
+      int4
+      
+      Page number of this page within its large object
+      (counting from zero)
+     
+
+     
+      data
+      bytea
+      
+      
+       Actual data stored in the large object.
+       This will never be more than LOBLKSIZE bytes, and may be less.
+      
+     
+    
+   
+  
+
+  
+   Each row of pg_largeobject holds data
+   for one page of a large object, beginning at
+   byte offset (pageno * LOBLKSIZE) within the object.  The implementation
+   allows sparse storage: pages may be missing, and may be shorter than
+   LOBLKSIZE bytes even if they are not the last page of the object.
+   Missing regions within a large object read as zeroes.
+  
+
+
+
+  pg_listener
+
+  
+   pg_listener supports the LISTEN
+   and NOTIFY commands.  A listener creates an entry in
+   pg_listener for each notification name
+   it is listening for.  A notifier scans pg_listener
+   and updates each matching entry to show that a notification has occurred.
+   The notifier also sends a signal (using the PID recorded in the table)
+   to awaken the listener from sleep.
+  
+
+  
+   pg_listener Columns
+
+   
+    
+     
+      Name
+      Type
+      References
+      Description
+     
+    
+
+    
+     
+      relname
+      name
+      
+      Notify condition name.  (The name need not match any actual
+      relation in the database; the term relname is historical.)
+      
+     
+
+     
+      listenerpid
+      int4
+      
+      PID of the backend process that created this entry.
+     
+
+     
+      notification
+      int4
+      
+      
+       Zero if no event is pending for this listener.  If an event is
+       pending, the PID of the backend that sent the notification.
+      
+     
+    
+   
+  
+
+
+
  
   pg_operator
 
       proretset
       bool
       
-      Function returns a set (probably not functional)
+      Function returns a set (ie, multiple values of the specified
+      datatype)
      
 
      
        This tells the function handler how to invoke the function.  It
        might be the actual source code of the function for interpreted
        languages, a link symbol, a file name, or just about anything
-       else, depending the implementation language/call convention.
+       else, depending on the implementation language/call convention.
       
      
 
       probin
       bytea
       
-      ?
+      Additional information about how to invoke the function.
+      Again, the interpretation is language-specific.
+      
      
     
    
   
 
+  
+  Currently, prosrc contains the function's C-language name (link symbol)
+  for compiled functions, both built-in and dynamically loaded.  For all
+  other language types, prosrc contains the function's source text.
+  
+
+  
+  Currently, probin is unused except for dynamically-loaded C functions,
+  for which it gives the name of the shared library file containing the
+  function.
+  
+
  
 
 
       rcsrc
       text
       
-      A human-readable representation of the consraint expression
+      A human-readable representation of the constraint expression
      
     
    
  
 
 
+  pg_rewrite
+
+  
+   This system catalog stores rewrite rules for tables and views.
+  
+
+  
+   pg_rewrite Columns
+
+   
+    
+     
+      Name
+      Type
+      References
+      Description
+     
+    
+
+    
+     
+      rulename
+      name
+      
+      Rule name
+     
+
+     
+      ev_type
+      char
+      
+      Event type that the rule is for: '1' = SELECT,
+      '2' = UPDATE, '3' = INSERT, '4' = DELETE
+     
+
+     
+      ev_class
+      oid
+      pg_class.oid
+      The table this rule is for
+     
+
+     
+      ev_attr
+      int2
+      
+      The column this rule is for (currently, always zero to
+      indicate the whole table)
+     
+
+     
+      is_instead
+      bool
+      
+      True if the rule is an INSTEAD rule
+     
+
+     
+      ev_qual
+      text
+      
+      Expression tree (in the form of a nodeToString representation)
+      for the rule's qualifying condition
+     
+
+     
+      ev_action
+      text
+      
+      Query tree (in the form of a nodeToString representation)
+      for the rule's action
+     
+    
+   
+  
+
+  
+   
+    pg_class.relhasrules
+    must be true if a table has any rules in this catalog.
+   
+  
+
+
+
  
   pg_shadow
 
    pg_shadow contains information about
    database users.  The name stems from the fact that this table
    should not be readable by the public since it contains passwords.
-   pg_user is a view on
+   pg_user is a publicly readable view on
    pg_shadow that blanks out the password field.
   
 
    information about user and permission management.
   
 
+  
+   Because user identities are cluster-wide,
+   pg_shadow
+   is shared across all databases of a cluster: there is only one
+   copy of pg_shadow per cluster, not
+   one per database.
+  
+
   
    pg_shadow Columns
 
    src/include/catalog/pg_statistic.h.
   
 
+  
+   pg_statistic should not be readable by the
+   public, since even statistical information about a table's contents
+   may be considered sensitive.  (Example: minimum and maximum values
+   of a salary column might be quite interesting.)
+   pg_stats is a publicly readable view on
+   pg_statistic that only exposes information
+   about those tables that are readable by the current user.
+   pg_stats is also designed to present the
+   information in a more readable format than the underlying
+   pg_statistic table --- at the cost that
+   its schema must be extended whenever new slot types are added.
+  
+
   
    pg_statistic Columns
 
  
 
 
+  pg_trigger
+
+  
+   This system catalog stores triggers on tables.  See under
+   CREATE TRIGGER for more information.
+  
+
+  
+   pg_trigger Columns
+
+   
+    
+     
+      Name
+      Type
+      References
+      Description
+     
+    
+
+    
+     
+      tgrelid
+      oid
+      pg_class.oid
+      The table this trigger is on
+     
+
+     
+      tgname
+      name
+      
+      Trigger name (need not be unique)
+     
+
+     
+      tgfoid
+      oid
+      pg_proc.oid
+      The function to be called
+     
+
+     
+      tgtype
+      int2
+      
+      Bitmask identifying trigger conditions
+     
+
+     
+      tgenabled
+      bool
+      
+      True if trigger is enabled (not presently checked everywhere
+      it should be, so disabling a trigger by setting this false does not
+      work reliably)
+     
+
+     
+      tgisconstraint
+      bool
+      
+      True if trigger is a RI constraint
+     
+
+     
+      tgconstrname
+      name
+      
+      RI constraint name
+     
+
+     
+      tgconstrrelid
+      oid
+      pg_class.oid
+      The table referenced by an RI constraint
+     
+
+     
+      tgdeferrable
+      bool
+      
+      True if deferrable
+     
+
+     
+      tginitdeferred
+      bool
+      
+      True if initially deferred
+     
+
+     
+      tgnargs
+      int2
+      
+      Number of argument strings passed to trigger function
+     
+
+     
+      tgattr
+      int2vector
+      
+      Currently unused
+     
+
+     
+      tgargs
+      bytea
+      
+      Argument strings to pass to trigger, each null-terminated
+     
+    
+   
+  
+
+  
+   
+    pg_class.reltriggers
+    needs to match up with the entries in this table.
+   
+  
+
+
+
  
   pg_type
 
+  
+   This catalog stores information about datatypes.  Scalar types
+   (base types) are created with CREATE TYPE.
+   A complex type is also created for each table in the database, to
+   represent the row structure of the table.
+  
+
   
    pg_type Columns
 
       
       
        typtype is b for
-       a basic type and c for a catalog type (i.e.,
-       a table).  If typtype is
+       a base type and c for a complex type (i.e.,
+       a table's row type).  If typtype is
        ctyprelid is
        the OID of the type's entry in
        pg_class.
       typisdefined
       bool
       
-      ???
+      True if the type is defined, false if this is a placeholder
+      entry for a not-yet-defined type.  When typisdefined is false,
+      nothing except the type name and OID can be relied on.
+      
      
 
      
       oid
       pg_class.oid
       
-       If this is a catalog type (see
+       If this is a complex type (see
        typtype), then this field points to
        the pg_class entry that defines the
        corresponding table. A table could theoretically be used as a