Re: Arrays and foreign keys
От | Stephan Szabo |
---|---|
Тема | Re: Arrays and foreign keys |
Дата | |
Msg-id | Pine.BSF.4.10.10008091047260.59889-100000@megazone23.bigpanda.com обсуждение исходный текст |
Ответ на | Arrays and foreign keys (Kaare Rasmussen <kar@webline.dk>) |
Ответы |
Re: Arrays and foreign keys
|
Список | pgsql-hackers |
Well, the two types aren't the same (one is an integer the other an integer array,) so I wouldn't expect it to work. Note: This shows another thing it probably should check before allowing the constraint to be created. I don't know if these belong in TODO, but this might be the appropriate entry. * Make sure that types used in foreign key constraints are comparable. Stephan Szabo sszabo@bigpanda.com On Tue, 8 Aug 2000, Kaare Rasmussen wrote: > Seems that it's not possible to combine arrays and foreign keys ? > > CREATE TABLE table1 ( > fld1 integer NOT NULL, > number integer, > level integer, > PRIMARY KEY (fld1) > ); > > CREATE TABLE table2 ( > pkey integer NOT NULL, > arvar integer[], > PRIMARY KEY (pkey), > FOREIGN KEY (arvar) REFERENCES table1(fld1) > ); > > > This works, but the following insert complains that > > ERROR: Unable to identify an operator '=' for types 'int4' and '_int4' > You will have to retype this query using an explicit cast
В списке pgsql-hackers по дате отправления: