D&C Lug - Home Page
Devon & Cornwall Linux Users' Group

[ Date Index ][ Thread Index ]
[ <= Previous by date / thread ] [ Next by date / thread => ]

Re: [LUG] postgresql inserts



cheers Kev, that is exactly what i am trying to acheive.

I have come accross the function currvalue, but this does not return the
value directly from an INSERT statement. Is this what your thinking of or is
there another function?

Many thanks, Rob


>From www.postgresql.org

currval
Return the value most recently obtained by nextval for this sequence in the
current session. (An error is reported if nextval has never been called for
this sequence in this session.) Notice that because this is returning a
session-local value, it gives a predictable answer even if other sessions
are executing nextval meanwhile.


----- Original Message -----
From: "Kevin Bailey" <kbailey@xxxxxxxxxxxxxxxxxxx>
To: <list@xxxxxxxxxxxx>
Sent: Monday, April 14, 2003 4:49 PM
Subject: Re: [LUG] postgresql inserts


>
>
> Robert Nowik wrote:
>
> > Hi,
> > Not really a linux specific problem, but in postgreSQL i am trying to
> > have an INSERT statement, that has a serial as the only unique
> > identifier. This serial is not set by myself (postgres handles this)
> > but as this is the only unqiue identifier, i need to return it as I do
> > the insert. Any suggestions?
>
>
> you need to get back the id value created by the sequence function when
> inserting a record?
>
> there is a way that postgresql handles this and it does it well - i have
> had to do the same thing on MS SQL server and had to work around it with
> a global variable - but i believe postgresql has this built in.
>
> i can't remember what it is though it should be on www.postgresql.org
> somewhere
>
> please post back if you find it,
>
> kev
>
> >
> >
> > Cheers
> >
> > Rob Nowik
>
>
>
>
> --
> The Mailing List for the Devon & Cornwall LUG
> Mail majordomo@xxxxxxxxxxxx with "unsubscribe list" in the
> message body to unsubscribe.
>
>
>
****************************************************************************
**
>  This email has been virus checked by the Eclipse Internet MAILsafe
service
>
****************************************************************************
**
>  www: http://www.eclipse.net.uk/                email:
eclipse@xxxxxxxxxxxxxx
>
****************************************************************************
**
>
>


--
The Mailing List for the Devon & Cornwall LUG
Mail majordomo@xxxxxxxxxxxx with "unsubscribe list" in the
message body to unsubscribe.


Lynx friendly