pnfsDump2MigratePnfs2Chimera: companion2chimera.sql

File companion2chimera.sql, 619 bytes (added by tigran, 3 years ago)
Line 
1---
2--- migrate companion info into t_locationinfo table
3---
4--- v0.1
5---
6
7
8CREATE OR REPLACE FUNCTION "public"."companion2chimera" ()  RETURNS void AS $$
9DECLARE
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;
20END;
21$$
22LANGUAGE 'plpgsql';
23