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

2017-08-05 Thread Igor Korot
Hi, Dan,

On Sat, Aug 5, 2017 at 8:52 PM, Dan Cooperstock at Software4Nonprofits
 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: i...@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:kar...@isi.edu]
> 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_')
>>
>
> From the above, I am assuming you did something like:
>
>CREATE SEQUENCE "GEN_" ...;
>
> 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_"');
>
> With these sorts of identifier-as-argument parameters in Postgres, you can
> also include schema-qualification syntax:
>
>SELECT nextval('"My Schema"."GEN_"');
>
>
> Karl
>
>
>
>
> --
> 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


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

2017-08-05 Thread Dan Cooperstock at Software4Nonprofits
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: i...@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:kar...@isi.edu] 
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_')
>

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

   CREATE SEQUENCE "GEN_" ...;

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_"');

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

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


Karl




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

2017-08-05 Thread Karl Czajkowski

>   Select currval('GEN_')
>

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

   CREATE SEQUENCE "GEN_" ...;

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_"');

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

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


Karl



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

2017-08-05 Thread Rick Widmer

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/


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

2017-08-05 Thread Dan Cooperstock at Software4Nonprofits
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:   i...@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-ow...@postgresql.org 
[mailto:pgsql-general-ow...@postgresql.org] On Behalf Of Melvin Davidson
Sent: August 5, 2017 7:05 PM
To: Igor Korot 
Cc: Dan Cooperstock at Software4Nonprofits ; Rob 
Sargent ; Forums postgresql 

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

 

 

On Sat, Aug 5, 2017 at 6:26 PM, Igor Korot  > wrote:

Hi,

Did you try bringing it to SAP?

Thank you.

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

 > 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_')"
>
> 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: i...@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:robjsarg...@gmail.com 
>  ]
> Sent: August 5, 2017 5:30 PM
> To: Dan Cooperstock at Software4Nonprofits   >
> Cc: Forums postgresql   >
> Subject: Re: [GENERAL] PostgreSQL with PowerBuilder, and Identity keys 
> (serials)
>
>
>> On Aug 5, 2017, at 3:12 PM, Dan Cooperstock at Software4Nonprofits 
>>  > 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 

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

2017-08-05 Thread Melvin Davidson
On Sat, Aug 5, 2017 at 6:26 PM, Igor Korot  wrote:

> Hi,
>
> Did you try bringing it to SAP?
>
> Thank you.
>
> On Sat, Aug 5, 2017 at 2:39 PM, Dan Cooperstock at Software4Nonprofits
>  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_')"
> >
> > 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: i...@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:robjsarg...@gmail.com]
> > Sent: August 5, 2017 5:30 PM
> > To: Dan Cooperstock at Software4Nonprofits  >
> > Cc: Forums postgresql 
> > Subject: Re: [GENERAL] PostgreSQL with PowerBuilder, and Identity keys
> (serials)
> >
> >
> >> On Aug 5, 2017, at 3:12 PM, Dan Cooperstock at Software4Nonprofits <
> i...@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(
> >>   CATEGORYNUMSMALLINT NOT NULL DEFAULT NEXTVAL('GEN_CATEGORY'),
> >>   DESCRIPTIONVARCHAR(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: i...@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:melvin6...@gmail.com]
> >> Sent: August 5, 2017 4:46 PM
> >> To: Dan Cooperstock at Software4Nonprofits
> >> 
> >> Cc: pgsql-general@postgresql.org
> >> Subject: Re: [GENERAL] PostgreSQL with PowerBuilder, and Identity keys
> >> (serials)
> >>
> >> >GetIdentity="Select currval('GEN_')"
> >>
> >> 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 <
> i...@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 

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

2017-08-05 Thread Igor Korot
Hi,

Did you try bringing it to SAP?

Thank you.

On Sat, Aug 5, 2017 at 2:39 PM, Dan Cooperstock at Software4Nonprofits
 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_')"
>
> 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: i...@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:robjsarg...@gmail.com]
> Sent: August 5, 2017 5:30 PM
> To: Dan Cooperstock at Software4Nonprofits 
> Cc: Forums postgresql 
> Subject: Re: [GENERAL] PostgreSQL with PowerBuilder, and Identity keys 
> (serials)
>
>
>> On Aug 5, 2017, at 3:12 PM, Dan Cooperstock at Software4Nonprofits 
>>  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(
>>   CATEGORYNUMSMALLINT NOT NULL DEFAULT NEXTVAL('GEN_CATEGORY'),
>>   DESCRIPTIONVARCHAR(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: i...@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:melvin6...@gmail.com]
>> Sent: August 5, 2017 4:46 PM
>> To: Dan Cooperstock at Software4Nonprofits
>> 
>> Cc: pgsql-general@postgresql.org
>> Subject: Re: [GENERAL] PostgreSQL with PowerBuilder, and Identity keys
>> (serials)
>>
>> >GetIdentity="Select currval('GEN_')"
>>
>> 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 
>>  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 

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

2017-08-05 Thread Dan Cooperstock at Software4Nonprofits
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_')"

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: i...@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:robjsarg...@gmail.com] 
Sent: August 5, 2017 5:30 PM
To: Dan Cooperstock at Software4Nonprofits 
Cc: Forums postgresql 
Subject: Re: [GENERAL] PostgreSQL with PowerBuilder, and Identity keys (serials)


