Re: [GENERAL] Array values and foreign keys

2004-10-27 Thread Daniel Savard
Le mer 27/10/2004 à 11:59, Pierre-Frédéric Caillaud a écrit : > > > You can't express it directly with a CHECK constraint but you can do this > : > > - add CHECK( test_array( yourcolumn )) in your table definition > - create function test_array which takes an array and looks

Re: [GENERAL] Array values and foreign keys

2004-10-27 Thread Michael Fuhr
On Wed, Oct 27, 2004 at 05:59:46PM +0200, Pierre-Fr?d?ric Caillaud wrote: > > - add CHECK( test_array( yourcolumn )) in your table definition > - create function test_array which takes an array and looks if all > its elements are in your table T2, I do something like comparing

Re: [GENERAL] Array values and foreign keys

2004-10-27 Thread Pierre-Frédéric Caillaud
You can't express it directly with a CHECK constraint but you can do this : - add CHECK( test_array( yourcolumn )) in your table definition - create function test_array which takes an array and looks if all its elements are in your table T2, I do something like comparing the length of th

[GENERAL] Array values and foreign keys

2004-10-27 Thread Daniel Savard
Is there a way to define a foreign key for the values of an array? For example, if table T1 is having a colum A which is defined as integer[] can I define a foreign key in order to force each value to be a pointer (index) to a row in a table T2? If yes, how? Is there any shortcomings to this ap