Search Postgresql Archives

Re: Remove Modifiers on Table

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, May 17, 2011 at 10:14 AM, Carlos Mennens
<carlos.mennens@xxxxxxxxx> 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

-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux