[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_US

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 = Dr

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

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 ?

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

[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

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

2017-08-05 Thread Melvin Davidson
>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 cas

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

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,

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,

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 ide

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

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 Ap

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/

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

2017-08-05 Thread Karl Czajkowski
> 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()

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

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 w