Expanding values on a select

I have a large record that I’m needing returned in full and will need to be used as a subquery elsewhere so I cannot have embedded tuples and such, basically and minimally I’m trying to do this SQL:

SELECT banner.sfrstcr.*, 42 AS blah
  FROM banner.sfrstcr

Except the FROM is another subquery, I need to retain all the values returned from it while adding another, and the values returned is dynamic parsed from user input so I cannot just hard code (the very large) list of values, basically looking for the equivalent of something like:

from s in Banner.SFTSTCR,
select: Map.put_new(s, :blah, fragment("42")) # Using a fragment to show this needs to be calculated

Except in Ecto’s notation, and I need to do more than just adding 1, I need to add multiple and as well as combining multiple joins and returning all values in some cases, though not this one right now, as well, remembering that ‘this’ query will also be used as a subquery elsewhere too so I cannot just return a tuple or so as those throw very large errors when trying to pull in from a subquery.

2 Likes