postgresql/src/backend
Andrew Gierth a40631a920 Fix lexing of standard multi-character operators in edge cases.
Commits c6b3c939b (which fixed the precedence of >=, <=, <> operators)
and 865f14a2d (which added support for the standard => notation for
named arguments) created a class of lexer tokens which look like
multi-character operators but which have their own token IDs distinct
from Op. However, longest-match rules meant that following any of
these tokens with another operator character, as in (1<>-1), would
cause them to be incorrectly returned as Op.

The error here isn't immediately obvious, because the parser would
usually still find the correct operator via the Op token, but there
were more subtle problems:

1. If immediately followed by a comment or +-, >= <= <> would be given
   the old precedence of Op rather than the correct new precedence;

2. If followed by a comment, != would be returned as Op rather than as
   NOT_EQUAL, causing it not to be found at all;

3. If followed by a comment or +-, the => token for named arguments
   would be lexed as Op, causing the argument to be mis-parsed as a
   simple expression, usually causing an error.

Fix by explicitly checking for the operators in the {operator} code
block in addition to all the existing special cases there.

Backpatch to 9.5 where the problem was introduced.

Analysis and patch by me; review by Tom Lane.
Discussion: https://postgr.es/m/87va851ppl.fsf@news-spur.riddles.org.uk
2018-08-23 21:42:40 +01:00
..
access doc: Update uses of the word "procedure" 2018-08-22 14:44:49 +02:00
bootstrap Use a ResourceOwner to track buffer pins in all cases. 2018-07-18 12:15:16 -04:00
catalog Clarify comment about assignment and reset of temp namespace ID in MyProc 2018-08-21 08:32:18 +09:00
commands Change PROCEDURE to FUNCTION in CREATE OPERATOR syntax 2018-08-22 14:44:49 +02:00
executor Set scan direction appropriately for SubPlans (bug #15336) 2018-08-17 15:44:13 +01:00
foreign Remove bogus "extern" annotations on function definitions. 2018-02-19 12:07:44 -05:00
jit LLVMJIT: Check for 'noinline' attribute in recursively inlined functions. 2018-07-25 16:23:59 -07:00
lib doc: Update redirecting links 2018-07-16 10:48:05 +02:00
libpq Fix set of NLS translation issues 2018-08-21 15:17:13 +09:00
main Update copyright for 2018 2018-01-02 23:30:12 -05:00
nodes Fix run-time partition pruning for appends with multiple source rels. 2018-08-01 19:42:52 -04:00
optimizer Fix wrong order of operations in inheritance_planner. 2018-08-11 15:53:20 -04:00
parser Fix lexing of standard multi-character operators in edge cases. 2018-08-23 21:42:40 +01:00
partitioning Remove bogus Assert in make_partitionedrel_pruneinfo(). 2018-08-08 20:02:32 -04:00
po Translation updates 2018-06-25 12:37:18 +02:00
port Remove obsolete netbsd dynloader code 2018-08-13 23:21:01 +02:00
postmaster Clean up assorted misuses of snprintf()'s result value. 2018-08-15 16:29:31 -04:00
regex Clean up warnings from -Wimplicit-fallthrough. 2018-05-01 19:35:08 -04:00
replication Close the file descriptor in ApplyLogicalMappingFile 2018-08-16 16:49:57 +02:00
rewrite Fix set of NLS translation issues 2018-08-21 15:17:13 +09:00
snowball Avoid unnecessary use of pg_strcasecmp for already-downcased identifiers. 2018-01-26 18:25:14 -05:00
statistics Fix bogus code for extracting extended-statistics data from syscache. 2018-05-02 12:23:00 -04:00
storage Make autovacuum more aggressive to remove orphaned temp tables 2018-08-13 11:49:04 +02:00
tcop Don't run atexit callbacks in quickdie signal handlers. 2018-08-08 19:10:32 +03:00
tsearch Hand code string to integer conversion for performance. 2018-07-22 14:58:23 -07:00
utils Wrap long line in postgresql.conf.sample. 2018-08-22 21:34:50 +12:00
.gitignore Add .gitignore entries for AIX-specific intermediate build artifacts. 2015-07-08 20:44:22 -04:00
common.mk Remove PARTIAL_LINKING build mode. 2018-03-30 17:33:04 -07:00
Makefile Rearrange makefile rules for running Gen_fmgrtab.pl. 2018-05-03 17:54:18 -04:00
nls.mk Translation updates 2018-06-25 12:37:18 +02:00