Thread: [GENERAL] PostgreSQL with PowerBuilder, and Identity keys (serials)

[GENERAL] PostgreSQL with PowerBuilder, and Identity keys (serials)

From
"Dan Cooperstock at Software4Nonprofits"
Date:

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.

 

Re: [GENERAL] PostgreSQL with PowerBuilder, and Identity keys (serials)

From
Melvin Davidson
Date:
>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.

Re: [GENERAL] PostgreSQL with PowerBuilder, and Identity keys (serials)

From
"Dan Cooperstock at Software4Nonprofits"
Date:

I’m on PostgreSQL 9.6, 64-bit Windows.

 

That really is the correct name for the sequence, because I’m not using SERIAL. (I needed everything to match the naming in my existing DB I’m using for the app, Firebird SQL, so the changes to make it work with either DB would be as minimal as possible.) The setup of tables I’m using with this sort of thing are like the following example:

 

CREATE SEQUENCE GEN_CATEGORY MINVALUE 0;

 

CREATE TABLE CATEGORY(

  CATEGORYNUM    SMALLINT NOT NULL DEFAULT NEXTVAL('GEN_CATEGORY'),

  DESCRIPTION        VARCHAR(20) NOT NULL,

  CONSTRAINT PK_CATEGORY PRIMARY KEY (CATEGORYNUM)

);

 

So as you can see GEN_ plus the tablename is indeed correct. The default on the CATEGORYNUM column is definitely working, which I tested with direct SQL commands: after inserting a row (with the CATEGORYNUM not specified in the INSERT), if I SELECT currval(‘GEN_CATEGORY’), it gives me the correct value, which is also what got saved in that column.

 

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

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.

 

From: Melvin Davidson [mailto:melvin6925@gmail.com]
Sent: August 5, 2017 4:46 PM
To: Dan Cooperstock at Software4Nonprofits <info@software4nonprofits.com>
Cc: pgsql-general@postgresql.org
Subject: Re: [GENERAL] PostgreSQL with PowerBuilder, and Identity keys (serials)

 

>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.

Re: [GENERAL] PostgreSQL with PowerBuilder, and Identity keys(serials)

From
Rob Sargent
Date:
> On Aug 5, 2017, at 3:12 PM, Dan Cooperstock at Software4Nonprofits <info@software4nonprofits.com> wrote:
>
> I’m on PostgreSQL 9.6, 64-bit Windows.
>
> That really is the correct name for the sequence, because I’m not using SERIAL. (I needed everything to match the
namingin my existing DB I’m using for the app, Firebird SQL, so the changes to make it work with either DB would be as
minimalas possible.) The setup of tables I’m using with this sort of thing are like the following example: 
>
> CREATE SEQUENCE GEN_CATEGORY MINVALUE 0;
>
> CREATE TABLE CATEGORY(
>   CATEGORYNUM    SMALLINT NOT NULL DEFAULT NEXTVAL('GEN_CATEGORY'),
>   DESCRIPTION        VARCHAR(20) NOT NULL,
>   CONSTRAINT PK_CATEGORY PRIMARY KEY (CATEGORYNUM)
> );
>
> So as you can see GEN_ plus the tablename is indeed correct. The default on the CATEGORYNUM column is definitely
working,which I tested with direct SQL commands: after inserting a row (with the CATEGORYNUM not specified in the
INSERT),if I SELECT currval(‘GEN_CATEGORY’), it gives me the correct value, which is also what got saved in that
column.
>
> --------------------------------------------------------
> 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
subjectline "UNSUBSCRIBE", and we will immediately remove you from our mailing list, if you are on it. 
>
>
> From: Melvin Davidson [mailto:melvin6925@gmail.com]
> Sent: August 5, 2017 4:46 PM
> To: Dan Cooperstock at Software4Nonprofits <info@software4nonprofits.com>
> Cc: pgsql-general@postgresql.org
> Subject: Re: [GENERAL] PostgreSQL with PowerBuilder, and Identity keys (serials)
>
> >GetIdentity="Select currval('GEN_&TableName')"
>
> FYI, it would be helpful to specify the PostgreSQL version & O/S, but generically speaking, in PostgreSQL, when you
generatea 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
unlessenclosed 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
Identitykeys – 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
ituses to know how to deal with different aspects of different DBs (PBODBxxx.INI) for Postgres, including the following
linefor 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,
whocan 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
subjectline "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.

