X-Original-To: pgsql-jdbc-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id A931A563EA for ; Mon, 21 Mar 2005 17:00:36 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 57093-10 for ; Mon, 21 Mar 2005 17:00:33 +0000 (GMT) Received: from floppy.pyrenet.fr (unknown [194.116.145.2]) by svr1.postgresql.org (Postfix) with ESMTP id 6386E5691A for ; Mon, 21 Mar 2005 17:00:29 +0000 (GMT) Received: by floppy.pyrenet.fr (Postfix, from userid 106) id 464E930EA1; Mon, 21 Mar 2005 18:00:28 +0100 (MET) From: "Nico" X-Newsgroups: pgsql.interfaces.jdbc Subject: Re: getting a sequence value Date: Mon, 21 Mar 2005 18:00:05 +0100 Organization: Hub.Org Networking Services Lines: 40 Message-ID: References: <423EC07B.6080406@mosaic-ag.com> X-Complaints-To: usenet@news.hub.org X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.2180 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 X-RFC2646: Format=Flowed; Response To: pgsql-jdbc@postgresql.org X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=3.359 tagged_above=0 required=5 tests=FORGED_YAHOO_RCVD, PRIORITY_NO_NAME X-Spam-Level: *** X-Archive-Number: 200503/177 X-Sequence-Number: 12569 Thank you, Nico. "Roland Walter" schreef in bericht news:423EC07B.6080406@mosaic-ag.com... > Nico schrieb: > >>Table data: >>Table 1: >>Field1 (integer) default: nextval('public."tblTable1_FieldID_seq"'::text) >>other field... >>Table 2: >>Field1 (integer) default: nextval('public."tblTable2_FieldID_seq"':text) >>Field2 (integer) foreign key that references to Field1 in Table 1... >> >>So when I do this: >>INSERT INTO "tblTable1"(other fields...) VALUES(...); >>how do I know what to put in here? >>INSERT INTO "tblTable2"("Field2", other fields...) VALUES(???, ...); >> >> > How about INSERT INTO "tblTable2 ("Field2", ...) VALUES > (currval('public."TbleTable1_FieldID_seq"'), ...); > > But you have to do this in the same connection to the database, that did > insert into table 1. > > -- > Roland Walter > MOSAIC SOFTWARE AG > Telefon: 02225/882-411 Fax: 02225/882-201 > http://www.mosaic-ag.com > > > ---------------------------(end of broadcast)--------------------------- > TIP 9: the planner will ignore your desire to choose an index scan if your > joining column's datatypes do not match >