1. 06 9月, 2017 2 次提交
    • H
      Don't initialize random seed when creating a temporary file. · be894afd
      Heikki Linnakangas 提交于
      That seems like a very random place to do it (sorry for the pun). The
      random seed is initialized at backend startup anyway, that ought to be
      good enough, so just remove the spurious initialization from bfz.c.
      
      In the passing, improve the debug-message to mention which compression
      algorithm was used.
      be894afd
    • H
      Remove unnecessary parse-analysis error position callback. · b325dc8e
      Heikki Linnakangas 提交于
      I guess once upon a time this was needed to get better error messages,
      with error positions, but we rely on the 'location' fields in the parse
      nodes nowadays. Removing this doesn't affect any of the error messages
      memorized in the regression tests, so it's not needed anymore.
      b325dc8e
  2. 05 9月, 2017 8 次提交
  3. 04 9月, 2017 14 次提交
    • D
      Use GetOptions for options parsing in get_ereport · c637a0d0
      Daniel Gustafsson 提交于
      When adding the GPTest version printing it become clear that not
      only was the existing version printing broken, the options parsing
      was too. See sample execution below:
      
        ./get_ereport.pl -version
        Use of uninitialized value $ARGV[0] in pattern match (m//) at ./get_ereport.pl line 99.
        Missing argument in sprintf at ./get_ereport.pl line 163.
        ./get_ereport.pl version 0.
      
      So while in there, this commit fixes both. The options are now
      properly parsed with GetOptions() using pass_through and the version
      printed using the GPTest module.
      c637a0d0
    • D
      Move version printing to common module for Perl code · 7d64740b
      Daniel Gustafsson 提交于
      The perl code in src/test/regress was using a mix of either not
      printing the version, printing it wrong (due to us not using CVS
      anymore) or using a hardcoded string. Implement a new module for
      common test code called GPTest.pm which abstracts this (for now
      it's the only thing it does but this might/will change, hence the
      name). The module is created by autoconf to make it pull in the
      GP_VERSION from there.
      
      While there, simplify the version output in gpdiff which included
      the version of the system diff command - somewhat uninteresting
      information as it's not something that changes very often and just
      cluttered up the output.
      
      This removes the MakeMaker support but since we have no intention
      of packaging these programs into a CPAN module it seems pointless
      to carry that format around.
      7d64740b
    • D
      Refactor Greenplum specific testcode to a new file · 01304a76
      Daniel Gustafsson 提交于
      regress.c is an upstream file, and all Greenplum additions can
      cause conflicts as we merge with PostgreSQL. This refactors all
      GPDB specific code into a new file, regress_gp.c, to keep the
      upstream file as close to upstream as possible (with backports).
      The new file gets compiled and loaded just like regress.c, so
      no change in how it works.
      
      Also remove an unused function, perform rudimentary codereview
      on the Greenplum tests and massage regress.c slightly to make
      it closer to upstream.
      01304a76
    • X
      Refactor copy's target segment computing function · 36f2f6d6
      Xiaoran Wang 提交于
      There are same codes computing target segment in both function CopyFrom
      and CopyFromDispatch. Extract the codes into separate functions.
      Signed-off-by: NXiaoran Wang <xiwang@pivotal.io>
      36f2f6d6
    • H
      Share external URL-mapping code between planner and ORCA. · cbb8ea18
      Heikki Linnakangas 提交于
      Planner and ORCA translator both implemented the same logic, to assign
      external table URIs to segments. But I spotted one case where the logic
      differed:
      
      CREATE EXTERNAL TABLE exttab_with_on_master( i int, j text )
      LOCATION ('file://@hostname@@abs_srcdir@/data/exttab_few_errors.data') ON MASTER FORMAT 'TEXT' (DELIMITER '|');
      
      SELECT * FROM exttab_with_on_master;
      ERROR:  'ON MASTER' is not supported by this protocol yet.
      
      With ORCA you got a less user-friendly error:
      
      set optimizer=on;
      set optimizer_enable_master_only_queries = on;
      postgres=# explain SELECT * FROM exttab_with_on_master;
      ERROR:  External scan error: Could not assign a segment database for external file (CTranslatorDXLToPlStmt.cpp:472)
      
      The immediate cause of that was that commit fcf82234 didn't remember to
      modify the ORCA translator's copy of the same logic. But really, it's silly
      and error-prone to duplicate the code, so modify ORCA to use the same code
      that the planner does.
      cbb8ea18
    • H
      Further refactoring of ParseFuncOrColumn and func_get_detail. · 5a7563cc
      Heikki Linnakangas 提交于
      This backports the new FUNCDETAIL_WINDOWFUNC return code from PostgreSQL
      8.4, and refactors the code to match upstream, as much as feasible. A few
      error scenarios now give better error messages.
      5a7563cc
    • D
      Fix typo in copy.c comment · 102aac6f
      Daniel Gustafsson 提交于
      102aac6f
    • H
      Replace custom expandable buffer implementation with StringInfo. · 38f354aa
      Heikki Linnakangas 提交于
      Simpler that way.
      38f354aa
    • H
      Replace redundant functions with contain_window_function() from PG 8.4 · 232ecfc3
      Heikki Linnakangas 提交于
      We don't need two different functions to check whether an expression
      contains a window function. Replace both with the variant used in
      the upstream, contain_window_function().
      232ecfc3
    • H
      Cherry-pick locate_windowfunc() from PostgreSQL 8.4. · 3fc342d6
      Heikki Linnakangas 提交于
      This allows having error positions for more syntax errors, and reduces
      the diff footprint of our window functions implementation against the
      one in PostgreSQL 8.4.
      3fc342d6
    • X
      Handle the failure in AssignResGroupOnMaster() · 931d5d57
      xiong-gang 提交于
      As AssignResGroupOnMaster() is called before the transaction is
      actually started, so the failure won't cause transaction abort,
      we need handle the error to prevent slot leaking.
      Signed-off-by: NZhenghua Lyu <zlv@pivotal.io>
      931d5d57
    • H
      Cosmetic fixes, to reduce diff vs upstream. · 74fdbc5d
      Heikki Linnakangas 提交于
      Most notably, move the definition of XmlExpr and friends to where they are
      in the upstream.
      74fdbc5d
    • H
      Rename checkExprHasWindFuncs to checkExprHasWindowFuncs to match upstream. · e94a339a
      Heikki Linnakangas 提交于
      Also move the function to where it is in the upstream.
      
      To reduce our diff footprint.
      e94a339a
    • H
      Remove overly-complicated SzAllocate function. · 4212fdad
      Heikki Linnakangas 提交于
      There was only one caller, and it provided no memory pool. The fault
      injection was also unused AFAICS.
      4212fdad
  4. 03 9月, 2017 8 次提交
  5. 02 9月, 2017 8 次提交
    • H
      Run pgindent over PXF code. · d10ecad3
      Heikki Linnakangas 提交于
      Backport to 5X_STABLE, in order to make backporting future fixes easier.
      d10ecad3
    • H
      Also remove WindowSpecParse. · 4f71d679
      Heikki Linnakangas 提交于
      I meant to remove this in previous commit already, but forgot to "git add".
      4f71d679
    • H
      Remove remnants of winlevelsup field and WindowSpecParse. · c01d18e3
      Heikki Linnakangas 提交于
      Commits 563c8c6b and 96e6f19d removed most of this dead
      infrastructure, but had to leave these in place to avoid catalog change.
      Now that catalog changes are OK again, complete the removal.
      c01d18e3
    • H
      Little cleanup of ParseFuncOrColumn, to match upstream code better. · d223b2d3
      Heikki Linnakangas 提交于
      This includes the changes from upstream commit 096a30b5, to silence
      compiler warnings. We had already silenced them by initializing the
      variables elsewhere, but let's stick to upstream code wherever possible.
      d223b2d3
    • H
      Refactor ParseFuncOrColumn and func_get_detail to match upstream better. · 6a5a99ba
      Heikki Linnakangas 提交于
      Only ParseFuncOrColumn needed the additional "isstrict" and "isordered"
      return values from func_get_detail. And even ParseFuncOrColumn only needed
      that information under certain circumstances, for error checks. Move the
      code to fetch that information out of func_get_detail, to separate
      little helper functions.
      
      In principle, fetching the "isstrict" and "isordered" flags separately is
      more expensive, because it now requires two syscache lookups rather than
      one. In practice, however, this is a win, because you only need to fetch
      the "isstrict" flag if a FILTER clause was given, and you only need the
      "isordered" flag if an OVER clause was given. Both of those clauses are
      rare, so in the common case this actually saves one syscache lookup. (None
      of this matters much in practice, though, because syscache lookups are
      pretty cheap anyway.)
      6a5a99ba
    • H
      Move some code to where it is in the upstream. · ad67f666
      Heikki Linnakangas 提交于
      The upstream code isn't quite identical to ours, but it's the same
      functionality. Now it's at least in the same place.
      ad67f666
    • H
      Cherry-pick psprintf() function from upstream, and use it. · 48db54aa
      Heikki Linnakangas 提交于
      This makes constructing strings a lot simpler, and less scary. I changed
      many places in GPDB code to use the new psprintf() function, where it
      seemed to make most sense. A lot of code remains that could use it, but
      there's no urgency.
      
      I avoided changing upstream code to use it yet, even where it would make
      sense, to avoid introducing unnecessary merge conflict.
      
      The biggest changes are in cdbbackup.c, where the code to count the buffer
      sizes was most really complex. I also refactored the #ifdef USE_DDBOOST
      blocks so that there is less repetition between the USE_DDBOOST and
      !USE_DDBOOST blocks, that should make it easier to catch bugs at compilation
      time, that affect the !USE_DDBOOST case, when compiling with USE_DDBOOST,
      and vice versa. I also switched to using pstrdup instead of strdup() in
      a few places, to avoid memory leaks. (Although the way cdbbackup works,
      it would only get launched once per connection, so it didn't really matter
      in practice.)
      48db54aa
    • H
      Refactor TransformExttabAuthClause function slightly, for readability. · 100e3f67
      Heikki Linnakangas 提交于
      Seems better for the function to palloc the struct it returns, rather than
      have it fill in a struct provided by the caller.
      
      The thing that really caught my eye was this:
      
      ```
      genericPair *genpair = (genericPair *) palloc0 (4 * sizeof(char *));
      ```
      
      That wrorks, because the genericPair struct consists of four "char *"
      fields. But it seems fragile, should use "sizeof(genericPair)". This commit
      fixes that, among the other kibitzing.
      100e3f67