1. 01 May, 2009 2 commits
    • Tom Lane's avatar
      Fix a couple of cases where the plpgsql grammar looked for T_WORD and · ccc6759d
      Tom Lane authored
      failed to consider the possibility that it would get T_SCALAR, T_RECORD,
      or T_ROW instead because the word happens to match a plpgsql variable name.
      In particular, give "duplicate declaration" rather than generic "syntax error"
      if the same identifier is declared twice in the same block, as per my recent
      complaint.  Also behave more sanely when decl_aliasitem or proc_condition or
      opt_lblname is coincidentally not T_WORD.  Refactor the related productions a
      bit to reduce duplication.
      
      This is a longstanding bug, but it doesn't seem critical enough to
      back-patch.
      ccc6759d
    • Tom Lane's avatar
      When checking for datetime field overflow, we should allow a fractional-second · fe1b07a6
      Tom Lane authored
      part that rounds up to exactly 1.0 second.  The previous coding rejected input
      like "00:12:57.9999999999999999999999999999", with the exact number of nines
      needed to cause failure varying depending on float-timestamp option and
      possibly on platform.  Obviously this should round up to the next integral
      second, if we don't have enough precision to distinguish the value from that.
      Per bug #4789 from Robert Kruus.
      
      In passing, fix a missed check for fractional seconds in one copy of the
      "is it greater than 24:00:00" code.
      
      Broken all the way back, so patch all the way back.
      fe1b07a6
  2. 30 Apr, 2009 1 commit
  3. 29 Apr, 2009 1 commit
    • Heikki Linnakangas's avatar
      Add check_keyword.pl script to perform some basic sanity checks to the · 19499bf9
      Heikki Linnakangas authored
      keyword lists in gram.y and kwlist.h. It checks that all lists are in
      alphabetical order, and that all keywords present in gram.y are listed
      in kwlist.h in the right category, and that all keywords in kwlist.h are
      also in gram.y. What's still missing is to check that all keywords
      defined  with "%token <keyword>" in gram.y are present in one of the
      keyword lists in gram.y.
      19499bf9
  4. 28 Apr, 2009 4 commits
  5. 27 Apr, 2009 1 commit
  6. 26 Apr, 2009 4 commits
  7. 25 Apr, 2009 1 commit
    • Tom Lane's avatar
      Fix the handling of sub-SELECTs appearing in the arguments of an outer-level · 20a3ddbb
      Tom Lane authored
      aggregate function.  By definition, such a sub-SELECT cannot reference any
      variables of query levels between itself and the aggregate's semantic level
      (else the aggregate would've been assigned to that lower level instead).
      So the correct, most efficient implementation is to treat the sub-SELECT as
      being a sub-select of that outer query level, not the level the aggregate
      syntactically appears in.  Not doing so also confuses the heck out of our
      parameter-passing logic, as illustrated in bug report from Daniel Grace.
      
      Fortunately, we were already copying the whole Aggref expression up to the
      outer query level, so all that's needed is to delay SS_process_sublinks
      processing of the sub-SELECT until control returns to the outer level.
      
      This has been broken since we introduced spec-compliant treatment of
      outer aggregates in 7.4; so patch all the way back.
      20a3ddbb
  8. 24 Apr, 2009 6 commits
  9. 23 Apr, 2009 6 commits
  10. 22 Apr, 2009 2 commits
  11. 21 Apr, 2009 5 commits
  12. 20 Apr, 2009 1 commit
  13. 19 Apr, 2009 6 commits
    • Tom Lane's avatar
      ce53791b
    • Tom Lane's avatar
      Rethink the idea of having plpgsql depend on parser/gram.h. Aside from the · 85128e5d
      Tom Lane authored
      fact that this is breaking the MSVC build, it's probably not really a good
      idea to expand the dependencies of gram.h any further than the core parser;
      for instance the value of SCONST might depend on which bison version you'd
      built with.  Better to expose an additional call point in parser.c, so
      move what I had put into pl_funcs.c into parser.c.  Also PGDLLIMPORT'ify
      the reference to standard_conforming_strings, per buildfarm results.
      85128e5d
    • Tom Lane's avatar
      Fix de-escaping checks so that we will reject \000 as well as other invalidly · 22c92226
      Tom Lane authored
      encoded sequences.  Per discussion of a couple of days ago.
      22c92226
    • Tom Lane's avatar
      Fix textsearch documentation examples to not recommend concatenating separate · c1c40e58
      Tom Lane authored
      fields without putting a space between.  Per gripe from Rick Schumeyer.
      c1c40e58
    • Tom Lane's avatar
      Fix estimate_num_groups() to not fail on PlaceHolderVars, per report from · 1d97c19a
      Tom Lane authored
      Stefan Kaltenbrunner.  The most reasonable behavior (at least for the near
      term) seems to be to ignore the PlaceHolderVar and examine its argument
      instead.  In support of this, change the API of pull_var_clause() to allow
      callers to request recursion into PlaceHolderVars.  Currently
      estimate_num_groups() is the only customer for that behavior, but where
      there's one there may be others.
      1d97c19a
    • Tom Lane's avatar
      Revise plpgsql's scanner to process comments and string literals in a way · 3a624e92
      Tom Lane authored
      more nearly matching the core SQL scanner.  The user-visible effects are:
      
      * Block comments (slash-star comments) now nest, as per SQL spec.
      
      * In standard_conforming_strings mode, backslash as the last character of a
        non-E string literal is now correctly taken as an ordinary character;
        formerly it was misinterpreted as escaping the ending quote.  (Since the
        string also had to pass through the core scanner, this invariably led
        to syntax errors.)
      
      * Formerly, backslashes in the format string of RAISE were always treated as
        quoting the next character, regardless of mode.  Now, they are ordinary
        characters with standard_conforming_strings on, while with it off, they
        introduce the same set of escapes as in the core SQL scanner.  Also,
        escape_string_warning is now effective for RAISE format strings.  These
        changes make RAISE format strings work just like any other string literal.
      
      This is implemented by copying and pasting a lot of logic from the core
      scanner.  It would be a good idea to look into getting rid of plpgsql's
      scanner entirely in favor of using the core scanner.  However, that involves
      more change than I can justify making during beta --- in particular, the core
      scanner would have to become re-entrant.
      
      In passing, remove the kluge that made the plpgsql scanner emit T_FUNCTION or
      T_TRIGGER as a made-up first token.  That presumably had some value once upon
      a time, but now it's just useless complication for both the scanner and the
      grammar.
      3a624e92