readysettech / readyset

Readyset is a MySQL and Postgres wire-compatible caching layer that sits in front of existing databases to speed up queries and horizontally scale read throughput. Under the hood, ReadySet caches the results of cached select statements and incrementally updates these results over time as the underlying data changes.
https://readyset.io
Other
4.54k stars 125 forks source link

Views on uppercase table(s) get converted to lower case during snapshot and cannot be created #1269

Open altmannmarcelo opened 5 months ago

altmannmarcelo commented 5 months ago

Description

# It works when you do it on a running instance (via replication)

mysql> CREATE TABLE C (ID INT);
Query OK, 0 rows affected (0,02 sec)

mysql> CREATE VIEW myvv AS SELECT * FROM C;
Query OK, 0 rows affected (0,00 sec)

mysql> CREATE CACHE FROM SELECT * FROM myvv;
Query OK, 0 rows affected (0,00 sec)

Stop RS. Remove datadir and start again and try to create cache on view

mysql> CREATE CACHE FROM SELECT * FROM myvv;
ERROR 1105 (HY000): Error during RPC (extend_recipe): SQL SELECT query 'q_e2e8e13b8957edf0' couldn't be added: SQL SELECT query 'vertical_ddl_oracle.myvv' couldn't be added: Could not find table 'c'

mysql> SHOW CREATE VIEW myvv;
+------+----------------------------------------------------------------------------------------------------------------------------+----------------------+----------------------+
| View | Create View                                                                                                                | character_set_client | collation_connection |
+------+----------------------------------------------------------------------------------------------------------------------------+----------------------+----------------------+
| myvv | CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `myvv` AS select `c`.`ID` AS `ID` from `c` | utf8mb4              | utf8mb4_general_ci   |
+------+----------------------------------------------------------------------------------------------------------------------------+----------------------+----------------------+
1 row in set (0,00 sec)

As we can see in the SHOW CREATE VIEW produced by MySQL shows table C as lower case, which does not exists on our side.

Change in user-visible behavior

Requires documentation change