[Ur] Multiple joins with an outer join

Athene Noctua steenuil.owl at gmail.com
Mon Jul 3 15:37:10 EDT 2017


I see, that's what I thought. Thanks!

On Mon, Jul 3, 2017 at 9:16 PM, Adam Chlipala <adamc at csail.mit.edu> wrote:

> 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?
>>
>
>
> _______________________________________________
> Ur mailing list
> Ur at impredicative.com
> http://www.impredicative.com/cgi-bin/mailman/listinfo/ur
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.impredicative.com/pipermail/ur/attachments/20170703/6c1b5ccd/attachment.html>


More information about the Ur mailing list