Thread: How to create a dynamic list?

How to create a dynamic list?

From
Renaud Tthonnart
Date:
I 'd like create a type like a dynamic list.

I've tried

CREATE TYPE liste
(
 INPUT = array_in,
 OUTPUT = array_out,
 INTERNALLENGTH = VARIABLE,
 ELEMENT = int
);

CREATE TABLE xxx
(
 num  int,
 nom  varchar(10),
 nb     liste,
 PRIMARY KEY(num)
);

This instruction give an error :

INSERT INTO xxx
VALUES(1,'aaa',(10,20,30));

ERROR:  parser: parse error at or near ")"

Could someone tell me how do I have to do?
Thanks

Renaud THONNART


Re: How to create a dynamic list?

From
Christopher Sawtell
Date:
On Sat, 24 Feb 2001 02:56, Renaud Tthonnart wrote:
> I 'd like create a type like a dynamic list.

chris=# \d+ xxx
                        Table "xxx"
 Attribute |         Type          | Modifier | Description
-----------+-----------------------+----------+-------------
 num       | integer               | not null |
 nom       | character varying(10) |          |
 nb        | integer[]             |          |
Index: xxx_pkey

chris=# INSERT INTO xxx  VALUES(1,'aaa','{10,20,30}');
INSERT 137225 1
chris=# select * from xxx;
 num | nom |     nb
-----+-----+------------
   1 | aaa | {10,20,30}
(1 row)


--
Sincerely etc.,

 NAME       Christopher Sawtell
 CELL PHONE 021 257 4451
 ICQ UIN    45863470
 EMAIL      csawtell @ xtra . co . nz
 CNOTES     ftp://ftp.funet.fi/pub/languages/C/tutorials/sawtell_C.tar.gz

 -->> Please refrain from using HTML or WORD attachments in e-mails to me
<<--


Re: How to create a dynamic list?

From
Renaud Tthonnart
Date:
Ok, many thanks