[COMMITTERS] pgsql: Add CREATE SEQUENCE AS clause - Mailing list pgsql-committers

From Peter Eisentraut
Subject [COMMITTERS] pgsql: Add CREATE SEQUENCE AS clause
Date
Msg-id E1ccHy5-0005KU-3R@gemulon.postgresql.org
Whole thread Raw
List pgsql-committers
Add CREATE SEQUENCE AS <data type> clause

This stores a data type, required to be an integer type, with the
sequence.  The sequences min and max values default to the range
supported by the type, and they cannot be set to values exceeding that
range.  The internal implementation of the sequence is not affected.

Change the serial types to create sequences of the appropriate type.
This makes sure that the min and max values of the sequence for a serial
column match the range of values supported by the table column.  So the
sequence can no longer overflow the table column.

This also makes monitoring for sequence exhaustion/wraparound easier,
which currently requires various contortions to cross-reference the
sequences with the table columns they are used with.

This commit also effectively reverts the pg_sequence column reordering
in f3b421da5f4addc95812b9db05a24972b8fd9739, because the new seqtypid
column allows us to fill the hole in the struct and create a more
natural overall column ordering.

Reviewed-by: Steve Singer <steve@ssinger.info>
Reviewed-by: Michael Paquier <michael.paquier@gmail.com>

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/2ea5b06c7a7056dca0af1610aadebe608fbcca08

Modified Files
--------------
doc/src/sgml/catalogs.sgml                  |  20 +++++-
doc/src/sgml/information_schema.sgml        |   4 +-
doc/src/sgml/ref/alter_sequence.sgml        |  30 ++++++--
doc/src/sgml/ref/create_sequence.sgml       |  36 ++++++----
src/backend/catalog/information_schema.sql  |   4 +-
src/backend/catalog/system_views.sql        |   1 +
src/backend/commands/sequence.c             |  89 +++++++++++++++++++++---
src/backend/parser/gram.y                   |   6 +-
src/backend/parser/parse_utilcmd.c          |   2 +-
src/bin/pg_dump/pg_dump.c                   | 103 +++++++++++++++-------------
src/bin/pg_dump/t/002_pg_dump.pl            |   2 +
src/include/catalog/catversion.h            |   2 +-
src/include/catalog/pg_proc.h               |   2 +-
src/include/catalog/pg_sequence.h           |   8 ++-
src/test/modules/test_pg_dump/t/001_base.pl |   1 +
src/test/regress/expected/rules.out         |   1 +
src/test/regress/expected/sequence.out      |  49 +++++++++----
src/test/regress/sql/sequence.sql           |  13 ++++
18 files changed, 274 insertions(+), 99 deletions(-)


pgsql-committers by date:

Previous
From: Simon Riggs
Date:
Subject: [COMMITTERS] pgsql: Update ddl.sgml for declarative partitioning syntax
Next
From: Noah Misch
Date:
Subject: [COMMITTERS] pgsql: Ignore tablespace ACLs when ignoring schema ACLs.