I don’t see that you posted any sort of error message?
Also don’t test that sequence more than 64K times as you’ll certainly get a number too big for smallest :)
Did your direct sql testing actually use ALL CAPS?



Re: [GENERAL] PostgreSQL with PowerBuilder, and Identity keys (serials)

From
"Dan Cooperstock at Software4Nonprofits"
Date:
Yes my direct SQL testing used all caps and worked fine.

There is no error message. It's just that PowerBuilder's built-in mechanism that should retrieve the identity key
column'svalue after an insert is done using its DataWindow control, that is based on the setting I gave in my first
post, 

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

isn't working - the value doesn't get filled in. I have no way of knowing whether that code isn't getting called, isn't
working,or what. (I tried a trace option in PowerBuilder, and it didn't show any call to that code, but it also didn't
showany call to the corresponding code in my setup for Firebird SQL, where this works perfectly.) 

I really need responses from people who have successfully done this with PowerBuilder, because I think it's an issue
aboutthe combination of PowerBuilder and PostgreSQL, not PostgreSQL alone. 

--------------------------------------------------------
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. 


-----Original Message-----
From: Rob Sargent [mailto:robjsargent@gmail.com]
Sent: August 5, 2017 5:30 PM
To: Dan Cooperstock at Software4Nonprofits <info@software4nonprofits.com>
Cc: Forums postgresql <pgsql-general@postgresql.org>
Subject: Re: [GENERAL] PostgreSQL with PowerBuilder, and Identity keys (serials)


> On Aug 5, 2017, at 3:12 PM, Dan Cooperstock at Software4Nonprofits <info@software4nonprofits.com> wrote:
>
> I’m on PostgreSQL 9.6, 64-bit Windows.
>
> That really is the correct name for the sequence, because I’m not using SERIAL. (I needed everything to match the
namingin my existing DB I’m using for the app, Firebird SQL, so the changes to make it work with either DB would be as
minimalas possible.) The setup of tables I’m using with this sort of thing are like the following example: 
>
> CREATE SEQUENCE GEN_CATEGORY MINVALUE 0;
>
> CREATE TABLE CATEGORY(
>   CATEGORYNUM    SMALLINT NOT NULL DEFAULT NEXTVAL('GEN_CATEGORY'),
>   DESCRIPTION        VARCHAR(20) NOT NULL,
>   CONSTRAINT PK_CATEGORY PRIMARY KEY (CATEGORYNUM) );
>
> So as you can see GEN_ plus the tablename is indeed correct. The default on the CATEGORYNUM column is definitely
working,which I tested with direct SQL commands: after inserting a row (with the CATEGORYNUM not specified in the
INSERT),if I SELECT currval(‘GEN_CATEGORY’), it gives me the correct value, which is also what got saved in that
column.
>
> --------------------------------------------------------
> 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
subjectline "UNSUBSCRIBE", and we will immediately remove you from our mailing list, if you are on it. 
>
>
> From: Melvin Davidson [mailto:melvin6925@gmail.com]
> Sent: August 5, 2017 4:46 PM
> To: Dan Cooperstock at Software4Nonprofits
> <info@software4nonprofits.com>
> Cc: pgsql-general@postgresql.org
> Subject: Re: [GENERAL] PostgreSQL with PowerBuilder, and Identity keys
> (serials)
>
> >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#DATAT
> YPE-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
unlessenclosed 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
Identitykeys – 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
ituses to know how to deal with different aspects of different DBs (PBODBxxx.INI) for Postgres, including the following
linefor 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,
whocan 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
subjectline "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.

