1. 09 6月, 2007 1 次提交
    • A
      Avoid passing zero as a value for vacuum_cost_limit, because it's not a valid · 2b438c12
      Alvaro Herrera 提交于
      value for the vacuum code.  Instead, make zero signify getting the value from a
      higher level configuration facility, just like -1 in the original coding.  We
      still document that -1 is the value that disables the feature, to avoid
      confusing the user unnecessarily.
      
      Reported by Galy Lee in <200705310914.l4V9E6JA094603@wwwmaster.postgresql.org>;
      per subsequent discussion.
      2b438c12
  2. 06 6月, 2007 1 次提交
    • T
      Downgrade implicit casts to text to be assignment-only, except for the ones · 31edbadf
      Tom Lane 提交于
      from the other string-category types; this eliminates a lot of surprising
      interpretations that the parser could formerly make when there was no directly
      applicable operator.
      
      Create a general mechanism that supports casts to and from the standard string
      types (text,varchar,bpchar) for *every* datatype, by invoking the datatype's
      I/O functions.  These new casts are assignment-only in the to-string direction,
      explicit-only in the other, and therefore should create no surprising behavior.
      Remove a bunch of thereby-obsoleted datatype-specific casting functions.
      
      The "general mechanism" is a new expression node type CoerceViaIO that can
      actually convert between *any* two datatypes if their external text
      representations are compatible.  This is more general than needed for the
      immediate feature, but might be useful in plpgsql or other places in future.
      
      This commit does nothing about the issue that applying the concatenation
      operator || to non-text types will now fail, often with strange error messages
      due to misinterpreting the operator as array concatenation.  Since it often
      (not always) worked before, we should either make it succeed or at least give
      a more user-friendly error; but details are still under debate.
      
      Peter Eisentraut and Tom Lane
      31edbadf
  3. 16 5月, 2007 1 次提交
  4. 12 5月, 2007 1 次提交
    • T
      Support arrays of composite types, including the rowtypes of regular tables · bc8036fc
      Tom Lane 提交于
      and views (but not system catalogs, nor sequences or toast tables).  Get rid
      of the hardwired convention that a type's array type is named exactly "_type",
      instead using a new column pg_type.typarray to provide the linkage.  (It still
      will be named "_type", though, except in odd corner cases such as
      maximum-length type names.)
      
      Along the way, make tracking of owner and schema dependencies for types more
      uniform: a type directly created by the user has these dependencies, while a
      table rowtype or auto-generated array type does not have them, but depends on
      its parent object instead.
      
      David Fetter, Andrew Dunstan, Tom Lane
      bc8036fc
  5. 07 4月, 2007 1 次提交
  6. 02 4月, 2007 1 次提交
  7. 27 3月, 2007 1 次提交
    • T
      Allow non-superuser database owners to create procedural languages. · 55a7cf80
      Tom Lane 提交于
      A DBA is allowed to create a language in his database if it's marked
      "tmpldbacreate" in pg_pltemplate.  The factory default is that this is set
      for all standard trusted languages, but of course a superuser may adjust
      the settings.  In service of this, add the long-foreseen owner column to
      pg_language; renaming, dropping, and altering owner of a PL now follow
      normal ownership rules instead of being superuser-only.
      Jeremy Drake, with some editorialization by Tom Lane.
      55a7cf80
  8. 22 3月, 2007 1 次提交
  9. 20 3月, 2007 1 次提交
    • J
      Changes pg_trigger and extend pg_rewrite in order to allow triggers and · 0fe16500
      Jan Wieck 提交于
      rules to be defined with different, per session controllable, behaviors
      for replication purposes.
      
      This will allow replication systems like Slony-I and, as has been stated
      on pgsql-hackers, other products to control the firing mechanism of
      triggers and rewrite rules without modifying the system catalog directly.
      
      The firing mechanisms are controlled by a new superuser-only GUC
      variable, session_replication_role, together with a change to
      pg_trigger.tgenabled and a new column pg_rewrite.ev_enabled. Both
      columns are a single char data type now (tgenabled was a bool before).
      The possible values in these attributes are:
      
           'O' - Trigger/Rule fires when session_replication_role is "origin"
                 (default) or "local". This is the default behavior.
      
           'D' - Trigger/Rule is disabled and fires never
      
           'A' - Trigger/Rule fires always regardless of the setting of
                 session_replication_role
      
           'R' - Trigger/Rule fires when session_replication_role is "replica"
      
      The GUC variable can only be changed as long as the system does not have
      any cached query plans. This will prevent changing the session role and
      accidentally executing stored procedures or functions that have plans
      cached that expand to the wrong query set due to differences in the rule
      firing semantics.
      
      The SQL syntax for changing a triggers/rules firing semantics is
      
           ALTER TABLE <tabname> <when> TRIGGER|RULE <name>;
      
           <when> ::= ENABLE | ENABLE ALWAYS | ENABLE REPLICA | DISABLE
      
      psql's \d command as well as pg_dump are extended in a backward
      compatible fashion.
      
      Jan
      0fe16500
  10. 14 2月, 2007 1 次提交
    • T
      Fix up foreign-key mechanism so that there is a sound semantic basis for the · 7bddca34
      Tom Lane 提交于
      equality checks it applies, instead of a random dependence on whatever
      operators might be named "=".  The equality operators will now be selected
      from the opfamily of the unique index that the FK constraint depends on to
      enforce uniqueness of the referenced columns; therefore they are certain to be
      consistent with that index's notion of equality.  Among other things this
      should fix the problem noted awhile back that pg_dump may fail for foreign-key
      constraints on user-defined types when the required operators aren't in the
      search path.  This also means that the former warning condition about "foreign
      key constraint will require costly sequential scans" is gone: if the
      comparison condition isn't indexable then we'll reject the constraint
      entirely. All per past discussions.
      
      Along the way, make the RI triggers look into pg_constraint for their
      information, instead of using pg_trigger.tgargs; and get rid of the always
      error-prone fixed-size string buffers in ri_triggers.c in favor of building up
      the RI queries in StringInfo buffers.
      
      initdb forced due to columns added to pg_constraint and pg_trigger.
      7bddca34
  11. 01 2月, 2007 1 次提交
    • B
      Update documentation on may/can/might: · a134ee33
      Bruce Momjian 提交于
      Standard English uses "may", "can", and "might" in different ways:
      
              may - permission, "You may borrow my rake."
      
              can - ability, "I can lift that log."
      
              might - possibility, "It might rain today."
      
      Unfortunately, in conversational English, their use is often mixed, as
      in, "You may use this variable to do X", when in fact, "can" is a better
      choice.  Similarly, "It may crash" is better stated, "It might crash".
      
      Also update two error messages mentioned in the documenation to match.
      a134ee33
  12. 22 1月, 2007 1 次提交
    • T
      Add COST and ROWS options to CREATE/ALTER FUNCTION, plus underlying pg_proc · 5a7471c3
      Tom Lane 提交于
      columns procost and prorows, to allow simple user adjustment of the estimated
      cost of a function call, as well as control of the estimated number of rows
      returned by a set-returning function.  We might eventually wish to extend this
      to allow function-specific estimation routines, but there seems to be
      consensus that we should try a simple constant estimate first.  In particular
      this provides a relatively simple way to control the order in which different
      WHERE clauses are applied in a plan node, which is a Good Thing in view of the
      fact that the recent EquivalenceClass planner rewrite made that much less
      predictable than before.
      5a7471c3
  13. 21 1月, 2007 1 次提交
    • T
      Simplify pg_am representation of ordering-capable access methods: · fcf4b146
      Tom Lane 提交于
      provide just a boolean 'amcanorder', instead of fields that specify the
      sort operator strategy numbers.  We have decided to require ordering-capable
      AMs to use btree-compatible strategy numbers, so the old fields are
      overkill (and indeed misleading about what's allowed).
      fcf4b146
  14. 09 1月, 2007 1 次提交
    • T
      Support ORDER BY ... NULLS FIRST/LAST, and add ASC/DESC/NULLS FIRST/NULLS LAST · 44317582
      Tom Lane 提交于
      per-column options for btree indexes.  The planner's support for this is still
      pretty rudimentary; it does not yet know how to plan mergejoins with
      nondefault ordering options.  The documentation is pretty rudimentary, too.
      I'll work on improving that stuff later.
      
      Note incompatible change from prior behavior: ORDER BY ... USING will now be
      rejected if the operator is not a less-than or greater-than member of some
      btree opclass.  This prevents less-than-sane behavior if an operator that
      doesn't actually define a proper sort ordering is selected.
      44317582
  15. 31 12月, 2006 1 次提交
  16. 23 12月, 2006 1 次提交
    • T
      Restructure operator classes to allow improved handling of cross-data-type · a78fcfb5
      Tom Lane 提交于
      cases.  Operator classes now exist within "operator families".  While most
      families are equivalent to a single class, related classes can be grouped
      into one family to represent the fact that they are semantically compatible.
      Cross-type operators are now naturally adjunct parts of a family, without
      having to wedge them into a particular opclass as we had done originally.
      
      This commit restructures the catalogs and cleans up enough of the fallout so
      that everything still works at least as well as before, but most of the work
      needed to actually improve the planner's behavior will come later.  Also,
      there are not yet CREATE/DROP/ALTER OPERATOR FAMILY commands; the only way
      to create a new family right now is to allow CREATE OPERATOR CLASS to make
      one by default.  I owe some more documentation work, too.  But that can all
      be done in smaller pieces once this infrastructure is in place.
      a78fcfb5
  17. 19 12月, 2006 1 次提交
  18. 12 11月, 2006 1 次提交
    • N
      Do a round of copy-editing for the system catalog chapter. In particular, · f49baa73
      Neil Conway 提交于
      consistently capitalize the content of the "Description" column but do
      not include a terminating period, as is the convention elsewhere in the
      docs. Also, remove the "References" column from catalog that do not
      have any referencing columns, for the sake of brevity. Make various
      other SGML and grammar fixes.
      f49baa73
  19. 06 11月, 2006 1 次提交
    • T
      Fix recently-understood problems with handling of XID freezing, particularly · 48188e16
      Tom Lane 提交于
      in PITR scenarios.  We now WAL-log the replacement of old XIDs with
      FrozenTransactionId, so that such replacement is guaranteed to propagate to
      PITR slave databases.  Also, rather than relying on hint-bit updates to be
      preserved, pg_clog is not truncated until all instances of an XID are known to
      have been replaced by FrozenTransactionId.  Add new GUC variables and
      pg_autovacuum columns to allow management of the freezing policy, so that
      users can trade off the size of pg_clog against the amount of freezing work
      done.  Revise the already-existing code that forces autovacuum of tables
      approaching the wraparound point to make it more bulletproof; also, revise the
      autovacuum logic so that anti-wraparound vacuuming is done per-table rather
      than per-database.  initdb forced because of changes in pg_class, pg_database,
      and pg_autovacuum catalogs.  Heikki Linnakangas, Simon Riggs, and Tom Lane.
      48188e16
  20. 24 10月, 2006 1 次提交
  21. 23 9月, 2006 1 次提交
  22. 19 9月, 2006 1 次提交
    • T
      Add built-in userlock manipulation functions to replace the former · 9b4cda0d
      Tom Lane 提交于
      contrib functionality.  Along the way, remove the USER_LOCKS configuration
      symbol, since it no longer makes any sense to try to compile that out.
      No user documentation yet ... mmoncure has promised to write some.
      Thanks to Abhijit Menon-Sen for creating a first draft to work from.
      9b4cda0d
  23. 17 9月, 2006 1 次提交
  24. 16 9月, 2006 1 次提交
  25. 25 8月, 2006 1 次提交
  26. 01 8月, 2006 1 次提交
    • T
      Change the relation_open protocol so that we obtain lock on a relation · 09d3670d
      Tom Lane 提交于
      (table or index) before trying to open its relcache entry.  This fixes
      race conditions in which someone else commits a change to the relation's
      catalog entries while we are in process of doing relcache load.  Problems
      of that ilk have been reported sporadically for years, but it was not
      really practical to fix until recently --- for instance, the recent
      addition of WAL-log support for in-place updates helped.
      
      Along the way, remove pg_am.amconcurrent: all AMs are now expected to support
      concurrent update.
      09d3670d
  27. 27 7月, 2006 1 次提交
  28. 25 7月, 2006 1 次提交
    • T
      Remove hard-wired lists of timezone abbreviations in favor of providing · d8b5c95c
      Tom Lane 提交于
      configuration files that can be altered by a DBA.  The australian_timezones
      GUC setting disappears, replaced by a timezone_abbreviations setting (set this
      to 'Australia' to get the effect of australian_timezones).  The list of zone
      names defined by default has undergone a bit of cleanup, too.  Documentation
      still needs some work --- in particular, should we fix Table B-4, or just get
      rid of it?  Joachim Wieland, with some editorializing by moi.
      d8b5c95c
  29. 11 7月, 2006 1 次提交
    • A
      Improve vacuum code to track minimum Xids per table instead of per database. · d4cef0aa
      Alvaro Herrera 提交于
      To this end, add a couple of columns to pg_class, relminxid and relvacuumxid,
      based on which we calculate the pg_database columns after each vacuum.
      
      We now force all databases to be vacuumed, even template ones.  A backend
      noticing too old a database (meaning pg_database.datminxid is in danger of
      falling behind Xid wraparound) will signal the postmaster, which in turn will
      start an autovacuum iteration to process the offending database.  In principle
      this is only there to cope with frozen (non-connectable) databases without
      forcing users to set them to connectable, but it could force regular user
      database to go through a database-wide vacuum at any time.  Maybe we should
      warn users about this somehow.  Of course the real solution will be to use
      autovacuum all the time ;-)
      
      There are some additional improvements we could have in this area: for example
      the vacuum code could be smarter about not updating pg_database for each table
      when called by autovacuum, and do it only once the whole autovacuum iteration
      is done.
      
      I updated the system catalogs documentation, but I didn't modify the
      maintenance section.  Also having some regression tests for this would be nice
      but it's not really a very straightforward thing to do.
      
      Catalog version bumped due to system catalog changes.
      d4cef0aa
  30. 04 7月, 2006 1 次提交
    • T
      Code review for FILLFACTOR patch. Change WITH grammar as per earlier · b7b78d24
      Tom Lane 提交于
      discussion (including making def_arg allow reserved words), add missed
      opt_definition for UNIQUE case.  Put the reloptions support code in a less
      random place (I chose to make a new file access/common/reloptions.c).
      Eliminate header inclusion creep.  Make the index options functions safely
      user-callable (seems like client apps might like to be able to test validity
      of options before trying to make an index).  Reduce overhead for normal case
      with no options by allowing rd_options to be NULL.  Fix some unmaintainably
      klugy code, including getting rid of Natts_pg_class_fixed at long last.
      Some stylistic cleanup too, and pay attention to keeping comments in sync
      with code.
      
      Documentation still needs work, though I did fix the omissions in
      catalogs.sgml and indexam.sgml.
      b7b78d24
  31. 03 6月, 2006 1 次提交
  32. 28 5月, 2006 1 次提交
  33. 03 5月, 2006 1 次提交
  34. 11 3月, 2006 1 次提交
  35. 12 2月, 2006 1 次提交
    • B
      I've created a new shared catalog table pg_shdescription to store · f9a726aa
      Bruce Momjian 提交于
      comments on cluster global objects like databases, tablespaces, and
      roles.
      
      It touches a lot of places, but not much in the way of big changes.  The
      only design decision I made was to duplicate the query and manipulation
      functions rather than to try and have them handle both shared and local
      comments.  I believe this is simpler for the code and not an issue for
      callers because they know what type of object they are dealing with.
      This has resulted in a shobj_description function analagous to
      obj_description and backend functions [Create/Delete]SharedComments
      mirroring the existing [Create/Delete]Comments functions.
      
      pg_shdescription.h goes into src/include/catalog/
      
      Kris Jurka
      f9a726aa
  36. 22 1月, 2006 1 次提交
  37. 18 1月, 2006 1 次提交
    • N
      Add a new system view, pg_cursors, that displays the currently available · 33e06ebc
      Neil Conway 提交于
      cursors. Patch from Joachim Wieland, review and ediorialization by Neil
      Conway. The view lists cursors defined by DECLARE CURSOR, using SPI, or
      via the Bind message of the frontend/backend protocol. This means the
      view does not list the unnamed portal or the portal created to implement
      EXECUTE. Because we do list SPI portals, there might be more rows in
      this view than you might expect if you are using SPI implicitly (e.g.
      via a procedural language).
      
      Per recent discussion on -hackers, the query string included in the
      view for cursors defined by DECLARE CURSOR is based on
      debug_query_string. That means it is not accurate if multiple queries
      separated by semicolons are submitted as one query string. However,
      there doesn't seem a trivial fix for that: debug_query_string
      is better than nothing. I also changed SPI_cursor_open() to include
      the source text for the portal it creates: AFAICS there is no reason
      not to do this.
      
      Update the documentation and regression tests, bump the catversion.
      33e06ebc
  38. 17 1月, 2006 1 次提交
  39. 08 1月, 2006 1 次提交
    • N
      Add a new system view, pg_prepared_statements, that can be used to · 44b928e8
      Neil Conway 提交于
      access information about the prepared statements that are available
      in the current session. Original patch from Joachim Wieland, various
      improvements by Neil Conway.
      
      The "statement" column of the view contains the literal query string
      sent by the client, without any rewriting or pretty printing. This
      means that prepared statements created via SQL will be prefixed with
      "PREPARE ... AS ", whereas those prepared via the FE/BE protocol will
      not. That is unfortunate, but discussion on -patches did not yield an
      efficient way to improve this, and there is some merit in returning
      exactly what the client sent to the backend.
      
      Catalog version bumped, regression tests updated.
      44b928e8
  40. 05 11月, 2005 1 次提交