WL#7247: Deprecate and remove the \N synonym of NULL

Affects: Server-8.0   —   Status: Complete   —   Priority: Medium

The \N synonym for the NULL is a non-standard SQL syntax extension.

Most likely it is not widely used any more, so it would be nice to deprecate it (output a warning message on use) to make the server a bit more standard- compliant.

Another reason for this WL is to make the parser simpler in the future.

We propose to add a deprecation warnings in 5.7 + 5.6 maintenance releases, and remove in 8.0. This should leave enough time for users to change their application since it is not a commonly used syntax.

Note: this WL does nothing with the \N feature of the input/output file format of SELECT INTO/LOAD DATA statements.

See also: http://www.tocker.ca/2013/09/06/spring-cleaning-deprecation-of-null-synonym-backslash-n.html

User Documentation

Contents


Functional requirements

N/A

Non-functional requirements

5.7

  • NF-1: Each \N literal in any valid SQL statement causes deprecation warning.
  • NF-2: \N escape sequence use cases are not affected (work as before the WL).

8.0

  • NF-3: The 1st \N literal in any valid (before the WL) SQL statement causes a syntax error.
  • NF-4 (Same as NF-2): \N escape sequence use cases are not affected (work as before the WL).

Contents


Terms

  • The \N literal is a non-standard synonym of the standard NULL literal.
  • The \N escape sequence is a text-encoded representation of the NULL value in

the output of the "SELECT INTO" statement and in the input of the "LOAD DATA" statement.

Application area of the WL

The current WL affects use cases of the \N literal and doesn't affect use cases of the \N escape sequence.

This WL touches two releases: 5.7 and 8.0.

5.7

Each occurrence of the \N literal in a SQL statement will cause a deprecation warning.

8.0

The fist occurrence of the \N literal in a SQL statement will cause a syntax error.

Most of the \N literal support is implemented in the lexical scanner.

Parser

The \N literal support is represented in the parser by the only one line of code which is a "lexer hack" or a "lexer callback":

             lip->next_state= MY_LEX_OPERATOR_OR_IDENT;

This WL simply removes this line.

Note: this is really good to not have lexer hacks in the parser any more!

Lexical scanner

The current implementation adds extra processing to

  1. recognize the "\" (backslash) character in the input with the help of a special character table,
  2. return the NULL_SYM token on the \N literal like on the usual NULL literal.

This WL removes both extra processing cases from the lexer.