From: | Ron Johnson <ron(dot)l(dot)johnson(at)cox(dot)net> |
---|---|
To: | postgresql <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: last inserted raw (identity) |
Date: | 2003-08-02 00:02:28 |
Message-ID: | 1059782548.22384.88.camel@haggis |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Fri, 2003-08-01 at 18:25, b b wrote:
> Is there an environment variable that returns the
> primary key of the last inserted row. This is usefull
> if you insert a rwo and need the primary key to insert
> it into another table as a foreign key.
>
> In MS-SQL that is equivalent to @@identity variable:
> insert into organization ('org name', ....)
> insert into contact (@@identity, 'contact name'
> .....)
> Here Identity is the organization's ID that is needed
> as a foreign key in contact table.
Why "environment variable"? Are you writing this in shell?
--
+-----------------------------------------------------------------+
| Ron Johnson, Jr. Home: ron(dot)l(dot)johnson(at)cox(dot)net |
| Jefferson, LA USA |
| |
| "I'm not a vegetarian because I love animals, I'm a vegetarian |
| because I hate vegetables!" |
| unknown |
+-----------------------------------------------------------------+
From | Date | Subject | |
---|---|---|---|
Next Message | Josh Berkus | 2003-08-02 00:05:18 | Re: [HACKERS] OSDL DBT-2 for PostgreSQL |
Previous Message | markw | 2003-08-01 23:56:55 | OSDL DBT-2 for PostgreSQL |