I don’t see that you posted any sort of error message?
Also don’t test that sequence more than 64K times as you’ll certainly get a number too big for smallest :) Did your
directsql testing actually use ALL CAPS? 




Re: [GENERAL] PostgreSQL with PowerBuilder, and Identity keys (serials)

From
Igor Korot
Date:
Hi,

Did you try bringing it to SAP?

Thank you.

On Sat, Aug 5, 2017 at 2:39 PM, Dan Cooperstock at Software4Nonprofits
<info@software4nonprofits.com> wrote:
> Yes my direct SQL testing used all caps and worked fine.
>
> There is no error message. It's just that PowerBuilder's built-in mechanism that should retrieve the identity key
column'svalue after an insert is done using its DataWindow control, that is based on the setting I gave in my first
post,
>
>     GetIdentity="Select currval('GEN_&TableName')"
>
> isn't working - the value doesn't get filled in. I have no way of knowing whether that code isn't getting called,
isn'tworking, or what. (I tried a trace option in PowerBuilder, and it didn't show any call to that code, but it also
didn'tshow any call to the corresponding code in my setup for Firebird SQL, where this works perfectly.) 
>
> I really need responses from people who have successfully done this with PowerBuilder, because I think it's an issue
aboutthe combination of PowerBuilder and PostgreSQL, not PostgreSQL alone. 
>
> --------------------------------------------------------
> 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
subjectline "UNSUBSCRIBE", and we will immediately remove you from our mailing list, if you are on it. 
>
>
> -----Original Message-----
> From: Rob Sargent [mailto:robjsargent@gmail.com]
> Sent: August 5, 2017 5:30 PM
> To: Dan Cooperstock at Software4Nonprofits <info@software4nonprofits.com>
> Cc: Forums postgresql <pgsql-general@postgresql.org>
> Subject: Re: [GENERAL] PostgreSQL with PowerBuilder, and Identity keys (serials)
>
>
>> On Aug 5, 2017, at 3:12 PM, Dan Cooperstock at Software4Nonprofits <info@software4nonprofits.com> wrote:
>>
>> I’m on PostgreSQL 9.6, 64-bit Windows.
>>
>> That really is the correct name for the sequence, because I’m not using SERIAL. (I needed everything to match the
namingin my existing DB I’m using for the app, Firebird SQL, so the changes to make it work with either DB would be as
minimalas possible.) The setup of tables I’m using with this sort of thing are like the following example: 
>>
>> CREATE SEQUENCE GEN_CATEGORY MINVALUE 0;
>>
>> CREATE TABLE CATEGORY(
>>   CATEGORYNUM    SMALLINT NOT NULL DEFAULT NEXTVAL('GEN_CATEGORY'),
>>   DESCRIPTION        VARCHAR(20) NOT NULL,
>>   CONSTRAINT PK_CATEGORY PRIMARY KEY (CATEGORYNUM) );
>>
>> So as you can see GEN_ plus the tablename is indeed correct. The default on the CATEGORYNUM column is definitely
working,which I tested with direct SQL commands: after inserting a row (with the CATEGORYNUM not specified in the
INSERT),if I SELECT currval(‘GEN_CATEGORY’), it gives me the correct value, which is also what got saved in that
column.
>>
>> --------------------------------------------------------
>> 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
subjectline "UNSUBSCRIBE", and we will immediately remove you from our mailing list, if you are on it. 
>>
>>
>> From: Melvin Davidson [mailto:melvin6925@gmail.com]
>> Sent: August 5, 2017 4:46 PM
>> To: Dan Cooperstock at Software4Nonprofits
>> <info@software4nonprofits.com>
>> Cc: pgsql-general@postgresql.org
>> Subject: Re: [GENERAL] PostgreSQL with PowerBuilder, and Identity keys
>> (serials)
>>
>> >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#DATAT
>> YPE-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
unlessenclosed 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
isIdentity 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
fileit uses to know how to deal with different aspects of different DBs (PBODBxxx.INI) for Postgres, including the
followingline 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,
whocan 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
subjectline "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.
>
> I don’t see that you posted any sort of error message?
> Also don’t test that sequence more than 64K times as you’ll certainly get a number too big for smallest :) Did your
directsql testing actually use ALL CAPS? 
>
>
>
>
> --
> Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-general


