Add Record en-/decoder

Issue #258 new
Lars Kanis
created an issue

Original post:!topic/ruby-pg/ikdlp67c5RA

The current implementation of decoders and encoders doesn't support embedded Records of composite type?

What I'd like to do is decode the following example:

CREATE TYPE example AS (a string, b integer, c boolean);
CREATE TABLE test (id integer, sample example);
INSERT INTO test VALUES (1, '("Some text",123,false)');

The query returns the following values, before decoder:

result['id'] === 1
result['sample'] === '("Some text",123,false)'

What I'd like to do is something like the "PG::TextDecoder::Array#decode" method, but with a mix of decoder functions, returning:

result['sample'] === ['Some text', 123, false]

Comments (1)

  1. Log in to comment