> On Aug 5, 2017, at 3:12 PM, Dan Cooperstock at Software4Nonprofits 
>  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(
>   CATEGORYNUMSMALLINT NOT NULL DEFAULT NEXTVAL('GEN_CATEGORY'),
>   DESCRIPTIONVARCHAR(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: i...@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:melvin6...@gmail.com]
> Sent: August 5, 2017 4:46 PM
> To: Dan Cooperstock at Software4Nonprofits 
> 
> Cc: pgsql-general@postgresql.org
> Subject: Re: [GENERAL] PostgreSQL with PowerBuilder, and Identity keys 
> (serials)
>  
> >GetIdentity="Select currval('GEN_')"
> 
> 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 
>  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_')"
>>  
>> That obviously depends on the generator being 

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

2017-08-05 Thread Rob Sargent

> On Aug 5, 2017, at 3:12 PM, Dan Cooperstock at Software4Nonprofits 
>  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(
>   CATEGORYNUMSMALLINT NOT NULL DEFAULT NEXTVAL('GEN_CATEGORY'),
>   DESCRIPTIONVARCHAR(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: i...@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:melvin6...@gmail.com] 
> Sent: August 5, 2017 4:46 PM
> To: Dan Cooperstock at Software4Nonprofits 
> Cc: pgsql-general@postgresql.org
> Subject: Re: [GENERAL] PostgreSQL with PowerBuilder, and Identity keys 
> (serials)
>  
> >GetIdentity="Select currval('GEN_')"
> 
> 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 
>  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_')"
>>  
>> 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: i...@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


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

2017-08-05 Thread Dan Cooperstock at Software4Nonprofits
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(

  CATEGORYNUMSMALLINT NOT NULL DEFAULT NEXTVAL('GEN_CATEGORY'),

  DESCRIPTIONVARCHAR(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:   i...@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:melvin6...@gmail.com] 
Sent: August 5, 2017 4:46 PM
To: Dan Cooperstock at Software4Nonprofits 
Cc: pgsql-general@postgresql.org
Subject: Re: [GENERAL] PostgreSQL with PowerBuilder, and Identity keys (serials)

 

>GetIdentity="Select currval('GEN_')"

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 
 > 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_')"

 

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: i...@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)

2017-08-05 Thread Melvin Davidson
>GetIdentity="Select currval('GEN_')"


*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,
tryhttps://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 <
i...@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_')"
>
>
>
> 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: i...@software4nonprofits.com
> Phone: 416-423-7722 <(416)%20423-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.


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

2017-08-05 Thread Dan Cooperstock at Software4Nonprofits
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_')"

 

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: i...@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] Lifetime of PQexecPrepared() returned value

2017-08-05 Thread Tom Lane
Igor Korot  writes:
> However it leads to another question - should PQclear set the pointer to NULL?

C doesn't provide any reasonable way to do that.  The argument of PQclear
needn't even be an lvalue; for example, if you're not too concerned about
error checking, it's not unreasonable to write

PQclear(PQexec(conn, "some SQL command"));

regards, tom lane


-- 
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] Invalid byte sequence for encoding UTF-8 0xc3\n

2017-08-05 Thread Igor Korot
John et al,

