Skip to content
Snippets Groups Projects
  1. May 29, 2013
  2. May 16, 2013
    • Tom Lane's avatar
      Allow CREATE FOREIGN TABLE to include SERIAL columns. · b1420686
      Tom Lane authored
      The behavior is that the required sequence is created locally, which is
      appropriate because the default expression will be evaluated locally.
      Per gripe from Brad Nicholson that this case was refused with a confusing
      error message.  We could have improved the error message but it seems
      better to just allow the case.
      
      Also, remove ALTER TABLE's arbitrary prohibition against being applied to
      foreign tables, which was pretty inconsistent considering we allow it for
      views, sequences, and other relation types that aren't even called tables.
      This is needed to avoid breaking pg_dump, which sometimes emits column
      defaults using separate ALTER TABLE commands.  (I think this can happen
      even when the default is not associated with a sequence, so that was a
      pre-existing bug once we allowed column defaults for foreign tables.)
      b1420686
  3. 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
  4. Mar 14, 2013
    • Tom Lane's avatar
      Introduce less-bogus handling of collations in contrib/postgres_fdw. · ed3ddf91
      Tom Lane authored
      Treat expressions as being remotely executable only if all collations used
      in them are determined by Vars of the foreign table.  This means that, if
      the foreign server gets different answers than we do, it's the user's fault
      for not having marked the foreign table columns with collations equivalent
      to the remote table's.  This rule allows most simple expressions such as
      "var < 'constant'" to be sent to the remote side, because the constant
      isn't determining the collation (the Var's collation would win).  There's
      still room for improvement, but it's hard to see how to do it without a
      lot more knowledge and/or assumptions about what the remote side will do.
      ed3ddf91
  5. 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
      Avoid row-processing-order dependency in postgres_fdw regression test. · 0247d43d
      Tom Lane authored
      A test intended to provoke an error on the remote side was coded in such
      a way that multiple rows should be updated, so the output would vary
      depending on which one was processed first.  Per buildfarm.
      0247d43d
    • 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
  6. Mar 11, 2013
  7. Mar 10, 2013
    • Tom Lane's avatar
      Band-aid for regression test expected-results problem with timestamptz. · f7951eef
      Tom Lane authored
      We probably need to tell the remote server to use specific timezone and
      datestyle settings, and maybe other things.  But for now let's just hack
      the postgres_fdw regression test to not provoke failures when run in
      non-EST5EDT environments.  Per buildfarm.
      f7951eef
    • 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
  8. Feb 23, 2013
  9. 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
      Fix whole-row references in postgres_fdw. · 6da378db
      Tom Lane authored
      The optimization to not retrieve unnecessary columns wasn't smart enough.
      Noted by Thom Brown.
      6da378db
    • Tom Lane's avatar
      Change postgres_fdw to show casts as casts, not underlying function calls. · 211e157a
      Tom Lane authored
      On reflection this method seems to be exposing an unreasonable amount of
      implementation detail.  It wouldn't matter when talking to a remote server
      of the identical Postgres version, but it seems likely to make things worse
      not better if the remote is a different version with different casting
      infrastructure.  Instead adopt ruleutils.c's policy of regurgitating the
      cast as it was originally specified; including not showing it at all, if
      it was implicit to start with.  (We must do that because for some datatypes
      explicit and implicit casts have different semantics.)
      211e157a
    • 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
    • Tom Lane's avatar
      Adjust postgres_fdw's search path handling. · 6d060494
      Tom Lane authored
      Set the remote session's search path to exactly "pg_catalog" at session
      start, then schema-qualify only names that aren't in that schema.  This
      greatly reduces clutter in the generated SQL commands, as seen in the
      regression test changes.  Per discussion.
      
      Also, rethink use of FirstNormalObjectId as the "built-in object" cutoff
      --- FirstBootstrapObjectId is safer, since the former will accept
      objects in information_schema for instance.
      6d060494
  10. Feb 21, 2013
Loading