I'm running the query twice to see if there are differences with the #naked call, while debugging. The generated query is (identical between both cases, as expected):
SELECT
"users"."email"
, "users"."name"
, "users"."default_ui_language"
, "users"."id", "users"."user_id"
, array_agg("domain") AS "domains"
, array_agg("permission") AS "products"
FROM "users"
INNER JOIN "user_accounts" USING ("email")
INNER JOIN "account_product_permissions" USING ("domain")
WHERE (("users"."id" = 2) AND ("users"."user_state" = 'active'))
GROUP BY "users"."email", "users"."name", "users"."default_ui_language", "users"."id", "users"."user_id"
LIMIT 1
which is, as far as I'm concerned, exactly what I want. Running the above query in psql returns correct values in domains and products, namely text::[] values. Unfortunately, the resulting hash has unparsed values:
Well, I managed to fix my problem. I had to load the extension like this:
Sequel::Model.db.extension :pg_array
I found the proper way to load the extension in the source code at lib/sequel/extensions/pg_array.rb.
I did NOT find this documentation on http://sequel.rubyforge.org/rdoc-plugins/classes/Sequel/Postgres/PGAr... or in the 3.35 release notes. Now that I've read the source, I see the documentation is indeed extensive, but I didn't find the link to the extensions' documentation from the main documentation site. Where should I have looked?
> I'm running the query twice to see if there are differences with the > #naked call, while debugging. The generated query is (identical between > both cases, as expected):
> SELECT
> "users"."email"
> , "users"."name"
> , "users"."default_ui_language"
> , "users"."id", "users"."user_id"
> , array_agg("domain") AS "domains"
> , array_agg("permission") AS "products"
> FROM "users"
> INNER JOIN "user_accounts" USING ("email")
> INNER JOIN "account_product_permissions" USING ("domain")
> WHERE (("users"."id" = 2) AND ("users"."user_state" = 'active'))
> GROUP BY "users"."email", "users"."name", "users"."default_ui_language", > "users"."id", "users"."user_id"
> LIMIT 1
> which is, as far as I'm concerned, exactly what I want. Running the above > query in psql returns correct values in domains and products, namely > text::[] values. Unfortunately, the resulting hash has unparsed values:
On Sunday, November 4, 2012 6:01:23 AM UTC-8, François Beausoleil wrote:
> Well, I managed to fix my problem. I had to load the extension like this:
> Sequel::Model.db.extension :pg_array
> I found the proper way to load the extension in the source code at > lib/sequel/extensions/pg_array.rb.
> I did NOT find this documentation on > http://sequel.rubyforge.org/rdoc-plugins/classes/Sequel/Postgres/PGAr... in the 3.35 release notes. Now that I've read the source, I see the > documentation is indeed extensive, but I didn't find the link to the > extensions' documentation from the main documentation site. Where should I > have looked?
Ha, I see. I was hitting http://sequel.rubyforge.org/ then following the documentation link. There's an Extensions/Plugins link that I followed, and that brought me to the RDoc for the plugins.