Skip to content
Snippets Groups Projects
  1. Jan 07, 2014
  2. Jan 04, 2014
    • Tom Lane's avatar
      Fix typo in comment. · 99299756
      Tom Lane authored
      classifyClauses was renamed to classifyConditions somewhere along the
      line, but this comment didn't get the memo.
      
      Ian Barwick
      99299756
  3. Oct 31, 2013
  4. Aug 18, 2013
    • Tom Lane's avatar
      Fix planner problems with LATERAL references in PlaceHolderVars. · 9e7e29c7
      Tom Lane authored
      The planner largely failed to consider the possibility that a
      PlaceHolderVar's expression might contain a lateral reference to a Var
      coming from somewhere outside the PHV's syntactic scope.  We had a previous
      report of a problem in this area, which I tried to fix in a quick-hack way
      in commit 4da6439b, but Antonin Houska
      pointed out that there were still some problems, and investigation turned
      up other issues.  This patch largely reverts that commit in favor of a more
      thoroughly thought-through solution.  The new theory is that a PHV's
      ph_eval_at level cannot be higher than its original syntactic level.  If it
      contains lateral references, those don't change the ph_eval_at level, but
      rather they create a lateral-reference requirement for the ph_eval_at join
      relation.  The code in joinpath.c needs to handle that.
      
      Another issue is that createplan.c wasn't handling nested PlaceHolderVars
      properly.
      
      In passing, push knowledge of lateral-reference checks for join clauses
      into join_clause_is_movable_to.  This is mainly so that FDWs don't need
      to deal with it.
      
      This patch doesn't fix the original join-qual-placement problem reported by
      Jeremy Evans (and indeed, one of the new regression test cases shows the
      wrong answer because of that).  But the PlaceHolderVar problems need to be
      fixed before that issue can be addressed, so committing this separately
      seems reasonable.
      9e7e29c7
  5. Jun 12, 2013
    • Tom Lane's avatar
      Improve updatability checking for views and foreign tables. · dc3eb563
      Tom Lane authored
      Extend the FDW API (which we already changed for 9.3) so that an FDW can
      report whether specific foreign tables are insertable/updatable/deletable.
      The default assumption continues to be that they're updatable if the
      relevant executor callback function is supplied by the FDW, but finer
      granularity is now possible.  As a test case, add an "updatable" option to
      contrib/postgres_fdw.
      
      This patch also fixes the information_schema views, which previously did
      not think that foreign tables were ever updatable, and fixes
      view_is_auto_updatable() so that a view on a foreign table can be
      auto-updatable.
      
      initdb forced due to changes in information_schema views and the functions
      they rely on.  This is a bit unfortunate to do post-beta1, but if we don't
      change this now then we'll have another API break for FDWs when we do
      change it.
      
      Dean Rasheed, somewhat editorialized on by Tom Lane
      dc3eb563
  6. May 29, 2013
  7. Mar 22, 2013
    • Tom Lane's avatar
      Document cross-version compatibility issues for contrib/postgres_fdw. · 5b86fedf
      Tom Lane authored
      One of the use-cases for postgres_fdw is extracting data from older PG
      servers, so cross-version compatibility is important.  Document what we
      can do here, and further annotate some of the coding choices that create
      compatibility constraints.  In passing, remove one unnecessary
      incompatibility with old servers, namely assuming that we didn't need to
      quote the timezone name 'UTC'.
      5b86fedf
    • Tom Lane's avatar
      Avoid retrieving dummy NULL columns in postgres_fdw. · e690b951
      Tom Lane authored
      This should provide some marginal overall savings, since it surely takes
      many more cycles for the remote server to deal with the NULL columns than
      it takes for postgres_fdw not to emit them.  But really the reason is to
      keep the emitted queries from looking quite so silly ...
      e690b951
    • Tom Lane's avatar
      Redo postgres_fdw's planner code so it can handle parameterized paths. · 9cbc4b80
      Tom Lane authored
      I wasn't going to ship this without having at least some example of how
      to do that.  This version isn't terribly bright; in particular it won't
      consider any combinations of multiple join clauses.  Given the cost of
      executing a remote EXPLAIN, I'm not sure we want to be very aggressive
      about doing that, anyway.
      
      In support of this, refactor generate_implied_equalities_for_indexcol
      so that it can be used to extract equivalence clauses that aren't
      necessarily tied to an index.
      9cbc4b80
  8. Mar 12, 2013
    • Tom Lane's avatar
      Fix contrib/postgres_fdw's handling of column defaults. · 50c19fc7
      Tom Lane authored
      Adopt the position that only locally-defined defaults matter.  Any defaults
      defined in the remote database do not affect insertions performed through
      a foreign table (unless they are for columns not known to the foreign
      table).  While it'd arguably be more useful to permit remote defaults to be
      used, making that work in a consistent fashion requires far more work than
      seems possible for 9.3.
      50c19fc7
    • Tom Lane's avatar
      Fix postgres_fdw's issues with inconsistent interpretation of data values. · cc3f281f
      Tom Lane authored
      For datatypes whose output formatting depends on one or more GUC settings,
      we have to worry about whether the other server will interpret the value
      the same way it was meant.  pg_dump has been aware of this hazard for a
      long time, but postgres_fdw needs to deal with it too.  To fix data
      retrieval from the remote server, set the necessary remote GUC settings at
      connection startup.  (We were already assuming that settings made then
      would persist throughout the remote session.)  To fix data transmission to
      the remote server, temporarily force the relevant GUCs to the right values
      when we're about to convert any data values to text for transmission.
      
      This is all pretty grotty, and not very cheap either.  It's tempting to
      think of defining one uber-GUC that would override any settings that might
      render printed data values unportable.  But of course, older remote servers
      wouldn't know any such thing and would still need this logic.
      
      While at it, revert commit f7951eef, since
      this provides a real fix.  (The timestamptz given in the error message
      returned from the "remote" server will now reliably be shown in UTC.)
      cc3f281f
  9. Mar 10, 2013
    • Tom Lane's avatar
      Support writable foreign tables. · 21734d2f
      Tom Lane authored
      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
  10. Feb 23, 2013
  11. Feb 22, 2013
    • Tom Lane's avatar
      Fix some planning oversights in postgres_fdw. · c0c6acdf
      Tom Lane authored
      Include eval costs of local conditions in remote-estimate mode, and don't
      assume the remote eval cost is zero in local-estimate mode.  (The best
      we can do with that at the moment is to assume a seqscan, which may well
      be wildly pessimistic ... but zero won't do at all.)
      
      To get a reasonable local estimate, we need to know the relpages count
      for the remote rel, so improve the ANALYZE code to fetch that rather
      than just setting the foreign table's relpages field to zero.
      c0c6acdf
    • Tom Lane's avatar
      Get rid of postgres_fdw's assumption that remote type OIDs match ours. · 5fd386bb
      Tom Lane authored
      The only place we depended on that was in sending numeric type OIDs in
      PQexecParams; but we can replace that usage with explicitly casting
      each Param symbol in the query string, so that the types are specified
      to the remote by name not OID.  This makes no immediate difference but
      will be essential if we ever hope to support use of non-builtin types.
      5fd386bb
  12. Feb 21, 2013
    • Tom Lane's avatar
      Add postgres_fdw contrib module. · d0d75c40
      Tom Lane authored
      There's still a lot of room for improvement, but it basically works,
      and we need this to be present before we can do anything much with the
      writable-foreign-tables patch.  So let's commit it and get on with testing.
      
      Shigeru Hanada, reviewed by KaiGai Kohei and Tom Lane
      d0d75c40
Loading