Foreign Key for PHP serialized data - possible?

From: "Dave" <withheld(at)nospam(dot)thanks>
To: pgsql-general(at)postgresql(dot)org
Subject: Foreign Key for PHP serialized data - possible?
Date: 2007-10-05 20:43:55
Message-ID: bf242$4706a213$453dce02$24167@FUSE.NET
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi,

I have a table1 with a tb1_column that stores PHP serialized data that are
unique integers.
| tb1_column |
-----------
a:5:{i:0;s:1:"9";i:1;s:2:"5";i:2;s:2:"11";i:3;s:2:"100";i:4;s:2:"10";}

I also have a table2 with unique integers (ids) in tb2_column
| tb2_column | descr |
----------
11 | Pears
100 | Plums
9 | Apples
5 | Oranges
10 | Cranberries

What I'm trying to do is to create a foreign key on tb1_column so that if a
number in tb2_column changes or gets deleted, it cascades to the appropriate
segment of the serialized data.
e.g. if an id of Oranges changes from '5' to '24', the tb1_column rows will
get changed in the above example row to:
a:5:{i:0;s:1:"9";i:1;s:2:"24";i:2;s:2:"11";i:3;s:2:"100";i:4;s:2:"10";}

Is this possible? Can anyone suggest a function that would do that?

If not what is the alternative that will have a similar effect?

Thanks

Dave

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Aroon Pahwa 2007-10-05 21:33:20 valid query runs forever?
Previous Message John Wells 2007-10-05 19:57:07 Re: "timer" script from SAMS book or equivalent?