Skip to content

Q: Is it possible to handle composite values like row(123, 'str', true) ? #578

@kwatch

Description

@kwatch

Is it possible to retrieve composite values (ex: row(123, 'str', true, null))
as Ruby's Array object (ex: [123, "str", true, nil]) ?

I hope to execute the following SQL...

select row(emp.*), row(dept.*)    --- !!! composite values !!!
from employees as emp
join departments as dept on emp.dept_id = dept.id

and want to get the following result for example...

[
  [1001, "Alice",    211, "Sales"],
  [1002, "Bob",      215, "Marketing"],
  [1003, "Charlie",  213, "Customer support"],
]

but actually got the following unexpected result:

[
  ["(1001,\"Alice\",211,\"Sales\")"],
  ["(1002,\"Bob\",215,\"Marketing\")"],
  ["(1003,\"Charlie\",215,\"Customer support\")"],
]

If you know how to retrieve composite values correctly, please let me know.

(I found the following page but I can't succeeded to do what I want.)
https://deveiate.org/code/pg/PG/TextDecoder/Record.html

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions