Re: Create table & serial question

From: Jean-Luc Lachance <jllachan(at)nsd(dot)ca>
To: Dror Matalon <dror(at)zapatec(dot)com>
Cc: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: Create table & serial question
Date: 2002-11-18 21:06:53
Message-ID: 3DD9566D.F98E542B@nsd.ca
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

Should be:

INSERT INTO ROUTE(START) VALUES('10/10/1999');

Dror Matalon wrote:
>
> Just do
>
> INSERT INTO ROUTE VALUES('10/10/1999') ;
>
> It will automatically populate the next value.
>
> On Mon, Nov 18, 2002 at 08:30:13PM +0100, Alex Dovlecel wrote:
> > Hello all
> > If this is too trivial... sorry. :o(((
> >
> > I have created a table with the following command:
> >
> > CREATE TABLE ROUTE
> > (
> > ID SERIAL ,
> > START DATE ,
> > PRIMARY KEY ( ID )
> > ) ;
> >
> > And it worked just fine. But if I call:
> > INSERT INTO ROUTE VALUES(10, '10/10/1999') ;
> > it ads a record but the id is 10. Is this the correct behaviour for the
> > SERIAL type? I was hoping it will be 1 and ignore the one that I set.
> >
> > If this is the normal behaviour, how can I make it ignore the 10 and place
> > the next id?
> >
> > Tx
> > dovle
> >
> > ---------------------------(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
>
> --
> Dror Matalon
> Zapatec Inc
> 1700 MLK Way
> Berkeley, CA 94709
> http://www.zapatec.com
>
> ---------------------------(end of broadcast)---------------------------
> TIP 6: Have you searched our list archives?
>
> http://archives.postgresql.org

In response to

Browse pgsql-jdbc by date

  From Date Subject
Next Message Barry Lind 2002-11-19 00:48:13 Re: default values
Previous Message Nic Ferrier 2002-11-18 21:02:48 Re: streaming result sets: progress