PostgreSQL

PowerBuilder apps can connect with the PostgreSQL 10 (32-bit and 64-bit) (ANSI and Unicode) database through the PostgreSQL ODBC driver.

PBODB170.INI must be configured first in order for connecting with the PostgreSQL database through ODBC interface. Search "PostgreSQL" in PBODB170.INI to view the parameter list, related syntax, and functions. For how to configure the PBODB170.INI file, see Adding Functions to the PBODB170 Initialization File.

Note

When the PostgreSQL database is used in the remote procedure call (RPC), use the inout keyword to define the stored procedure (using out keyword cannot return data), and use subroutine (rather than function) to define the RPC function.

Limited support for stored procedure

PostgreSQL stored procedure is not fully supported, for example, PostgreSQL stored procedure with parameters cannot be used as the data source for DataWindow objects. When using PostgreSQL stored procedure as the data source for DataWindow objects, make sure to set the StripParmNames connection parameter to Yes (or select the "strip parameter names" option in the syntax section of the database profile setup). PostgreSQL stored procedure syntax cannot be previewed in the Database Painter or the DataWindow data source.

Support for auto-increment column

PostgreSQL supports the auto-increment column with the following two methods:

  • Method 1: GetIdentity='Select currval(''GEN_&TableName'')'

  • Method 2: GetIdentity='Select currval(''&TableName._&ColumnName._seq')'

    Method 2 uses the serial to create the auto-increment column.

These methods require that the sequence name follows the name conversions specified by GetIdentity in pbodb170.ini, for example, gen_TableName, TableName_ColumnName_seq. If the sequence name is not in the required format, the identity value cannot be obtained automatically.

These methods also require that the DelimitIdentifier property ("Enclose Table and Column Names in Quotes" option) set to NO. If it is set to YES, the identity value cannot be returned.