Possibility to expand * to fully qualified field

Skip to first unread message


Jul 26, 2013, 6:04:12 AM7/26/13
to akiba...@akiban.com
Hi All,
Not sure if it is possible to use the parser to expand the * back to the full list of select field? Could any one point me where to start with?
E.g, I get a query select * from tbl1 and I would like to expand it to select fielda,fieldb,fieldc from tbl1 as long as I can supply the field information for tbl1 table.


Mike McMahon

Jul 31, 2013, 4:24:42 PM7/31/13
to akiba...@akiban.com, not.a...@gmail.com
The parser by itself is not enough. As you say, you need meta-data with the column information for the tables. And the process will include disambiguating partially qualified table names in the FROM list based on the default schema.

For a working example of code that does this using the parser, look at the open source akiban-server SQL engine. Specifically, at AISBinder.expandAllsAndNameColumns (https://github.com/akiban/akiban-server/blob/master/src/main/java/com/akiban/sql/optimizer/AISBinder.java#L793).

Note that if derived tables (subselects) might occur in the FROM list, it's possible that you will need to do the whole thing recursively.
Reply all
Reply to author
0 new messages