Problem with serial type in PostgreSQL database

Forum related to version 6.5.1 (alpha) and 6.6.x (beta) of ZeosLib's DBOs

Moderators: gto, cipto_kh, EgonHugeist

Post Reply
pakis
Fresh Boarder
Fresh Boarder
Posts: 6
Joined: 15.09.2006, 07:10

Problem with serial type in PostgreSQL database

Post by pakis »

Hello,

I have folloving problem: using Ztable + Delphi 7 + PostgreSQL 8.1.3
table have id_art serial type, reguired is false, it is not a key
when I try to post to table receive message cannot insert null in id_art

But if I insert first record by hand (INSERT ....), after than everithing work
fine and I can post new records and id_art automaticali get next value.

Can anyone help with this problem? Thanks in advance.
User avatar
mdaems
Zeos Project Manager
Zeos Project Manager
Posts: 2766
Joined: 20.09.2005, 15:28
Location: Brussels, Belgium
Contact:

Post by mdaems »

Hi pakis,

Can you please check what query is sent to the server by zeos (using ZSQLMonitor or a database side utility)? Is that query exactly the same as the one you issue manually (I suppose you do this by using some database utility?)?
I don't know PostGreSQL. Is there something special to the first insert in a brand new table with serial type fields? Or don't you mean first insert in a table but first insert in a program run/transaction?

Mark
pakis
Fresh Boarder
Fresh Boarder
Posts: 6
Joined: 15.09.2006, 07:10

Post by pakis »

Hi Mark,

thanks for fast reply. What I do is simple INSERT (id_art ....) values (1, ...)
from SQL editor. In program I don't use sql but simple Ztable conected with
DBGrid, where I insert other values except id_art + ApplyUpdates.This work fine but only after I insert first record. Same things happen wher using ZQuery + ZUpdate where in insert statment I dont use id_art. Its strange problem. What I need is to use same method for inserting first row. PostgreSQL doesn't have problem because insert work. Any ideas ?
Is it about Zeos?

Thanks
Post Reply