pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Clemens Eisserer <linuxhippy@gmail.com>
To: pgsql-general@postgresql.org
Subject: Re: Implicit sequence with start value?
Date: Sun, 26 Jul 2009 13:20:41 -0400
Message-ID: <194f62550907261020p569d3440s17f4edbfd88b0ba4@mail.gmail.com> (raw)
In-Reply-To: <27956.1248625117@sss.pgh.pa.us>
References: <194f62550907260910x5a286204g3280e4eb5e583cca@mail.gmail.com>
	<27956.1248625117@sss.pgh.pa.us>

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



view thread (7+ messages)  latest in thread

Message-ID: <194f62550907261020p569d3440s17f4edbfd88b0ba4@mail.gmail.com>
Permalink:  ../194f62550907261020p569d3440s17f4edbfd88b0ba4@mail.gmail.com/
Also on:    postgresql.org/message-id/194f62550907261020p569d3440s17f4edbfd88b0ba4@mail.gmail.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-jdbc@postgresql.org
  Cc: linuxhippy@gmail.com, pgsql-general@postgresql.org
  Subject: Re: Implicit sequence with start value?
  In-Reply-To: <194f62550907261020p569d3440s17f4edbfd88b0ba4@mail.gmail.com>
  References: <194f62550907260910x5a286204g3280e4eb5e583cca@mail.gmail.com> <27956.1248625117@sss.pgh.pa.us> <194f62550907261020p569d3440s17f4edbfd88b0ba4@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox