Re: Arrays of records?

Поиск
Список
Период
Сортировка
От Pavel Stehule
Тема Re: Arrays of records?
Дата
Msg-id 162867790707071339p597e6165qf039a5fb9aeb65a2@mail.gmail.com
обсуждение исходный текст
Ответ на Arrays of records?  (Chris Travers <chris@travelamericas.com>)
Список pgsql-general
Hello

you can test it. PostgreSQL 8.3 supports it.

postgres=# CREATE TYPE at AS (a integer, b integer);
CREATE TYPE
postgres=# CREATE TABLE foo(a at[]);
CREATE TABLE
postgres=# INSERT INTO foo VALUES(ARRAY[(10,20)::at]);
INSERT 0 1
postgres=# INSERT INTO foo VALUES(ARRAY[(10,20)::at, (20,30)::at]);
INSERT 0 1
postgres=# SELECT * FROM foo;
           a
-----------------------
 {"(10,20)"}
 {"(10,20)","(20,30)"}
(2 rows)

postgres=# SELECT a[1] FROM foo;
    a
---------
 (10,20)
 (10,20)
(2 rows)

postgres=# SELECT a[1].a FROM foo;
 a
----
 10
 10
(2 rows)

regards

Pavel Stehule




2007/7/7, Chris Travers <chris@travelamericas.com>:
> Hi all;
>
> I was wondering how one would define an array of complex data types or
> records.  Any ideas or is this simply not supported?
>
> Best Wishes,
> Chris Travers
>
> ---------------------------(end of broadcast)---------------------------
> TIP 9: In versions below 8.0, the planner will ignore your desire to
>        choose an index scan if your joining column's datatypes do not
>        match
>

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

Предыдущее
От: Zlatko Matić
Дата:
Сообщение: Re: How to retrieve number of rows affected, in an after statement trigger?
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Crash in PostgreSQL-8.2.4 while executing query