Original post: https://groups.google.com/forum/#!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)'); SELECT * FROM test;
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]