Bug #944: implicit sequence creating error

Started by PostgreSQL Bugs Listabout 23 years ago2 messagesbugs
Jump to latest
#1PostgreSQL Bugs List
pgsql-bugs@postgresql.org

Marat Khairullin (xmm@rambler.ru) reports a bug with a severity of 4
The lower the number the more severe it is.

Short Description
implicit sequence creating error

Long Description
maxvalue in CREATE SEQUENCE command set to biginteger's max value.
Must be 2147483647 as in docs.

Sample Code
ALTLinux Master 2.0 (based on Mandrake)
postgresql-7.2.1-alt2

$ psql -V
psql (PostgreSQL) 7.2.1
$ createdb test
$ psql test
test=# select version();
version
--------------------------------------------------------------
PostgreSQL 7.2.1 on i586-alt-linux-gnu, compiled by GCC 2.96
(1 ������)
...
test=# create table "test" ( t serial primary key, d integer );
NOTICE: CREATE TABLE will create implicit sequence 'test_t_seq' for SERIAL column 'test.t'
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index 'test_pkey' for table 'test'
CREATE
test=# \q

$ pg_dump -s test
--
-- Selected TOC Entries:
--
\connect - xmm

--
-- TOC Entry ID 2 (OID 18989)
--
-- Name: test_t_seq Type: SEQUENCE Owner: xmm
--

CREATE SEQUENCE "test_t_seq" start 1 increment 1 maxvalue 9223372036854775807 minvalue 1 cache 1;

--
-- TOC Entry ID 4 (OID 18991)
--
-- Name: test Type: TABLE Owner: xmm
--

CREATE TABLE "test" (
"t" integer DEFAULT nextval('"test_t_seq"'::text) NOT NULL,
"d" integer,
Constraint "test_pkey" Primary Key ("t")
);

--
-- Data for TOC Entry ID 5 (OID 18991)
--
-- Name: test Type: TABLE DATA Owner: xmm
--

COPY "test" FROM stdin;
\.
--
-- TOC Entry ID 3 (OID 18989)
--
-- Name: test_t_seq Type: SEQUENCE SET Owner: xmm
--

SELECT setval ('"test_t_seq"', 1, false);

$ psql test
test=# SELECT setval ('"test_t_seq"', 9223372036854775806, false);
setval
---------------------
9223372036854775805
(1 ������)

test=# insert into test (d) values (1);
ERROR: int8 conversion to int4 is out of range

No file was uploaded with this report

#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: PostgreSQL Bugs List (#1)
Re: Bug #944: implicit sequence creating error

pgsql-bugs@postgresql.org writes:

maxvalue in CREATE SEQUENCE command set to biginteger's max value.
Must be 2147483647 as in docs.

As in what docs? Sequences are int8 as of 7.2.

regards, tom lane