From: | Keary Suska <hierophant(at)pcisys(dot)net> |
---|---|
To: | PostgreSQL <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: inserting data into multiple tables |
Date: | 2001-10-15 19:13:43 |
Message-ID: | B7F09187.49E1%hierophant@pcisys.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
See currval() and nextval() in the docs. No need for anything fancy.
Keary Suska
Esoteritech, Inc.
"Leveraging Open Source for a better Internet"
> From: Tony Grant <tony(at)animaproductions(dot)com>
> Date: 15 Oct 2001 15:58:13 +0200
> To: postgres list <pgsql-general(at)postgresql(dot)org>
> Subject: [GENERAL] inserting data into multiple tables
>
> Hello,
>
> I have a table "refers_to"
>
> individual_id int4
> book_id int4
>
> and another "individual"
>
> individual_id int4 nextval('individual_serial')
> name varchar
> forename varchar
>
> If the individual exists then get his id. If he doesn't allready exist
> write his names to the table and get the newly created individual_id.
>
> Then I though of using a function to write the book_id and the
> individual_id to refers_to.
>
> QUESTIONS
>
> I am using JSP so the ideal seems to be stored functions in pl/pgsql?
>
> What is the best order to do this in order to prevent a performance hit?
>
> TIA
>
> Tony Grant
>
> --
> RedHat Linux on Sony Vaio C1XD/S
> http://www.animaproductions.com/linux2.html
> Macromedia UltraDev with PostgreSQL
> http://www.animaproductions.com/ultra.html
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 3: if posting/reading through Usenet, please send an appropriate
> subscribe-nomail command to majordomo(at)postgresql(dot)org so that your
> message can get through to the mailing list cleanly
>
From | Date | Subject | |
---|---|---|---|
Next Message | Peter Eisentraut | 2001-10-15 19:27:50 | Re: writing & flushing C extensions |
Previous Message | Keary Suska | 2001-10-15 19:11:32 | Re: Newbie |