Received: from localhost (maia-1.hub.org [200.46.204.191]) by postgresql.org (Postfix) with ESMTP id A6A8A9FB1C4 for ; Sun, 29 Jul 2007 09:00:24 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.191]) (amavisd-maia, port 10024) with ESMTP id 69619-05 for ; Sun, 29 Jul 2007 09:00:11 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.5 Received: from web50803.mail.re2.yahoo.com (web50803.mail.re2.yahoo.com [206.190.38.112]) by postgresql.org (Postfix) with SMTP id 5ACEA9FA4E4 for ; Sun, 29 Jul 2007 09:00:11 -0300 (ADT) Received: (qmail 95261 invoked by uid 60001); 29 Jul 2007 12:00:09 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=X-YMail-OSG:Received:Date:From:Subject:To:MIME-Version:Content-Type:Content-Transfer-Encoding:Message-ID; b=NuLssEJaCB7oU40rs7klvGxCehVUVI5i66OvptInPVb19h8jdgwaVU9te6/CDOfUa2k95M8bU80BgvNGl9dOYT3+xVvwEzfv0vsQzzNJp6K5PKbnpHwrSrvrj0Fr2K50KfXHFT1fRWud0elaK2MbLS3M6iVtR64e+lR77ozTFC8=; X-YMail-OSG: ppdZz6cVM1kfeQ5mOwBZstWeWMz3hJcZssYFIZf26CKArNTJErmzT5ln.gLCQppyR7kCAjJ3BkmYYbun.qo80lSi_ZESkxXKlASsX7hwFFSPm2jlVumIuUzZTEDZ8g-- Received: from [116.240.130.24] by web50803.mail.re2.yahoo.com via HTTP; Sun, 29 Jul 2007 05:00:09 PDT Date: Sun, 29 Jul 2007 05:00:09 -0700 (PDT) From: roopa perumalraja Subject: increment the primary key value without using sequences To: pgsql-sql@postgresql.org MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="0-334839604-1185710409=:94674" Content-Transfer-Encoding: 8bit Message-ID: <945413.94674.qm@web50803.mail.re2.yahoo.com> X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200707/177 X-Sequence-Number: 28912 --0-334839604-1185710409=:94674 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Hi all, I would like to know if its possible to increment the primary key field value of stocks table without using sequences by getting the next value of the pk field from the sequnce table ? insert into stocks (prim_id, date,time, code, price, volume) (select ..... from temp_stocks) sequence sequence_code | next_value prim_id 101 stocks table (prim_id, date, time, code, price, volume) temp_stocks table (date, time, code, price, volume) If it can be done, can you please explain me with an example. Thanks a lot in advance. --------------------------------- Sick sense of humor? Visit Yahoo! TV's Comedy with an Edge to see what's on, when. --0-334839604-1185710409=:94674 Content-Type: text/html; charset=iso-8859-1 Content-Transfer-Encoding: 8bit
Hi all,
 
I would like to know if its possible to increment the primary key field value of stocks table without using sequences by getting the next value of the pk field from the sequnce table ?
 
insert into stocks (prim_id, date,time, code, price, volume) (select ..... from temp_stocks)
 
sequence
sequence_code | next_value
prim_id               101
 
stocks table (prim_id, date, time, code, price, volume)
 
temp_stocks table (date, time, code, price, volume)
 
If it can be done, can you please explain me with an example.
 
Thanks a lot in advance.


Sick sense of humor? Visit Yahoo! TV's Comedy with an Edge to see what's on, when. --0-334839604-1185710409=:94674--