Re: [GENERAL] PostgreSQL with PowerBuilder, and Identity keys (serials)

From
Melvin Davidson
Date:

On Sat, Aug 5, 2017 at 6:26 PM, Igor Korot <ikorot01@gmail.com> wrote:
Hi,

Did you try bringing it to SAP?

Thank you.

On Sat, Aug 5, 2017 at 2:39 PM, Dan Cooperstock at Software4Nonprofits
<info@software4nonprofits.com> wrote:
> Yes my direct SQL testing used all caps and worked fine.
>
> There is no error message. It's just that PowerBuilder's built-in mechanism that should retrieve the identity key column's value after an insert is done using its DataWindow control, that is based on the setting I gave in my first post,
>
>     GetIdentity="Select currval('GEN_&TableName')"
>
> isn't working - the value doesn't get filled in. I have no way of knowing whether that code isn't getting called, isn't working, or what. (I tried a trace option in PowerBuilder, and it didn't show any call to that code, but it also didn't show any call to the corresponding code in my setup for Firebird SQL, where this works perfectly.)
>
> I really need responses from people who have successfully done this with PowerBuilder, because I think it's an issue about the combination of PowerBuilder and PostgreSQL, not PostgreSQL alone.
>
> --------------------------------------------------------
> 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.
>
>
> -----Original Message-----
> From: Rob Sargent [mailto:robjsargent@gmail.com]
> Sent: August 5, 2017 5:30 PM
> To: Dan Cooperstock at Software4Nonprofits <info@software4nonprofits.com>
> Cc: Forums postgresql <pgsql-general@postgresql.org>
> Subject: Re: [GENERAL] PostgreSQL with PowerBuilder, and Identity keys (serials)
>
>
>> On Aug 5, 2017, at 3:12 PM, Dan Cooperstock at Software4Nonprofits <info@software4nonprofits.com> wrote:
>>
>> I’m on PostgreSQL 9.6, 64-bit Windows.
>>
>> That really is the correct name for the sequence, because I’m not using SERIAL. (I needed everything to match the naming in my existing DB I’m using for the app, Firebird SQL, so the changes to make it work with either DB would be as minimal as possible.) The setup of tables I’m using with this sort of thing are like the following example:
>>
>> CREATE SEQUENCE GEN_CATEGORY MINVALUE 0;
>>
>> CREATE TABLE CATEGORY(
>>   CATEGORYNUM    SMALLINT NOT NULL DEFAULT NEXTVAL('GEN_CATEGORY'),
>>   DESCRIPTION        VARCHAR(20) NOT NULL,
>>   CONSTRAINT PK_CATEGORY PRIMARY KEY (CATEGORYNUM) );
>>
>> So as you can see GEN_ plus the tablename is indeed correct. The default on the CATEGORYNUM column is definitely working, which I tested with direct SQL commands: after inserting a row (with the CATEGORYNUM not specified in the INSERT), if I SELECT currval(‘GEN_CATEGORY’), it gives me the correct value, which is also what got saved in that column.
>>
>> --------------------------------------------------------
>> 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.
>>
>>
>> From: Melvin Davidson [mailto:melvin6925@gmail.com]
>> Sent: August 5, 2017 4:46 PM
>> To: Dan Cooperstock at Software4Nonprofits
>> <info@software4nonprofits.com>
>> Cc: pgsql-general@postgresql.org
>> Subject: Re: [GENERAL] PostgreSQL with PowerBuilder, and Identity keys
>> (serials)
>>
>> >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#DATAT
>> YPE-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.
>
> I don’t see that you posted any sort of error message?
> Also don’t test that sequence more than 64K times as you’ll certainly get a number too big for smallest :) Did your direct sql testing actually use ALL CAPS?
>
>
>
>
> --
> Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-general


