| 1 | --- |
|---|
| 2 | --- migrate companion info into t_locationinfo table |
|---|
| 3 | --- |
|---|
| 4 | --- v0.1 |
|---|
| 5 | --- |
|---|
| 6 | |
|---|
| 7 | |
|---|
| 8 | CREATE OR REPLACE FUNCTION "public"."companion2chimera" () RETURNS void AS $$ |
|---|
| 9 | DECLARE |
|---|
| 10 | ichain RECORD; |
|---|
| 11 | BEGIN |
|---|
| 12 | FOR ichain IN SELECT * FROM cacheinfo LOOP |
|---|
| 13 | BEGIN |
|---|
| 14 | INSERT INTO t_locationinfo VALUES ( ichain.pnfsid, 1, ichain.pool, 10, NOW(), NOW(), 1); |
|---|
| 15 | EXCEPTION WHEN foreign_key_violation THEN |
|---|
| 16 | RAISE NOTICE 'not in chimera %', ichain.pnfsid; |
|---|
| 17 | --- INSERT INTO t_locationinfo_trash VALUES ( ichain.pnfsid, 1, ichain.pool, 10, NOW(), NOW(), 0); |
|---|
| 18 | END; |
|---|
| 19 | END LOOP; |
|---|
| 20 | END; |
|---|
| 21 | $$ |
|---|
| 22 | LANGUAGE 'plpgsql'; |
|---|
| 23 | |
|---|