Update to equivalent SQL in 8.1.4. Serial Types

Поиск
Список
Период
Сортировка
От PG Doc comments form
Тема Update to equivalent SQL in 8.1.4. Serial Types
Дата
Msg-id 155066682428.1372.11257078279583524116@wrigleys.postgresql.org
обсуждение исходный текст
Ответы Re: Update to equivalent SQL in 8.1.4. Serial Types  (Peter Eisentraut <peter.eisentraut@2ndquadrant.com>)
Список pgsql-docs
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;

В списке pgsql-docs по дате отправления:

Предыдущее
От: PG Doc comments form
Дата:
Сообщение: Improve examples for range operators
Следующее
От: PG Doc comments form
Дата:
Сообщение: Improve documentation for current_setting function