On Mon, Jul 31, 2017 at 12:13 AM, Igor Korot  wrote:
> John,
>
> On Sun, Jul 30, 2017 at 5:32 PM, Igor Korot  wrote:
>> Hi, John,
>>
>> On Sun, Jul 30, 2017 at 4:53 PM, John R Pierce  wrote:
>>> On 7/30/2017 1:43 PM, Igor Korot wrote:
>>>
>>> what encodings are default on your system ?`\l+` in psql should show the
>>> encodings.
>>>
>>> Is this "backslash + pipe + plus-sign"?
>>>
>>> Trying it gives: "Invalid command".
>>>
>>>
>>> \ + lower case L + plus sign, thats the psql metacommand to list all
>>> databases with extra info
>>>
>>> postgres=# \l+
>>>List
>>> of databases
>>>   Name  |   Owner   | Encoding |   Collate   |Ctype|
>>> Access privileges   |  Size   | Tablespace |Description
>>> +---+--+-+-+---+-++
>>>  junk   | pierce| UTF8 | en_US.UTF-8 | en_US.UTF-8 |
>>> | 6586 kB | pg_default |
>>>  observers_test | observers | UTF8 | en_US.UTF-8 | en_US.UTF-8 |
>>> | 207 MB  | pg_default |
>>>  pierce | pierce| UTF8 | en_US.UTF-8 | en_US.UTF-8 |
>>> | 6786 kB | pg_default |
>>>  postgres   | postgres  | UTF8 | en_US.UTF-8 | en_US.UTF-8 |
>>> | 6610 kB | pg_default | default administrative connection database
>>>  scac   | scac  | UTF8 | en_US.UTF-8 | en_US.UTF-8 |
>>> | 75 MB   | pg_default |
>>>  scac_save  | scac  | UTF8 | en_US.UTF-8 | en_US.UTF-8 |
>>> | 105 MB  | pg_default |
>>>  smf| smf   | UTF8 | en_US.UTF-8 | en_US.UTF-8 |
>>> | 34 MB   | pg_default |
>>>  sympa  | sympa | UTF8 | en_US.UTF-8 | en_US.UTF-8 |
>>> | 6898 kB | pg_default |
>>>  template0  | postgres  | UTF8 | en_US.UTF-8 | en_US.UTF-8 |
>>> =c/postgres  +| 6457 kB | pg_default | unmodifiable empty database
>>> |   |  | | |
>>> postgres=CTc/postgres | ||
>>>  template1  | postgres  | UTF8 | en_US.UTF-8 | en_US.UTF-8 |
>>> =c/postgres  +| 6465 kB | pg_default | default template for new
>>> databases
>>> |   |  | | |
>>> postgres=CTc/postgres | ||
>>>  tendenci   | tendenci  | UTF8 | en_US.UTF-8 | en_US.UTF-8 |
>>> | 15 MB   | pg_default |
>>>  test   | postgres  | UTF8 | en_US.UTF-8 | en_US.UTF-8 |
>>> | 6634 kB | pg_default |
>>> (12 rows)
>>>
>>>
>>> for instance, all my databases are UTF8 on that server.
>>
>> Looks like mine are as well:
>>
>> draft=# \l+
>>List of 
>> databases
>>Name|  Owner   | Encoding | Collate | Ctype |   Access
>> privileges   |  Size   | Tablespace |Description
>> ---+--+--+-+---+---+-++
>>  draft | postgres | UTF8 | C   | C |
>> | 11 MB   | pg_default |
>>  leagues   | postgres | UTF8 | C   | C |
>> | 5865 kB | pg_default |
>>  postgres  | postgres | UTF8 | C   | C |
>> | 5865 kB | pg_default | default administrative connection
>> database
>>  template0 | postgres | UTF8 | C   | C | =c/postgres
>>+| 5865 kB | pg_default | unmodifiable empty database
>>|  |  | |   |
>> postgres=CTc/postgres | ||
>>  template1 | postgres | UTF8 | C   | C | =c/postgres
>>+| 5865 kB | pg_default | default template for new databases
>>|  |  | |   |
>> postgres=CTc/postgres | ||
>> (5 rows)
>>
>> I'm using the draft one.
>
> And my application is compiled in UNICODE mode.
>
> Now IIUC, in order to work correctly, the application and the database
> should have
> the same encoding. If I'm right, what is the way to get the encoding
> of the database?
>
> Thank you.

My application has a different ways to connect to the database.
One way is thru the ODBC another is thru the native client library.

When trying to connect using ODBC (iODBC + PostgreSQL driver)
everything works correctly. There is no errors.
However, when trying to connect with libpq, I get the aforementioned error.

I tried to call:

setlocale( LC_ALL, "" );

before and after I get the connection as suggested by ODBC driver maintainer,
Hiroshi Inoue, but it didn't help.

Is there anything else I can try to fix the problem?

Thank you.

>
>>
>> Thank you.
>>
>>>
>>>
>>> --
>>> john r pierce, recycling bits in santa cruz


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

Re: [GENERAL] Lifetime of PQexecPrepared() returned value

2017-08-05 Thread Igor Korot
Hi, guys,

