Thread

  1. Newbie Question

    Clay & Judi Kinney <cricketk@home.com> — 2001-05-01T12:34:46Z

    How do I create an autoincrement field in a postgresql table???
    
    What are the correct field type and parameters????
    
    Any help would be appreciated.....
    
    Thanks
    
    Clay
    
    
    
    
  2. Re: Newbie Question

    Mitch Vincent <mitch@venux.net> — 2001-05-04T20:46:51Z

    You *really* should go glance over the manual.. There is the field type
    SERIAL and things called sequences, both could be what you're talking
    about....The rest I'll leave up to you :-)
    
    Good luck!!!
    
    -Mitch
    
    ----- Original Message -----
    From: "Clay & Judi Kinney" <cricketk@home.com>
    To: <pgsql-general@postgresql.org>
    Sent: Tuesday, May 01, 2001 8:34 AM
    Subject: Newbie Question
    
    
    > How do I create an autoincrement field in a postgresql table???
    >
    > What are the correct field type and parameters????
    >
    > Any help would be appreciated.....
    >
    > Thanks
    >
    > Clay
    >
    >
    >
    > ---------------------------(end of broadcast)---------------------------
    > TIP 4: Don't 'kill -9' the postmaster
    >
    
    
    
  3. Re: Newbie Question

    Ludwig Meyerhoff <ludwig@antar.com> — 2001-05-04T20:53:11Z

    Hallo!
    
    > How do I create an autoincrement field in a postgresql table???
    > What are the correct field type and parameters????
    Well, what about using sequences?
    create sequence tralalala;
    create table huibui
    (
      id integer primary key default nextval('tralalala'),
      field1 references table1,
      and-so-on references all-other-tables
    );
    
    How, each time You insert some data in huibui using
    insert into huibui (field1, and-son-on) values (?, ..);
    the 'tralala' counter will be increased by one (nextval).
    
    
    Saluti!
    
    Ludwig
    
    
    
  4. Re: Newbie Question

    Joel Burton <jburton@scw.org> — 2001-05-04T21:17:08Z

    On Tue, 1 May 2001, Clay & Judi Kinney wrote:
    
    > How do I create an autoincrement field in a postgresql table???
    > 
    > What are the correct field type and parameters????
    > 
    > Any help would be appreciated.....
    
    CREATE TABLE foo (
      id SERIAL,
      ...
    )
    
    it comes out as an int4 or integer type.
    
    -- 
    Joel Burton   <jburton@scw.org>
    Director of Information Systems, Support Center of Washington
    
    
    
  5. Re: Newbie Question

    Peter Eisentraut <peter_e@gmx.net> — 2001-05-04T21:19:53Z

    Clay & Judi Kinney writes:
    
    > How do I create an autoincrement field in a postgresql table???
    
    See FAQ.
    
    -- 
    Peter Eisentraut   peter_e@gmx.net   http://funkturm.homeip.net/~peter