Open mathiasrw opened 6 years ago
After some research this is what I found:
The query
object has a sources
property where the tables that appear in the select clause are defined. If we use arrays instead of tables, the sources
are created but their columns
property are not populated. Then the compileSelectStar
function requires that the columns property of every source are populated in order to decide the names of the final columns according to the alasql.options.joinstar
option (line 9377).
The same problem happens when you create a table and then add data from an array. The data is added, but the columns
property of the table in the database is not updated.
Thank you so much for looking into this :)
Is there any resolution or workaround to this issue?
Not that I know of. Any inputs or PR's would be greatly appreciated.
Spawned from https://github.com/agershun/alasql/issues/547#issuecomment-388832335
The
alasql.options.joinstar
option seems not working now.If we reproduce the example of @filipkis, but defining
alasql.options.joinstar = 'underscore'
, the result is not the expected:results is:
[{"dep":"B","qt":2,"price":5,"extra":1}]
and it should be
[{ data_dep: 'A', data_qt: 10, data_price: 5, data_extra: 1,data2_dep: 'B', data2_qt: 2, data2_price: 5 }]
if I'm not wrong.