Re: Combining scalar and row types in RETURNING - Mailing list pgsql-general

From PetSerAl
Subject Re: Combining scalar and row types in RETURNING
Date
Msg-id CAKygsHSmiDzcXSruEjR2XSbyF9WP2Ro3ni5utWS+XAGScJd8EQ@mail.gmail.com
Whole thread Raw
List pgsql-general
> In my case, m_new_data is actually a table row type rather than plain
> "record". The row is passed on to another function which calculates the
> altered columns and logs the changes.

In my experience, to specify composite-typed receiver as one element
of INTO list, it need to be column of composite variable.

CREATE TABLE t (a int, b int, c int);
CREATE TYPE wrap AS (v t);
DO $DO$
  DECLARE
    s text;
    w wrap;
  BEGIN
    INSERT INTO t VALUES (1, 2, 3)
    RETURNING 'text', t
    INTO s, w.v;
    RAISE '%, %', s, w.v;
  END;
$DO$;

https://dbfiddle.uk/e5Q4Fj6l



pgsql-general by date:

Previous
From: Dominique Devienne
Date:
Subject: Re: LOCALE C.UTF-8 on EDB Windows v17 server
Next
From: "Daniel Verite"
Date:
Subject: Re: LOCALE C.UTF-8 on EDB Windows v17 server