Glenn MacGregor
2004-04-22 20:46:31 UTC
Hi All,
Sorry if this is a double post.
Here is an example of my table which works
vid vname parentname
1 ***@test.com
2 ***@test.com ***@test.com
3 ***@test.com ***@test.com
4 ***@test.com ***@test.com
5 ***@test.com ***@test.com
So my simple cascade on delete states that if I delete a row whose vname
matches the parentname of any other delete those rows.
No problem this works great!
Now I have changed my data to
vid vname parentname
1 ***@test.com
2 ***@test.com n1
3 ***@test.com n1
4 ***@test.com n1
5 ***@test.com n3
Notice the parentname is a substring of the vname. I can get that
substring from a select query
select (substring(vname from 0 for position('@' in vname)) from table1
This query returns
vname
------
n1
n2
n3
n4
n5
Can I change my delete cascade constraint to do this substring query
instead of an exact match?
Is there anyway to accomplish what I need to do?
Thanks
Glenn MacGregor
---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your
joining column's datatypes do not match
Sorry if this is a double post.
Here is an example of my table which works
vid vname parentname
1 ***@test.com
2 ***@test.com ***@test.com
3 ***@test.com ***@test.com
4 ***@test.com ***@test.com
5 ***@test.com ***@test.com
So my simple cascade on delete states that if I delete a row whose vname
matches the parentname of any other delete those rows.
No problem this works great!
Now I have changed my data to
vid vname parentname
1 ***@test.com
2 ***@test.com n1
3 ***@test.com n1
4 ***@test.com n1
5 ***@test.com n3
Notice the parentname is a substring of the vname. I can get that
substring from a select query
select (substring(vname from 0 for position('@' in vname)) from table1
This query returns
vname
------
n1
n2
n3
n4
n5
Can I change my delete cascade constraint to do this substring query
instead of an exact match?
Is there anyway to accomplish what I need to do?
Thanks
Glenn MacGregor
---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your
joining column's datatypes do not match