1. 14 Jul, 2021 1 commit
    • Michael Paquier's avatar
      Fix unexpected error messages for various flavors of ALTER TABLE · 0c83eb2e
      Michael Paquier authored
      Some commands of ALTER TABLE could fail with the following error:
      ERROR:  "tab" is of the wrong type
      
      This error is unexpected, as all the code paths leading to
      ATWrongRelkindError() should use a supported set of relkinds to generate
      correct error messages.  This commit closes the gap with such mistakes,
      by adding all the missing relkind combinations.  Tests are added to
      check all the problems found.  Note that some combinations are not used,
      but these are left around as it could have an impact on applications
      relying on this code.
      
      2ed532e has done a much larger refactoring on HEAD to make such error
      messages easier to manage in the long-term, so nothing is needed there.
      
      Author: Kyotaro Horiguchi
      Reviewed-by: Peter Eisentraut, Ahsan Hadi, Michael Paquier
      Discussion: https://postgr.es/m/20210216.181415.368926598204753659.horikyota.ntt@gmail.com
      Backpatch-through: 11
      0c83eb2e
  2. 26 Jun, 2019 1 commit
    • Alvaro Herrera's avatar
      Fix partitioned index creation with foreign partitions · 55ed3def
      Alvaro Herrera authored
      When a partitioned tables contains foreign tables as partitions, it is
      not possible to implement unique or primary key indexes -- but when
      regular indexes are created, there is no reason to do anything other
      than ignoring such partitions.  We were raising errors upon encountering
      the foreign partitions, which is unfriendly and doesn't protect against
      any actual problems.
      
      Relax this restriction so that index creation is allowed on partitioned
      tables containing foreign partitions, becoming a no-op on them.  (We may
      later want to redefine this so that the FDW is told to create the
      indexes on the foreign side.)  This applies to CREATE INDEX, as well as
      ALTER TABLE / ATTACH PARTITION and CREATE TABLE / PARTITION OF.
      
      Backpatch to 11, where indexes on partitioned tables were introduced.
      
      Discussion: https://postgr.es/m/15724-d5a58fa9472eef4f@postgresql.org
      Author: Álvaro Herrera
      Reviewed-by: Amit Langote
      55ed3def
  3. 24 Mar, 2019 1 commit
    • Tom Lane's avatar
      Un-hide most cascaded-drop details in regression test results. · 940311e4
      Tom Lane authored
      Now that the ordering of DROP messages ought to be stable everywhere,
      we should not need these kluges of hiding DETAIL output just to avoid
      unstable ordering.  Hiding it's not great for test coverage, so
      let's undo that where possible.
      
      In a small number of places, it's necessary to leave it in, for
      example because the output might include a variable pg_temp_nnn
      schema name.  I also left things alone in places where the details
      would depend on other regression test scripts, e.g. plpython_drop.sql.
      
      Perhaps buildfarm experience will show this to be a bad idea,
      but if so I'd like to know why.
      
      Discussion: https://postgr.es/m/E1h6eep-0001Mw-Vd@gemulon.postgresql.org
      940311e4
  4. 22 Mar, 2019 1 commit
  5. 21 Mar, 2019 1 commit
  6. 20 Mar, 2019 2 commits
    • Peter Geoghegan's avatar
      Suppress DETAIL output from a foreign_data test. · 7d3bf73a
      Peter Geoghegan authored
      Unstable sort order related to changes to nbtree from commit dd299df8
      can cause two lines of DETAIL output to be in opposite-of-expected
      order.  Suppress the output using the same VERBOSITY hack that is used
      elsewhere in the foreign_data tests.
      
      Note that the same foreign_data.out DETAIL output was mechanically
      updated by commit dd299df8.  Only a few such changes were required,
      though.
      
      Per buildfarm member batfish.
      
      Discussion: https://postgr.es/m/CAH2-WzkCQ_MtKeOpzozj7QhhgP1unXsK8o9DMAFvDqQFEPpkYQ@mail.gmail.com
      7d3bf73a
    • Peter Geoghegan's avatar
      Make heap TID a tiebreaker nbtree index column. · dd299df8
      Peter Geoghegan authored
      Make nbtree treat all index tuples as having a heap TID attribute.
      Index searches can distinguish duplicates by heap TID, since heap TID is
      always guaranteed to be unique.  This general approach has numerous
      benefits for performance, and is prerequisite to teaching VACUUM to
      perform "retail index tuple deletion".
      
      Naively adding a new attribute to every pivot tuple has unacceptable
      overhead (it bloats internal pages), so suffix truncation of pivot
      tuples is added.  This will usually truncate away the "extra" heap TID
      attribute from pivot tuples during a leaf page split, and may also
      truncate away additional user attributes.  This can increase fan-out,
      especially in a multi-column index.  Truncation can only occur at the
      attribute granularity, which isn't particularly effective, but works
      well enough for now.  A future patch may add support for truncating
      "within" text attributes by generating truncated key values using new
      opclass infrastructure.
      
      Only new indexes (BTREE_VERSION 4 indexes) will have insertions that
      treat heap TID as a tiebreaker attribute, or will have pivot tuples
      undergo suffix truncation during a leaf page split (on-disk
      compatibility with versions 2 and 3 is preserved).  Upgrades to version
      4 cannot be performed on-the-fly, unlike upgrades from version 2 to
      version 3.  contrib/amcheck continues to work with version 2 and 3
      indexes, while also enforcing stricter invariants when verifying version
      4 indexes.  These stricter invariants are the same invariants described
      by "3.1.12 Sequencing" from the Lehman and Yao paper.
      
      A later patch will enhance the logic used by nbtree to pick a split
      point.  This patch is likely to negatively impact performance without
      smarter choices around the precise point to split leaf pages at.  Making
      these two mostly-distinct sets of enhancements into distinct commits
      seems like it might clarify their design, even though neither commit is
      particularly useful on its own.
      
      The maximum allowed size of new tuples is reduced by an amount equal to
      the space required to store an extra MAXALIGN()'d TID in a new high key
      during leaf page splits.  The user-facing definition of the "1/3 of a
      page" restriction is already imprecise, and so does not need to be
      revised.  However, there should be a compatibility note in the v12
      release notes.
      
      Author: Peter Geoghegan
      Reviewed-By: Heikki Linnakangas, Alexander Korotkov
      Discussion: https://postgr.es/m/CAH2-WzkVb0Kom=R+88fDFb=JSxZMFvbHVC6Mn9LJ2n=X=kS-Uw@mail.gmail.com
      dd299df8
  7. 21 Nov, 2018 1 commit
    • Andres Freund's avatar
      Remove WITH OIDS support, change oid catalog column visibility. · 578b2297
      Andres Freund authored
      Previously tables declared WITH OIDS, including a significant fraction
      of the catalog tables, stored the oid column not as a normal column,
      but as part of the tuple header.
      
      This special column was not shown by default, which was somewhat odd,
      as it's often (consider e.g. pg_class.oid) one of the more important
      parts of a row.  Neither pg_dump nor COPY included the contents of the
      oid column by default.
      
      The fact that the oid column was not an ordinary column necessitated a
      significant amount of special case code to support oid columns. That
      already was painful for the existing, but upcoming work aiming to make
      table storage pluggable, would have required expanding and duplicating
      that "specialness" significantly.
      
      WITH OIDS has been deprecated since 2005 (commit ff02d0a05280e0).
      Remove it.
      
      Removing includes:
      - CREATE TABLE and ALTER TABLE syntax for declaring the table to be
        WITH OIDS has been removed (WITH (oids[ = true]) will error out)
      - pg_dump does not support dumping tables declared WITH OIDS and will
        issue a warning when dumping one (and ignore the oid column).
      - restoring an pg_dump archive with pg_restore will warn when
        restoring a table with oid contents (and ignore the oid column)
      - COPY will refuse to load binary dump that includes oids.
      - pg_upgrade will error out when encountering tables declared WITH
        OIDS, they have to be altered to remove the oid column first.
      - Functionality to access the oid of the last inserted row (like
        plpgsql's RESULT_OID, spi's SPI_lastoid, ...) has been removed.
      
      The syntax for declaring a table WITHOUT OIDS (or WITH (oids = false)
      for CREATE TABLE) is still supported. While that requires a bit of
      support code, it seems unnecessary to break applications / dumps that
      do not use oids, and are explicit about not using them.
      
      The biggest user of WITH OID columns was postgres' catalog. This
      commit changes all 'magic' oid columns to be columns that are normally
      declared and stored. To reduce unnecessary query breakage all the
      newly added columns are still named 'oid', even if a table's column
      naming scheme would indicate 'reloid' or such.  This obviously
      requires adapting a lot code, mostly replacing oid access via
      HeapTupleGetOid() with access to the underlying Form_pg_*->oid column.
      
      The bootstrap process now assigns oids for all oid columns in
      genbki.pl that do not have an explicit value (starting at the largest
      oid previously used), only oids assigned later by oids will be above
      FirstBootstrapObjectId. As the oid column now is a normal column the
      special bootstrap syntax for oids has been removed.
      
      Oids are not automatically assigned during insertion anymore, all
      backend code explicitly assigns oids with GetNewOidWithIndex(). For
      the rare case that insertions into the catalog via SQL are called for
      the new pg_nextoid() function can be used (which only works on catalog
      tables).
      
      The fact that oid columns on system tables are now normal columns
      means that they will be included in the set of columns expanded
      by * (i.e. SELECT * FROM pg_class will now include the table's oid,
      previously it did not). It'd not technically be hard to hide oid
      column by default, but that'd mean confusing behavior would either
      have to be carried forward forever, or it'd cause breakage down the
      line.
      
      While it's not unlikely that further adjustments are needed, the
      scope/invasiveness of the patch makes it worthwhile to get merge this
      now. It's painful to maintain externally, too complicated to commit
      after the code code freeze, and a dependency of a number of other
      patches.
      
      Catversion bump, for obvious reasons.
      
      Author: Andres Freund, with contributions by John Naylor
      Discussion: https://postgr.es/m/20180930034810.ywp2c7awz7opzcfr@alap3.anarazel.de
      578b2297
  8. 20 Jun, 2018 1 commit
    • Michael Paquier's avatar
      Clarify use of temporary tables within partition trees · 1c7c317c
      Michael Paquier authored
      Since their introduction, partition trees have been a bit lossy
      regarding temporary relations.  Inheritance trees respect the following
      patterns:
      1) a child relation can be temporary if the parent is permanent.
      2) a child relation can be temporary if the parent is temporary.
      3) a child relation cannot be permanent if the parent is temporary.
      4) The use of temporary relations also imply that when both parent and
      child need to be from the same sessions.
      
      Partitions share many similar patterns with inheritance, however the
      handling of the partition bounds make the situation a bit tricky for
      case 1) as the partition code bases a lot of its lookup code upon
      PartitionDesc which does not really look after relpersistence.  This
      causes for example a temporary partition created by session A to be
      visible by another session B, preventing this session B to create an
      extra partition which overlaps with the temporary one created by A with
      a non-intuitive error message.  There could be use-cases where mixing
      permanent partitioned tables with temporary partitions make sense, but
      that would be a new feature.  Partitions respect 2), 3) and 4) already.
      
      It is a bit depressing to see those error checks happening in
      MergeAttributes() whose purpose is different, but that's left as future
      refactoring work.
      
      Back-patch down to 10, which is where partitioning has been introduced,
      except that default partitions do not apply there.  Documentation also
      includes limitations related to the use of temporary tables with
      partition trees.
      
      Reported-by: David Rowley
      Author: Amit Langote, Michael Paquier
      Reviewed-by: Ashutosh Bapat, Amit Langote, Michael Paquier
      Discussion: https://postgr.es/m/CAKJS1f94Ojk0og9GMkRHGt8wHTW=ijq5KzJKuoBoqWLwSVwGmw@mail.gmail.com
      1c7c317c
  9. 14 May, 2018 1 commit
    • Alvaro Herrera's avatar
      Don't allow partitioned index on foreign-table partitions · 4eaa5372
      Alvaro Herrera authored
      Creating indexes on foreign tables is already forbidden, but local
      partitioned indexes (commit 8b08f7d4) forgot to check for them.  Add
      a preliminary check to prevent wasting time.
      
      Another school of thought says to allow the index to be created if it's
      not a unique index; but it's possible to do better in the future (enable
      indexing of foreign tables, somehow), so we avoid painting ourselves in
      a corner by rejecting all cases, to avoid future grief (a.k.a. backward
      incompatible changes).
      
      Reported-by: Arseny Sher
      Author: Amit Langote, Álvaro Herrera
      Discussion: https://postgr.es/m/87sh71cakz.fsf@ars-thinkpad
      4eaa5372
  10. 15 Mar, 2018 1 commit
    • Tom Lane's avatar
      Clean up duplicate table and function names in regression tests. · 2cf8c7aa
      Tom Lane authored
      Many of the objects we create during the regression tests are put in the
      public schema, so that using the same names in different regression tests
      creates a hazard of test failures if any two such scripts run concurrently.
      This patch cleans up a bunch of latent hazards of that sort, as well as two
      live hazards.
      
      The current situation in this regard is far worse than it was a year or two
      back, because practically all of the partitioning-related test cases have
      reused table names with enthusiasm.  I despaired of cleaning up that mess
      within the five most-affected tests (create_table, alter_table, insert,
      update, inherit); fortunately those don't run concurrently.
      
      Other than partitioning problems, most of the issues boil down to using
      names like "foo", "bar", "tmp", etc, without thought for the fact that
      other test scripts might use similar names concurrently.  I've made an
      effort to make all such names more specific.
      
      One of the live hazards was that commit 7421f4b8 caused with.sql to
      create a table named "test", conflicting with a similarly-named table
      in alter_table.sql; this was exposed in the buildfarm recently.
      The other one was that join.sql and transactions.sql both create tables
      named "foo" and "bar"; but join.sql's uses of those names date back
      only to December or so.
      
      Since commit 7421f4b8 was back-patched to v10, back-patch a minimal
      fix for that problem.  The rest of this is just future-proofing.
      
      Discussion: https://postgr.es/m/4627.1521070268@sss.pgh.pa.us
      2cf8c7aa
  11. 15 Sep, 2017 1 commit
  12. 07 Aug, 2017 1 commit
    • Noah Misch's avatar
      Again match pg_user_mappings to information_schema.user_mapping_options. · e568e1ee
      Noah Misch authored
      Commit 3eefc510 claimed to make
      pg_user_mappings enforce the qualifications user_mapping_options had
      been enforcing, but its removal of a longstanding restriction left them
      distinct when the current user is the subject of a mapping yet has no
      server privileges.  user_mapping_options emits no rows for such a
      mapping, but pg_user_mappings includes full umoptions.  Change
      pg_user_mappings to show null for umoptions.  Back-patch to 9.2, like
      the above commit.
      
      Reviewed by Tom Lane.  Reported by Jeff Janes.
      
      Security: CVE-2017-7547
      e568e1ee
  13. 10 May, 2017 1 commit
  14. 08 May, 2017 1 commit
    • Noah Misch's avatar
      Match pg_user_mappings limits to information_schema.user_mapping_options. · 3eefc510
      Noah Misch authored
      Both views replace the umoptions field with NULL when the user does not
      meet qualifications to see it.  They used different qualifications, and
      pg_user_mappings documented qualifications did not match its implemented
      qualifications.  Make its documentation and implementation match those
      of user_mapping_options.  One might argue for stronger qualifications,
      but these have long, documented tenure.  pg_user_mappings has always
      exhibited this problem, so back-patch to 9.2 (all supported versions).
      
      Michael Paquier and Feike Steenbergen.  Reviewed by Jeff Janes.
      Reported by Andrew Wheelwright.
      
      Security: CVE-2017-7486
      3eefc510
  15. 20 Mar, 2017 1 commit
  16. 08 Mar, 2017 1 commit
  17. 17 Jul, 2016 1 commit
    • Tom Lane's avatar
      Establish conventions about global object names used in regression tests. · 18555b13
      Tom Lane authored
      To ensure that "make installcheck" can be used safely against an existing
      installation, we need to be careful about what global object names
      (database, role, and tablespace names) we use; otherwise we might
      accidentally clobber important objects.  There's been a weak consensus that
      test databases should have names including "regression", and that test role
      names should start with "regress_", but we didn't have any particular rule
      about tablespace names; and neither of the other rules was followed with
      any consistency either.
      
      This commit moves us a long way towards having a hard-and-fast rule that
      regression test databases must have names including "regression", and that
      test role and tablespace names must start with "regress_".  It's not
      completely there because I did not touch some test cases in rolenames.sql
      that test creation of special role names like "session_user".  That will
      require some rethinking of exactly what we want to test, whereas the intent
      of this patch is just to hit all the cases in which the needed renamings
      are cosmetic.
      
      There is no enforcement mechanism in this patch either, but if we don't
      add one we can expect that the tests will soon be violating the convention
      again.  Again, that's not such a cosmetic change and it will require
      discussion.  (But I did use a quick-hack enforcement patch to find these
      cases.)
      
      Discussion: <16638.1468620817@sss.pgh.pa.us>
      18555b13
  18. 11 Dec, 2015 1 commit
    • Alvaro Herrera's avatar
      For REASSIGN OWNED for foreign user mappings · 8c161553
      Alvaro Herrera authored
      As reported in bug #13809 by Alexander Ashurkov, the code for REASSIGN
      OWNED hadn't gotten word about user mappings.  Deal with them in the
      same way default ACLs do, which is to ignore them altogether; they are
      handled just fine by DROP OWNED.  The other foreign object cases are
      already handled correctly by both commands.
      
      Also add a REASSIGN OWNED statement to foreign_data test to exercise the
      foreign data objects.  (The changes are just before the "cleanup" phase,
      so it shouldn't remove any existing live test.)
      
      Reported by Alexander Ashurkov, then independently by Jaime Casanova.
      8c161553
  19. 22 Mar, 2015 1 commit
    • Tom Lane's avatar
      Allow foreign tables to participate in inheritance. · cb1ca4d8
      Tom Lane authored
      Foreign tables can now be inheritance children, or parents.  Much of the
      system was already ready for this, but we had to fix a few things of
      course, mostly in the area of planner and executor handling of row locks.
      
      As side effects of this, allow foreign tables to have NOT VALID CHECK
      constraints (and hence to accept ALTER ... VALIDATE CONSTRAINT), and to
      accept ALTER SET STORAGE and ALTER SET WITH/WITHOUT OIDS.  Continuing to
      disallow these things would've required bizarre and inconsistent special
      cases in inheritance behavior.  Since foreign tables don't enforce CHECK
      constraints anyway, a NOT VALID one is a complete no-op, but that doesn't
      mean we shouldn't allow it.  And it's possible that some FDWs might have
      use for SET STORAGE or SET WITH OIDS, though doubtless they will be no-ops
      for most.
      
      An additional change in support of this is that when a ModifyTable node
      has multiple target tables, they will all now be explicitly identified
      in EXPLAIN output, for example:
      
       Update on pt1  (cost=0.00..321.05 rows=3541 width=46)
         Update on pt1
         Foreign Update on ft1
         Foreign Update on ft2
         Update on child3
         ->  Seq Scan on pt1  (cost=0.00..0.00 rows=1 width=46)
         ->  Foreign Scan on ft1  (cost=100.00..148.03 rows=1170 width=46)
         ->  Foreign Scan on ft2  (cost=100.00..148.03 rows=1170 width=46)
         ->  Seq Scan on child3  (cost=0.00..25.00 rows=1200 width=46)
      
      This was done mainly to provide an unambiguous place to attach "Remote SQL"
      fields, but it is useful for inherited updates even when no foreign tables
      are involved.
      
      Shigeru Hanada and Etsuro Fujita, reviewed by Ashutosh Bapat and Kyotaro
      Horiguchi, some additional hacking by me
      cb1ca4d8
  20. 17 Dec, 2014 1 commit
    • Tom Lane's avatar
      Allow CHECK constraints to be placed on foreign tables. · fc2ac1fb
      Tom Lane authored
      As with NOT NULL constraints, we consider that such constraints are merely
      reports of constraints that are being enforced by the remote server (or
      other underlying storage mechanism).  Their only real use is to allow
      planner optimizations, for example in constraint-exclusion checks.  Thus,
      the code changes here amount to little more than removal of the error that
      was formerly thrown for applying CHECK to a foreign table.
      
      (In passing, do a bit of cleanup of the ALTER FOREIGN TABLE reference page,
      which had accumulated some weird decisions about ordering etc.)
      
      Shigeru Hanada and Etsuro Fujita, reviewed by Kyotaro Horiguchi and
      Ashutosh Bapat.
      fc2ac1fb
  21. 10 Jul, 2014 1 commit
    • Tom Lane's avatar
      Implement IMPORT FOREIGN SCHEMA. · 59efda3e
      Tom Lane authored
      This command provides an automated way to create foreign table definitions
      that match remote tables, thereby reducing tedium and chances for error.
      In this patch, we provide the necessary core-server infrastructure and
      implement the feature fully in the postgres_fdw foreign-data wrapper.
      Other wrappers will throw a "feature not supported" error until/unless
      they are updated.
      
      Ronan Dunklau and Michael Paquier, additional work by me
      59efda3e
  22. 23 Mar, 2014 1 commit
    • Noah Misch's avatar
      Offer triggers on foreign tables. · 7cbe57c3
      Noah Misch authored
      This covers all the SQL-standard trigger types supported for regular
      tables; it does not cover constraint triggers.  The approach for
      acquiring the old row mirrors that for view INSTEAD OF triggers.  For
      AFTER ROW triggers, we spool the foreign tuples to a tuplestore.
      
      This changes the FDW API contract; when deciding which columns to
      populate in the slot returned from data modification callbacks, writable
      FDWs will need to check for AFTER ROW triggers in addition to checking
      for a RETURNING clause.
      
      In support of the feature addition, refactor the TriggerFlags bits and
      the assembly of old tuples in ModifyTable.
      
      Ronan Dunklau, reviewed by KaiGai Kohei; some additional hacking by me.
      7cbe57c3
  23. 12 Mar, 2013 1 commit
    • Tom Lane's avatar
      Allow default expressions to be attached to columns of foreign tables. · a0c6dfee
      Tom Lane authored
      There's still some discussion about exactly how postgres_fdw ought to
      handle this case, but there seems no debate that we want to allow defaults
      to be used for inserts into foreign tables.  So remove the core-code
      restrictions that prevented it.
      
      While at it, get rid of the special grammar productions for CREATE FOREIGN
      TABLE, and instead add explicit FEATURE_NOT_SUPPORTED error checks for the
      disallowed cases.  This makes the grammar a shade smaller, and more
      importantly results in much more intelligible error messages for
      unsupported cases.  It's also one less thing to fix if we ever start
      supporting constraints on foreign tables.
      a0c6dfee
  24. 15 May, 2012 1 commit
  25. 06 Apr, 2012 1 commit
    • Tom Lane's avatar
      Allow statistics to be collected for foreign tables. · 263d9de6
      Tom Lane authored
      ANALYZE now accepts foreign tables and allows the table's FDW to control
      how the sample rows are collected.  (But only manual ANALYZEs will touch
      foreign tables, for the moment, since among other things it's not very
      clear how to handle remote permissions checks in an auto-analyze.)
      
      contrib/file_fdw is extended to support this.
      
      Etsuro Fujita, reviewed by Shigeru Hanada, some further tweaking by me.
      263d9de6
  26. 27 Jan, 2012 1 commit
    • Peter Eisentraut's avatar
      Show default privileges in information schema · b376ec6f
      Peter Eisentraut authored
      Hitherto, the information schema only showed explicitly granted
      privileges that were visible in the *acl catalog columns.  If no
      privileges had been granted, the implicit privileges were not shown.
      
      To fix that, add an SQL-accessible version of the acldefault()
      function, and use that inside the aclexplode() calls to substitute the
      catalog-specific default privilege set for null values.
      
      reviewed by Abhijit Menon-Sen
      b376ec6f
  27. 23 Jan, 2012 1 commit
  28. 15 Dec, 2011 1 commit
  29. 09 Dec, 2011 1 commit
  30. 18 Nov, 2011 1 commit
    • Robert Haas's avatar
      Further consolidation of DROP statement handling. · fc6d1006
      Robert Haas authored
      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
  31. 10 Oct, 2011 1 commit
  32. 25 Aug, 2011 1 commit
  33. 05 Aug, 2011 1 commit
  34. 04 Jul, 2011 1 commit
  35. 25 Apr, 2011 1 commit
  36. 01 Apr, 2011 1 commit
    • Robert Haas's avatar
      Support comments on FOREIGN DATA WRAPPER and SERVER objects. · 50533a6d
      Robert Haas authored
      This mostly involves making it work with the objectaddress.c framework,
      which does most of the heavy lifting.  In that vein, change
      GetForeignDataWrapperOidByName to get_foreign_data_wrapper_oid and
      GetForeignServerOidByName to get_foreign_server_oid, to match the
      pattern we use for other object types.
      
      Robert Haas and Shigeru Hanada
      50533a6d
  37. 19 Feb, 2011 1 commit
    • Tom Lane's avatar
      Create the catalog infrastructure for foreign-data-wrapper handlers. · 327e0250
      Tom Lane authored
      Add a fdwhandler column to pg_foreign_data_wrapper, plus HANDLER options
      in the CREATE FOREIGN DATA WRAPPER and ALTER FOREIGN DATA WRAPPER commands,
      plus pg_dump support for same.  Also invent a new pseudotype fdw_handler
      with properties similar to language_handler.
      
      This is split out of the "FDW API" patch for ease of review; it's all stuff
      we will certainly need, regardless of any other details of the FDW API.
      FDW handler functions will not actually get called yet.
      
      In passing, fix some omissions and infelicities in foreigncmds.c.
      
      Shigeru Hanada, Jan Urbanski, Heikki Linnakangas
      327e0250
  38. 06 Feb, 2011 1 commit
    • Robert Haas's avatar
      Tighten ALTER FOREIGN TABLE .. SET DATA TYPE checks. · 65377e0b
      Robert Haas authored
      If the foreign table's rowtype is being used as the type of a column in
      another table, we can't just up and change its data type.  This was
      already checked for composite types and ordinary tables, but we
      previously failed to enforce it for foreign tables.
      65377e0b
  39. 02 Jan, 2011 1 commit
    • Robert Haas's avatar
      Basic foreign table support. · 0d692a0d
      Robert Haas authored
      Foreign tables are a core component of SQL/MED.  This commit does
      not provide a working SQL/MED infrastructure, because foreign tables
      cannot yet be queried.  Support for foreign table scans will need to
      be added in a future patch.  However, this patch creates the necessary
      system catalog structure, syntax support, and support for ancillary
      operations such as COMMENT and SECURITY LABEL.
      
      Shigeru Hanada, heavily revised by Robert Haas
      0d692a0d