1. 16 Jul, 2003 1 commit
  2. 06 Jun, 2003 1 commit
    • Tom Lane's avatar
      Implement outer-level aggregates to conform to the SQL spec, with · e649796f
      Tom Lane authored
      extensions to support our historical behavior.  An aggregate belongs
      to the closest query level of any of the variables in its argument,
      or the current query level if there are no variables (e.g., COUNT(*)).
      The implementation involves adding an agglevelsup field to Aggref,
      and treating outer aggregates like outer variables at planning time.
      e649796f
  3. 08 Feb, 2003 1 commit
  4. 20 Jan, 2003 1 commit
    • Tom Lane's avatar
      IN clauses appearing at top level of WHERE can now be handled as joins. · bdfbfde1
      Tom Lane authored
      There are two implementation techniques: the executor understands a new
      JOIN_IN jointype, which emits at most one matching row per left-hand row,
      or the result of the IN's sub-select can be fed through a DISTINCT filter
      and then joined as an ordinary relation.
      Along the way, some minor code cleanup in the optimizer; notably, break
      out most of the jointree-rearrangement preprocessing in planner.c and
      put it in a new file prep/prepjointree.c.
      bdfbfde1
  5. 17 Jan, 2003 1 commit
  6. 12 Dec, 2002 1 commit
    • Tom Lane's avatar
      Phase 2 of read-only-plans project: restructure expression-tree nodes · a0bf885f
      Tom Lane authored
      so that all executable expression nodes inherit from a common supertype
      Expr.  This is somewhat of an exercise in code purity rather than any
      real functional advance, but getting rid of the extra Oper or Func node
      formerly used in each operator or function call should provide at least
      a little space and speed improvement.
      initdb forced by changes in stored-rules representation.
      a0bf885f
  7. 20 Oct, 2002 1 commit
    • Tom Lane's avatar
      Rule rewriter was doing the wrong thing with conditional INSTEAD rules · a044e2ab
      Tom Lane authored
      whose conditions might yield NULL.  The negated qual to attach to the
      original query is properly 'x IS NOT TRUE', not 'NOT x'.  This fix
      produces correct behavior, but we may be taking a performance hit because
      the planner is much stupider about IS NOT TRUE than it is about NOT
      clauses.  Future TODO: teach prepqual, other parts of planner how to
      cope with BooleanTest clauses more effectively.
      a044e2ab
  8. 11 Sep, 2002 1 commit
    • Tom Lane's avatar
      Tweak querytree-dependency-extraction code so that columns of tables · 6fdc44be
      Tom Lane authored
      that are explicitly JOINed are not considered dependencies unless they
      are actually used in the query: mere presence in the joinaliasvars
      list of a JOIN RTE doesn't count as being used.  The patch touches
      a number of files because I needed to generalize the API of
      query_tree_walker to support an additional flag bit, but the changes
      are otherwise quite small.
      6fdc44be
  9. 04 Sep, 2002 1 commit
  10. 20 Jun, 2002 1 commit
  11. 21 Mar, 2002 1 commit
    • Tom Lane's avatar
      First phase of SCHEMA changes, concentrating on fixing the grammar and · 95ef6a34
      Tom Lane authored
      the parsetree representation.  As yet we don't *do* anything with schema
      names, just drop 'em on the floor; but you can enter schema-compatible
      command syntax, and there's even a primitive CREATE SCHEMA command.
      No doc updates yet, except to note that you can now extract a field
      from a function-returning-row's result with (foo(...)).fieldname.
      95ef6a34
  12. 12 Mar, 2002 1 commit
    • Tom Lane's avatar
      Restructure representation of join alias variables. An explicit JOIN · 6eeb95f0
      Tom Lane authored
      now has an RTE of its own, and references to its outputs now are Vars
      referencing the JOIN RTE, rather than CASE-expressions.  This allows
      reverse-listing in ruleutils.c to use the correct alias easily, rather
      than painfully reverse-engineering the alias namespace as it used to do.
      Also, nested FULL JOINs work correctly, because the result of the inner
      joins are simple Vars that the planner can cope with.  This fixes a bug
      reported a couple times now, notably by Tatsuo on 18-Nov-01.  The alias
      Vars are expanded into COALESCE expressions where needed at the very end
      of planning, rather than during parsing.
      Also, beginnings of support for showing plan qualifier expressions in
      EXPLAIN.  There are probably still cases that need work.
      initdb forced due to change of stored-rule representation.
      6eeb95f0
  13. 05 Nov, 2001 1 commit
  14. 28 Oct, 2001 1 commit
  15. 25 Oct, 2001 1 commit
  16. 07 Sep, 2001 1 commit
  17. 18 Apr, 2001 1 commit
  18. 22 Mar, 2001 1 commit
  19. 27 Jan, 2001 1 commit
  20. 24 Jan, 2001 1 commit
  21. 06 Dec, 2000 1 commit
  22. 05 Dec, 2000 1 commit
    • Tom Lane's avatar
      Repair breakage of rules containing INSERT ... SELECT actions, per bug · a51f004d
      Tom Lane authored
      report from Joel Burton.  Turns out that my simple idea of turning the
      SELECT into a subquery does not interact well *at all* with the way the
      rule rewriter works.  Really what we need to make INSERT ... SELECT work
      cleanly is to decouple targetlists from rangetables: an INSERT ... SELECT
      wants to have two levels of targetlist but only one rangetable.  No time
      for that for 7.1, however, so I've inserted some ugly hacks to make the
      rewriter know explicitly about the structure of INSERT ... SELECT queries.
      Ugh :-(
      a51f004d
  23. 16 Nov, 2000 1 commit
  24. 05 Oct, 2000 1 commit
    • Tom Lane's avatar
      Reimplementation of UNION/INTERSECT/EXCEPT. INTERSECT/EXCEPT now meet the · 05e3d0ee
      Tom Lane authored
      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
  25. 29 Sep, 2000 1 commit
    • Tom Lane's avatar
      Subselects in FROM clause, per ISO syntax: FROM (SELECT ...) [AS] alias. · 3a94e789
      Tom Lane authored
      (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
  26. 12 Sep, 2000 1 commit
  27. 30 May, 2000 1 commit
  28. 12 Apr, 2000 1 commit
  29. 16 Mar, 2000 1 commit
    • Tom Lane's avatar
      Fix some (more) problems with subselects in rules. Rewriter failed to · e64a3311
      Tom Lane authored
      mark query as having subselects if a subselect was added from a rule
      WHERE condition (as opposed to a rule action).  Also, fix adjustment
      of varlevelsup so that it actually has some prospect of working when
      inserting an expression containing a subselect into a subquery.
      e64a3311
  30. 27 Jan, 2000 1 commit
    • Tom Lane's avatar
      Redesign DISTINCT ON as discussed in pgsql-sql 1/25/00: syntax is now · dd979f66
      Tom Lane authored
      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 Jan, 2000 1 commit
    • Bruce Momjian's avatar
      Add: · 5c25d602
      Bruce Momjian authored
        * Portions Copyright (c) 1996-2000, PostgreSQL, Inc
      
      to all files copyright Regents of Berkeley.  Man, that's a lot of files.
      5c25d602
  32. 07 Nov, 1999 1 commit
  33. 01 Oct, 1999 1 commit
    • Tom Lane's avatar
      Clean up rewriter routines to use expression_tree_walker and · 389af07c
      Tom Lane authored
      expression_tree_mutator rather than ad-hoc tree walking code.  This shortens
      the code materially and fixes a fair number of sins of omission.  Also,
      change modifyAggrefQual to *not* recurse into subselects, since its mission
      is satisfied if it removes aggregate functions from the top level of a
      WHERE clause.  This cures problems with queries of the form SELECT ...
      WHERE x IN (SELECT ... HAVING something-using-an-aggregate), which would
      formerly get mucked up by modifyAggrefQual.  The routine is still
      fundamentally broken, of course, but I don't think there's any way to get
      rid of it before we implement subselects in FROM ...
      389af07c
  34. 25 Aug, 1999 1 commit
    • Tom Lane's avatar
      Revise implementation of SubLinks so that there is a consistent, · 42af56e1
      Tom Lane authored
      documented intepretation of the lefthand and oper fields.  Fix a number of
      obscure problems while at it --- for example, the old code failed if the parser
      decided to insert a type-coercion function just below the operator of a
      SubLink.
      CAUTION: this will break stored rules that contain subplans.  You may
      need to initdb.
      42af56e1
  35. 21 Aug, 1999 1 commit
    • Tom Lane's avatar
      Major revision of sort-node handling: push knowledge of query · db436adf
      Tom Lane authored
      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
  36. 17 Jul, 1999 1 commit
  37. 16 Jul, 1999 2 commits
  38. 15 Jul, 1999 2 commits