1. 05 1月, 2001 1 次提交
    • T
      Remove not-really-standard implementation of CREATE TABLE's UNDER clause, · 2fb6cc90
      Tom Lane 提交于
      and revert documentation to describe the existing INHERITS clause
      instead, per recent discussion in pghackers.  Also fix implementation
      of SQL_inheritance SET variable: it is not cool to look at this var
      during the initial parsing phase, only during parse_analyze().  See
      recent bug report concerning misinterpretation of date constants just
      after a SET TIMEZONE command.  gram.y really has to be an invariant
      transformation of the query string to a raw parsetree; anything that
      can vary with time must be done during parse analysis.
      2fb6cc90
  2. 15 12月, 2000 1 次提交
    • T
      Planner speedup hacking. Avoid saving useless pathkeys, so that path · ea166f11
      Tom Lane 提交于
      comparison does not consider paths different when they differ only in
      uninteresting aspects of sort order.  (We had a special case of this
      consideration for indexscans already, but generalize it to apply to
      ordered join paths too.)  Be stricter about what is a canonical pathkey
      to allow faster pathkey comparison.  Cache canonical pathkeys and
      dispersion stats for left and right sides of a RestrictInfo's clause,
      to avoid repeated computation.  Total speedup will depend on number of
      tables in a query, but I see about 4x speedup of planning phase for
      a sample seven-table query.
      ea166f11
  3. 13 12月, 2000 1 次提交
  4. 25 11月, 2000 1 次提交
  5. 15 11月, 2000 1 次提交
    • T
      Extend CREATE DATABASE to allow selection of a template database to be · 2cf48ca0
      Tom Lane 提交于
      cloned, rather than always cloning template1.  Modify initdb to generate
      two identical databases rather than one, template0 and template1.
      Connections to template0 are disallowed, so that it will always remain
      in its virgin as-initdb'd state.  pg_dumpall now dumps databases with
      restore commands that say CREATE DATABASE foo WITH TEMPLATE = template0.
      This allows proper behavior when there is user-added data in template1.
      initdb forced!
      2cf48ca0
  6. 12 11月, 2000 1 次提交
    • T
      Restructure handling of inheritance queries so that they work with outer · 6543d81d
      Tom Lane 提交于
      joins, and clean things up a good deal at the same time.  Append plan node
      no longer hacks on rangetable at runtime --- instead, all child tables are
      given their own RT entries during planning.  Concept of multiple target
      tables pushed up into execMain, replacing bug-prone implementation within
      nodeAppend.  Planner now supports generating Append plans for inheritance
      sets either at the top of the plan (the old way) or at the bottom.  Expanding
      at the bottom is appropriate for tables used as sources, since they may
      appear inside an outer join; but we must still expand at the top when the
      target of an UPDATE or DELETE is an inheritance set, because we actually need
      a different targetlist and junkfilter for each target table in that case.
      Fortunately a target table can't be inside an outer join...  Bizarre mutual
      recursion between union_planner and prepunion.c is gone --- in fact,
      union_planner doesn't really have much to do with union queries anymore,
      so I renamed it grouping_planner.
      6543d81d
  7. 06 11月, 2000 1 次提交
  8. 05 11月, 2000 1 次提交
  9. 31 10月, 2000 1 次提交
  10. 19 10月, 2000 1 次提交
    • B
      The following patch was sent to the patches list: · 73677dd9
      Bruce Momjian 提交于
      This patch forces the use of 'DROP VIEW' to destroy views.
      
      It also changes the syntax of DROP VIEW to
      DROP VIEW v1, v2, ...
      to match the syntax of DROP TABLE.
      
      Some error messages were changed so this patch also includes changes to the
      appropriate expected/*.out files.
      
      Doc changes for 'DROP TABLE" and 'DROP VIEW' are included.
      
      
      --
      Mark Hollomon
      73677dd9
  11. 07 10月, 2000 1 次提交
    • T
      Arrange that no database accesses are attempted during parser() --- this · fbd26d69
      Tom Lane 提交于
      took some rejiggering of typename and ACL parsing, as well as moving
      parse_analyze call out of parser().  Restructure postgres.c processing
      so that parse analysis and rewrite are skipped when in abort-transaction
      state.  Only COMMIT and ABORT statements will be processed beyond the raw
      parser() phase.  This addresses problem of parser failing with database access
      errors while in aborted state (see pghackers discussions around 7/28/00).
      Also fix some bugs with COMMIT/ABORT statements appearing in the middle of
      a single query input string.
      Function, operator, and aggregate arguments/results can now use full
      TypeName production, in particular foo[] for array types.
      DROP OPERATOR and COMMENT ON OPERATOR were broken for unary operators.
      Allow CREATE AGGREGATE to accept unquoted numeric constants for initcond.
      fbd26d69
  12. 06 10月, 2000 1 次提交
    • T
      Reimplementation of UNION/INTERSECT/EXCEPT. INTERSECT/EXCEPT now meet the · 05e3d0ee
      Tom Lane 提交于
      SQL92 semantics, including support for ALL option.  All three can be used
      in subqueries and views.  DISTINCT and ORDER BY work now in views, too.
      This rewrite fixes many problems with cross-datatype UNIONs and INSERT/SELECT
      where the SELECT yields different datatypes than the INSERT needs.  I did
      that by making UNION subqueries and SELECT in INSERT be treated like
      subselects-in-FROM, thereby allowing an extra level of targetlist where the
      datatype conversions can be inserted safely.
      INITDB NEEDED!
      05e3d0ee
  13. 30 9月, 2000 1 次提交
    • T
      Subselects in FROM clause, per ISO syntax: FROM (SELECT ...) [AS] alias. · 3a94e789
      Tom Lane 提交于
      (Don't forget that an alias is required.)  Views reimplemented as expanding
      to subselect-in-FROM.  Grouping, aggregates, DISTINCT in views actually
      work now (he says optimistically).  No UNION support in subselects/views
      yet, but I have some ideas about that.  Rule-related permissions checking
      moved out of rewriter and into executor.
      INITDB REQUIRED!
      3a94e789
  14. 13 9月, 2000 1 次提交
  15. 12 8月, 2000 1 次提交
    • T
      copyObject() and equal() now know about all parse-time node types, · 4951a882
      Tom Lane 提交于
      including utility statements.  Still can't copy or compare executor
      state, but at present that doesn't seem to be necessary.  This makes
      it possible to execute most (all?) utility statements in plpgsql.
      Had to change parsetree representation of CreateTrigStmt so that it
      contained only legal Nodes, and not bare string constants.
      4951a882
  16. 08 8月, 2000 1 次提交
    • T
      Remove 'func_tlist' from Func expression nodes, likewise 'param_tlist' · 62e29fe2
      Tom Lane 提交于
      from Param nodes, per discussion a few days ago on pghackers.  Add new
      expression node type FieldSelect that implements the functionality where
      it's actually needed.  Clean up some other unused fields in Func nodes
      as well.
      NOTE: initdb forced due to change in stored expression trees for rules.
      62e29fe2
  17. 22 7月, 2000 1 次提交
  18. 17 7月, 2000 1 次提交
    • T
      Revise aggregate functions per earlier discussions in pghackers. · bec98a31
      Tom Lane 提交于
      There's now only one transition value and transition function.
      NULL handling in aggregates is a lot cleaner.  Also, use Numeric
      accumulators instead of integer accumulators for sum/avg on integer
      datatypes --- this avoids overflow at the cost of being a little slower.
      Implement VARIANCE() and STDDEV() aggregates in the standard backend.
      
      Also, enable new LIKE selectivity estimators by default.  Unrelated
      change, but as long as I had to force initdb anyway...
      bec98a31
  19. 12 7月, 2000 1 次提交
  20. 29 6月, 2000 1 次提交
  21. 13 4月, 2000 1 次提交
  22. 23 3月, 2000 1 次提交
    • T
      Repair logic flaw in cost estimator: cost_nestloop() was estimating CPU · 1d5e7a6f
      Tom Lane 提交于
      costs using the inner path's parent->rows count as the number of tuples
      processed per inner scan iteration.  This is wrong when we are using an
      inner indexscan with indexquals based on join clauses, because the rows
      count in a Relation node reflects the selectivity of the restriction
      clauses for that rel only.  Upshot was that if join clause was very
      selective, we'd drastically overestimate the true cost of the join.
      Fix is to calculate correct output-rows estimate for an inner indexscan
      when the IndexPath node is created and save it in the path node.
      Change of path node doesn't require initdb, since path nodes don't
      appear in saved rules.
      1d5e7a6f
  23. 02 3月, 2000 1 次提交
  24. 22 2月, 2000 1 次提交
    • T
      Change parse-time representation of float literals (which include oversize · 393f3132
      Tom Lane 提交于
      integers) to be strings instead of 'double'.  We convert from string form
      to internal representation only after type resolution has determined the
      correct type for the constant.  This eliminates loss-of-precision worries
      and gets rid of the change in behavior seen at 17 digits with the
      previous kluge.
      393f3132
  25. 21 2月, 2000 1 次提交
    • T
      Create a new expression node type RelabelType, which exists solely to · 57b30e8e
      Tom Lane 提交于
      represent the result of a binary-compatible type coercion.  At runtime
      it just evaluates its argument --- but during type resolution, exprType
      will pick up the output type of the RelabelType node instead of the type
      of the argument.  This solves some longstanding problems with dropped
      type coercions, an example being 'select now()::abstime::int4' which
      used to produce date-formatted output, not an integer, because the
      coercion to int4 was dropped on the floor.
      57b30e8e
  26. 16 2月, 2000 1 次提交
    • T
      New cost model for planning, incorporating a penalty for random page · b1577a7c
      Tom Lane 提交于
      accesses versus sequential accesses, a (very crude) estimate of the
      effects of caching on random page accesses, and cost to evaluate WHERE-
      clause expressions.  Export critical parameters for this model as SET
      variables.  Also, create SET variables for the planner's enable flags
      (enable_seqscan, enable_indexscan, etc) so that these can be controlled
      more conveniently than via PGOPTIONS.
      
      Planner now estimates both startup cost (cost before retrieving
      first tuple) and total cost of each path, so it can optimize queries
      with LIMIT on a reasonable basis by interpolating between these costs.
      Same facility is a win for EXISTS(...) subqueries and some other cases.
      
      Redesign pathkey representation to achieve a major speedup in planning
      (I saw as much as 5X on a 10-way join); also minor changes in planner
      to reduce memory consumption by recycling discarded Path nodes and
      not constructing unnecessary lists.
      
      Minor cleanups to display more-plausible costs in some cases in
      EXPLAIN output.
      
      Initdb forced by change in interface to index cost estimation
      functions.
      b1577a7c
  27. 15 2月, 2000 1 次提交
  28. 07 2月, 2000 1 次提交
    • T
      Repair planning bugs caused by my misguided removal of restrictinfo link · d8733ce6
      Tom Lane 提交于
      fields in JoinPaths --- turns out that we do need that after all :-(.
      Also, rearrange planner so that only one RelOptInfo is created for a
      particular set of joined base relations, no matter how many different
      subsets of relations it can be created from.  This saves memory and
      processing time compared to the old method of making a bunch of RelOptInfos
      and then removing the duplicates.  Clean up the jointree iteration logic;
      not sure if it's better, but I sure find it more readable and plausible
      now, particularly for the case of 'bushy plans'.
      d8733ce6
  29. 31 1月, 2000 1 次提交
  30. 28 1月, 2000 1 次提交
    • T
      Redesign DISTINCT ON as discussed in pgsql-sql 1/25/00: syntax is now · dd979f66
      Tom Lane 提交于
      SELECT DISTINCT ON (expr [, expr ...]) targetlist ...
      and there is a check to make sure that the user didn't specify an ORDER BY
      that's incompatible with the DISTINCT operation.
      Reimplement nodeUnique and nodeGroup to use the proper datatype-specific
      equality function for each column being compared --- they used to do
      bitwise comparisons or convert the data to text strings and strcmp().
      (To add insult to injury, they'd look up the conversion functions once
      for each tuple...)  Parse/plan representation of DISTINCT is now a list
      of SortClause nodes.
      initdb forced by querytree change...
      dd979f66
  31. 26 1月, 2000 1 次提交
    • B
      Add: · 5c25d602
      Bruce Momjian 提交于
        * Portions Copyright (c) 1996-2000, PostgreSQL, Inc
      
      to all files copyright Regents of Berkeley.  Man, that's a lot of files.
      5c25d602
  32. 09 1月, 2000 1 次提交
  33. 24 12月, 1999 1 次提交
    • T
      Clean up handling of explicit NULL constants. Cases like · 350cb386
      Tom Lane 提交于
      	SELECT null::text;
      	SELECT int4fac(null);
      work as expected now.  In some cases a NULL must be surrounded by
      parentheses:
      	SELECT 2 + null;                 fails
      	SELECT 2 + (null);               OK
      This is a grammatical ambiguity that seems difficult to avoid.  Other
      than that, NULLs seem to behave about like you'd expect.  The internal
      implementation is that NULL constants are typed as UNKNOWN (like
      untyped string constants) until the parser can deduce the right type.
      350cb386
  34. 13 12月, 1999 1 次提交
  35. 24 11月, 1999 1 次提交
  36. 15 11月, 1999 1 次提交
  37. 07 10月, 1999 1 次提交
    • T
      Fix planner and rewriter to follow SQL semantics for tables that are · 3eb1c822
      Tom Lane 提交于
      mentioned in FROM but not elsewhere in the query: such tables should be
      joined over anyway.  Aside from being more standards-compliant, this allows
      removal of some very ugly hacks for COUNT(*) processing.  Also, allow
      HAVING clause without aggregate functions, since SQL does.  Clean up
      CREATE RULE statement-list syntax the same way Bruce just fixed the
      main stmtmulti production.
      CAUTION: addition of a field to RangeTblEntry nodes breaks stored rules;
      you will have to initdb if you have any rules.
      3eb1c822
  38. 26 9月, 1999 1 次提交
    • T
      Implement constant-expression simplification per Bernard · 40f65241
      Tom Lane 提交于
      Frankpitt, plus some improvements from yours truly.  The simplifier depends
      on the proiscachable field of pg_proc to tell it whether a function is
      safe to pre-evaluate --- things like nextval() are not, for example.
      Update pg_proc.h to contain reasonable cacheability information; as of
      6.5.* hardly any functions were marked cacheable.  I may have erred too
      far in the other direction; see recent mail to pghackers for more info.
      This update does not force an initdb, exactly, but you won't see much
      benefit from the simplifier until you do one.
      40f65241
  39. 21 8月, 1999 1 次提交
    • T
      Major revision of sort-node handling: push knowledge of query · db436adf
      Tom Lane 提交于
      sort order down into planner, instead of handling it only at the very top
      level of the planner.  This fixes many things.  An explicit sort is now
      avoided if there is a cheaper alternative (typically an indexscan) not
      only for ORDER BY, but also for the internal sort of GROUP BY.  It works
      even when there is no other reason (such as a WHERE condition) to consider
      the indexscan.  It works for indexes on functions.  It works for indexes
      on functions, backwards.  It's just so cool...
      
      CAUTION: I have changed the representation of SortClause nodes, therefore
      THIS UPDATE BREAKS STORED RULES.  You will need to initdb.
      db436adf
  40. 16 8月, 1999 1 次提交
    • T
      Major planner/optimizer revision: get rid of PathOrder node type, · e6381966
      Tom Lane 提交于
      store all ordering information in pathkeys lists (which are now lists of
      lists of PathKeyItem nodes, not just lists of lists of vars).  This was
      a big win --- the code is smaller and IMHO more understandable than it
      was, even though it handles more cases.  I believe the node changes will
      not force an initdb for anyone; planner nodes don't show up in stored
      rules.
      e6381966