--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


>I’m on PostgreSQL 9.6, 64-bit Windows.

 >That really is the correct name for the sequence, because I’m not using SERIAL.> GetIdentity="Select currval('GEN_&TableName')"
>isn't working

If you are not sure what the correct name is (or is generated), then use the information schema to see what sequence names
have actually been generated.

SELECT sequence_schema,
               sequence_name
  FROM information_schema.sequences
 ORDER BY 1, 2;

It might also be that you have not done a  SELECT nextval(your_sequnce) before SELECT currval(your_sequence) in that session.
currval

Return the value most recently obtained by nextval for this sequence in the current session. (An error is reported if nextval has never been called for this sequence in this session.)

If that is the case, then you can get the current sequence value by treating the sequence like a table.
EG: SELECT seqeunce_name,
                       last_value
            FROM your_seqeunce_name;

FYI, the structure of sequence tables is as follows:
     seqeunce_name     name
     last_value                bigint
     start_value               bigint
     increment_by           bigint
     max_value               bigint
     min_value                bigint
     cache_value            bigint
     log_cnt                     bigint
     is_cycled                  boolean
     is_called                   boolean


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

Re: [GENERAL] PostgreSQL with PowerBuilder, and Identity keys (serials)

From
"Dan Cooperstock at Software4Nonprofits"
Date:

Igor, PowerBuilder is now being sold and supported by Appeon, not SAP, and I have this question also on a community discussion board there, but so far no answers. (I wish Postgres had a web-based community board, rather than just this mailing list with no history available!) I will post it to Appeon as an actual bug if I get stuck.

 

Melvin, I created the schema, so I know for sure what the naming is, and as I mentioned in another answer, I have done exactly what PowerBuilder should be doing with direct SQL statements in Postgres and they work perfectly.

 

It’s currval() that can’t be called before nextval(). Nextval() can always be called, and is the only thing that should be being called in this situation.

 

I think I can assure you all that although I’m a newbie with Postgres, I have long experience with various SQL database servers, I have read the relevant parts of the Postgres docs thoroughly, and I know what’s going on with the sequence within it. The problem is clearly in whatever PowerBuilder is doing with Postgres, but I was just hoping someone on this list would have experience with that combination and know the answer.

 

I really think there is no point in anyone else replying to this thread unless you have experience with both programs together, and have solved this problem for yourself. 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.

 

From: pgsql-general-owner@postgresql.org [mailto:pgsql-general-owner@postgresql.org] On Behalf Of Melvin Davidson
Sent: August 5, 2017 7:05 PM
To: Igor Korot <ikorot01@gmail.com>
Cc: Dan Cooperstock at Software4Nonprofits <info@software4nonprofits.com>; Rob Sargent <robjsargent@gmail.com>; Forums postgresql <pgsql-general@postgresql.org>
Subject: Re: [GENERAL] PostgreSQL with PowerBuilder, and Identity keys (serials)

 

 

On Sat, Aug 5, 2017 at 6:26 PM, Igor Korot <ikorot01@gmail.com> wrote:

Hi,

Did you try bringing it to SAP?

Thank you.

On Sat, Aug 5, 2017 at 2:39 PM, Dan Cooperstock at Software4Nonprofits

