Bug #12208 Function to return source table name when selecting from merge table?
Submitted: 27 Jul 2005 15:28
Reporter: James Harvard Email Updates:
Status: Open Impact on me:
Category:MySQL Server: General Severity:S4 (Feature request)
Version: OS:Any
Assigned to: CPU Architecture:Any

[27 Jul 2005 15:28] James Harvard
In many of the situations where one might use a merge table it would be useful to be able to return the source table name for the rows returned.

This would mean that is would not be necessary to store redundant information in the underlying tables. For example, consider two tables that separately hold import and export data. It would be nice to be able to do this:

select merge_table_name() as type, value, description from merge_imports_exports;

Currently it is necessary to have an additional column (e.g. is_import BOOL) in both tables where the column will always be 1 for imports and always be 0 for exports.

For large data sets eliminating this redundant data would reduce the disc space required and presumably increase performance too.

How to repeat: