1. 13 4月, 2013 1 次提交
    • T
      Clean up the mess around EXPLAIN and materialized views. · 0b337904
      Tom Lane 提交于
      Revert the matview-related changes in explain.c's API, as per recent
      complaint from Robert Haas.  The reason for these appears to have been
      principally some ill-considered choices around having intorel_startup do
      what ought to be parse-time checking, plus a poor arrangement for passing
      it the view parsetree it needs to store into pg_rewrite when creating a
      materialized view.  Do the latter by having parse analysis stick a copy
      into the IntoClause, instead of doing it at runtime.  (On the whole,
      I seriously question the choice to represent CREATE MATERIALIZED VIEW as a
      variant of SELECT INTO/CREATE TABLE AS, because that means injecting even
      more complexity into what was already a horrid legacy kluge.  However,
      I didn't go so far as to rethink that choice ... yet.)
      
      I also moved several error checks into matview parse analysis, and
      made the check for external Params in a matview more accurate.
      
      In passing, clean things up a bit more around interpretOidsOption(),
      and fix things so that we can use that to force no-oids for views,
      sequences, etc, thereby eliminating the need to cons up "oids = false"
      options when creating them.
      
      catversion bump due to change in IntoClause.  (I wonder though if we
      really need readfuncs/outfuncs support for IntoClause anymore.)
      0b337904
  2. 11 3月, 2013 1 次提交
    • T
      Support writable foreign tables. · 21734d2f
      Tom Lane 提交于
      This patch adds the core-system infrastructure needed to support updates
      on foreign tables, and extends contrib/postgres_fdw to allow updates
      against remote Postgres servers.  There's still a great deal of room for
      improvement in optimization of remote updates, but at least there's basic
      functionality there now.
      
      KaiGai Kohei, reviewed by Alexander Korotkov and Laurenz Albe, and rather
      heavily revised by Tom Lane.
      21734d2f
  3. 04 3月, 2013 1 次提交
    • K
      Add a materialized view relations. · 3bf3ab8c
      Kevin Grittner 提交于
      A materialized view has a rule just like a view and a heap and
      other physical properties like a table.  The rule is only used to
      populate the table, references in queries refer to the
      materialized data.
      
      This is a minimal implementation, but should still be useful in
      many cases.  Currently data is only populated "on demand" by the
      CREATE MATERIALIZED VIEW and REFRESH MATERIALIZED VIEW statements.
      It is expected that future releases will add incremental updates
      with various timings, and that a more refined concept of defining
      what is "fresh" data will be developed.  At some point it may even
      be possible to have queries use a materialized in place of
      references to underlying tables, but that requires the other
      above-mentioned features to be working first.
      
      Much of the documentation work by Robert Haas.
      Review by Noah Misch, Thom Brown, Robert Haas, Marko Tiikkaja
      Security review by KaiGai Kohei, with a decision on how best to
      implement sepgsql still pending.
      3bf3ab8c
  4. 28 2月, 2013 1 次提交
    • H
      Add support for piping COPY to/from an external program. · 3d009e45
      Heikki Linnakangas 提交于
      This includes backend "COPY TO/FROM PROGRAM '...'" syntax, and corresponding
      psql \copy syntax. Like with reading/writing files, the backend version is
      superuser-only, and in the psql version, the program is run in the client.
      
      In the passing, the psql \copy STDIN/STDOUT syntax is subtly changed: if you
      the stdin/stdout is quoted, it's now interpreted as a filename. For example,
      "\copy foo from 'stdin'" now reads from a file called 'stdin', not from
      standard input. Before this, there was no way to specify a filename called
      stdin, stdout, pstdin or pstdout.
      
      This creates a new function in pgport, wait_result_to_str(), which can
      be used to convert the exit status of a process, as returned by wait(3),
      to a human-readable string.
      
      Etsuro Fujita, reviewed by Amit Kapila.
      3d009e45
  5. 23 1月, 2013 1 次提交
    • A
      Improve concurrency of foreign key locking · 0ac5ad51
      Alvaro Herrera 提交于
      This patch introduces two additional lock modes for tuples: "SELECT FOR
      KEY SHARE" and "SELECT FOR NO KEY UPDATE".  These don't block each
      other, in contrast with already existing "SELECT FOR SHARE" and "SELECT
      FOR UPDATE".  UPDATE commands that do not modify the values stored in
      the columns that are part of the key of the tuple now grab a SELECT FOR
      NO KEY UPDATE lock on the tuple, allowing them to proceed concurrently
      with tuple locks of the FOR KEY SHARE variety.
      
      Foreign key triggers now use FOR KEY SHARE instead of FOR SHARE; this
      means the concurrency improvement applies to them, which is the whole
      point of this patch.
      
      The added tuple lock semantics require some rejiggering of the multixact
      module, so that the locking level that each transaction is holding can
      be stored alongside its Xid.  Also, multixacts now need to persist
      across server restarts and crashes, because they can now represent not
      only tuple locks, but also tuple updates.  This means we need more
      careful tracking of lifetime of pg_multixact SLRU files; since they now
      persist longer, we require more infrastructure to figure out when they
      can be removed.  pg_upgrade also needs to be careful to copy
      pg_multixact files over from the old server to the new, or at least part
      of multixact.c state, depending on the versions of the old and new
      servers.
      
      Tuple time qualification rules (HeapTupleSatisfies routines) need to be
      careful not to consider tuples with the "is multi" infomask bit set as
      being only locked; they might need to look up MultiXact values (i.e.
      possibly do pg_multixact I/O) to find out the Xid that updated a tuple,
      whereas they previously were assured to only use information readily
      available from the tuple header.  This is considered acceptable, because
      the extra I/O would involve cases that would previously cause some
      commands to block waiting for concurrent transactions to finish.
      
      Another important change is the fact that locking tuples that have
      previously been updated causes the future versions to be marked as
      locked, too; this is essential for correctness of foreign key checks.
      This causes additional WAL-logging, also (there was previously a single
      WAL record for a locked tuple; now there are as many as updated copies
      of the tuple there exist.)
      
      With all this in place, contention related to tuples being checked by
      foreign key rules should be much reduced.
      
      As a bonus, the old behavior that a subtransaction grabbing a stronger
      tuple lock than the parent (sub)transaction held on a given tuple and
      later aborting caused the weaker lock to be lost, has been fixed.
      
      Many new spec files were added for isolation tester framework, to ensure
      overall behavior is sane.  There's probably room for several more tests.
      
      There were several reviewers of this patch; in particular, Noah Misch
      and Andres Freund spent considerable time in it.  Original idea for the
      patch came from Simon Riggs, after a problem report by Joel Jacobson.
      Most code is from me, with contributions from Marti Raudsepp, Alexander
      Shulgin, Noah Misch and Andres Freund.
      
      This patch was discussed in several pgsql-hackers threads; the most
      important start at the following message-ids:
      	AANLkTimo9XVcEzfiBR-ut3KVNDkjm2Vxh+t8kAmWjPuv@mail.gmail.com
      	1290721684-sup-3951@alvh.no-ip.org
      	1294953201-sup-2099@alvh.no-ip.org
      	1320343602-sup-2290@alvh.no-ip.org
      	1339690386-sup-8927@alvh.no-ip.org
      	4FE5FF020200002500048A3D@gw.wicourts.gov
      	4FEAB90A0200002500048B7D@gw.wicourts.gov
      0ac5ad51
  6. 22 1月, 2013 1 次提交
    • T
      Add infrastructure for storing a VARIADIC ANY function's VARIADIC flag. · 75b39e79
      Tom Lane 提交于
      Originally we didn't bother to mark FuncExprs with any indication whether
      VARIADIC had been given in the source text, because there didn't seem to be
      any need for it at runtime.  However, because we cannot fold a VARIADIC ANY
      function's arguments into an array (since they're not necessarily all the
      same type), we do actually need that information at runtime if VARIADIC ANY
      functions are to respond unsurprisingly to use of the VARIADIC keyword.
      Add the missing field, and also fix ruleutils.c so that VARIADIC ANY
      function calls are dumped properly.
      
      Extracted from a larger patch that also fixes concat() and format() (the
      only two extant VARIADIC ANY functions) to behave properly when VARIADIC is
      specified.  This portion seems appropriate to review and commit separately.
      
      Pavel Stehule
      75b39e79
  7. 02 1月, 2013 1 次提交
  8. 04 10月, 2012 2 次提交
    • T
      Support CREATE SCHEMA IF NOT EXISTS. · fb34e94d
      Tom Lane 提交于
      Per discussion, schema-element subcommands are not allowed together with
      this option, since it's not very obvious what should happen to the element
      objects.
      
      Fabrízio de Royes Mello
      fb34e94d
    • A
      refactor ALTER some-obj SET OWNER implementation · 994c36e0
      Alvaro Herrera 提交于
      Remove duplicate implementation of catalog munging and miscellaneous
      privilege and consistency checks.  Instead rely on already existing data
      in objectaddress.c to do the work.
      
      Author: KaiGai Kohei
      Tweaked by me
      Reviewed by Robert Haas
      994c36e0
  9. 03 10月, 2012 1 次提交
    • A
      Refactor "ALTER some-obj SET SCHEMA" implementation · 2164f9a1
      Alvaro Herrera 提交于
      Instead of having each object type implement the catalog munging
      independently, centralize knowledge about how to do it and expand the
      existing table in objectaddress.c with enough data about each object
      type to support this operation.
      
      Author: KaiGai Kohei
      Tweaks by me
      Reviewed by Robert Haas
      2164f9a1
  10. 23 9月, 2012 1 次提交
    • A
      Allow IF NOT EXISTS when add a new enum label. · 6d12b68c
      Andrew Dunstan 提交于
      If the label is already in the enum the statement becomes a no-op.
      This will reduce the pain that comes from our not allowing this
      operation inside a transaction block.
      
      Andrew Dunstan, reviewed by Tom Lane and Magnus Hagander.
      6d12b68c
  11. 27 8月, 2012 1 次提交
    • T
      Fix up planner infrastructure to support LATERAL properly. · 9ff79b9d
      Tom Lane 提交于
      This patch takes care of a number of problems having to do with failure
      to choose valid join orders and incorrect handling of lateral references
      pulled up from subqueries.  Notable changes:
      
      * Add a LateralJoinInfo data structure similar to SpecialJoinInfo, to
      represent join ordering constraints created by lateral references.
      (I first considered extending the SpecialJoinInfo structure, but the
      semantics are different enough that a separate data structure seems
      better.)  Extend join_is_legal() and related functions to prevent trying
      to form unworkable joins, and to ensure that we will consider joins that
      satisfy lateral references even if the joins would be clauseless.
      
      * Fill in the infrastructure needed for the last few types of relation scan
      paths to support parameterization.  We'd have wanted this eventually
      anyway, but it is necessary now because a relation that gets pulled up out
      of a UNION ALL subquery may acquire a reltargetlist containing lateral
      references, meaning that its paths *have* to be parameterized whether or
      not we have any code that can push join quals down into the scan.
      
      * Compute data about lateral references early in query_planner(), and save
      in RelOptInfo nodes, to avoid repetitive calculations later.
      
      * Assorted corner-case bug fixes.
      
      There's probably still some bugs left, but this is a lot closer to being
      real than it was before.
      9ff79b9d
  12. 08 8月, 2012 1 次提交
    • T
      Implement SQL-standard LATERAL subqueries. · 5ebaaa49
      Tom Lane 提交于
      This patch implements the standard syntax of LATERAL attached to a
      sub-SELECT in FROM, and also allows LATERAL attached to a function in FROM,
      since set-returning function calls are expected to be one of the principal
      use-cases.
      
      The main change here is a rewrite of the mechanism for keeping track of
      which relations are visible for column references while the FROM clause is
      being scanned.  The parser "namespace" lists are no longer lists of bare
      RTEs, but are lists of ParseNamespaceItem structs, which carry an RTE
      pointer as well as some visibility-controlling flags.  Aside from
      supporting LATERAL correctly, this lets us get rid of the ancient hacks
      that required rechecking subqueries and JOIN/ON and function-in-FROM
      expressions for invalid references after they were initially parsed.
      Invalid column references are now always correctly detected on sight.
      
      In passing, remove assorted parser error checks that are now dead code by
      virtue of our having gotten rid of add_missing_from, as well as some
      comments that are obsolete for the same reason.  (It was mainly
      add_missing_from that caused so much fudging here in the first place.)
      
      The planner support for this feature is very minimal, and will be improved
      in future patches.  It works well enough for testing purposes, though.
      
      catversion bump forced due to new field in RangeTblEntry.
      5ebaaa49
  13. 01 8月, 2012 1 次提交
    • T
      Fix WITH attached to a nested set operation (UNION/INTERSECT/EXCEPT). · f6ce81f5
      Tom Lane 提交于
      Parse analysis neglected to cover the case of a WITH clause attached to an
      intermediate-level set operation; it only handled WITH at the top level
      or WITH attached to a leaf-level SELECT.  Per report from Adam Mackler.
      
      In HEAD, I rearranged the order of SelectStmt's fields to put withClause
      with the other fields that can appear on non-leaf SelectStmts.  In back
      branches, leave it alone to avoid a possible ABI break for third-party
      code.
      
      Back-patch to 8.4 where WITH support was added.
      f6ce81f5
  14. 18 7月, 2012 1 次提交
    • R
      Syntax support and documentation for event triggers. · 3855968f
      Robert Haas 提交于
      They don't actually do anything yet; that will get fixed in a
      follow-on commit.  But this gets the basic infrastructure in place,
      including CREATE/ALTER/DROP EVENT TRIGGER; support for COMMENT,
      SECURITY LABEL, and ALTER EXTENSION .. ADD/DROP EVENT TRIGGER;
      pg_dump and psql support; and documentation for the anticipated
      initial feature set.
      
      Dimitri Fontaine, with review and a bunch of additional hacking by me.
      Thom Brown extensively reviewed earlier versions of this patch set,
      but there's not a whole lot of that code left in this commit, as it
      turns out.
      3855968f
  15. 17 7月, 2012 1 次提交
    • T
      Avoid pre-determining index names during CREATE TABLE LIKE parsing. · c92be3c0
      Tom Lane 提交于
      Formerly, when trying to copy both indexes and comments, CREATE TABLE LIKE
      had to pre-assign names to indexes that had comments, because it made up an
      explicit CommentStmt command to apply the comment and so it had to know the
      name for the index.  This creates bad interactions with other indexes, as
      shown in bug #6734 from Daniele Varrazzo: the preassignment logic couldn't
      take any other indexes into account so it could choose a conflicting name.
      
      To fix, add a field to IndexStmt that allows it to carry a comment to be
      assigned to the new index.  (This isn't a user-exposed feature of CREATE
      INDEX, only an internal option.)  Now we don't need preassignment of index
      names in any situation.
      
      I also took the opportunity to refactor DefineIndex to accept the IndexStmt
      as such, rather than passing all its fields individually in a mile-long
      parameter list.
      
      Back-patch to 9.2, but no further, because it seems too dangerous to change
      IndexStmt or DefineIndex's API in released branches.  The bug exists back
      to 9.0 where CREATE TABLE LIKE grew the ability to copy comments, but given
      the lack of prior complaints we'll just let it go unfixed before 9.2.
      c92be3c0
  16. 11 6月, 2012 1 次提交
  17. 21 4月, 2012 1 次提交
    • A
      Recast "ONLY" column CHECK constraints as NO INHERIT · 09ff76fc
      Alvaro Herrera 提交于
      The original syntax wasn't universally loved, and it didn't allow its
      usage in CREATE TABLE, only ALTER TABLE.  It now works everywhere, and
      it also allows using ALTER TABLE ONLY to add an uninherited CHECK
      constraint, per discussion.
      
      The pg_constraint column has accordingly been renamed connoinherit.
      
      This commit partly reverts some of the changes in
      61d81bd2, particularly some pg_dump and
      psql bits, because now pg_get_constraintdef includes the necessary NO
      INHERIT within the constraint definition.
      
      Author: Nikhil Sontakke
      Some tweaks by me
      09ff76fc
  18. 20 4月, 2012 1 次提交
    • T
      Revise parameterized-path mechanism to fix assorted issues. · 5b7b5518
      Tom Lane 提交于
      This patch adjusts the treatment of parameterized paths so that all paths
      with the same parameterization (same set of required outer rels) for the
      same relation will have the same rowcount estimate.  We cache the rowcount
      estimates to ensure that property, and hopefully save a few cycles too.
      Doing this makes it practical for add_path_precheck to operate without
      a rowcount estimate: it need only assume that paths with different
      parameterizations never dominate each other, which is close enough to
      true anyway for coarse filtering, because normally a more-parameterized
      path should yield fewer rows thanks to having more join clauses to apply.
      
      In add_path, we do the full nine yards of comparing rowcount estimates
      along with everything else, so that we can discard parameterized paths that
      don't actually have an advantage.  This fixes some issues I'd found with
      add_path rejecting parameterized paths on the grounds that they were more
      expensive than not-parameterized ones, even though they yielded many fewer
      rows and hence would be cheaper once subsequent joining was considered.
      
      To make the same-rowcounts assumption valid, we have to require that any
      parameterized path enforce *all* join clauses that could be obtained from
      the particular set of outer rels, even if not all of them are useful for
      indexing.  This is required at both base scans and joins.  It's a good
      thing anyway since the net impact is that join quals are checked at the
      lowest practical level in the join tree.  Hence, discard the original
      rather ad-hoc mechanism for choosing parameterization joinquals, and build
      a better one that has a more principled rule for when clauses can be moved.
      The original rule was actually buggy anyway for lack of knowledge about
      which relations are part of an outer join's outer side; getting this right
      requires adding an outer_relids field to RestrictInfo.
      5b7b5518
  19. 18 4月, 2012 2 次提交
  20. 09 4月, 2012 1 次提交
    • T
      Don't bother copying empty support arrays in a zero-column MergeJoin. · d515365a
      Tom Lane 提交于
      The case could not arise when this code was originally written, but it can
      now (since we made zero-column MergeJoins work for the benefit of FULL JOIN
      ON TRUE).  I don't think there is any actual bug here, but we might as well
      treat it consistently with other uses of COPY_POINTER_FIELD().  Per comment
      from Ashutosh Bapat.
      d515365a
  21. 06 4月, 2012 1 次提交
  22. 28 3月, 2012 1 次提交
    • T
      Add some infrastructure for contrib/pg_stat_statements. · a40fa613
      Tom Lane 提交于
      Add a queryId field to Query and PlannedStmt.  This is not used by the
      core backend, except for being copied around at appropriate times.
      It's meant to allow plug-ins to track a particular query forward from
      parse analysis to execution.
      
      The queryId is intentionally not dumped into stored rules (and hence this
      commit doesn't bump catversion).  You could argue that choice either way,
      but it seems better that stored rule strings not have any dependency
      on plug-ins that might or might not be present.
      
      Also, add a post_parse_analyze_hook that gets invoked at the end of
      parse analysis (but only for top-level analysis of complete queries,
      not cases such as analyzing a domain's default-value expression).
      This is mainly meant to be used to compute and assign a queryId,
      but it could have other applications.
      
      Peter Geoghegan
      a40fa613
  23. 20 3月, 2012 1 次提交
    • T
      Restructure SELECT INTO's parsetree representation into CreateTableAsStmt. · 9dbf2b7d
      Tom Lane 提交于
      Making this operation look like a utility statement seems generally a good
      idea, and particularly so in light of the desire to provide command
      triggers for utility statements.  The original choice of representing it as
      SELECT with an IntoClause appendage had metastasized into rather a lot of
      places, unfortunately, so that this patch is a great deal more complicated
      than one might at first expect.
      
      In particular, keeping EXPLAIN working for SELECT INTO and CREATE TABLE AS
      subcommands required restructuring some EXPLAIN-related APIs.  Add-on code
      that calls ExplainOnePlan or ExplainOneUtility, or uses
      ExplainOneQuery_hook, will need adjustment.
      
      Also, the cases PREPARE ... SELECT INTO and CREATE RULE ... SELECT INTO,
      which formerly were accepted though undocumented, are no longer accepted.
      The PREPARE case can be replaced with use of CREATE TABLE AS EXECUTE.
      The CREATE RULE case doesn't seem to have much real-world use (since the
      rule would work only once before failing with "table already exists"),
      so we'll not bother with that one.
      
      Both SELECT INTO and CREATE TABLE AS still return a command tag of
      "SELECT nnnn".  There was some discussion of returning "CREATE TABLE nnnn",
      but for the moment backwards compatibility wins the day.
      
      Andres Freund and Tom Lane
      9dbf2b7d
  24. 10 3月, 2012 1 次提交
    • T
      Revise FDW planning API, again. · b1495393
      Tom Lane 提交于
      Further reflection shows that a single callback isn't very workable if we
      desire to let FDWs generate multiple Paths, because that forces the FDW to
      do all work necessary to generate a valid Plan node for each Path.  Instead
      split the former PlanForeignScan API into three steps: GetForeignRelSize,
      GetForeignPaths, GetForeignPlan.  We had already bit the bullet of breaking
      the 9.1 FDW API for 9.2, so this shouldn't cause very much additional pain,
      and it's substantially more flexible for complex FDWs.
      
      Add an fdw_private field to RelOptInfo so that the new functions can save
      state there rather than possibly having to recalculate information two or
      three times.
      
      In addition, we'd not thought through what would be needed to allow an FDW
      to set up subexpressions of its choice for runtime execution.  We could
      treat ForeignScan.fdw_private as an executable expression but that seems
      likely to break existing FDWs unnecessarily (in particular, it would
      restrict the set of node types allowable in fdw_private to those supported
      by expression_tree_walker).  Instead, invent a separate field fdw_exprs
      which will receive the postprocessing appropriate for expression trees.
      (One field is enough since it can be a list of expressions; also, we assume
      the corresponding expression state tree(s) will be held within fdw_state,
      so we don't need to add anything to ForeignScanState.)
      
      Per review of Hanada Shigeru's pgsql_fdw patch.  We may need to tweak this
      further as we continue to work on that patch, but to me it feels a lot
      closer to being right now.
      b1495393
  25. 06 3月, 2012 1 次提交
    • T
      Redesign PlanForeignScan API to allow multiple paths for a foreign table. · 6b289942
      Tom Lane 提交于
      The original API specification only allowed an FDW to create a single
      access path, which doesn't seem like a terribly good idea in hindsight.
      Instead, move the responsibility for building the Path node and calling
      add_path() into the FDW's PlanForeignScan function.  Now, it can do that
      more than once if appropriate.  There is no longer any need for the
      transient FdwPlan struct, so get rid of that.
      
      Etsuro Fujita, Shigeru Hanada, Tom Lane
      6b289942
  26. 28 2月, 2012 1 次提交
    • A
      ALTER TABLE: skip FK validation when it's safe to do so · cb3a7c2b
      Alvaro Herrera 提交于
      We already skip rewriting the table in these cases, but we still force a
      whole table scan to validate the data.  This can be skipped, and thus
      we can make the whole ALTER TABLE operation just do some catalog touches
      instead of scanning the table, when these two conditions hold:
      
      (a) Old and new pg_constraint.conpfeqop match exactly.  This is actually
      stronger than needed; we could loosen things by way of operator
      families, but it'd require a lot more effort.
      
      (b) The functions, if any, implementing a cast from the foreign type to
      the primary opcintype are the same.  For this purpose, we can consider a
      binary coercion equivalent to an exact type match.  When the opcintype
      is polymorphic, require that the old and new foreign types match
      exactly.  (Since ri_triggers.c does use the executor, the stronger check
      for polymorphic types is no mere future-proofing.  However, no core type
      exercises its necessity.)
      
      Author: Noah Misch
      
      Committer's note: catalog version bumped due to change of the Constraint
      node.  I can't actually find any way to have such a node in a stored
      rule, but given that we have "out" support for them, better be safe.
      cb3a7c2b
  27. 24 1月, 2012 1 次提交
  28. 08 1月, 2012 1 次提交
    • P
      Rename the internal structures of the CREATE TABLE (LIKE ...) facility · db49517c
      Peter Eisentraut 提交于
      The original implementation of this interpreted it as a kind of
      "inheritance" facility and named all the internal structures
      accordingly.  This turned out to be very confusing, because it has
      nothing to do with the INHERITS feature.  So rename all the internal
      parser infrastructure, update the comments, adjust the error messages,
      and split up the regression tests.
      db49517c
  29. 06 1月, 2012 1 次提交
  30. 02 1月, 2012 1 次提交
  31. 23 12月, 2011 1 次提交
    • R
      Add a security_barrier option for views. · 0e4611c0
      Robert Haas 提交于
      When a view is marked as a security barrier, it will not be pulled up
      into the containing query, and no quals will be pushed down into it,
      so that no function or operator chosen by the user can be applied to
      rows not exposed by the view.  Views not configured with this
      option cannot provide robust row-level security, but will perform far
      better.
      
      Patch by KaiGai Kohei; original problem report by Heikki Linnakangas
      (in October 2009!).  Review (in earlier versions) by Noah Misch and
      others.  Design advice by Tom Lane and myself.  Further review and
      cleanup by me.
      0e4611c0
  32. 08 12月, 2011 1 次提交
  33. 25 11月, 2011 1 次提交
    • T
      Fix unsupported options in CREATE TABLE ... AS EXECUTE. · 9ed439a9
      Tom Lane 提交于
      The WITH [NO] DATA option was not supported, nor the ability to specify
      replacement column names; the former limitation wasn't even documented, as
      per recent complaint from Naoya Anzai.  Fix by moving the responsibility
      for supporting these options into the executor.  It actually takes less
      code this way ...
      
      catversion bump due to change in representation of IntoClause, which might
      affect stored rules.
      9ed439a9
  34. 18 11月, 2011 1 次提交
    • R
      Further consolidation of DROP statement handling. · fc6d1006
      Robert Haas 提交于
      This gets rid of an impressive amount of duplicative code, with only
      minimal behavior changes.  DROP FOREIGN DATA WRAPPER now requires object
      ownership rather than superuser privileges, matching the documentation
      we already have.  We also eliminate the historical warning about dropping
      a built-in function as unuseful.  All operations are now performed in the
      same order for all object types handled by dropcmds.c.
      
      KaiGai Kohei, with minor revisions by me
      fc6d1006
  35. 03 11月, 2011 1 次提交
  36. 12 10月, 2011 1 次提交
    • T
      Rearrange the implementation of index-only scans. · a0185461
      Tom Lane 提交于
      This commit changes index-only scans so that data is read directly from the
      index tuple without first generating a faux heap tuple.  The only immediate
      benefit is that indexes on system columns (such as OID) can be used in
      index-only scans, but this is necessary infrastructure if we are ever to
      support index-only scans on expression indexes.  The executor is now ready
      for that, though the planner still needs substantial work to recognize
      the possibility.
      
      To do this, Vars in index-only plan nodes have to refer to index columns
      not heap columns.  I introduced a new special varno, INDEX_VAR, to mark
      such Vars to avoid confusion.  (In passing, this commit renames the two
      existing special varnos to OUTER_VAR and INNER_VAR.)  This allows
      ruleutils.c to handle them with logic similar to what we use for subplan
      reference Vars.
      
      Since index-only scans are now fundamentally different from regular
      indexscans so far as their expression subtrees are concerned, I also chose
      to change them to have their own plan node type (and hence, their own
      executor source file).
      a0185461
  37. 08 10月, 2011 1 次提交
    • T
      Support index-only scans using the visibility map to avoid heap fetches. · a2822fb9
      Tom Lane 提交于
      When a btree index contains all columns required by the query, and the
      visibility map shows that all tuples on a target heap page are
      visible-to-all, we don't need to fetch that heap page.  This patch depends
      on the previous patches that made the visibility map reliable.
      
      There's a fair amount left to do here, notably trying to figure out a less
      chintzy way of estimating the cost of an index-only scan, but the core
      functionality seems ready to commit.
      
      Robert Haas and Ibrar Ahmed, with some previous work by Heikki Linnakangas.
      a2822fb9
  38. 04 9月, 2011 1 次提交
    • T
      Rearrange planner to save the whole PlannerInfo (subroot) for a subquery. · b3aaf908
      Tom Lane 提交于
      Formerly, set_subquery_pathlist and other creators of plans for subqueries
      saved only the rangetable and rowMarks lists from the lower-level
      PlannerInfo.  But there's no reason not to remember the whole PlannerInfo,
      and indeed this turns out to simplify matters in a number of places.
      
      The immediate reason for doing this was so that the subroot will still be
      accessible when we're trying to extract column statistics out of an
      already-planned subquery.  But now that I've done it, it seems like a good
      code-beautification effort in its own right.
      
      I also chose to get rid of the transient subrtable and subrowmark fields in
      SubqueryScan nodes, in favor of having setrefs.c look up the subquery's
      RelOptInfo.  That required changing all the APIs in setrefs.c to pass
      PlannerInfo not PlannerGlobal, which was a large but quite mechanical
      transformation.
      
      One side-effect not foreseen at the beginning is that this finally broke
      inheritance_planner's assumption that replanning the same subquery RTE N
      times would necessarily give interchangeable results each time.  That
      assumption was always pretty risky, but now we really have to make a
      separate RTE for each instance so that there's a place to carry the
      separate subroots.
      b3aaf908