<info@software4nonprofits.com> wrote:
> Yes my direct SQL testing used all caps and worked fine.
>
> There is no error message. It's just that PowerBuilder's built-in mechanism that should retrieve the identity key column's value after an insert is done using its DataWindow control, that is based on the setting I gave in my first post,
>
>     GetIdentity="Select currval('GEN_&TableName')"
>
> isn't working - the value doesn't get filled in. I have no way of knowing whether that code isn't getting called, isn't working, or what. (I tried a trace option in PowerBuilder, and it didn't show any call to that code, but it also didn't show any call to the corresponding code in my setup for Firebird SQL, where this works perfectly.)
>
> I really need responses from people who have successfully done this with PowerBuilder, because I think it's an issue about the combination of PowerBuilder and PostgreSQL, not PostgreSQL alone.
>
> --------------------------------------------------------
> 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.
>
>
> -----Original Message-----
> From: Rob Sargent [mailto:robjsargent@gmail.com]
> Sent: August 5, 2017 5:30 PM
> To: Dan Cooperstock at Software4Nonprofits <info@software4nonprofits.com>
> Cc: Forums postgresql <pgsql-general@postgresql.org>
> Subject: Re: [GENERAL] PostgreSQL with PowerBuilder, and Identity keys (serials)
>
>
>> On Aug 5, 2017, at 3:12 PM, Dan Cooperstock at Software4Nonprofits <info@software4nonprofits.com> wrote:
>>
>> I’m on PostgreSQL 9.6, 64-bit Windows.
>>
>> That really is the correct name for the sequence, because I’m not using SERIAL. (I needed everything to match the naming in my existing DB I’m using for the app, Firebird SQL, so the changes to make it work with either DB would be as minimal as possible.) The setup of tables I’m using with this sort of thing are like the following example:
>>
>> CREATE SEQUENCE GEN_CATEGORY MINVALUE 0;
>>
>> CREATE TABLE CATEGORY(
>>   CATEGORYNUM    SMALLINT NOT NULL DEFAULT NEXTVAL('GEN_CATEGORY'),
>>   DESCRIPTION        VARCHAR(20) NOT NULL,
>>   CONSTRAINT PK_CATEGORY PRIMARY KEY (CATEGORYNUM) );
>>
>> So as you can see GEN_ plus the tablename is indeed correct. The default on the CATEGORYNUM column is definitely working, which I tested with direct SQL commands: after inserting a row (with the CATEGORYNUM not specified in the INSERT), if I SELECT currval(‘GEN_CATEGORY’), it gives me the correct value, which is also what got saved in that column.
>>
>> --------------------------------------------------------
>> 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.
>>
>>
>> From: Melvin Davidson [mailto:melvin6925@gmail.com]
>> Sent: August 5, 2017 4:46 PM
>> To: Dan Cooperstock at Software4Nonprofits
>> <info@software4nonprofits.com>
>> Cc: pgsql-general@postgresql.org
>> Subject: Re: [GENERAL] PostgreSQL with PowerBuilder, and Identity keys
>> (serials)
>>
>> >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#DATAT
>> YPE-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.
>
> I don’t see that you posted any sort of error message?
> Also don’t test that sequence more than 64K times as you’ll certainly get a number too big for smallest :) Did your direct sql testing actually use ALL CAPS?
>
>
>
>
> --
> Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-general


--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general



>I’m on PostgreSQL 9.6, 64-bit Windows.

 >That really is the correct name for the sequence, because I’m not using SERIAL.> GetIdentity="Select currval('GEN_&TableName')"

>isn't working

If you are not sure what the correct name is (or is generated), then use the information schema to see what sequence names
have actually been generated.

SELECT sequence_schema,
               sequence_name
  FROM information_schema.sequences

 ORDER BY 1, 2;

It might also be that you have not done a  SELECT nextval(your_sequnce) before SELECT currval(your_sequence) in that session.

currval

Return the value most recently obtained by nextval for this sequence in the current session. (An error is reported if nextval has never been called for this sequence in this session.)

If that is the case, then you can get the current sequence value by treating the sequence like a table.

EG: SELECT seqeunce_name,

                       last_value

            FROM your_seqeunce_name;

FYI, the structure of sequence tables is as follows:

     seqeunce_name     name

     last_value                bigint

     start_value               bigint

     increment_by           bigint

     max_value               bigint

     min_value                bigint

     cache_value            bigint

     log_cnt                     bigint

     is_cycled                  boolean

     is_called                   boolean

 

--

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

