[Ur] Multiple joins with an outer join
Adam Chlipala
adamc at csail.mit.edu
Mon Jul 3 15:16:54 EDT 2017
One way is to change:
files.Key
into:
{sql_nullable (SQL files.Key)}
That's a kind of cast into a nullable type, to match the type of the
other operand.
I don't see a way around changing types to indicate that any column of
an outer-joined table could be null.
On 07/03/2017 02:58 PM, Athene Noctua wrote:
> I'm having trouble with a query using multiple joins, one of which is
> an outer join:
>
> SELECT * FROM posts
> LEFT OUTER JOIN post_files ON post_files.Post = posts.Key
> JOIN files ON post_files.File = files.Key
>
> I think the type system assumes that posts_files.File will exist even
> though a post might not have any associated files, and end ups with this:
>
> Can't resolve type class instance
> Class constraint:
> {Post_files :
> {File : nullify string string,
> Post : nullify int (option int)}}
> Reduced to unresolvable:
> {File : nullify string string,
> Post : nullify int (option int)}
>
> Is this query resolvable in some way?
More information about the Ur
mailing list