Page 1 of 1

Problem with serial type in PostgreSQL database

Posted: 15.09.2006, 07:32
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.

Posted: 15.09.2006, 08:22
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

Posted: 15.09.2006, 09:11
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