[Phpmyadmin-devel] Sql export feature for queries
chirayu.chiripal at gmail.com
Sat Aug 16 11:33:45 CEST 2014
On Fri, Aug 15, 2014 at 11:48 PM, Smita <kumarismita62 at gmail.com> wrote:
> On Fri, Aug 15, 2014 at 3:45 PM, Hugues Peccatte <
> hugues.peccatte at gmail.com> wrote:
> 2014-08-15 9:54 GMT+02:00 Smita <kumarismita62 at gmail.com>:
>>> I came across the bug #4444
>>> <http://sourceforge.net/p/phpmyadmin/bugs/4444/> related to export
>>> feature for queries.
>>> I'm not sure how exactly this feature is supposed to behave if we are
>>> exporting rows with some but not all columns and also in case we have
>>> aliases and even when we have join queries.
>>> Assume we have tables:
>>> actor (actor_id, first_name, last_name, city_id) with actor_id as
>>> primary key.
>>> address (address_id, adress, city_id, city_id, district, postal_code,
>>> phone) with address_id as primary key and phone have not null unique
>>> 1. when we select some but not all columns ex,
>>> Select address_id, address from address:
>>> when exported few of the rows, it have create table statement for table
>>> 'address' with all the original columns not just these two. and data from
>>> just these two columns in the Insert statements. so here when the same
>>> exported file, we wish to import back will not work as phone have unique
>>> constraint and we are not inserting the phone values.
>>> Also If user is seeing just two of the columns in the table structure at
>>> screen so they might be doing export thinking that it will be exporting the
>>> same structure as on the screen.
>> I agree that the "CREATE TABLE" should have the same structure that the
>> data to "INSERT".
>>> 2. When we have aliases in column names:
>>> ex: select actor_id, first_name as fname from actor;
>>> So when we export few of the resultant rows, should the create table
>>> statement have a column name first_name or fname ?. As I think of it, It
>>> should be fname, if user have in mind that he is exporting the structure of
>>> the table he is looking at screen.
>> I agree that we should have the field alias as the column name. With this
>> feature, the user can keep the original name by not using aliases.
>>> 3. When we have alias in table names:
>>> The name of the table in create statement should be alias name or
>>> original table name?
>> Again, I agree with table alias as the name of new table, for the same
> Hi Hugues,
> Thanks. As Chirayu mentioned RFE #759
> <http://sourceforge.net/p/phpmyadmin/feature-requests/759/> seems to fix
> table and column aliasing issue(point 2 and 3), I tested with current
> master. Sorry, earlier I was working with QA_4_2 branch.
> But CREATE table has the same structure as original structure even if
> SELECT have some but not all the columns, I'm not sure if that is intended.
That is intended, the reason is that its not only about CREATE table or
INSERT queries. There are many other factors such as PROCEDURES, TRIGGERS
and we may not be able to remove those columns (which are not in select
query) as they might break them i.e. we have to sacrifice one thing over
the other. We can't force the user to accept one thing sacrificing the
other. So, its better to include complete structure (everything) though it
may not be good for import as it is. And leave that up to the user to make
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Developers