On Wed, Mar 8, 2023 at 7:58 PM Bryn Llewellyn <b...@yugabyte.com> wrote:

>
>     r := (my_c1, my_c2)::s.t;
>

If you write s.x there it will also work.

Your first and third assignments are identical in syntax/nature.  These are
both the first examples here[1]

Yes, the behavior of INTO in the second assignment is somewhat
non-intuitive; but covered here[2].  Probably it could use more examples.

The final form fits into a procedural flow better than the SQL-based one.
Since plpgsql allows for procedural flow this makes sense.  The composite
variable reference is simply: main_type_name.field_name  Hence the second
example here[1]

[1]
https://www.postgresql.org/docs/current/plpgsql-statements.html#PLPGSQL-STATEMENTS-ASSIGNMENT
[2]
https://www.postgresql.org/docs/current/plpgsql-statements.html#PLPGSQL-STATEMENTS-SQL-ONEROW

David J.

Reply via email to