Re: [pgAdmin4][Patch]: RM1592 - Download as CSV should be supported for DDL

From: Surinder Kumar <surinder(dot)kumar(at)enterprisedb(dot)com>
To: Dave Page <dpage(at)pgadmin(dot)org>
Cc: pgadmin-hackers <pgadmin-hackers(at)postgresql(dot)org>
Subject: Re: [pgAdmin4][Patch]: RM1592 - Download as CSV should be supported for DDL
Date: 2016-09-20 05:43:13
Message-ID: CAM5-9D8EB1vjrCPBU0ygOYzxahq-y1pVa6AheFaCG91y4M0hdA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgadmin-hackers

On Mon, Sep 19, 2016 at 8:59 PM, Surinder Kumar <
surinder(dot)kumar(at)enterprisedb(dot)com> wrote:

> On Mon, Sep 19, 2016 at 8:48 PM, Dave Page <dpage(at)pgadmin(dot)org> wrote:
>
>> Hi
>>
>> On Mon, Sep 19, 2016 at 3:03 PM, Surinder Kumar
>> <surinder(dot)kumar(at)enterprisedb(dot)com> wrote:
>> > Hi
>> >
>> > Please find attached patch with fix.
>> >>
>> >> Download as CSV
>> >> button should be enabled only for SELECT queries.
>>
>> I'm not sure there's a way to do this without parsing the query.
>> Simply matching on ^select certainly won't work reliably - for
>> example, there could be multiple statements in the script, or it could
>> be PERFORM ... or UPDATE ... RETURNING ...
>>
> I wasn't aware of such cases.
>
>>
>> I think we need to leave the button enabled, but give the user a
>> message if no data is returned, e.g.
>>
> ​ok.​ sure.
>
​I discussed the issue with Harshal and this is how download csv works:
​We just hit the url to download csv, and let the browser handle the
response from the server side. we don't have access to response data to
check if no data is returned.

The other approach is to hit the same query twice. First time an ajax query
to check if data is returned or not. if returned, fire another query to
download csv otherwise set message in message panel.
But the limitation with this approach is that we are just increasing load
over server by hitting same query twice, incase returned data rows in
billions.
Thoughts ?

>
>> =======
>> Download as CSV
>> -------------------------
>>
>> The query executed did not return any data.
>>
>> [OK]
>> ========
>
>
>> --
>> Dave Page
>> Blog: http://pgsnake.blogspot.com
>> Twitter: @pgsnake
>>
>> EnterpriseDB UK: http://www.enterprisedb.com
>> The Enterprise PostgreSQL Company
>>
>
>

In response to

Responses

Browse pgadmin-hackers by date

  From Date Subject
Next Message R Bakhshi 2016-09-20 06:42:02 PgAdmin4 Query tool for remote sites
Previous Message Dave Page 2016-09-19 16:19:48 Re: [pgAdmin4][Patch]: RM1627 - Objects are not visible after creation until press refresh button