473,382 Members | 1,766 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,382 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 1964

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...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...

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.