probably a bug of data-type serial

From: Ralf Miller <rm(at)topnet(dot)de>
To: pgsql-bugs(at)postgresql(dot)org
Subject: probably a bug of data-type serial
Date: 2001-10-10 08:11:31
Message-ID: 3BC402B3.D1FBBCBE@topnet.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Hi there,

recently I tried the following using my psql-client:

select version();
version
---------------------------------------------------------------
PostgreSQL 7.1.2 on i686-pc-linux-gnu, compiled by GCC 2.95.2
(1 row)

create table test_serial (number serial,atext varchar (10) not null);

insert into test_serial (atext) values ('A');
insert into test_serial (atext) values ('B');
insert into test_serial (atext) values (null);
insert into test_serial (atext) values ('C');

SELECT * from test_serial ;
zahl | eintext
------+---------
1 | A
2 | B
4 | C
(3 rows)

\ds
List of relations
Name | Type | Owner
---------------------------------+----------+----------
test_serial_number_seq | sequence | postgres

drop table test_serial;

select * from test_serial ;
ERROR: Relation 'test_serial' does not exist

\ds
List of relations
Name | Type | Owner
---------------------------------+----------+----------
test_serial_number_seq | sequence | postgres

************************************************************************************************************************************

First question:
The example shows that the column number of type serial is incremented
as if the preceding insert-statement was successfull, even if it was
not.
Are the values for the column number of type serial inserted into the
corresponding
sequence before the attempt to insert into the table and are not deleted
if the
latter fails ?
But maybe this behaviour was intended to log succcessless attempts to
insert into the table.

Second question:
The SEQUENCE corresponding to a column of type serial is not beeing
droped
automatically when the table containing the serial-column is droped.
Does it make sense to store a sequence without a corresponding table ?

with best regards

Ralf Miller
--
Wir würden uns freuen, Sie vom 15. bis 19. Oktober 2001 auf der Systems
in München, Halle B6 Stand 321, begrüßen zu dürfen.
---------------------------------------------------------------------------
Ralf Miller
Topnet-AG
Telefon 0211-53087-244

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Mika Mantyla 2001-10-10 08:15:33 SQLPutData bug ?
Previous Message MikeSmialek 2001-10-10 02:09:29 comment on inheritance