1. 29 Apr, 2008 2 commits
  2. 14 Apr, 2008 1 commit
    • Tom Lane's avatar
      Push index operator lossiness determination down to GIST/GIN opclass · 9b5c8d45
      Tom Lane authored
      "consistent" functions, and remove pg_amop.opreqcheck, as per recent
      discussion.  The main immediate benefit of this is that we no longer need
      8.3's ugly hack of requiring @@@ rather than @@ to test weight-using tsquery
      searches on GIN indexes.  In future it should be possible to optimize some
      other queries better than is done now, by detecting at runtime whether the
      index match is exact or not.
      
      Tom Lane, after an idea of Heikki's, and with some help from Teodor.
      9b5c8d45
  3. 21 Mar, 2008 1 commit
  4. 20 Mar, 2008 1 commit
    • Tom Lane's avatar
      Arrange for an explicit cast applied to an ARRAY[] constructor to be applied · 6b0706ac
      Tom Lane authored
      directly to all the member expressions, instead of the previous implementation
      where the ARRAY[] constructor would infer a common element type and then we'd
      coerce the finished array after the fact.  This has a number of benefits,
      one being that we can allow an empty ARRAY[] construct so long as its
      element type is specified by such a cast.
      
      Brendan Jurd, minor fixes by me.
      6b0706ac
  5. 07 Feb, 2008 1 commit
    • Tom Lane's avatar
      Fix CREATE TABLE ... LIKE ... INCLUDING INDEXES to not cause unwanted · b7fe5f70
      Tom Lane authored
      tablespace permissions failures when copying an index that is in the
      database's default tablespace.  A side-effect of the change is that explicitly
      specifying the default tablespace no longer triggers a permissions check;
      this is not how it was done in pre-8.3 releases but is argued to be more
      consistent.  Per bug #3921 from Andrew Gilligan.  (Note: I argued in the
      subsequent discussion that maybe LIKE shouldn't copy index tablespaces
      at all, but since no one indicated agreement with that idea, I've refrained
      from doing it.)
      b7fe5f70
  6. 01 Jan, 2008 1 commit
  7. 01 Dec, 2007 1 commit
    • Tom Lane's avatar
      Code review for LIKE ... INCLUDING INDEXES patch. Fix failure to propagate · 265f904d
      Tom Lane authored
      constraint status of copied indexes (bug #3774), as well as various other
      small bugs such as failure to pstrdup when needed.  Allow INCLUDING INDEXES
      indexes to be merged with identical declared indexes (perhaps not real useful,
      but the code is there and having it not apply to LIKE indexes seems pretty
      unorthogonal).  Avoid useless work in generateClonedIndexStmt().  Undo some
      poorly chosen API changes, and put a couple of routines in modules that seem
      to be better places for them.
      265f904d
  8. 15 Nov, 2007 2 commits
  9. 24 Oct, 2007 1 commit
    • Tom Lane's avatar
      Disallow scrolling of FOR UPDATE/FOR SHARE cursors, so as to avoid problems · 048efc25
      Tom Lane authored
      in corner cases such as re-fetching a just-deleted row.  We may be able to
      relax this someday, but let's find out how many people really care before
      we invest a lot of work in it.  Per report from Heikki and subsequent
      discussion.
      
      While in the neighborhood, make the combination of INSENSITIVE and FOR UPDATE
      throw an error, since they are semantically incompatible.  (Up to now we've
      accepted but just ignored the INSENSITIVE option of DECLARE CURSOR.)
      048efc25
  10. 03 Sep, 2007 1 commit
  11. 22 Aug, 2007 1 commit
  12. 21 Aug, 2007 1 commit
  13. 17 Jul, 2007 1 commit
  14. 23 Jun, 2007 1 commit
    • Tom Lane's avatar
      Separate parse-analysis for utility commands out of parser/analyze.c · 46379d6e
      Tom Lane authored
      (which now deals only in optimizable statements), and put that code
      into a new file parser/parse_utilcmd.c.  This helps clarify and enforce
      the design rule that utility statements shouldn't be processed during
      the regular parse analysis phase; all interpretation of their meaning
      should happen after they are given to ProcessUtility to execute.
      (We need this because we don't retain any locks for a utility statement
      that's in a plan cache, nor have any way to detect that it's stale.)
      
      We are also able to simplify the API for parse_analyze() and related
      routines, because they will now always return exactly one Query structure.
      
      In passing, fix bug #3403 concerning trying to add a serial column to
      an existing temp table (this is largely Heikki's work, but we needed
      all that restructuring to make it safe).
      46379d6e
  15. 27 Apr, 2007 1 commit
    • Tom Lane's avatar
      Modify processing of DECLARE CURSOR and EXPLAIN so that they can resolve the · bbbe825f
      Tom Lane authored
      types of unspecified parameters when submitted via extended query protocol.
      This worked in 8.2 but I had broken it during plancache changes.  DECLARE
      CURSOR is now treated almost exactly like a plain SELECT through parse
      analysis, rewrite, and planning; only just before sending to the executor
      do we divert it away to ProcessUtility.  This requires a special-case check
      in a number of places, but practically all of them were already special-casing
      SELECT INTO, so it's not too ugly.  (Maybe it would be a good idea to merge
      the two by treating IntoClause as a form of utility statement?  Not going to
      worry about that now, though.)  That approach doesn't work for EXPLAIN,
      however, so for that I punted and used a klugy solution of running parse
      analysis an extra time if under extended query protocol.
      bbbe825f
  16. 26 Apr, 2007 1 commit
    • Neil Conway's avatar
      Rename the newly-added commands for discarding session state. · 16efdb5e
      Neil Conway authored
      RESET SESSION, RESET PLANS, and RESET TEMP are now DISCARD ALL,
      DISCARD PLANS, and DISCARD TEMP, respectively. This is to avoid
      confusion with the pre-existing RESET variants: the DISCARD
      commands are not actually similar to RESET. Patch from Marko
      Kreen, with some minor editorialization.
      16efdb5e
  17. 16 Apr, 2007 1 commit
    • Tom Lane's avatar
      Expose more cursor-related functionality in SPI: specifically, allow · 66888f74
      Tom Lane authored
      access to the planner's cursor-related planning options, and provide new
      FETCH/MOVE routines that allow access to the full power of those commands.
      Small refactoring of planner(), pg_plan_query(), and pg_plan_queries()
      APIs to make it convenient to pass the planning options down from SPI.
      
      This is the core-code portion of Pavel Stehule's patch for scrollable
      cursor support in plpgsql; I'll review and apply the plpgsql changes
      separately.
      66888f74
  18. 12 Apr, 2007 1 commit
    • Neil Conway's avatar
      RESET SESSION, plus related new DDL commands. Patch from Marko Kreen, · d13e903b
      Neil Conway authored
      reviewed by Neil Conway. This patch adds the following DDL command
      variants: RESET SESSION, RESET TEMP, RESET PLANS, CLOSE ALL, and
      DEALLOCATE ALL. RESET SESSION is intended for use by connection
      pool software and the like, in order to reset a client session
      to something close to its initial state.
      
      Note that while most of these command variants can be executed
      inside a transaction block (but are not transaction-aware!),
      RESET SESSION cannot. While this is inconsistent, it is intended
      to catch programmer mistakes: RESET SESSION in an open transaction
      block is probably unintended.
      d13e903b
  19. 02 Apr, 2007 1 commit
  20. 19 Mar, 2007 1 commit
    • Jan Wieck's avatar
      Changes pg_trigger and extend pg_rewrite in order to allow triggers and · 0fe16500
      Jan Wieck authored
      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
  21. 13 Mar, 2007 1 commit
    • Tom Lane's avatar
      First phase of plan-invalidation project: create a plan cache management · b9527e98
      Tom Lane authored
      module and teach PREPARE and protocol-level prepared statements to use it.
      In service of this, rearrange utility-statement processing so that parse
      analysis does not assume table schemas can't change before execution for
      utility statements (necessary because we don't attempt to re-acquire locks
      for utility statements when reusing a stored plan).  This requires some
      refactoring of the ProcessUtility API, but it ends up cleaner anyway,
      for instance we can get rid of the QueryContext global.
      
      Still to do: fix up SPI and related code to use the plan cache; I'm tempted to
      try to make SQL functions use it too.  Also, there are at least some aspects
      of system state that we want to ensure remain the same during a replan as in
      the original processing; search_path certainly ought to behave that way for
      instance, and perhaps there are others.
      b9527e98
  22. 20 Feb, 2007 1 commit
    • Tom Lane's avatar
      Remove the Query structure from the executor's API. This allows us to stop · 9cbd0c15
      Tom Lane authored
      storing mostly-redundant Query trees in prepared statements, portals, etc.
      To replace Query, a new node type called PlannedStmt is inserted by the
      planner at the top of a completed plan tree; this carries just the fields of
      Query that are still needed at runtime.  The statement lists kept in portals
      etc. now consist of intermixed PlannedStmt and bare utility-statement nodes
      --- no Query.  This incidentally allows us to remove some fields from Query
      and Plan nodes that shouldn't have been there in the first place.
      
      Still to do: simplify the execution-time range table; at the moment the
      range table passed to the executor still contains Query trees for subqueries.
      
      initdb forced due to change of stored rules.
      9cbd0c15
  23. 03 Feb, 2007 1 commit
  24. 23 Jan, 2007 1 commit
  25. 09 Jan, 2007 1 commit
    • Tom Lane's avatar
      Support ORDER BY ... NULLS FIRST/LAST, and add ASC/DESC/NULLS FIRST/NULLS LAST · 44317582
      Tom Lane authored
      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
  26. 05 Jan, 2007 1 commit
  27. 30 Dec, 2006 1 commit
  28. 23 Dec, 2006 1 commit
    • Tom Lane's avatar
      Restructure operator classes to allow improved handling of cross-data-type · a78fcfb5
      Tom Lane authored
      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
  29. 05 Nov, 2006 1 commit
    • Tom Lane's avatar
      Fix recently-understood problems with handling of XID freezing, particularly · 48188e16
      Tom Lane authored
      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
  30. 13 Oct, 2006 1 commit
  31. 11 Oct, 2006 1 commit
  32. 04 Oct, 2006 1 commit
  33. 05 Sep, 2006 1 commit
    • Tom Lane's avatar
      Get rid of the separate RULE privilege for tables: now only a table's owner · 7bae5a28
      Tom Lane authored
      can create or modify rules for the table.  Do setRuleCheckAsUser() while
      loading rules into the relcache, rather than when defining a rule.  This
      ensures that permission checks for tables referenced in a rule are done with
      respect to the current owner of the rule's table, whereas formerly ALTER TABLE
      OWNER would fail to update the permission checking for associated rules.
      Removal of separate RULE privilege is needed to prevent various scenarios
      in which a grantee of RULE privilege could effectively have any privilege
      of the table owner.  For backwards compatibility, GRANT/REVOKE RULE is still
      accepted, but it doesn't do anything.  Per discussion here:
      http://archives.postgresql.org/pgsql-hackers/2006-04/msg01138.php
      7bae5a28
  34. 03 Sep, 2006 2 commits
  35. 02 Sep, 2006 1 commit
  36. 30 Aug, 2006 1 commit
  37. 25 Aug, 2006 1 commit