<div dir="ltr">On Fri, Aug 15, 2014 at 3:45 PM, Hugues Peccatte <span dir="ltr"><<a href="mailto:hugues.peccatte@gmail.com" target="_blank">hugues.peccatte@gmail.com</a>></span> wrote:<br><div class="gmail_extra"><div class="gmail_quote">

<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">2014-08-15 9:54 GMT+02:00 Smita <span dir="ltr"><<a href="mailto:kumarismita62@gmail.com" target="_blank">kumarismita62@gmail.com</a>></span>:<div>

<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">

<div dir="ltr"><div><div><div><div><div><div><div><div><div><div><div><div><div><div>Hi,<br></div><br></div>I came across the <a href="http://sourceforge.net/p/phpmyadmin/bugs/4444/" target="_blank">bug #4444</a> related to export feature for queries. <br>




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.<br><br></div>Assume we have tables:<br>




actor (actor_id, first_name, last_name, city_id) with actor_id as primary key.<br></div>address (address_id, adress, city_id, city_id, district, postal_code, phone) with address_id as primary key and phone have not null unique constraints.<br>




<br></div>1. when we select some but not all columns ex, <br>Select address_id, address from address:<br></div>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.<br>




</div>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.<br></div></div></div></div></div>



</div></div></div></blockquote><div><br></div></div><div>Hi,</div><div><br></div><div>I agree that the "CREATE TABLE" should have the same structure that the data to "INSERT".</div><div><div>
 </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">

<div dir="ltr"><div><div><div><div><div><div><div><br></div>2. When we have aliases in column names:<br>
</div>ex: select actor_id, first_name as fname from actor;<br></div>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.<br>



</div></div></div></div></div></blockquote><div><br></div></div><div>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.</div><div>

<div> </div>

<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div><div><div><div>
<br></div>3. When we have alias in table names:<br></div>The name of the table in create statement should be alias name or original table name?<br></div></div></div></blockquote><div><br></div></div><div>Again, I agree with table alias as the name of new table, for the same reason.</div>

<div>

<div> </div></div></div></div></div></blockquote><div>Hi Hugues,<br></div><div>Thanks. As Chirayu mentioned <a href="http://sourceforge.net/p/phpmyadmin/feature-requests/759/" target="_blank">RFE #759</a>  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.<br>

</div><div>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.<br></div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div dir="ltr">
<div class="gmail_extra"><div class="gmail_quote"><div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div><div><br></div>4. When we have JOIN queries with more than one tables:<br>



</div>
<div>ex:</div><div><div><div><div><div><div><div><div><div><div><div><div><div><div><div><div>SELECT * FROM (SELECT actor_id FROM actor as e INNER JOIN address as g on e.actor_id = g.city_id) as t1<br></div><div>Currently if we try to export some rows from the above query, it export nothing it goes on edit sql screen.<br>



</div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></blockquote><div><br></div></div><div>I ran the query, select some lines and clicked on the link "Export" at the bottom of the table and had a file to download.</div>



<div>I used the "Quick" export method.</div><div><br></div><div>BUT… It seems that the content of the file is not the expected result. I don't have any "INSERT" queries… After the "CREATE TABLE" I have this:</div>



<div>-- Error reading data: (#1054 - Unknown column 'actor.actor_id' in 'where clause')<br></div><div> <br></div></div></div></div></blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div></div><div>Do we have a bug into the export ?</div></div></div></div></blockquote><div>Looks like that. For me, when I select some lines from query result and click on export it shows me a screen to run the query with query editor, see 1.png.  I'm using Firefox-28, Ubuntu 12.04<br>
<br></div><div>- Smita<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div>
<br></div><div>Hugues.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div>

<div dir="ltr"><div><div><div><div><div><div><div><div><div><div><div><div><div><div><div><div>
</div><div><br></div><div>Please share your thoughts.<br><br></div><div>Thanks and Regards<span><font color="#888888"><br></font></span></div><span><font color="#888888"><div>- Smita<br></div></font></span></div>

</div></div></div></div></div></div></div></div></div></div></div></div></div></div></div>
<br></div>------------------------------------------------------------------------------<br>
<br>_______________________________________________<br>
Phpmyadmin-devel mailing list<br>
<a href="mailto:Phpmyadmin-devel@lists.sourceforge.net" target="_blank">Phpmyadmin-devel@lists.sourceforge.net</a><br>
<a href="https://lists.sourceforge.net/lists/listinfo/phpmyadmin-devel" target="_blank">https://lists.sourceforge.net/lists/listinfo/phpmyadmin-devel</a><br>
<br></blockquote></div><br></div></div>
<br>------------------------------------------------------------------------------<br>
<br>_______________________________________________<br>
Phpmyadmin-devel mailing list<br>
<a href="mailto:Phpmyadmin-devel@lists.sourceforge.net" target="_blank">Phpmyadmin-devel@lists.sourceforge.net</a><br>
<a href="https://lists.sourceforge.net/lists/listinfo/phpmyadmin-devel" target="_blank">https://lists.sourceforge.net/lists/listinfo/phpmyadmin-devel</a><br>
<br></blockquote></div><br></div></div>