I'm working on a port of my PB2017 version of my app to PostgreSQL. I have updated all copies of the PBODB170.INI file to include the following sections (irrelevant bits omitted):
[PostgreSQL]
PBSyntax='PGSQL_SYNTAX'
PBTableOwner='NO'
...
PBNoCatalog='YES'
[PGSQL_SYNTAX]
...
GetIdentity="Select currval('GEN_&TableName')"
I am quite sure this section is being found, because before I added this section, every time I connected in PB to Postgres I was warned about the fact that the catalog tables couldn't be created. Now I'm not warned about that. (So that's the PBNoCatalog setting working.)
However, in DWs with Identity Columns, the identity value isn't being retrieved properly after an Update. I'm quite sure from the Postgres docs that the syntax for GetIdentity in the code above is good.
I've tested this in the DB painter, to make sure my DDL is correct in that it is correctly using a SEQUENCE to insert the identity values. To test that, I did an INSERT statement to insert a row (with no identity column value), did a SELECT to retrieve that row and saw that the identity column was filled in, and did the Select currval('GEN_...') which correctly returned that same identity column I saw in the SELECT of the row itself.
So, any bright ideas of what I might be missing here? Thanks.
GetIdentity=’Select max(&ColumnName) from &TableName’
However, I wouldn't be entirely happy using that, both from an efficiency standpoint, and the fact that it seems to me it could be error prone, if two people were inserting to the same table at exactly the same time, they might get the same number.