473,469 Members | 1,495 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Why does the sequence get 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) ) )
Nov 22 '05 #1
0 1171

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

Similar topics

0
by: Markus Seibold | last post by:
Hello NG, sorry for pasting that much code but I just can't figure out how get the <key><keyref> to work in XML Schema. I am using XMLSpy 4.3 for editing my XML. I want to represent a...
0
by: schaf | last post by:
Hi ! I'm writing a new xsl:function, which uses two other functions. But by the call of the first function, it would be abort just after the call. Not even the xsl:param would be set. I don't...
1
by: Stephen Edgecombe | last post by:
Hi Environment: Visual Studio .NET 2003 (vb) I am developing an XSD Schema and want to include some building blocks from another source, so they have a different namespace. - If I use an...
1
by: Dmitry Martynov | last post by:
Hi I have a question whether XmlValidatingReader doesn't check keyref constrain (the same with key constraint) or I do smth wrong. I have the following schema <?xml version="1.0"...
1
by: vishal | last post by:
What does #line 182 parser.y mean in a C program?
5
by: Tarun | last post by:
Hi All, I have written the following prog. int main() { int val = 4; printf("size of val = %d, val = %d",sizeof(++val),val); } output: size of val = 2, val = 4 The output expected was :...
6
by: seeIT | last post by:
In a client application a simple webservice (add/multiply) was added to solution panel but proxy methods do not appear. WSDL description in solution panel follows: <?xml version="1.0"...
0
by: Richard Gregory | last post by:
Hi, I have the wsdl below, for an Axis web service, and when I select Add Web Refernce in Visual Studio the proxy is missing a class representing the returnedElementsType (see reference.cs below...
0
by: vpal61 | last post by:
Hello, I have an Excel/VBA web service client with SOAP Toolkit, consuming Apache Tomcat webservice, which is working fine. Now I am trying to migrate to .NET, and build client in VS2005 with...
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
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
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.