Я работаю с некоторыми примерами полнотекстового поиска с помощью MySQL и получаю синтаксическую ошибку при попытке создать псевдоним сгенерированного столбца, используя MATCH () и AGAINST
$ cat <<- EOF | mysql -u root -ppassword -h 127.0.0.1 -v --table crashcourse | pbcopy
SELECT note_text,
Match(note_text) Against('rabbit') AS rank
FROM productnotes;
EOF
--------------
SELECT note_text,
Match(note_text) Against('rabbit') AS rank
FROM productnotes
--------------
ERROR 1064 (42000) at line 1: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'rank
FROM productnotes' at line 2
Однако, не пытаясь создать псевдоним, он работает просто отлично:
$ cat <<- EOF | mysql -u root -ppassword -h 127.0.0.1 -v --table crashcourse | pbcopy
SELECT note_text,
Match(note_text) Against('rabbit')
FROM productnotes;
EOF
--------------
SELECT note_text,
Match(note_text) Against('rabbit')
FROM productnotes
--------------
+-----------------------------------------------------------------------------------------------------------------------------------------------------------+------------------------------------+
| note_text | Match(note_text) Against('rabbit') |
+-----------------------------------------------------------------------------------------------------------------------------------------------------------+------------------------------------+
| Customer complaint:
Sticks not individually wrapped, too easy to mistakenly detonate all at once.
Recommend individual wrapping. | 0 |
| Can shipped full, refills not available.
Need to order new can if refill needed. | 0 |
| Safe is combination locked, combination not provided with safe.
This is rarely a problem as safes are typically blown up or dropped by customers. | 0 |
| Quantity varies, sold by the sack load.
All guaranteed to be bright and orange, and suitable for use as rabbit bait. | 1.5905543565750122 |
| Included fuses are short and have been known to detonate too quickly for some customers.
Longer fuses are available (item FU1) and should be recommended. | 0 |
| Matches not included, recommend purchase of matches or detonator (item DTNTR). | 0 |
| Please note that no returns will be accepted if safe opened using explosives. | 0 |
| Multiple customer returns, anvils failing to drop fast enough or falling backwards on purchaser. Recommend that customer considers using heavier anvils. | 0 |
| Item is extremely heavy. Designed for dropping, not recommended for use with slings, ropes, pulleys, or tightropes. | 0 |
| Customer complaint: rabbit has been able to detect trap, food apparently less effective now. | 1.6408053636550903 |
| Shipped unassembled, requires common tools (including oversized hammer). | 0 |
| Customer complaint:
Circular hole in safe floor can apparently be easily cut with handsaw. | 0 |
| Customer complaint:
Not heavy enough to generate flying stars around head of victim. If being purchased for dropping, recommend ANV02 or ANV03 instead. | 0 |
| Call from individual trapped in safe plummeting to the ground, suggests an escape hatch be added.
Comment forwarded to vendor. | 0 |
+-----------------------------------------------------------------------------------------------------------------------------------------------------------+------------------------------------+
Я что-то упустил на самом деле c?
$ mysql --version
mysql Ver 8.0.16 for macos10.14 on x86_64 (MySQL Community Server - GPL)