Re: Last inserted row id with complex PK

From: Sameer Kumar <sameer(dot)kumar(at)ashnik(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 07:13:40
Message-ID: CADp-Sm5domLucpSduUhHdweY4e1N--LjUUxzk0TJ9o5o7LZmYg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Wed, Jan 8, 2014 at 11:54 PM, Nelson Green <nelsongreen84(at)gmail(dot)com>wrote:

> I have a projects log table with a three column PK,
> project_num, person_num, and sequence, where each new entry for a
> project/person combination increments the sequence, which is not an auto
> incrementing sequence. Is there any way to retrieve the last entry to the
> table? For instance, if the last entry for person 427 on project 15 was
> sequence number 125, is that information available to me anywhere?

Are these
project_num, person_num FK from some other table? If yes then I would first
insert in those tables and use it over here?

Best Regards,
*Sameer Kumar | Database Consultant*

*ASHNIK PTE. LTD. *101 Cecil Street, #11-11 Tong Eng Building, Singapore
069533
M : *+65 8110 0350* T: +65 6438 3504 | www.ashnik.com
www.facebook.com/ashnikbiz | www.twitter.com/ashnikbiz

[image: email patch]

This email may contain confidential, privileged or copyright material and
is solely for the use of the intended recipient(s).

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Sameer Kumar 2014-01-09 07:19:09 Re: How to know server status variable in postgresql?
Previous Message Raghavendra 2014-01-09 05:59:16 Re: general questions