> t...@sss.pgh.pa.us wrote: > >> pavel.steh...@gmail.com writes: >> >> Some errors like this, but not this can be detected by plpgsql_check >> https://www.google.com/url?q=https://github.com/okbob/plpgsql_check&source=gmail-imap&ust=1629148434000000&usg=AOvVaw3f9UAP7RvDPC2QKi3_4Mj0 >> - probably the heuristic for type >> check is not complete. > > STRICTMULTIASSIGNMENT would detect most cases of this, except that the > condition is checked too late. We'd need to count the fields > *before* trying to assign values, not after. > > In the meantime, it does seem like the docs could be more explicit about > this, and perhaps give an example showing the (x).* solution.
Tom, Pavel, and John, thanks for your quick responses. I've filed them all away and I'm hoping that I won't be caught out by this in the future. It now seems to me to be odd, in the light of the explanations for why the naïve (PL/SQL-style) syntax doesn't work in PL/pgSQL, that assigning a scalar subquery to a variable of the composite type in question _does_ work! But don't take that as a question. I'm going to regard this as "case closed".