From: postgresql@thomasbache.de
To: pgsql-odbc@postgresql.org
Subject: Error when inserting data
Date: Sat, 5 Mar 2005 16:35:25 +0100 (CET)
Message-ID: <20050305153525.2C94A6EC374@mx01.asacom.de> (raw)
Hi folks!
I just found a strange thing in pg8.0.1. I have a table called
Anwesenheit with an int4-field called TeilnehmerID, wich is constrained
to another tables primary key.
Now when I try to insert data into the table, pg throws an error. It
looks like that:
query: INSERT INTO "Anwesenheit" ("TeilnehmerID", "Monat", "Jahr")
VALUES (-1324054016, 9, 2003);
errorlog:
ERROR: 22003: integer out of range
LOCATION: int84, int8.c:947
STATEMENT: INSERT INTO "Anwesenheit" ("TeilnehmerID", "Monat", "Jahr")
VALUES (-1324054016, 9, 2003);
The interesting part of the table-definition is
CREATE TABLE "Anwesenheit"
(
"lID" int4 NOT NULL DEFAULT nextval('Anwesenheit_s'::text),
"TeilnehmerID" int4 DEFAULT 0,
"Monat" int4 DEFAULT date_part('month'::text, (now())::timestamp
without time zone),
"Jahr" int4 DEFAULT date_part('year'::text, (now())::timestamp without
time zone),
[...],
CONSTRAINT a_pk PRIMARY KEY ("lID"),
CONSTRAINT fk FOREIGN KEY ("TeilnehmerID") REFERENCES "Teilnehmer"
("ID") ON UPDATE CASCADE ON DELETE CASCADE
)
WITH OIDS;
I'm puzzled, because the integervalue is accepted as int4 by pg:
data=# SELECT (-1324054016)::int4;
int4
-------------
-1324054016
(1 row)
I use this insert-statement via odbc in my access-app. The error also
occurs, when I connect directly to the database.
Any ideas are welcome!
Thanks,
Thomas Bache
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-odbc@postgresql.org
Cc: postgresql@thomasbache.de
Subject: Re: Error when inserting data
In-Reply-To: <20050305153525.2C94A6EC374@mx01.asacom.de>
References: <20050305153525.2C94A6EC374@mx01.asacom.de>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox