1. 12 2月, 2016 1 次提交
    • H
      Remove unnecessary #includes. · 9aa7a22f
      Heikki Linnakangas 提交于
      In cdbcat.h, include only the header files that are actually needed for
      the single function prototype in that file. And don't include cdbcat.h
      unnecessarily. A couple of .c files were including cdbcat.h to get
      GpPolicy, but that's actually defined in catalog/gp_policy.h, so #include
      that directly instead where needed.
      9aa7a22f
  2. 08 2月, 2016 1 次提交
  3. 19 1月, 2016 1 次提交
  4. 18 1月, 2016 1 次提交
  5. 12 1月, 2016 1 次提交
    • H
      Make functions in gp_toolkit to execute on all nodes as intended. · 246f7510
      Heikki Linnakangas 提交于
      Moving the installation of gp_toolkit.sql into initdb, in commit f8910c3c,
      broke all the functions that are supposed to execute on all nodes, like
      gp_toolkit.__gp_localid. After that change, gp_toolkit.sql was executed
      in utility mode, and the gp_distribution_policy entries for those functions
      were not created as a result.
      
      To fix, change the code so that gp_distribution_policy entries are never
      never created, or consulted, for EXECUTE-type external tables. They have
      more fine-grained information in pg_exttable.location field anyway, so rely
      on that instead. With this change, there is no difference in whether an
      EXECUTE-type external table is created in utility mode or not. We would
      still have similar problems if gp_toolkit contained other kinds of
      external tables, but it doesn't.
      
      This removes the isMasterOnly() function and changes all its callers to
      call GpPolicyFetch() directly instead. Some places used GpPolicyFetch()
      directly to check if a table is distributed, so this just makes that the
      canonical way to do it. The check for system schemas that used to be in
      isMasterOnly() are no longer performed, but they should've unnecessary in
      the first place. System tables don't have gp_distribution_policy entries,
      so they'll be treated as master-only even without that check.
      246f7510
  6. 07 1月, 2016 1 次提交
  7. 30 12月, 2015 1 次提交
  8. 11 12月, 2015 1 次提交
    • H
      Rename local variables to 'typename', to match upstream. · 14b78f40
      Heikki Linnakangas 提交于
      These were renamed to 'typname' in GPDB a long time ago because 'typename'
      is a reserved keyword in C++. That's a valid concern for header files that
      need to be included in C++ code (like src/backend/gpopt), but it's not
      necessary for local variables that appear in .c files, as long as we're
      careful to compile those files as C code, not C++. So rename local
      variables back to 'typename', to reduce diff vs. upstream and make merging
      slightly easier.
      
      In the upstream header files, the 'typename' fields were renamed to
      'typeName', in a later PostgreSQL version. In GPDB, we've renamed them
      to 'typname' instead. Would be good to adopt the upstream naming at some
      point, but not in this patch.
      14b78f40
  9. 02 12月, 2015 1 次提交
  10. 19 11月, 2015 1 次提交
    • H
      Remove gp_upgrade_mode and related machinery. · d9b60cd2
      Heikki Linnakangas 提交于
      The current plan is to use something like pg_upgrade for future in-place
      upgrades. The gpupgrade mechanism will not scale to the kind of drastic
      catalog and other data directory layout changes that are coming as we
      merge with later PostgreSQL releases.
      
      Kept gpupgrademirror for now. Need to check if there's some logic that's
      worth saving, for a possible pg_upgrade based solution later.
      d9b60cd2
  11. 18 11月, 2015 1 次提交
    • H
      Remove back-ported partial FDW support. · 601c58c3
      Heikki Linnakangas 提交于
      It was just syntax and catalogs, you couldn't actually do anything useful
      with it. Remove it, so that we have less code to maintain, until it's time
      to merge this stuff from upstream again when we merge with PostgreSQL 8.4.
      It's probably easier to merge this back at that point than maintain this
      backported version in the meanwhile. Less effort now, until we reach that
      point, and once we get to the point in 8.4 that we merge this in, we'll
      have all the preceding patches applied already, so it should merge quite
      smoothly.
      601c58c3
  12. 07 11月, 2015 1 次提交
  13. 05 11月, 2015 1 次提交
  14. 03 11月, 2015 1 次提交
    • A
      DROP TABLE should look up the name again, if blocked. · 4739cd22
      Asim Praveen 提交于
      If DROP has to wait for a lock on the relation after its OID was looked up, it
      may happen that the name is no longer valid by the time DROP acquires the lock.
      
      This case is handled by pulling a function from upstream commit
      	commit 4240e429
      	Author: Robert Haas <rhaas@postgresql.org>
      	Date:   Fri Jul 8 22:19:30 2011 -0400
      	Try to acquire relation locks in RangeVarGetRelid.
      4739cd22
  15. 30 10月, 2015 1 次提交
  16. 28 10月, 2015 1 次提交
  17. 14 2月, 2007 1 次提交
    • T
      Fix up foreign-key mechanism so that there is a sound semantic basis for the · 7bddca34
      Tom Lane 提交于
      equality checks it applies, instead of a random dependence on whatever
      operators might be named "=".  The equality operators will now be selected
      from the opfamily of the unique index that the FK constraint depends on to
      enforce uniqueness of the referenced columns; therefore they are certain to be
      consistent with that index's notion of equality.  Among other things this
      should fix the problem noted awhile back that pg_dump may fail for foreign-key
      constraints on user-defined types when the required operators aren't in the
      search path.  This also means that the former warning condition about "foreign
      key constraint will require costly sequential scans" is gone: if the
      comparison condition isn't indexable then we'll reject the constraint
      entirely. All per past discussions.
      
      Along the way, make the RI triggers look into pg_constraint for their
      information, instead of using pg_trigger.tgargs; and get rid of the always
      error-prone fixed-size string buffers in ri_triggers.c in favor of building up
      the RI queries in StringInfo buffers.
      
      initdb forced due to columns added to pg_constraint and pg_trigger.
      7bddca34
  18. 02 2月, 2007 1 次提交
    • T
      Repair failure to check that a table is still compatible with a previously · 5413eef8
      Tom Lane 提交于
      made query plan.  Use of ALTER COLUMN TYPE creates a hazard for cached
      query plans: they could contain Vars that claim a column has a different
      type than it now has.  Fix this by checking during plan startup that Vars
      at relation scan level match the current relation tuple descriptor.  Since
      at that point we already have at least AccessShareLock, we can be sure the
      column type will not change underneath us later in the query.  However,
      since a backend's locks do not conflict against itself, there is still a
      hole for an attacker to exploit: he could try to execute ALTER COLUMN TYPE
      while a query is in progress in the current backend.  Seal that hole by
      rejecting ALTER TABLE whenever the target relation is already open in
      the current backend.
      
      This is a significant security hole: not only can one trivially crash the
      backend, but with appropriate misuse of pass-by-reference datatypes it is
      possible to read out arbitrary locations in the server process's memory,
      which could allow retrieving database content the user should not be able
      to see.  Our thanks to Jeff Trout for the initial report.
      
      Security: CVE-2007-0556
      5413eef8
  19. 25 1月, 2007 2 次提交
  20. 06 1月, 2007 1 次提交
  21. 04 1月, 2007 1 次提交
    • T
      Clean up smgr.c/md.c APIs as per discussion a couple months ago. Instead of · ef072219
      Tom Lane 提交于
      having md.c return a success/failure boolean to smgr.c, which was just going
      to elog anyway, let md.c issue the elog messages itself.  This allows better
      error reporting, particularly in cases such as "short read" or "short write"
      which Peter was complaining of.  Also, remove the kluge of allowing mdread()
      to return zeroes from a read-beyond-EOF: this is now an error condition
      except when InRecovery or zero_damaged_pages = true.  (Hash indexes used to
      require that behavior, but no more.)  Also, enforce that mdwrite() is to be
      used for rewriting existing blocks while mdextend() is to be used for
      extending the relation EOF.  This restriction lets us get rid of the old
      ad-hoc defense against creating huge files by an accidental reference to
      a bogus block number: we'll only create new segments in mdextend() not
      mdwrite() or mdread().  (Again, when InRecovery we allow it anyway, since
      we need to allow updates of blocks that were later truncated away.)
      Also, clean up the original makeshift patch for bug #2737: move the
      responsibility for padding relation segments to full length into md.c.
      ef072219
  22. 31 12月, 2006 1 次提交
  23. 23 12月, 2006 1 次提交
    • T
      Restructure operator classes to allow improved handling of cross-data-type · a78fcfb5
      Tom Lane 提交于
      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
  24. 14 10月, 2006 1 次提交
  25. 12 10月, 2006 1 次提交
  26. 07 10月, 2006 1 次提交
  27. 04 10月, 2006 1 次提交
  28. 05 9月, 2006 1 次提交
  29. 25 8月, 2006 1 次提交
  30. 21 8月, 2006 1 次提交
    • T
      Fix all known problems with pg_dump's handling of serial sequences · 2b2a5072
      Tom Lane 提交于
      by abandoning the idea that it should say SERIAL in the dump.  Instead,
      dump serial sequences and column defaults just like regular ones.
      Add a new backend command ALTER SEQUENCE OWNED BY to let pg_dump recreate
      the sequence-to-column dependency that was formerly created "behind the
      scenes" by SERIAL.  This restores SERIAL to being truly "just a macro"
      consisting of component operations that can be stated explicitly in SQL.
      Furthermore, the new command allows sequence ownership to be reassigned,
      so that old mistakes can be cleaned up.
      
      Also, downgrade the OWNED-BY dependency from INTERNAL to AUTO, since there
      is no longer any very compelling argument why the sequence couldn't be
      dropped while keeping the column.  (This forces initdb, to be sure the
      right kinds of dependencies are in there.)
      
      Along the way, add checks to prevent ALTER OWNER or SET SCHEMA on an
      owned sequence; you can now only do this indirectly by changing the
      owning table's owner or schema.  This is an oversight in previous
      releases, but probably not worth back-patching.
      2b2a5072
  31. 04 8月, 2006 1 次提交
    • T
      Cause ALTER TABLE to perform ALTER COLUMN DROP DEFAULT operations during · 7946f772
      Tom Lane 提交于
      the DROP pass rather than the ADD_CONSTR pass.  On examining the code I
      think this was just an oversight rather than intentional, and it seems
      to satisfy the principle of least surprise better than the alternative
      solution that was discussed.  Add an example to the ref page showing how
      to do ALTER TYPE and update the default in one command.  Per gripe from
      Markus Bertheau that that wasn't possible.
      7946f772
  32. 01 8月, 2006 1 次提交
    • T
      Change the relation_open protocol so that we obtain lock on a relation · 09d3670d
      Tom Lane 提交于
      (table or index) before trying to open its relcache entry.  This fixes
      race conditions in which someone else commits a change to the relation's
      catalog entries while we are in process of doing relcache load.  Problems
      of that ilk have been reported sporadically for years, but it was not
      really practical to fix until recently --- for instance, the recent
      addition of WAL-log support for in-place updates helped.
      
      Along the way, remove pg_am.amconcurrent: all AMs are now expected to support
      concurrent update.
      09d3670d
  33. 31 7月, 2006 1 次提交
    • T
      Change the bootstrap sequence so that toast tables for system catalogs are · 6e38e34d
      Tom Lane 提交于
      created in the bootstrap phase proper, rather than added after-the-fact
      by initdb.  This is cleaner than before because it allows us to retire the
      undocumented ALTER TABLE ... CREATE TOAST TABLE command, but the real reason
      I'm doing it is so that toast tables of shared catalogs will now have
      predetermined OIDs.  This will allow a reasonably clean solution to the
      problem of locking tables before we load their relcache entries, to appear
      in a forthcoming patch.
      6e38e34d
  34. 14 7月, 2006 2 次提交
  35. 12 7月, 2006 1 次提交
  36. 11 7月, 2006 1 次提交
  37. 04 7月, 2006 1 次提交
    • T
      Code review for FILLFACTOR patch. Change WITH grammar as per earlier · b7b78d24
      Tom Lane 提交于
      discussion (including making def_arg allow reserved words), add missed
      opt_definition for UNIQUE case.  Put the reloptions support code in a less
      random place (I chose to make a new file access/common/reloptions.c).
      Eliminate header inclusion creep.  Make the index options functions safely
      user-callable (seems like client apps might like to be able to test validity
      of options before trying to make an index).  Reduce overhead for normal case
      with no options by allowing rd_options to be NULL.  Fix some unmaintainably
      klugy code, including getting rid of Natts_pg_class_fixed at long last.
      Some stylistic cleanup too, and pay attention to keeping comments in sync
      with code.
      
      Documentation still needs work, though I did fix the omissions in
      catalogs.sgml and indexam.sgml.
      b7b78d24
  38. 02 7月, 2006 1 次提交
    • N
      Do a pass of code review for the ALTER TABLE ADD INHERITS patch. Keep · 7fb9090e
      Neil Conway 提交于
      the read lock we hold on the table's parent relation until commit.
      Update equalfuncs.c for the new field in AlterTableCmd. Various
      improvements to comments, variable names, and error reporting.
      
      There is room for further improvement here, but this is at least
      a step in the right direction.
      7fb9090e