pg.ddx.io pgsql-docs@postgresql.org mailing list archive
help / color / mirror / Atom feedUpdate to equivalent SQL in 8.1.4. Serial Types
2+ messages / 2 participants
[nested] [flat]
* Update to equivalent SQL in 8.1.4. Serial Types
@ 2019-02-20 12:47 PG Doc comments form <noreply@postgresql.org>
0 siblings, 1 reply; 2+ messages in thread
From: PG Doc comments form @ 2019-02-20 12:47 UTC (permalink / raw)
To: pgsql-docs@lists.postgresql.org; +Cc: mjf@pearson.co.uk
The following documentation comment has been logged on the website:
Page: https://www.postgresql.org/docs/11/datatype-numeric.html
Description:
In 8.1.4. Serial Types it says that
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;
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: Update to equivalent SQL in 8.1.4. Serial Types
@ 2019-04-08 20:09 Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
parent: PG Doc comments form <noreply@postgresql.org>
0 siblings, 0 replies; 2+ messages in thread
From: Peter Eisentraut @ 2019-04-08 20:09 UTC (permalink / raw)
To: mjf@pearson.co.uk; pgsql-docs@lists.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
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2019-04-08 20:09 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2019-02-20 12:47 Update to equivalent SQL in 8.1.4. Serial Types PG Doc comments form <noreply@postgresql.org>
2019-04-08 20:09 ` Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
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