New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
sql: modify the signature of TRIM() #3879
Comments
Konstantin Osipov asked me about this on 2019-01-11 in dev thread I have Ubuntu 18.04. I have Tarantool 2.1, pulled from source today. It is possible to support "TRIM (string1 [, trim-string])" MySQL + DB2 + Oracle are reasonably close to the standard: SQL Server is vaguely similar but does not have LEADING|TRAILING|BOTH: If [LEADING|TRAILING|BOTH] is omitted, assume BOTH. If trim_character is omitted: (Currently Tarantool cannot handle TRIM correctly with BLOBs If [LEADING|TRAILING|BOTH] is omitted, In standard SQL the arguments must be strings (char/varchar/blob), The resulting data type should be the same as the data type of string1, What I do not understand about this proposal is: |
@pgulutzan, hello! In my opinion, both. I think to do it as follows: If character is not specialized:
I think, we should throw error in this case.
This also should be supported. |
I would like to agree with everything that romanhabibov said above. However, we will have inconsistency if we disallow TRIM(non-string) and continue to allow QUOTE(non-string), SUBSTR(non-string,1,1), HEX(non-string), LOWER(non-string), etc. If we throw an error for one function where non-string makes no sense, then we should throw an error for all functions where non-string makes no sense. So perhaps that is not part of this issue. |
According to the ANSI standart, ltrim, rtrim and trim should be merged into one unified TRIM() function. The specialization of trimming (left, right or both and trimming charcters) determined in arguments of this function. Closes #3879
According to the ANSI standart, ltrim, rtrim and trim should be merged into one unified TRIM() function. The specialization of trimming (left, right or both and trimming charcters) determined in arguments of this function. Closes #3879
According to the ANSI standart, ltrim, rtrim and trim should be merged into one unified TRIM() function. The specialization of trimming (left, right or both and trimming charcters) determined in arguments of this function. Closes #3879
According to the ANSI standart, ltrim, rtrim and trim should be merged into one unified TRIM() function. The specialization of trimming (left, right or both and trimming charcters) determined in arguments of this function. Closes #3879
According to the ANSI standart, ltrim, rtrim and trim should be merged into one unified TRIM() function. The specialization of trimming (left, right or both and trimming charcters) determined in arguments of this function. Closes #3879
According to the ANSI standart, ltrim, rtrim and trim should be merged into one unified TRIM() function. The specialization of trimming (left, right or both and trimming charcters) determined in arguments of this function. Closes #3879
According to the ANSI standart, ltrim, rtrim and trim should be merged into one unified TRIM() function. The specialization of trimming (left, right or both and trimming charcters) determined in arguments of this function. Closes #3879
According to the ANSI standard, ltrim, rtrim and trim should be merged into one unified TRIM() function. The specialization of trimming (left, right or both and trimming characters) determined in arguments of this function. Closes #3879
According to the ANSI standard, ltrim, rtrim and trim should be merged into one unified TRIM() function. The specialization of trimming (left, right or both and trimming characters) determined in arguments of this function. Closes #3879
According to the ANSI standard, ltrim, rtrim and trim should be merged into one unified TRIM() function. The specialization of trimming (left, right or both and trimming characters) determined in arguments of this function. Closes #3879
According to the ANSI standard, ltrim, rtrim and trim should be merged into one unified TRIM() function. The specialization of trimming (left, right or both and trimming characters) determined in arguments of this function. Closes #3879
According to the ANSI standard, ltrim, rtrim and trim should be merged into one unified TRIM() function. The specialization of trimming (left, right or both and trimming characters) determined in arguments of this function. Closes #3879
According to the ANSI standard, ltrim, rtrim and trim should be merged into one unified TRIM() function. The specialization of trimming (left, right or both and trimming characters) determined in arguments of this function. Closes #3879
According to the ANSI standard, ltrim, rtrim and trim should be merged into one unified TRIM() function. The specialization of trimming (left, right or both and trimming characters) determined in arguments of this function. Closes #3879
According to the ANSI standard, ltrim, rtrim and trim should be merged into one unified TRIM() function. The specialization of trimming (left, right or both and trimming characters) determined in arguments of this function. Closes #3879
According to the ANSI standard, ltrim, rtrim and trim should be merged into one unified TRIM() function. The specialization of trimming (left, right or both and trimming characters) determined in arguments of this function. Closes #3879
According to the ANSI standard, ltrim, rtrim and trim should be merged into one unified TRIM() function. The specialization of trimming (left, right or both and trimming characters) determined in arguments of this function. Closes #3879
According to the ANSI standard, ltrim, rtrim and trim should be merged into one unified TRIM() function. The specialization of trimming (left, right or both and trimming characters) determined in arguments of this function. Closes #3879
According to the ANSI standard, ltrim, rtrim and trim should be merged into one unified TRIM() function. The specialization of trimming (left, right or both and trimming characters) determined in arguments of this function. Closes #3879
According to the ANSI standard, ltrim, rtrim and trim should be merged into one unified TRIM() function. The specialization of trimming (left, right or both and trimming characters) determined in arguments of this function. Closes #3879
According to the ANSI standard, ltrim, rtrim and trim should be merged into one unified TRIM() function. The specialization of trimming (left, right or both and trimming characters) determined in arguments of this function. Closes #3879 @TarantoolBot document Title: TRIM() function Modify signature of SQL function TRIM(). This function removes characters included in <trim character> (binary) string from <trim source> (binary) string until encounter a character that doesn't belong to <trim character>. Removal occurs on the side, specified by <trim specification>. Now, syntax is following: TRIM([ [ <trim specification> ] [ <trim character> ] FROM ] <trim source>). <trim specification> can be one of the following keywords: LEADING, TRAILING and BOTH. <trim character> is the set of trimming characters. <trim source> is the string, that will be trimmed. If FROM is specified, then: 1) Either <trim specification> or <trim character> or both shall be specified. 2) If <trim specification> is not specified, then BOTH is implicit. 3) If <trim character> is not specified, then ' ' is implicit.
It was fixed in 2.2.0-198-gf95a34da9 (and all 2.3 versions). |
Tarantool version: 2.1
OS version: any
In accordance with the standard, the trim function has a signature TRIM ([ specification FROM ] ). As you can see the signature does not have commas inside and may contain FROM and specification as keywords. In the SQLite or earlier versions of the SQL, there were TRIM, LTRIM, RTRIM with (, ) signature. Now the standard does not support LTRIM, RTRIM. The trimming mode is determined in TRIM using the specification parameter.
Standard: ISO/IEC CD 9075-2, 2013-02-05.
The text was updated successfully, but these errors were encountered: