Re: Remove Modifiers on Table

From: Jaime Casanova <jaime(at)2ndquadrant(dot)com>
To: Carlos Mennens <carlos(dot)mennens(at)gmail(dot)com>
Cc: PostgreSQL <pgsql-general(at)postgresql(dot)org>
Subject: Re: Remove Modifiers on Table
Date: 2011-05-17 15:22:55
Message-ID: BANLkTin5tMc5rY637sykWm4EEk1o7CeCuA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Tue, May 17, 2011 at 10:14 AM, Carlos Mennens
<carlos(dot)mennens(at)gmail(dot)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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Carlos Mennens 2011-05-17 15:26:44 Re: Remove Modifiers on Table
Previous Message Carlos Mennens 2011-05-17 15:14:37 Re: Remove Modifiers on Table