From: | pgsql-bugs(at)postgresql(dot)org |
---|---|
To: | pgsql-bugs(at)postgresql(dot)org |
Subject: | Bug #461: serial data type problem |
Date: | 2001-09-20 13:15:41 |
Message-ID: | 200109201315.f8KDFfV34505@hub.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
Teoh Teik Liang (martin_teoh(at)hotmail(dot)com) reports a bug with a severity of 3
The lower the number the more severe it is.
Short Description
serial data type problem
Long Description
I had created a table with 2 fields (transaction_code serial primary key) and (trans_desc varchar(20) not null). I found that when I insert a null value into a trans_desc field, the record is not added because of the field is not able to key in null value. But the transaction_code already increase 1 for me. So, if I add the another record, the transaction_code will skip 1 value. How can I make the transaction_code not to increase if the record is not added into the table?
Sample Code
CREATE TABLE TEST (
TRANSACTION_CODE SERIAL PRIMARY KEY,
TRANS_DESC VARCHAR(20) NOT NULL,
PARTICULAR VARCHAR(30) NOT NULL
);
INSERT INTO TEST (PARTICULAR) VALUES ('TEST2');
*** CANNOT ADD RECORD BUT TRANSACTION_CODE INCREASED ALREADY. ***
INSERT INTO TEST (TRANS_DESC, PARTICULAR) VALUES ('TEST2', 'TEST PAR');
*** TRANSACTION_CODE WILL START FROM 2 ***
No file was uploaded with this report
From | Date | Subject | |
---|---|---|---|
Next Message | Peter Eisentraut | 2001-09-20 14:02:22 | Re: Bug #458: serial data type problem |
Previous Message | pgsql-bugs | 2001-09-20 13:15:34 | Bug #460: serial data type problem |