On Sat, Oct 22, 2011 at 5:42 PM, Michael Van Canneyt <mich...@freepascal.org> wrote: > Just a use a TSQLQuery:
Are you sure that it is really like that? My code is virtually the same as yours and I already checked everything I could come up with. Using the final "as res;" or not, checked that the sequence exists in the database, but I still get this error: Error: <b>Preparation of query failed. (PostgreSQL: ERROR: column "GameSession_SessionId_seq" does not exist LINE 1: prepare prepst2 as SELECT nextval("GameSession_SessionId_se... This code: SQLGameSession := TSQLQuery.Create(nil); SQLGameSession.Transaction := DBComm.SQLTransaction; SQLGameSession.Database := DBComm.PQConnection; SQLGameSession.FieldDefs.Add('SessionId', ftLargeint); SQLGameSession.FieldDefs.Add('GameEvent', ftLargeint); SQLGameSession.FieldDefs.Add('TableId', ftInteger); OPDebugLn('[TGameSessionComm.CreateSessionResponse] Obtaining New Primary Key'); SQLGameSession.SQL.Text:='SELECT nextval("GameSession_SessionId_seq") as res;'; SQLGameSession.Open; FSessionId := (SQLGameSession.Fields[0] as TLargeIntField).AsLargeInt; SQLGameSession.Close; The transaction and connection cannot be wrong because they are the same ones used for all other transactions which work fine. -- Felipe Monteiro de Carvalho _______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal