1. Paweł Kasperek
  2. PowerBuilder
  3. Saturday, 2 March 2024 13:23 PM UTC

Hi,

I have a few years of experience with PostgreSQL. I tried to retrieve data from Postres table with array-type columns. I created a simple test table in Postgres with array columns as in the below image:

After link this table to Datawindow in PB I've got follow DW with all char()

The type is char. How I can (if possible) get true types described in DW ex. integer array? I now that Postgres backend always retrieves arrays as string type with "{,}" format.

 

 

 

 

 

Accepted Answer
Bruce Armstrong Accepted Answer Pending Moderation
  1. Sunday, 3 March 2024 16:30 PM UTC
  2. PowerBuilder
  3. # Permalink

You can't.  Not directly into the DataWindow.  The DataWindow only understands an array of simple datatypes.  For something more complex you would need to call the stored procedure from PowerScript, parse the results and then put them into into DataWindow in some form that looks like an array of simple datatypes.  Or create the stored procedure so that it puts the nested data into a simple data type.

Comment
  1. Paweł Kasperek
  2. Monday, 4 March 2024 13:06 PM UTC
Hi,



Currently, is not possible to update/insert data to array-type columns in Postgres via DW/DS?



How I can print the Update/Insert SQL statement generated by datastore/datawindow object (on call Update() method) ?



Regards,

Pawel

  1. Helpful
  1. Bruce Armstrong
  2. Monday, 4 March 2024 17:33 PM UTC
You can use the SQLPreview event to see what SQL statements the DataWindow is generating and modify them.
  1. Helpful 1
  1. Paweł Kasperek
  2. Thursday, 11 July 2024 09:34 AM UTC
I wrote my wrapper for DS/DW objects and I parsed the return text (string) value. Thank you for helping.



Regards,

Pawel
  1. Helpful
There are no comments made yet.


There are replies in this question but you are not allowed to view the replies from this question.