Bug #944: implicit sequence creating error - Mailing list pgsql-bugs

From pgsql-bugs@postgresql.org
Subject Bug #944: implicit sequence creating error
Date
Msg-id 20030410191335.202F747592C@postgresql.org
Whole thread Raw
Responses Re: Bug #944: implicit sequence creating error
List pgsql-bugs
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

pgsql-bugs by date:

Previous
From: pgsql-bugs@postgresql.org
Date:
Subject: Bug #943: Server-Encoding from EUC_TW to UTF-8 doesn't work
Next
From: Tom Lane
Date:
Subject: Re: Bug #944: implicit sequence creating error