Re: Update to equivalent SQL in 8.1.4. Serial Types

From: Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com>
To: mjf(at)pearson(dot)co(dot)uk, pgsql-docs(at)lists(dot)postgresql(dot)org
Subject: Re: Update to equivalent SQL in 8.1.4. Serial Types
Date: 2019-04-08 20:09:07
Message-ID: 893e471c-967d-7f00-44db-7887753ccc53@2ndquadrant.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-docs

On 2019-02-20 13:47, PG Doc comments form wrote:
> CREATE TABLE tablename (
> colname SERIAL
> );
>
> is equivalent to
>
> CREATE SEQUENCE tablename_colname_seq;
> CREATE TABLE tablename (
> colname integer NOT NULL DEFAULT nextval('tablename_colname_seq')
> );
> ALTER SEQUENCE tablename_colname_seq OWNED BY tablename.colname;
>
> Since Postgres 10, the datatype of the automatically-created sequence
> matches the datatype of the serial column. But the default type for
> CREATE SEQUENCE remains as bigint. So the second block should start with
> the line
>
> CREATE SEQUENCE tablename_colname_seq AS INTEGER;

fixed

--
Peter Eisentraut http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

In response to

Browse pgsql-docs by date

  From Date Subject
Next Message Emanuel Araújo 2019-04-09 13:23:37 Re: Improve documentation about include_dir parameter.
Previous Message Jonathan S. Katz 2019-04-08 12:46:00 Re: initdb recommendations