Nested composite types again

Поиск
Список
Период
Сортировка
От Michael Kolomeitsev
Тема Nested composite types again
Дата
Msg-id CAABbzO3RJb_4sobpkNy3hE2JZXZuWAGwy6Fr_bqvdM+0C5KJbQ@mail.gmail.com
обсуждение исходный текст
Ответы Re: Nested composite types again
Список pgsql-novice
Hi,

but it didn't help.

CREATE TABLE nodes (
  id SERIAL NOT NULL PRIMARY KEY,
  name TEXT NOT NULL
);

CREATE TYPE pathId AS (
  id INTEGER,
  node nodes
);

CREATE OR REPLACE FUNCTION test_AEN7304() RETURNS void AS $$
DECLARE
  r pathId;
  n nodes;
BEGIN
  n.name := 'abc';
  r.id := 1;
  r.node := n; -- All is ok
--  r.node.name := 'def'; -- << Error here
--  (r).node.name := 'def'; -- << and here
  ((r).node).name := 'def'; -- << and here
END;
$$ LANGUAGE 'plpgsql';

And I can't even make 'n' as ALIAS FOR r.node (to simulate C-like pointer).

What is the right syntax?
Thanks

В списке pgsql-novice по дате отправления:

Предыдущее
От: Gavan Schneider
Дата:
Сообщение: Re: Curiosity: what is PostgreSQL doing with data when "nothing" is happening?
Следующее
От: Vibhor Kumar
Дата:
Сообщение: Re: Nested composite types again