1. 10 2月, 2011 2 次提交
  2. 09 2月, 2011 5 次提交
  3. 08 2月, 2011 3 次提交
    • S
      Extend ALTER TABLE to allow Foreign Keys to be added without initial validation. · 722bf701
      Simon Riggs 提交于
      FK constraints that are marked NOT VALID may later be VALIDATED, which uses an
      ShareUpdateExclusiveLock on constraint table and RowShareLock on referenced
      table. Significantly reduces lock strength and duration when adding FKs.
      New state visible from psql.
      
      Simon Riggs, with reviews from Marko Tiikkaja and Robert Haas
      722bf701
    • H
      Oops, forgot to bump catversion in the Serializable Snapshot Isolation patch. · 47082fa8
      Heikki Linnakangas 提交于
      I thought we didn't need that, but then I remembered that it added a new
      SLRU subdirectory, pg_serial. While we're at it, document what pg_serial is.
      47082fa8
    • H
      Implement genuine serializable isolation level. · dafaa3ef
      Heikki Linnakangas 提交于
      Until now, our Serializable mode has in fact been what's called Snapshot
      Isolation, which allows some anomalies that could not occur in any
      serialized ordering of the transactions. This patch fixes that using a
      method called Serializable Snapshot Isolation, based on research papers by
      Michael J. Cahill (see README-SSI for full references). In Serializable
      Snapshot Isolation, transactions run like they do in Snapshot Isolation,
      but a predicate lock manager observes the reads and writes performed and
      aborts transactions if it detects that an anomaly might occur. This method
      produces some false positives, ie. it sometimes aborts transactions even
      though there is no anomaly.
      
      To track reads we implement predicate locking, see storage/lmgr/predicate.c.
      Whenever a tuple is read, a predicate lock is acquired on the tuple. Shared
      memory is finite, so when a transaction takes many tuple-level locks on a
      page, the locks are promoted to a single page-level lock, and further to a
      single relation level lock if necessary. To lock key values with no matching
      tuple, a sequential scan always takes a relation-level lock, and an index
      scan acquires a page-level lock that covers the search key, whether or not
      there are any matching keys at the moment.
      
      A predicate lock doesn't conflict with any regular locks or with another
      predicate locks in the normal sense. They're only used by the predicate lock
      manager to detect the danger of anomalies. Only serializable transactions
      participate in predicate locking, so there should be no extra overhead for
      for other transactions.
      
      Predicate locks can't be released at commit, but must be remembered until
      all the transactions that overlapped with it have completed. That means that
      we need to remember an unbounded amount of predicate locks, so we apply a
      lossy but conservative method of tracking locks for committed transactions.
      If we run short of shared memory, we overflow to a new "pg_serial" SLRU
      pool.
      
      We don't currently allow Serializable transactions in Hot Standby mode.
      That would be hard, because even read-only transactions can cause anomalies
      that wouldn't otherwise occur.
      
      Serializable isolation mode now means the new fully serializable level.
      Repeatable Read gives you the old Snapshot Isolation level that we have
      always had.
      
      Kevin Grittner and Dan Ports, reviewed by Jeff Davis, Heikki Linnakangas and
      Anssi Kääriäinen
      dafaa3ef
  4. 02 2月, 2011 1 次提交
  5. 26 1月, 2011 2 次提交
    • T
      Replace pg_class.relhasexclusion with pg_index.indisexclusion. · bd1ad1b0
      Tom Lane 提交于
      There isn't any need to track this state on a table-wide basis, and trying
      to do so introduces undesirable semantic fuzziness.  Move the flag to
      pg_index, where it clearly describes just a single index and can be
      immutable after index creation.
      bd1ad1b0
    • T
      Implement ALTER TABLE ADD UNIQUE/PRIMARY KEY USING INDEX. · 88452d5b
      Tom Lane 提交于
      This feature allows a unique or pkey constraint to be created using an
      already-existing unique index.  While the constraint isn't very
      functionally different from the bare index, it's nice to be able to do that
      for documentation purposes.  The main advantage over just issuing a plain
      ALTER TABLE ADD UNIQUE/PRIMARY KEY is that the index can be created with
      CREATE INDEX CONCURRENTLY, so that there is not a long interval where the
      table is locked against updates.
      
      On the way, refactor some of the code in DefineIndex() and index_create()
      so that we don't have to pass through those functions in order to create
      the index constraint's catalog entries.  Also, in parse_utilcmd.c, pass
      around the ParseState pointer in struct CreateStmtContext to save on
      notation, and add error location pointers to some error reports that didn't
      have one before.
      
      Gurjeet Singh, reviewed by Steve Singer and Tom Lane
      88452d5b
  6. 21 1月, 2011 1 次提交
  7. 12 1月, 2011 1 次提交
  8. 09 1月, 2011 1 次提交
    • T
      Remove pg_am.amindexnulls. · 7e2f9062
      Tom Lane 提交于
      The only use we have had for amindexnulls is in determining whether an
      index is safe to cluster on; but since the addition of the amclusterable
      flag, that usage is pretty redundant.
      
      In passing, clean up assorted sloppiness from the last patch that touched
      pg_am.h: Natts_pg_am was wrong, and ambuildempty was not documented.
      7e2f9062
  9. 08 1月, 2011 2 次提交
  10. 07 1月, 2011 1 次提交
  11. 05 1月, 2011 1 次提交
    • M
      Give superusers REPLIACTION permission by default · 66a8a042
      Magnus Hagander 提交于
      This can be overriden by using NOREPLICATION on the CREATE ROLE
      statement, but by default they will have it, making it backwards
      compatible and "less surprising" (given that superusers normally
      override all checks).
      66a8a042
  12. 03 1月, 2011 2 次提交
  13. 02 1月, 2011 3 次提交
    • P
      Implement remaining fields of information_schema.sequences view · 39b88432
      Peter Eisentraut 提交于
      Add new function pg_sequence_parameters that returns a sequence's start,
      minimum, maximum, increment, and cycle values, and use that in the view.
      (bug #5662; design suggestion by Tom Lane)
      
      Also slightly adjust the view's column order and permissions after review of
      SQL standard.
      39b88432
    • R
      Basic foreign table support. · 0d692a0d
      Robert Haas 提交于
      Foreign tables are a core component of SQL/MED.  This commit does
      not provide a working SQL/MED infrastructure, because foreign tables
      cannot yet be queried.  Support for foreign table scans will need to
      be added in a future patch.  However, this patch creates the necessary
      system catalog structure, syntax support, and support for ancillary
      operations such as COMMENT and SECURITY LABEL.
      
      Shigeru Hanada, heavily revised by Robert Haas
      0d692a0d
    • B
      Stamp copyrights for year 2011. · 5d950e3b
      Bruce Momjian 提交于
      5d950e3b
  14. 29 12月, 2010 2 次提交
    • R
      Support unlogged tables. · 53dbc27c
      Robert Haas 提交于
      The contents of an unlogged table are WAL-logged; thus, they are not
      available on standby servers and are truncated whenever the database
      system enters recovery.  Indexes on unlogged tables are also unlogged.
      Unlogged GiST indexes are not currently supported.
      53dbc27c
    • M
      Add REPLICATION privilege for ROLEs · 9b8aff8c
      Magnus Hagander 提交于
      This privilege is required to do Streaming Replication, instead of
      superuser, making it possible to set up a SR slave that doesn't
      have write permissions on the master.
      
      Superuser privileges do NOT override this check, so in order to
      use the default superuser account for replication it must be
      explicitly granted the REPLICATION permissions. This is backwards
      incompatible change, in the interest of higher default security.
      9b8aff8c
  15. 28 12月, 2010 1 次提交
    • T
      Rename the C functions bitand(), bitor() to bit_and(), bit_or(). · 84fc5713
      Tom Lane 提交于
      This is to avoid use of the C++ keywords "bitand" and "bitor" in
      the header file utils/varbit.h.  Note the functions' SQL-level
      names are not changed, only their C-level names.
      
      In passing, make some comments in varbit.c conform to project-standard
      layout.
      84fc5713
  16. 16 12月, 2010 1 次提交
  17. 14 12月, 2010 1 次提交
    • R
      Generalize concept of temporary relations to "relation persistence". · 5f7b58fa
      Robert Haas 提交于
      This commit replaces pg_class.relistemp with pg_class.relpersistence;
      and also modifies the RangeVar node type to carry relpersistence rather
      than istemp.  It also removes removes rd_istemp from RelationData and
      instead performs the correct computation based on relpersistence.
      
      For clarity, we add three new macros: RelationNeedsWAL(),
      RelationUsesLocalBuffers(), and RelationUsesTempNamespace(), so that we
      can clarify the purpose of each check that previous depended on
      rd_istemp.
      
      This is intended as infrastructure for the upcoming unlogged tables
      patch, as well as for future possible work on global temporary tables.
      5f7b58fa
  18. 04 12月, 2010 1 次提交
    • T
      KNNGIST, otherwise known as order-by-operator support for GIST. · 55450687
      Tom Lane 提交于
      This commit represents a rather heavily editorialized version of
      Teodor's builtin_knngist_itself-0.8.2 and builtin_knngist_proc-0.8.1
      patches.  I redid the opclass API to add a separate Distance method
      instead of turning the Consistent method into an illogical mess,
      fixed some bit-rot in the rbtree interfaces, and generally worked over
      the code style and comments.
      
      There's still no non-code documentation to speak of, but I'll work on
      that separately.  Some contrib-module changes are also yet to come
      (right now, point <-> point is the only KNN-ified operator).
      
      Teodor Sigaev and Tom Lane
      55450687
  19. 03 12月, 2010 1 次提交
    • T
      Create core infrastructure for KNNGIST. · d583f10b
      Tom Lane 提交于
      This is a heavily revised version of builtin_knngist_core-0.9.  The
      ordering operators are no longer mixed in with actual quals, which would
      have confused not only humans but significant parts of the planner.
      Instead, ordering operators are carried separately throughout planning and
      execution.
      
      Since the API for ambeginscan and amrescan functions had to be changed
      anyway, this commit takes the opportunity to rationalize that a bit.
      RelationGetIndexScan no longer forces a premature index_rescan call;
      instead, callers of index_beginscan must call index_rescan too.  Aside from
      making the AM-side initialization logic a bit less peculiar, this has the
      advantage that we do not make a useless extra am_rescan call when there are
      runtime key values.  AMs formerly could not assume that the key values
      passed to amrescan were actually valid; now they can.
      
      Teodor Sigaev and Tom Lane
      d583f10b
  20. 26 11月, 2010 1 次提交
    • R
      Object access hook framework, with post-creation hook. · cc1ed40d
      Robert Haas 提交于
      After a SQL object is created, we provide an opportunity for security
      or logging plugins to get control; for example, a security label provider
      could use this to assign an initial security label to newly created
      objects.  The basic infrastructure is (hopefully) reusable for other types
      of events that might require similar treatment.
      
      KaiGai Kohei, with minor adjustments.
      cc1ed40d
  21. 25 11月, 2010 1 次提交
    • T
      Create the system catalog infrastructure needed for KNNGIST. · 725d52d0
      Tom Lane 提交于
      This commit adds columns amoppurpose and amopsortfamily to pg_amop, and
      column amcanorderbyop to pg_am.  For the moment all the entries in
      amcanorderbyop are "false", since the underlying support isn't there yet.
      
      Also, extend the CREATE OPERATOR CLASS/ALTER OPERATOR FAMILY commands with
      [ FOR SEARCH | FOR ORDER BY sort_operator_family ] clauses to allow the new
      columns of pg_amop to be populated, and create pg_dump support for dumping
      that information.
      
      I also added some documentation, although it's perhaps a bit premature
      given that the feature doesn't do anything useful yet.
      
      Teodor Sigaev, Robert Haas, Tom Lane
      725d52d0
  22. 24 11月, 2010 1 次提交
  23. 23 11月, 2010 1 次提交
    • R
      Centralize some ALTER <whatever> .. SET SCHEMA checks. · 44475e78
      Robert Haas 提交于
      Any flavor of ALTER <whatever> .. SET SCHEMA fails if (1) the object
      is already in the new schema, (2) either the old or new schema is
      a temp schema, or (3) either the old or new schema is the TOAST schema.
      
      Extraced from a patch by Dimitri Fontaine, with additional hacking by me.
      44475e78
  24. 21 11月, 2010 2 次提交
    • R
    • R
      Add new SQL function, format(text). · 75048707
      Robert Haas 提交于
      Currently, three conversion format specifiers are supported: %s for a
      string, %L for an SQL literal, and %I for an SQL identifier.  The latter
      two are deliberately designed not to overlap with what sprintf() already
      supports, in case we want to add more of sprintf()'s functionality here
      later.
      
      Patch by Pavel Stehule, heavily revised by me.  Reviewed by Jeff Janes
      and, in earlier versions, by Itagaki Takahiro and Tom Lane.
      75048707
  25. 19 11月, 2010 1 次提交
  26. 16 11月, 2010 1 次提交
    • R
      Add new buffers_backend_fsync field to pg_stat_bgwriter. · 3134d886
      Robert Haas 提交于
      This new field counts the number of times that a backend which writes a
      buffer out to the OS must also fsync() it.  This happens when the
      bgwriter fsync request queue is full, and is generally detrimental to
      performance, so it's good to know when it's happening.  Along the way,
      log a new message at level DEBUG1 whenever we fail to hand off an fsync,
      so that the problem can also be seen in examination of log files
      (if the logging level is cranked up high enough).
      
      Greg Smith, with minor tweaks by me.
      3134d886