1. 24 12月, 2006 1 次提交
  2. 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
  3. 22 12月, 2006 1 次提交
  4. 11 12月, 2006 1 次提交
    • T
      Add a paramtypmod field to Param nodes. This is dead weight for Params · 9fa12ddd
      Tom Lane 提交于
      representing externally-supplied values, since the APIs that carry such
      values only specify type not typmod.  However, for PARAM_SUBLINK Params
      it is handy to carry the typmod of the sublink's output column.  This
      is a much cleaner solution for the recently reported 'could not find
      pathkey item to sort' and 'failed to find unique expression in subplan
      tlist' bugs than my original 8.2-compatible patch.  Besides, someday we
      might want to support typmods for external parameters ...
      9fa12ddd
  5. 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
  6. 14 10月, 2006 1 次提交
  7. 04 10月, 2006 1 次提交
  8. 31 8月, 2006 1 次提交
  9. 25 8月, 2006 1 次提交
  10. 21 8月, 2006 1 次提交
    • T
      Fix all known problems with pg_dump's handling of serial sequences · 2b2a5072
      Tom Lane 提交于
      by abandoning the idea that it should say SERIAL in the dump.  Instead,
      dump serial sequences and column defaults just like regular ones.
      Add a new backend command ALTER SEQUENCE OWNED BY to let pg_dump recreate
      the sequence-to-column dependency that was formerly created "behind the
      scenes" by SERIAL.  This restores SERIAL to being truly "just a macro"
      consisting of component operations that can be stated explicitly in SQL.
      Furthermore, the new command allows sequence ownership to be reassigned,
      so that old mistakes can be cleaned up.
      
      Also, downgrade the OWNED-BY dependency from INTERNAL to AUTO, since there
      is no longer any very compelling argument why the sequence couldn't be
      dropped while keeping the column.  (This forces initdb, to be sure the
      right kinds of dependencies are in there.)
      
      Along the way, add checks to prevent ALTER OWNER or SET SCHEMA on an
      owned sequence; you can now only do this indirectly by changing the
      owning table's owner or schema.  This is an oversight in previous
      releases, but probably not worth back-patching.
      2b2a5072
  11. 12 8月, 2006 1 次提交
  12. 10 8月, 2006 1 次提交
  13. 02 8月, 2006 1 次提交
  14. 28 7月, 2006 1 次提交
    • T
      Aggregate functions now support multiple input arguments. I also took · 108fe473
      Tom Lane 提交于
      the opportunity to treat COUNT(*) as a zero-argument aggregate instead
      of the old hack that equated it to COUNT(1); this is materially cleaner
      (no more weird ANYOID cases) and ought to be at least a tiny bit faster.
      Original patch by Sergey Koposov; review, documentation, simple regression
      tests, pg_dump and psql support by moi.
      108fe473
  15. 14 7月, 2006 1 次提交
  16. 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
  17. 02 7月, 2006 4 次提交
    • N
      Do a pass of code review for the ALTER TABLE ADD INHERITS patch. Keep · 7fb9090e
      Neil Conway 提交于
      the read lock we hold on the table's parent relation until commit.
      Update equalfuncs.c for the new field in AlterTableCmd. Various
      improvements to comments, variable names, and error reporting.
      
      There is room for further improvement here, but this is at least
      a step in the right direction.
      7fb9090e
    • B
      Add FILLFACTOR to CREATE INDEX. · 277807bd
      Bruce Momjian 提交于
      ITAGAKI Takahiro
      277807bd
    • B
      ALTER TABLE ... ADD/DROPS INHERIT (actually INHERIT / NO INHERIT) · 8c092781
      Bruce Momjian 提交于
      Open items:
      
      There were a few tangentially related issues that have come up that I think
      are TODOs. I'm likely to tackle one or two of these next so I'm interested in
      hearing feedback on them as well.
      
      . Constraints currently do not know anything about inheritance. Tom suggested
        adding a coninhcount and conislocal like attributes have to track their
        inheritance status.
      
      . Foreign key constraints currently do not get copied to new children (and
        therefore my code doesn't verify them). I don't think it would be hard to
        add them and treat them like CHECK constraints.
      
      . No constraints at all are copied to tables defined with LIKE. That makes it
        hard to use LIKE to define new partitions. The standard defines LIKE and
        specifically says it does not copy constraints. But the standard already has
        an option called INCLUDING DEFAULTS; we could always define a non-standard
        extension LIKE table INCLUDING CONSTRAINTS that gives the user the option to
        request a copy including constraints.
      
      . Personally, I think the whole attislocal thing is bunk. The decision about
        whether to drop a column from children tables or not is something that
        should be up to the user and trying to DWIM based on whether there was ever
        a local definition or the column was acquired purely through inheritance is
        hardly ever going to match up with user expectations.
      
      . And of course there's the whole unique and primary key constraint issue. I
        think to get any traction at all on this you have a prerequisite of a real
        partitioned table implementation where the system knows what the partition
        key is so it can recognize when it's a leading part of an index key.
      
      Greg Stark
      8c092781
    • T
      Revise the planner's handling of "pseudoconstant" WHERE clauses, that is · cffd89ca
      Tom Lane 提交于
      clauses containing no variables and no volatile functions.  Such a clause
      can be used as a one-time qual in a gating Result plan node, to suppress
      plan execution entirely when it is false.  Even when the clause is true,
      putting it in a gating node wins by avoiding repeated evaluation of the
      clause.  In previous PG releases, query_planner() would do this for
      pseudoconstant clauses appearing at the top level of the jointree, but
      there was no ability to generate a gating Result deeper in the plan tree.
      To fix it, get rid of the special case in query_planner(), and instead
      process pseudoconstant clauses through the normal RestrictInfo qual
      distribution mechanism.  When a pseudoconstant clause is found attached to
      a path node in create_plan(), pull it out and generate a gating Result at
      that point.  This requires special-casing pseudoconstants in selectivity
      estimation and cost_qual_eval, but on the whole it's pretty clean.
      It probably even makes the planner a bit faster than before for the normal
      case of no pseudoconstants, since removing pull_constant_clauses saves one
      useless traversal of the qual tree.  Per gripe from Phil Frost.
      cffd89ca
  18. 27 6月, 2006 1 次提交
  19. 17 6月, 2006 1 次提交
    • A
      · bbcd0169
      Andrew Dunstan 提交于
      DROP ... IF EXISTS for the following cases:
        language, tablespace, trigger, rule, opclass, function, aggregate. operator, and cast.
      bbcd0169
  20. 01 5月, 2006 1 次提交
  21. 22 4月, 2006 1 次提交
  22. 16 4月, 2006 1 次提交
    • T
      Support the syntax · 3651a3e6
      Tom Lane 提交于
      	CREATE AGGREGATE aggname (input_type) (parameter_list)
      along with the old syntax where the input type was named in the parameter
      list.  This fits more naturally with the way that the aggregate is identified
      in DROP AGGREGATE and other utility commands; furthermore it has a natural
      extension to handle multiple-input aggregates, where the basetype-parameter
      method would get ugly.  In fact, this commit fixes the grammar and all the
      utility commands to support multiple-input aggregates; but DefineAggregate
      rejects it because the executor isn't fixed yet.
      I didn't do anything about treating agg(*) as a zero-input aggregate instead
      of artificially making it a one-input aggregate, but that should be considered
      in combination with supporting multi-input aggregates.
      3651a3e6
  23. 23 3月, 2006 1 次提交
  24. 16 3月, 2006 1 次提交
    • T
      Clean up representation of function RTEs for functions returning RECORD. · 23160139
      Tom Lane 提交于
      The original coding stored the raw parser output (ColumnDef and TypeName
      nodes) which was ugly, bulky, and wrong because it failed to create any
      dependency on the referenced datatype --- and in fact would not track type
      renamings and suchlike.  Instead store a list of column type OIDs in the
      RTE.
      
      Also fix up general failure of recordDependencyOnExpr to do anything sane
      about recording dependencies on datatypes.  While there are many cases where
      there will be an indirect dependency (eg if an operator returns a datatype,
      the dependency on the operator is enough), we do have to record the datatype
      as a separate dependency in examples like CoerceToDomain.
      
      initdb forced because of change of stored rules.
      23160139
  25. 15 3月, 2006 1 次提交
    • T
      Improve parser so that we can show an error cursor position for errors · 20ab467d
      Tom Lane 提交于
      during parse analysis, not only errors detected in the flex/bison stages.
      This is per my earlier proposal.  This commit includes all the basic
      infrastructure, but locations are only tracked and reported for errors
      involving column references, function calls, and operators.  More could
      be done later but this seems like a good set to start with.  I've also
      moved the ReportSyntaxErrorPosition logic out of psql and into libpq,
      which should make it available to more people --- even within psql this
      is an improvement because warnings weren't handled by ReportSyntaxErrorPosition.
      20ab467d
  26. 05 3月, 2006 1 次提交
  27. 03 3月, 2006 1 次提交
  28. 19 2月, 2006 1 次提交
  29. 05 2月, 2006 1 次提交
    • A
      · f8b54fe6
      Andrew Dunstan 提交于
      DROP IF EXISTS for ROLE/USER/GROUP
      f8b54fe6
  30. 01 2月, 2006 1 次提交
    • T
      Restructure planner's handling of inheritance. Rather than processing · 8a1468af
      Tom Lane 提交于
      inheritance trees on-the-fly, which pretty well constrained us to considering
      only one way of planning inheritance, expand inheritance sets during the
      planner prep phase, and build a side data structure that can be consulted
      later to find which RTEs are members of which inheritance sets.  As proof of
      concept, use the data structure to plan joins against inheritance sets more
      efficiently: we can now use indexes on the set members in inner-indexscan
      joins.  (The generated plans could be improved further, but it'll take some
      executor changes.)  This data structure will also support handling UNION ALL
      subqueries in the same way as inheritance sets, but that aspect of it isn't
      finished yet.
      8a1468af
  31. 28 12月, 2005 1 次提交
    • T
      Implement SQL-compliant treatment of row comparisons for < <= > >= cases · 6e077097
      Tom Lane 提交于
      (previously we only did = and <> correctly).  Also, allow row comparisons
      with any operators that are in btree opclasses, not only those with these
      specific names.  This gets rid of a whole lot of indefensible assumptions
      about the behavior of particular operators based on their names ... though
      it's still true that IN and NOT IN expand to "= ANY".  The patch adds a
      RowCompareExpr expression node type, and makes some changes in the
      representation of ANY/ALL/ROWCOMPARE SubLinks so that they can share code
      with RowCompareExpr.
      
      I have not yet done anything about making RowCompareExpr an indexable
      operator, but will look at that soon.
      
      initdb forced due to changes in stored rules.
      6e077097
  32. 20 12月, 2005 1 次提交
  33. 27 11月, 2005 1 次提交
    • T
      Teach tid-scan code to make use of "ctid = ANY (array)" clauses, so that · da27c0a1
      Tom Lane 提交于
      "ctid IN (list)" will still work after we convert IN to ScalarArrayOpExpr.
      Make some minor efficiency improvements while at it, such as ensuring that
      multiple TIDs are fetched in physical heap order.  And fix EXPLAIN so that
      it shows what's really going on for a TID scan.
      da27c0a1
  34. 23 11月, 2005 1 次提交
  35. 22 11月, 2005 1 次提交
    • A
      · 5b352d8e
      Andrew Dunstan 提交于
       DROP DATABASE IF EXISTS variant
      5b352d8e
  36. 21 11月, 2005 2 次提交
    • A
      Implement DROP OWNED and REASSIGN OWNED. These new commands facilitate the · cec3b0a9
      Alvaro Herrera 提交于
      process of dropping roles by dropping objects owned by them and privileges
      granted to them, or giving the owned objects to someone else, through the
      use of the data stored in the new pg_shdepend catalog.
      
      Some refactoring of the GRANT/REVOKE code was needed, as well as ALTER OWNER
      code.  Further cleanup of code duplication in the GRANT code seems necessary.
      
      Implemented by me after an idea from Tom Lane, who also provided various kind
      of implementation advice.
      
      Regression tests pass.  Some tests for the new functionality are also added,
      as well as rudimentary documentation.
      cec3b0a9
    • T
      Clean up after DROP IF EXISTS patch. · b91e6ed9
      Tom Lane 提交于
      b91e6ed9