No, Carl, when I created the sequence, I didn't put its name in double
quotes, so therefore its name wasn't being forced to stay upper case. So in
the nextval() command, putting it only in single quotes works - Postgres
converts both the original creation and the reference to it to lower case.

As I have mentioned in several replies, I have tested all of this code
directly in SQL statements and they work perfectly. It's only the
interaction with PowerBuilder that isn't working right, which is why I keep
saying that further answers from anyone that hasn't solved this problem of
using Postgres with PowerBuilder, and getting identity retrieval to work in
PowerBuilder, are not at this point worthwhile.

Dan Cooperstock
Phone: 416-423-7722
Mail: 57 Gledhill Ave., Toronto ON M4C 5K7, Canada

If you do not want to receive any further emails from Software4Nonprofits,
please reply to this email with the subject line "UNSUBSCRIBE", and we will
immediately remove you from our mailing list, if you are on it.

-----Original Message-----
From: Karl Czajkowski [] 
Sent: August 5, 2017 8:25 PM
To: Dan Cooperstock at Software4Nonprofits <>
Cc: 'Rob Sargent' <>; 'Forums postgresql'
Subject: Re: PostgreSQL with PowerBuilder, and Identity keys (serials)

>   Select currval('GEN_&TableName')

>From the above, I am assuming you did something like:

   CREATE SEQUENCE "GEN_&TableName" ...;

and are trying to access this sequence?  If so, you actually have to include
the SQL quoted identifier syntax within the text argument to
currval() or nextval(), e.g.

   SELECT nextval('"GEN_&TableName"');

With these sorts of identifier-as-argument parameters in Postgres, you can
also include schema-qualification syntax:

   SELECT nextval('"My Schema"."GEN_&TableName"');


Sent via pgsql-general mailing list (
To make changes to your subscription:

Reply via email to