Re: Edit Data in Query Tool

From: Dave Page <dpage(at)pgadmin(dot)org>
To: Rishi Ramraj <thereisnocowlevel(at)gmail(dot)com>
Cc: pgadmin-hackers <pgadmin-hackers(at)postgresql(dot)org>
Subject: Re: Edit Data in Query Tool
Date: 2013-01-15 10:45:57
Message-ID: CA+OCxowSho6t6RW0fBOiRE5_=9pDBX_PkOOHRSEm62JG_=MWTw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgadmin-hackers

On Mon, Jan 14, 2013 at 6:02 PM, Rishi Ramraj
<thereisnocowlevel(at)gmail(dot)com> wrote:
> I believe the way this sort of thing is done in tools like SQL navigator is,
> only select queries on individual tables with primary keys are updatable.

Yes, that's what we'd need to do - but it's not particularly
straightforward. You'd need to parse the query client-side (bearing in
mind it might be a 100KB script) to figure out if the results all come
from a single table, then check if you've got all the primary key
columns, and then figure out if any of the columns are aggregates or
expressions, and finally enable editing if appropriate.

Then... you'd need to have editing capabilities in the output grid of
the query tool. That code is not exactly trivial either.

> I'm not sure if this condition is sufficient for updatability however. The
> tool may also need to reissue the query (or modify it) in order to get
> primary keys.
>
> Is there a branch I could look at that contains the sql parser?

No, it was posted as a patch to the mailing list a month or two back
by Vladimir Kokovic. It should be easy to find in the archive (just
make sure you look at the latest version).

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

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

In response to

Browse pgadmin-hackers by date

  From Date Subject
Next Message Dave Page 2013-01-16 16:56:56 Re: pgAdmin3 and Greenplum partitions SQL
Previous Message Rishi Ramraj 2013-01-14 18:02:11 Re: Edit Data in Query Tool