Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bmDqU-00087I-15 for pgadmin-hackers@arkaria.postgresql.org; Tue, 20 Sep 2016 05:43:54 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1bmDqS-00068t-TO for pgadmin-hackers@arkaria.postgresql.org; Tue, 20 Sep 2016 05:43:52 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1bmDqS-00068k-Bf for pgadmin-hackers@postgresql.org; Tue, 20 Sep 2016 05:43:52 +0000 Received: from mail-wm0-x22b.google.com ([2a00:1450:400c:c09::22b]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84_2) (envelope-from ) id 1bmDqK-0006c0-MZ for pgadmin-hackers@postgresql.org; Tue, 20 Sep 2016 05:43:51 +0000 Received: by mail-wm0-x22b.google.com with SMTP id l132so14570742wmf.1 for ; Mon, 19 Sep 2016 22:43:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=enterprisedb-com.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=O8dSTgTSZPv5ojWObYUlG6cRYpCSO8g+j62rdaE50vc=; b=jNIH0vBrGizop1Ndc1FlIN4Jqp0XLkHLelYSLjn4nNz8R5yEaeh0V02cLOYnTe1UsX Nfw4ESQ3EJthj/rYjQvFK4ywcjgGk9apxXOPdtgVsE2J7BDMz7EJFjtIVJu6YlqW/Pho /u5aXfYvgjpQwvJLy8uKzz/WM5bN/6Nf5fwsnbP2jLIZ27K/NjYZgMoa+5OUY5miqlGu vccLjOf597vqiKU5cY2fQJF1Ir1Z3FLw40vetcKKBmvNgz2BlNwjfxHe0NaFQvVLCFVB z2DnDhrIH0cwBGGoCzgGZi6zhoLRHVqie7jI95L5rB1uCFXvgCPrlnPfxY5rTLoNvXvN 08yQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=O8dSTgTSZPv5ojWObYUlG6cRYpCSO8g+j62rdaE50vc=; b=fvmmJG/9OC2F2byy/u0cIq74NDKmzmEU5zg+BtB8rfRDRdYlxic8i725Ajp9xr5kTP ql+au9APXHcHgeixW1mBAsbcxBCwtsA8oooUqhGGCCIqk90G6tgQzbThx5BnAVtYtcl4 xUmwjAkzyAEvrjzR3iemvjDB92pmfXy/gTGuozIwrU1f/wTPP8eaCXoThnFzuGc1lhTL mr6HR3JKiMXCcaQiwWwX6C2rAs1AXuv6JLDiA1D4furQnmgoFTTlh3pTaevkd1gFnd6E DIVqxIT+6CPr0iZxys4DKhVN2cXwFUVtheFwHtANptlf9C7y1UMtSM8pmKdYWk69pBHN BPxQ== X-Gm-Message-State: AE9vXwP7Flg87pMGEIkiYSzYzNChfYvNeVpiE2S72slV8ooc0dwm5yAeW96oLSTX7irGtzQU4CgP0E0cAGa0Ejri X-Received: by 10.194.155.100 with SMTP id vv4mr27748235wjb.56.1474350223709; Mon, 19 Sep 2016 22:43:43 -0700 (PDT) MIME-Version: 1.0 Received: by 10.28.172.198 with HTTP; Mon, 19 Sep 2016 22:43:13 -0700 (PDT) In-Reply-To: References: From: Surinder Kumar Date: Tue, 20 Sep 2016 11:13:13 +0530 Message-ID: Subject: Re: [pgAdmin4][Patch]: RM1592 - Download as CSV should be supported for DDL To: Dave Page Cc: pgadmin-hackers Content-Type: multipart/alternative; boundary=089e011770955bf0ee053ce9e904 X-Pg-Spam-Score: -2.6 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgadmin-hackers Precedence: bulk Sender: pgadmin-hackers-owner@postgresql.org --089e011770955bf0ee053ce9e904 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On Mon, Sep 19, 2016 at 8:59 PM, Surinder Kumar < surinder.kumar@enterprisedb.com> wrote: > On Mon, Sep 19, 2016 at 8:48 PM, Dave Page wrote: > >> Hi >> >> On Mon, Sep 19, 2016 at 3:03 PM, Surinder Kumar >> 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. >> > =E2=80=8Bok.=E2=80=8B sure. > =E2=80=8BI discussed the issue with Harshal and this is how download csv wo= rks: =E2=80=8BWe just hit the url to download csv, and let the browser handle th= e 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 ? > >> =3D=3D=3D=3D=3D=3D=3D >> Download as CSV >> ------------------------- >> >> The query executed did not return any data. >> >> [OK] >> =3D=3D=3D=3D=3D=3D=3D=3D > > >> -- >> Dave Page >> Blog: http://pgsnake.blogspot.com >> Twitter: @pgsnake >> >> EnterpriseDB UK: http://www.enterprisedb.com >> The Enterprise PostgreSQL Company >> > > --089e011770955bf0ee053ce9e904 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
On Mon, Sep 19, 2016 at 8:59 PM, Surinder= Kumar <surinder.kumar@enterprisedb.com> wrote= :
On Mon, Sep 19, 2016 a= t 8:48 PM, Dave Page <dpage@pgadmin.org> wrote:
=
Hi

On Mon, Sep 19, 2016 at 3:03 PM, Surinder Kumar
<su= rinder.kumar@enterprisedb.com> wrote:
> Hi
>
> Please find attached patch with fix.
>>
>> Download as CSV
>>=C2=A0 button should be enabled only for SELECT queries.

I'm not sure there's a way to do this without parsing the qu= ery.
Simply matching on ^select certainly won't work reliably - for
example, there could be multiple statements in the script, or it could
be PERFORM ...=C2=A0 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.
=E2=80=8Bok.=E2=80=8B sure.
=E2= =80=8BI discussed the issue with Harshal and this is how download csv works= :
=E2=80=8BWe j= ust hit the url to download csv, and let the browser handle the response fr= om the server side. we don't have access to response data to check if n= o data is returned.

The o= ther approach is to hit the same query twice. First time an ajax query to c= heck if data is returned or not. if returned, fire another query to downloa= d csv otherwise set message in message panel.
But the limitation with this approach is tha= t we are just increasing load over server by hitting same query twice, inca= se returned data rows in billions.
Thoughts ?

=3D=3D=3D=3D=3D=3D=3D
Download as CSV
-------------------------

The query executed did not return any data.

[OK]
=3D=3D=3D=3D=3D=3D=3D=3D

--
Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake

EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


--089e011770955bf0ee053ce9e904--