New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not possible to use Array<SomeTuple> as SqlType #425

Closed
weiznich opened this Issue Sep 4, 2016 · 2 comments

Comments

Projects
None yet
2 participants
@weiznich
Contributor

weiznich commented Sep 4, 2016

It seems not to be possible to use Array<SomeTuple> as SqlType.

Think of the following query:

select a.*, array_agg(b.*),
from table_a as a 
left join table_b as b on a.id = b.table_a_id
group by a.id

This results in (A::SqlType, Array<B::SqlType>) as SqlType where B::SqlType' is a Tuple (e.g.(BigInt, Text, BigInt)`).

FromSql and FromSqlRow are implemented for Array for each SqlType that has a FromSql implementation. Tuples implement however only FromSqlRow

@sgrif

This comment has been minimized.

Member

sgrif commented Sep 6, 2016

We don't currently support tuple types in PG. They're not currently on the list of types that are high priority to support.

@sgrif

This comment has been minimized.

Member

sgrif commented Dec 16, 2017

Clearing out old issues....

This is basically just "we don't support PG tuples". I think support for this will probably need to come from another crate. I don't think we can make this ergonomic without variadic generics. If nothing else, the PG type (int4, int4) will map to PgTuple<i32, i32> not (i32, i32) if we ever support it in Diesel.

Closing, as this is not immediately actionable.

@sgrif sgrif closed this Dec 16, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment