pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Martin Marques <martin@bugs.unl.edu.ar>
To: Oliver Elphick <olly@lfix.co.uk>
To: Muhyiddin A.M Hayat <middink@indo.net.id>
Cc: pgsql-sql@postgresql.org
Subject: Re: auto_increment
Date: Sat, 20 Sep 2003 08:15:13 -0300
Message-ID: <200309200815.13766.martin@bugs.unl.edu.ar> (raw)
In-Reply-To: <1064038995.5359.70.camel@linda.lfix.co.uk>
References: <008501c37f35$832e26e0$1f00a8c0@middinkcomp>
	<1064038995.5359.70.camel@linda.lfix.co.uk>

El Sáb 20 Sep 2003 03:23, Oliver Elphick escribió:
> On Sat, 2003-09-20 at 06:10, Muhyiddin A.M Hayat wrote:
> > How to Create auto_increment field in PostreSQL.
> > Can I create them using Trigger.
>
> Use the SERIAL datatype.  See also the functions nextval(), currval()
> and setval().

Also to add, the auto increment is done through sequences.

I would suggest seeing the docs on SEQUENCE, and SERIAL data type.

-- 
Porqué usar una base de datos relacional cualquiera,
si podés usar PostgreSQL?
-----------------------------------------------------------------
Martín Marqués                  |        mmarques@unl.edu.ar
Programador, Administrador, DBA |       Centro de Telematica
                       Universidad Nacional
                            del Litoral
-----------------------------------------------------------------




view thread (27+ messages)  latest in thread

Message-ID: <200309200815.13766.martin@bugs.unl.edu.ar>
Permalink:  ../200309200815.13766.martin@bugs.unl.edu.ar/
Also on:    postgresql.org/message-id/200309200815.13766.martin@bugs.unl.edu.ar

 · 

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 using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: martin@bugs.unl.edu.ar, olly@lfix.co.uk, middink@indo.net.id
  Subject: Re: auto_increment
  In-Reply-To: <200309200815.13766.martin@bugs.unl.edu.ar>

* 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