Re: Identify primary key in simple/updatable view

From: Richard Broersma <richard(dot)broersma(at)gmail(dot)com>
To: Lionel Elie Mamane <lionel(at)mamane(dot)lu>, "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Identify primary key in simple/updatable view
Date: 2013-08-02 17:50:19
Message-ID: CABvLTWFZy2mzL4D2w6DvpsL53LfFJ5JYnrdk95h9JUhfkYrfVw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

MS-Access lets the user specify which column is the Primary Key to avoid
this introspection.

On Fri, Aug 2, 2013 at 8:18 AM, Lionel Elie Mamane <lionel(at)mamane(dot)lu> wrote:

> Now that PostgreSQL has updatable views, users (of LibreOffice /
> native PostgreSQL drivers) want to use them... LibreOffice needs a
> primary key to "locate" updates (that is, construct the WHERE clause
> of an UPDATE or DELETE).
>
> How can the driver automatically identify the view columns that
> correspond to the primary key of the underlying table (and more
> generally the same for keys and indexes)? For "simple" views. Without
> parsing the SQL that defines the view (unless libpq will serve me a
> parse tree? Didn't think so.).
>
> For tables, it does that by reading from pg_constraint, but to use
> that for views, I'd need to parse the SQL, track renamed columns,
> etc.
>
> Thanks in advance for your precious help,
>
> --
> Lionel
>
>
> --
> Sent via pgsql-general mailing list (pgsql-general(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-general
>

--
Regards,
Richard Broersma Jr.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Melvin Call 2013-08-02 17:56:14 Re: Understanding database schemas
Previous Message George Weaver 2013-08-02 17:49:33 Re: Postgres 9.2.4 for Windows (Vista) Dell Vostro 400, re-installation failure PLEASE CAN SOMEONE HELP!! (nearly fixed)