On Sat, Oct 22, 2011 at 9:38 PM, Ludo Brands <ludo.bra...@free.fr> wrote:
> Nextval takes a regclass as parameter, not an identifier (column). So, use
> single quotes: SELECT nextval('GameSession_SessionId_seq') as res;

But Postgres requires double quotes or else it will lowercase the
entire identifier and it won't match. It seams that it moves forward
if I use both types of quotes! Like this:

  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;

But now I get a new error "Cannot open a non-select statement" o.O

Regardless of the final "as res;" being there or not.
-- 
Felipe Monteiro de Carvalho
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply via email to