Re: MySQL comparable syntax for PostgreSQL - Mailing list pgsql-novice

From Bruno Wolff III
Subject Re: MySQL comparable syntax for PostgreSQL
Date
Msg-id 20030217174838.GA22287@wolff.to
Whole thread Raw
In response to MySQL comparable syntax for PostgreSQL  (Ben Clewett <B.Clewett@roadrunner.uk.com>)
List pgsql-novice
On Mon, Feb 17, 2003 at 14:47:01 +0000,
  Ben Clewett <B.Clewett@roadrunner.uk.com> wrote:
>
> An UNSIGNED number.  Is this 'field INTEGER CHECK (field >= 0)', or is
> there a direct UNSIGNED reference I have missed?

There is no unsigned type. You can use a check constraint to enforce this.

> The AUTO_INREMENT extension to a Primary Key, as used in MuSQL.  What is
> the official method for auto-incrementing fields?  I have found the
> 'DEFAULT NEXTVAL('...'), but I am not sure whether/how/if this can be
> used to auto-increment a primary field?

Yes, you want to use sequences as they are a lightweight way to generate
unique keys. The Serial types provide a simple way to do this. They
create a sequence, set the default to use nextval and add a not null
constraint. They don't create a unique index, but a primary key constraint
will do that.

pgsql-novice by date:

Previous
From: "Josh Trutwin"
Date:
Subject: Re: How to remove old pg RPMs?
Next
From: "Dirk Hamstra"
Date:
Subject: Dynamic IP - pg_hba