Bug #77260 Add tablename macro to MERGE table SELECT queries
Submitted: 5 Jun 2015 14:50
Reporter: Eelko Vos Email Updates:
Status: Open Impact on me:
None 
Category:MySQL Server: Parser Severity:S4 (Feature request)
Version: OS:Any
Assigned to: CPU Architecture:Any
Tags: matching table name, merge table, select query

[5 Jun 2015 14:50] Eelko Vos
Description:
Would it be possible to extend the parser for the SELECT query so that you can add in a macro for the name of the matching table within a MERGE table?

It's quite cumbersome to first see if a record is present in the MERGE table and then start querying each and every sub-table to see which specific one matched.

Thanks!
  Eelko

How to repeat:
1. create a merge table
2. do a select on the merge table
3. to obtain the name of the matching table for each record, you will need to query each sub-table separately

Suggested fix:
If there would be a macro, it would be very useful, like:

SELECT mysql_macros.tablename,* FROM my_merge_table WHERE surname='Black';