pg.ddx.io  pgsql-docs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
To: mjf@pearson.co.uk
To: pgsql-docs@lists.postgresql.org
Subject: Re: Update to equivalent SQL in 8.1.4. Serial Types
Date: Mon, 8 Apr 2019 22:09:07 +0200
Message-ID: <893e471c-967d-7f00-44db-7887753ccc53@2ndquadrant.com> (raw)
In-Reply-To: <155066682428.1372.11257078279583524116@wrigleys.postgresql.org>
References: <155066682428.1372.11257078279583524116@wrigleys.postgresql.org>

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





view thread (2+ messages)

Message-ID: <893e471c-967d-7f00-44db-7887753ccc53@2ndquadrant.com>
Permalink:  ../893e471c-967d-7f00-44db-7887753ccc53@2ndquadrant.com/
Also on:    postgresql.org/message-id/893e471c-967d-7f00-44db-7887753ccc53@2ndquadrant.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-docs@postgresql.org
  Cc: peter.eisentraut@2ndquadrant.com, mjf@pearson.co.uk, pgsql-docs@lists.postgresql.org
  Subject: Re: Update to equivalent SQL in 8.1.4. Serial Types
  In-Reply-To: <893e471c-967d-7f00-44db-7887753ccc53@2ndquadrant.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox