Re: [GENERAL] PostgreSQL with PowerBuilder, and Identity keys (serials) - Mailing list pgsql-general

From Melvin Davidson
Subject Re: [GENERAL] PostgreSQL with PowerBuilder, and Identity keys (serials)
Date
Msg-id CANu8Fixzk0exYor0ZDT50gaBV0MDNpvHmZX-QVo_eQTtcwg_cg@mail.gmail.com
Whole thread Raw
In response to [GENERAL] PostgreSQL with PowerBuilder, and Identity keys (serials)  ("Dan Cooperstock at Software4Nonprofits" <info@software4nonprofits.com>)
Responses Re: [GENERAL] PostgreSQL with PowerBuilder, and Identity keys (serials)  ("Dan Cooperstock at Software4Nonprofits" <info@software4nonprofits.com>)
List pgsql-general
>GetIdentity="Select currval('GEN_&TableName')"

FYI, it would be helpful to specify the PostgreSQL version & O/S, but generically speaking, in PostgreSQL, when you generate a sequence
by specifying serial as data type, the name takews the form of tablename_columnname_seq, so in your case, try

https://www.postgresql.org/docs/9.4/static/datatype-numeric.html#DATATYPE-SERIAL

GetIdentity="Select currval('tablename_column_seq')".

BTW, in PostgreSQL, it is NOT recommended to use mixed case object names, as all names are converted to lowercase unless enclosed in double quotes.


On Sat, Aug 5, 2017 at 4:09 PM, Dan Cooperstock at Software4Nonprofits <info@software4nonprofits.com> wrote:

I’m trying to get a Postgres DB version of an application I write in PowerBuilder working. The thing I’m stuck on is Identity keys – what you set up with the SERIAL attribute or SEQUENCEs / GENERATORs in Postgres.

 

I have the sequence set up and clearly working. And in PowerBuilder, I have added a section I found online to a file it uses to know how to deal with different aspects of different DBs (PBODBxxx.INI) for Postgres, including the following line for retrieving an identity key after saving a record, when the DB automatically fills in the value:

 

GetIdentity="Select currval('GEN_&TableName')"

 

That obviously depends on the generator being named “GEN_” plus the table’s name – which is true in our case.

 

But nothing like that is happening. Does anyone else have PostgresSQL working with PowerBuilder and identity keys, who can give me some pointers on how get this to work?

 

Thanks.

 

--------------------------------------------------------

Dan Cooperstock
DONATION and ACCOUNTS web site: http://www.Software4Nonprofits.com
Email: info@Software4Nonprofits.com
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.

 




--
Melvin Davidson
I reserve the right to fantasize.  Whether or not you
wish to share my fantasy is entirely up to you.

pgsql-general by date:

Previous
From: "Dan Cooperstock at Software4Nonprofits"
Date:
Subject: [GENERAL] PostgreSQL with PowerBuilder, and Identity keys (serials)
Next
From: "Dan Cooperstock at Software4Nonprofits"
Date:
Subject: Re: [GENERAL] PostgreSQL with PowerBuilder, and Identity keys (serials)