Error when inserting data

Поиск
Список
Период
Сортировка
От postgresql@thomasbache.de
Тема Error when inserting data
Дата
Msg-id 20050305153525.2C94A6EC374@mx01.asacom.de
обсуждение исходный текст
Ответы Re: Error when inserting data  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-odbc
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




В списке pgsql-odbc по дате отправления:

Предыдущее
От: Steve Backman
Дата:
Сообщение: Re: #Deleted strikes again
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Error when inserting data