On Fri, Aug 4, 2017 at 5:01 PM, Tom Lane  wrote:
> Igor Korot  writes:
>> I have a following piece of code:
>
>> [code]
>> PGresult *res = PQexecPrepared();
>> status = PQresultStatue( res );
>> if( status == PGRES_TUPLES_OK )
>> {
>> for( int j = 0; j < PQntuples( res ); j++ )
>> {
>> char *foo = PQgetValue( res, j, 0 );
>> char *bar = PQgetValue( res, j, 1 );
>> MyObject *obj = new MyObject( foo, bar );
>> if( SetAdditionalProperties( obj ) )
>> {
>>   result = 1;
>>   break;
>> }
>> }
>> PQclear( res );
>> }
>
> What I'm wondering about is whether the MyObject constructor is making
> copies of the strings it's passed, or whether it thinks it can just hold
> onto those pointers.  The pointers would be dangling once you do PQclear.
> Now, if the MyObject has gone out of scope and been destroyed, which
> this coding suggests would happen, then that shouldn't matter ... but
> maybe the pointers got copied to somewhere longer-lived?  Anyway, there's
> nothing visibly wrong with what you showed us, so the problem is somewhere
> else.

I need to deeply apologize.
I cam home yesterday, look at the code again and saw the PQclear()
call in the if()
block.
However it leads to another question - should PQclear set the pointer to NULL?

Sorry for the noise once again and thank you for reading.


>
> regards, tom lane


-- 
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] Type cast in PHP PDO (does not work like in Java?)

2017-08-05 Thread Raymond O'Donnell

On 05/08/17 16:58, Alexander Farber wrote:

Good evening,

with PostgreSQL 9.6.3 and JDBC 42.1.1.jre7 types can be casted when 
calling a stored function:


 final String sql = "SELECT words_buy_vip(?::text, ?::int, 
?::text, ?::text, ?::float, ?::inet)";


 try (Connection db = DriverManager.getConnection(DATABASE_URL, 
DATABASE_USER, DATABASE_PASS);

 PreparedStatement st = db.prepareStatement(sql)) {
  st.setString(2, sid);
  st.setInt(1, SOCIAL_FACEBOOK);
  // etc.
  st.executeQuery();
 }

But with PHP 5.4.16 on CentOS 7 Linux the types can not be casted (and 
strangely the statement is just not being executed without any error 
being reported) and the "::text", "::int" and "::inet" should be removed 
from the placeholders as in:


I think PDO uses a colon in named parameters, so maybe that's causing 
problems. You could try casting like this:


  select words_buy_vip(cast(? as text), cast(? as int), .);

Ray.


--
Raymond O'Donnell :: Galway :: Ireland
r...@iol.ie


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


[GENERAL] Type cast in PHP PDO (does not work like in Java?)

2017-08-05 Thread Alexander Farber
Good evening,

with PostgreSQL 9.6.3 and JDBC 42.1.1.jre7 types can be casted when calling
a stored function:

final String sql = "SELECT words_buy_vip(?::text, ?::int, ?::text,
?::text, ?::float, ?::inet)";

try (Connection db = DriverManager.getConnection(DATABASE_URL,
DATABASE_USER, DATABASE_PASS);
PreparedStatement st = db.prepareStatement(sql)) {
 st.setString(2, sid);
 st.setInt(1, SOCIAL_FACEBOOK);
 // etc.
 st.executeQuery();
}

But with PHP 5.4.16 on CentOS 7 Linux the types can not be casted (and
strangely the statement is just not being executed without any error being
reported) and the "::text", "::int" and "::inet" should be removed from the
placeholders as in:

$sql = 'SELECT words_buy_vip(?, ?, ?, ?, ?, ?)';   // can not use
type casts here?

try {
   $options = array(PDO::ATTR_ERRMODE =>
PDO::ERRMODE_EXCEPTION,
  PDO::ATTR_CASE =>
PDO::CASE_LOWER);
   $dbh = new PDO(sprintf('pgsql:host=%s;port=%u;dbname=%s',
DBHOST, DBPORT, DBNAME), DBUSER, DBPASS, $options);
   $sth = $dbh->prepare($sql);
   $params = array($sid, SOCIAL_FACEBOOK, $payment_id,
$product, $price, $_SERVER['REMOTE_ADDR']);
$sth->execute($params);
} catch (PDOException $ex) {
error_log("PDO exception $ex");
}

Is that so or do I overlook something?

And when reading the PHP docs
http://php.net/manual/en/pdostatement.bindvalue.php
and http://php.net/manual/en/pdo.constants.php
then there is no constant to use for the "::inet"

Thank you for any comments
Alex