Re: Remove Modifiers on Table - Mailing list pgsql-general

From Jaime Casanova
Subject Re: Remove Modifiers on Table
Date
Msg-id BANLkTin5tMc5rY637sykWm4EEk1o7CeCuA@mail.gmail.com
Whole thread Raw
In response to Re: Remove Modifiers on Table  (Carlos Mennens <carlos.mennens@gmail.com>)
Responses Re: Remove Modifiers on Table  (Carlos Mennens <carlos.mennens@gmail.com>)
List pgsql-general
On Tue, May 17, 2011 at 10:14 AM, Carlos Mennens
<carlos.mennens@gmail.com> wrote:
>
> Yes that worked perfect! I'm just curious if I have 20 tables and then
> want all the 'id' columns to be auto incrementing , that means I have
> to have 20 listed sequences for all 20 unique tables?

yes

> Seems very
> cluttered and messy for PostgreSQL. Can one sequence be attributed to
> multiple columns in multiple tables?

you can use only one sequence for all yes... but then you will have
id=1 in one table, id=2 in another, etc... i mean, it will generate
one single list of values for all tables

> I'm used to MySQL where this was
> as easy as running:
>
> CREATE TABLE test (
> id INT PRIMARY KEY AUTO INCREMENT);
>

in postgres is as easy as

CREATE TABLE test(
  id SERIAL PRIMARY KEY);

hey! it's even less keystrokes!

--
Jaime Casanova         www.2ndQuadrant.com
Professional PostgreSQL: Soporte y capacitación de PostgreSQL

pgsql-general by date:

Previous
From: Carlos Mennens
Date:
Subject: Re: Remove Modifiers on Table
Next
From: Carlos Mennens
Date:
Subject: Re: Remove Modifiers on Table