473,407 Members | 2,306 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,407 software developers and data experts.

How can the sequence become out of sequence?

Hi,

I wonder how this can happen.
A "not null" field is set to "" even if a sequence should set this
to next sequence number.

Ok, I know it is not set to null, it is set to '' which is proven by
the below
Select statement but it is not set to the next sequence number and the
inserts
does not specify any value in the insert statement for the id-column.

Are there any reasons for this behaviour?

/ Axier

CREATE TABLE public.mytable (
id int4 DEFAULT nextval('mytable_seq'::text) NOT NULL,
srcid int4,
name varchar(50),
date date,
"time" time,
week int4,
CONSTRAINT mytable_idx UNIQUE (name, date),
CONSTRAINT mytable_pkey PRIMARY KEY (id)
) WITH OIDS;
CREATE SEQUENCE public.mytable_seq INCREMENT 1 MINVALUE 1 MAXVALUE
2147483647 CACHE 1;
SELECT setval('public.mytable_seq', 39903);
mydatabase=# select * from mytable where length(name)<1;
id | srcid | name | date | time | week |
-------+-------+------+--------+--------+--------+---
| 12 | |2004-01-21 | 09:39:00 | 4 |
(1 rad)

mydatabase=# delete from mytable where length(name)<1;

mydatabase=# select * from mytable where id is null;
id | srcid | name | date | time | week |
----+-------+------+------+-----+-------+
(0 rows)

Here is the executed Insert-SQL.

INSERT INTO mytable ( srcid, name, date, time, week )
VALUES( $srcid, '$name', '$date', '$time', DATE_PART('week',
CURRENT_TIMESTAMP(0) ) )
Jul 19 '05 #1
1 1967

at a guess try qualifying sequence name

id int4 DEFAULT nextval('public.mytable_seq'::text) NOT NULL

Unregistered
-----------------------------------------------------------------------
Posted via http://www.webservertalk.co
-----------------------------------------------------------------------
View this thread: http://www.webservertalk.com/message93627.htm

Jul 19 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Honne Gowda A | last post by:
Hi, Can anybody clarify why destruction happens in reverse way? for example A<-B<-C, when C's object is constructed, ctor calls will A(),B() and C(), when this object is destroyed, sequence of...
3
by: Nobody | last post by:
I recently wrote an AVL tree class, I think its mostly working, but I want to make sure. Assuming it uses integers, is there an insert/delete sequence that is known to exercise every possible case...
0
by: Steven Bethard | last post by:
In trying to work out what's different between the start, stop and step of slice.indices() and the start, stop and step of sequence slicing I found that some of the list slicing documentation is...
6
by: Randy Harris | last post by:
Anyone know if there is an Event that occurs when you open a form AFTER it is visible on the screen? I've tried Open, Activate, Load, Current, Got Focus. None of them do. ???
4
by: j | last post by:
In a footnote in the c99 standard the following is labeled as undefined: a = i; And in the second clause of section 6.5 the following is stated: "Between the previous and next sequence...
0
by: Axier | last post by:
Hi I try to repost since I did not get any response on the earlier post. Hopefully I get it this time. I wonder how this can happen. A "not null" field is set to "" even if a sequence should set...
4
by: bboyle18 | last post by:
Hi, I am working with a table sorting script which can be found here http://www.workingwith.me.uk/articles/scripting/standardista_table_sorting This script works very nicely, but when there is a...
17
by: pedestrian via DotNetMonster.com | last post by:
With so many technologies around which include HTML, XML, Javascript, CSS, ASP, ASP.NET (and PHP, JSP of course etc.) What is the sequence for learning web programming? which come should be...
2
by: jaka | last post by:
Hi, I'm in need of some expert help in sorting a numerical/alphanumerical employee ID field (5&6 characters in length). Also seperating the alphanumerical IDs and finding the gaps in the...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.