Bug #944: implicit sequence creating error

From: pgsql-bugs(at)postgresql(dot)org
To: pgsql-bugs(at)postgresql(dot)org
Subject: Bug #944: implicit sequence creating error
Date: 2003-04-10 19:13:35
Message-ID: 20030410191335.202F747592C@postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Marat Khairullin (xmm(at)rambler(dot)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

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2003-04-10 20:28:04 Re: Bug #944: implicit sequence creating error
Previous Message pgsql-bugs 2003-04-10 12:11:35 Bug #943: Server-Encoding from EUC_TW to UTF-8 doesn't work