Re: Last inserted row id with complex PK

From: Francisco Olarte <folarte(at)peoplecall(dot)com>
To: Nelson Green <nelsongreen84(at)gmail(dot)com>
Cc: pgsql <pgsql-general(at)postgresql(dot)org>
Subject: Re: Last inserted row id with complex PK
Date: 2014-01-09 10:13:40
Message-ID: CA+bJJbwQmvAzmG3dE0YCBrAY3n=9nw6yYBWKKAZzROTz357yLA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi Nelson:

On Wed, Jan 8, 2014 at 7:14 PM, Nelson Green <nelsongreen84(at)gmail(dot)com> wrote:
> My apologies, I was not completely clear. I will not know any of the columns
> in advance. The most recent insert is the result of user input from a web
> form, so I won't know what project or what user generated the last insert.
> That was why I wandered if that information was stored anywhere in the
> system.

You mean someone already inserted a (project, user, sequence) tuple
and you need it? So the problem of calculating the last sequence for a
given ( p, u ) combination has been solved by the inserting web form
and you just need to communicate the result to another process ?

It seems what you need is an auxiliary log table ( serial + (P,U,S) )
which could be managed by a trigger, or made the web form do the
modifications using a procedure. Anyway, a lot more detail will be
needed to solve this.

Francisco Olarte.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Willy-Bas Loos 2014-01-09 10:42:42 wal archive peak during pg_dump
Previous Message Sameer Kumar 2014-01-09 10:05:38 Re: argument of CASE/WHEN must not return a set