Re: [GENERAL] PostgreSQL with PowerBuilder, and Identity keys(serials)

From
Rick Widmer
Date:
On 8/5/2017 6:06 PM, Dan Cooperstock at Software4Nonprofits wrote:
>  (I wish Postgres had a web-based community board,
> rather than just this mailing list with no history available!) I will
> post it to Appeon as an actual bug if I get stuck.

Have you looked here?

https://www.postgresql.org/list/

or here:

https://www.postgresql.org/list/pgsql-general/


Re: [GENERAL] PostgreSQL with PowerBuilder, and Identity keys (serials)

From
Karl Czajkowski
Date:
>   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"');


Karl



Re: [GENERAL] PostgreSQL with PowerBuilder, and Identity keys (serials)

From
"Dan Cooperstock at Software4Nonprofits"
Date:
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
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.


-----Original Message-----
From: Karl Czajkowski [mailto:karlcz@isi.edu]
Sent: August 5, 2017 8:25 PM
To: Dan Cooperstock at Software4Nonprofits <info@software4nonprofits.com>
Cc: 'Rob Sargent' <robjsargent@gmail.com>; 'Forums postgresql'
<pgsql-general@postgresql.org>
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"');


Karl




Re: [GENERAL] PostgreSQL with PowerBuilder, and Identity keys (serials)

From
Igor Korot
Date:
Hi, Dan,

On Sat, Aug 5, 2017 at 8:52 PM, Dan Cooperstock at Software4Nonprofits
<info@software4nonprofits.com> wrote:
> 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.

Do you have this DW inside some Window object?
Further do you have those queey in responce to an event for DW or Window?
If yes - what kind?

Can you post a complete script? You can do a PM if anything.
I didn't work with PB + PG, but I do have some PB knowledge...

Thank you.

>
> --------------------------------------------------------
> 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.
>
>
> -----Original Message-----
> From: Karl Czajkowski [mailto:karlcz@isi.edu]
> Sent: August 5, 2017 8:25 PM
> To: Dan Cooperstock at Software4Nonprofits <info@software4nonprofits.com>
> Cc: 'Rob Sargent' <robjsargent@gmail.com>; 'Forums postgresql'
> <pgsql-general@postgresql.org>
> 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"');
>
>
> Karl
>
>
>
>
> --
> Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-general


[GENERAL] PostgreSQL with PowerBuilder, and Identity keys (serials)

From
"David G. Johnston"
Date:
On Saturday, August 5, 2017, Dan Cooperstock at Software4Nonprofits <info@software4nonprofits.com> wrote:
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.

If it is PostgreSQL's problem you should be able to setup statement logging on the server and see what is happening at the SQL level.

David J.

Re: [GENERAL] PostgreSQL with PowerBuilder, and Identity keys (serials)

From
"Dan Cooperstock at Software4Nonprofits"
Date:

Thanks, David, this was actually the most helpful suggestion. Using logging of SQL statements in Postgres, I was able to first determine that the style of quoting I was using in the PowerBuilder INI file wasn’t working, and then that the &TableName variable wasn’t being expanded by PowerBuilder before sending the SQL to Postgres. The latter of which is a clear PowerBuilder problem, so I have submitted it to them as a bug.

 

So I think we can now put this to rest on this mailing list. Thanks, all.

 

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

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.

 

From: pgsql-general-owner@postgresql.org [mailto:pgsql-general-owner@postgresql.org] On Behalf Of David G. Johnston
Sent: August 6, 2017 3:47 AM
To: Dan Cooperstock at Software4Nonprofits <info@software4nonprofits.com>
Cc: Forums postgresql <pgsql-general@postgresql.org>
Subject: [GENERAL] PostgreSQL with PowerBuilder, and Identity keys (serials)

 

On Saturday, August 5, 2017, Dan Cooperstock at Software4Nonprofits <info@software4nonprofits.com> wrote:

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.

 

If it is PostgreSQL's problem you should be able to setup statement logging on the server and see what is happening at the SQL level.

 

David J.