Received: from localhost (unknown [200.46.208.211]) by mail.postgresql.org (Postfix) with ESMTP id 169A06322B4 for ; Sun, 26 Jul 2009 14:20:54 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.208.211]) (amavisd-maia, port 10024) with ESMTP id 65073-02 for ; Sun, 26 Jul 2009 17:20:41 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-bw0-f222.google.com (mail-bw0-f222.google.com [209.85.218.222]) by mail.postgresql.org (Postfix) with ESMTP id 37062632A5B for ; Sun, 26 Jul 2009 14:20:43 -0300 (ADT) Received: by bwz22 with SMTP id 22so2407036bwz.19 for ; Sun, 26 Jul 2009 10:20:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:content-type :content-transfer-encoding; bh=wXCdmLnPne2JXtaeoRguXCFJSucjk98ZE5R9heZ9454=; b=TfC0q+fD5Z7/uiATmkrfubrtab38xNzUGAw9XHLigl/GD6LTnChe2vstrf9vdk73ZT DWFBE7Ei2hwZGbWZ9kiD/tHUoTMETiHIMCsA+9n9q2wP71XBJH8k+sZ0pLknuDLXssGa 4cw8nixM4RvqY0wG7/YujCvwty59EkW4E/55Y= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; b=qdleORfV9hoFlLFB3mbRMwSILF/VDmQ33rw9ljHnNZQAc1ClHTY9rFA+nvO5s7FP8J jzOxgylSwV7TleLYpbZOrztfdpaDnE9AUOBh5F1TXIXps89YfjrNkaSTI75pv1BK1gf9 MxOs/9+ql/pQvj/I+qYT7Kof1aTrT11v9w+Hc= MIME-Version: 1.0 Received: by 10.223.126.1 with SMTP id a1mr2183548fas.52.1248628841576; Sun, 26 Jul 2009 10:20:41 -0700 (PDT) In-Reply-To: <27956.1248625117@sss.pgh.pa.us> References: <194f62550907260910x5a286204g3280e4eb5e583cca@mail.gmail.com> <27956.1248625117@sss.pgh.pa.us> Date: Sun, 26 Jul 2009 13:20:41 -0400 Message-ID: <194f62550907261020p569d3440s17f4edbfd88b0ba4@mail.gmail.com> Subject: Re: Implicit sequence with start value? From: Clemens Eisserer To: pgsql-general@postgresql.org Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0 tagged_above=-10 required=5 tests=none X-Spam-Level: X-Archive-Number: 200907/1077 X-Sequence-Number: 150840 Hi Tom, > regression=# alter sequence foo_bar_seq start with 1000; > ALTER SEQUENCE Completly forgot about that possibility, thanks a lot :) What still puzzles me is how to get the sequence value applied. MySQL's auto_increment simply ignores whatever value is supplied to it, however postgres seems to insert the value instead of the next sequence value, if one is supplied: > CREATE TABLE custtype (key SERIAL PRIMARY KEY NOT NULL, name VARCHAR(127) NOT NULL, short VARCHAR(4)); > ALTER SEQUENCE custtype_key_seq START WITH 10000;"); > INSERT INTO custtype VALUES(0, 'test', 'ta'); > > key | name | short > -----+----------------+------- > 0 | test | ta Of course, under normal circumstances it would be no problem to insert a nextval() however I am using an updateable JDBC ResultSet. Any idea how I can force the sequence's nextval() value into the key column using ResultSets? Thank you in advance, Clemens