probably a bug of data-type serial - Mailing list pgsql-bugs

From Ralf Miller
Subject probably a bug of data-type serial
Date
Msg-id 3BC402B3.D1FBBCBE@topnet.de
Whole thread Raw
Responses Re: probably a bug of data-type serial  (Stephan Szabo <sszabo@megazone23.bigpanda.com>)
Re: probably a bug of data-type serial  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: probably a bug of data-type serial  (Peter Eisentraut <peter_e@gmx.net>)
Re: probably a bug of data-type serial  (Bruce Momjian <pgman@candle.pha.pa.us>)
List 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

pgsql-bugs by date:

Previous
From: Orion
Date:
Subject: Index Scans Oddness
Next
From: Orion
Date:
Subject: Cant get planner to use index (7.1.3-1PGDG)