Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bm0Wa-0000XB-GV for pgadmin-hackers@arkaria.postgresql.org; Mon, 19 Sep 2016 15:30:28 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1bm0WZ-0007Kg-SI for pgadmin-hackers@arkaria.postgresql.org; Mon, 19 Sep 2016 15:30:27 +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 1bm0WM-000754-K9 for pgadmin-hackers@postgresql.org; Mon, 19 Sep 2016 15:30:14 +0000 Received: from mail-wm0-x233.google.com ([2a00:1450:400c:c09::233]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84_2) (envelope-from ) id 1bm0WI-0007a0-DE for pgadmin-hackers@postgresql.org; Mon, 19 Sep 2016 15:30:13 +0000 Received: by mail-wm0-x233.google.com with SMTP id b130so68796028wmc.0 for ; Mon, 19 Sep 2016 08:30:09 -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=af7TnCHDmJdvGeMSoWQBsyb6pqarpW7TvVLBEWd4PZ8=; b=LDkPg3c6bttQyTsn91WRjlplVbVRae+RFGvh8zcxLLoUiFbSk884bzRgg9GfZfmITW KI3xdrgviO/OLNh83b1CM9nP6OzCSzAExhv7NN4niqmMDl7A9vbu6Qxne2OrgvIz2dc4 yNmRXPJ8j7taxNCWM5M4LBjaXHsTFRPN8/QXXQvAu5TyQyBwwPp5CRP95dAAF68L17Z6 4NAWXMdtV3djIaxcyjZuRXDJ4iBBjmEjS9DtueQW52kZw8Ixtx1dBFpAmFnharbJrpsT G/67p62sj3HypyiJA5Azk67O7OC6TqBxB+DxSQVAv5Pu9TmxCxtmr7lpInNvTtVtvuZY r5DQ== 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=af7TnCHDmJdvGeMSoWQBsyb6pqarpW7TvVLBEWd4PZ8=; b=bv8iZA7ibsTwy/sCbBiCgO9DFuULPideYBdRhG+CH4qBFnVXbZ6qfAYnUycXEN6fse E1CtL8hSbCc8q/qxevom1Xf2aGX0eNrGW+JxOH1o6G+QRIybrn4PEkI1RCJcocAgVVlZ jUoiGlFhoJDuRtNR6qGVyb3NfmDq6zCjt1q84mmCEGVtYUAaa2afJLt5iqdv6gro/no5 SQtBagl+6eGivcHE9DoJO5GOOUNkNh4R+JGZd5OfYJj3hifKWjBr8GyN7zDOKi+b2mwt GZW2u0abHSNbx/gS7aD71A5VVraa/WSD+LhyRE28KOP5yGiRxrWAWbKsAuFebAYKVAYn 9+rg== X-Gm-Message-State: AE9vXwP2ofDkrcoHwHw9dvafORGGZsXT2W+WmiY8CllvCv8G/zdBr24RR8za6RwlLRp5QOA6Rrmj45xTSo+ljWm6 X-Received: by 10.28.142.197 with SMTP id q188mr10451289wmd.119.1474299009192; Mon, 19 Sep 2016 08:30:09 -0700 (PDT) MIME-Version: 1.0 Received: by 10.28.172.198 with HTTP; Mon, 19 Sep 2016 08:29:38 -0700 (PDT) In-Reply-To: References: From: Surinder Kumar Date: Mon, 19 Sep 2016 20:59:38 +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=001a1143d598bc7e99053cddfc44 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 --001a1143d598bc7e99053cddfc44 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable 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. > > =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 > --001a1143d598bc7e99053cddfc44 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
On = Mon, Sep 19, 2016 at 8:48 PM, Dave Page <dpage@pgadmin.org> = wrote:
Hi

On Mon, Sep 19, 2016 at 3:03 PM, Surinder Kumar
<surinder.kumar@enter= prisedb.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 was= n'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.

=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

--001a1143d598bc7e99053cddfc44--