Page 1 of 1

Error After Post With AutoRefresh + Sequence

Posted: Tue 01 Oct 2013 14:51
by thiagoalx
I use PostgreSQL.

After TUniQuery.Post, my application show "Refresh Failed. Found 0 Records".
But in my database, the record post normally.
My table:

Code: Select all

CREATE TABLE public.usuario (
  id SERIAL,
  funcionario VARCHAR(20),
  login VARCHAR(100),
  CONSTRAINT usuario_pkey PRIMARY KEY(id)
)
TUniQuery.SQLInsert

Code: Select all

INSERT INTO usuario
  (funcionario, login, data_cadastro)
VALUES
  (:funcionario, :login, :data_cadastro)
TUniQuery.SQLRefresh

Code: Select all

SELECT funcionario, login, data_cadastro
WHERE
  id = :id
My TUniQuery set roAfterInsert := True and roAfterUpdate := True
In my table, my column ID have a Default value := nextval('funcionario_id_seq'::regclass)

Others tables show the same error, and i don't want use StrictUpdate := False, because in some cases, in Refresh, i use JOINS or VIEWS.

Please, help me.

Thanks !

Re: Error After Post With AutoRefresh + Sequence

Posted: Tue 01 Oct 2013 20:37
by thiagoalx
I solved the problem.

Delete all fields in TUniQuery and set:
TUniQuery.Options.DefaultValues := True;
In my table in PostgreSQL i set:
PRIMARY KEY = SERIAL with Default = nextval('usuario_id_seq'::regclass) // Sequence created automatically

And add all fields in TUniQuery.

:D

Re: Error After Post With AutoRefresh + Sequence

Posted: Wed 02 Oct 2013 09:33
by AlexP
Hello,

Glad to see that you solved the problem. If you have any other questions, feel free to contact us