Re: [GENERAL] Functions

From: "Rafael Domiciano" <rafael(dot)domiciano(at)gmail(dot)com>
To: "Scott Marlowe" <scott(dot)marlowe(at)gmail(dot)com>
Cc: "c k" <shreeseva(dot)learning(at)gmail(dot)com>, "Richard Huxton" <dev(at)archonet(dot)com>, pgsql-general(at)postgresql(dot)org, pgsql-admin(at)postgresql(dot)org
Subject: Re: [GENERAL] Functions
Date: 2008-10-01 00:54:09
Message-ID: 3a0028490809301754h46458028v27877bfa7a665ee6@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin pgsql-general

Hello,

If you want to get the value of a autogenerated column it's better to use
"RETURNING"
insert into something returning primary key...

Best Regards,

Rafael Domiciano
Postgres DBA

2008/9/15 Scott Marlowe <scott(dot)marlowe(at)gmail(dot)com>

> On Mon, Sep 15, 2008 at 11:53 AM, c k <shreeseva(dot)learning(at)gmail(dot)com>
> wrote:
> >
> >
> > If I have a function having:
> > begin
> > insert into something ...
> > select max(primary key) from something..
> > end;
> >
> > does the second statement within a function can view the results after
> > execution of first statement to get max(P.K.)?
>
> Yep.
>
> --
> Sent via pgsql-admin mailing list (pgsql-admin(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-admin
>

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Rafael Domiciano 2008-10-01 01:15:37 Re: What process clears the logs?
Previous Message Steve Crawford 2008-09-30 21:58:36 Re: What process clears the logs?

Browse pgsql-general by date

  From Date Subject
Next Message Darren Weber 2008-10-01 01:10:56 Has anyone built pgbash-7.3 against postgreSQL-8.3?
Previous Message Chris 2008-09-30 23:16:24 Re: MySQL to Postgresql schema conversion