Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ------------------------------------------------------------------------------
- --**Create temp_smartnodelist_full
- create temp table temp_smartnodelist_full (
- txid varchar(64)
- ,index int
- ,status varchar(100)
- ,protocol int
- ,address varchar(34)
- ,lastseen int
- ,activeseconds int
- ,lastpaidtime int
- ,lastpaidblock INT
- ,ip varchar(20)
- ,PRIMARY KEY(address, txid)
- );
- ------------------------------------------------------------------------------
- --**Copy csv file into temp_smartnodelist_full
- \copy temp_smartnodelist_full (txid, index,status,protocol,address,lastseen,activeseconds,lastpaidtime,lastpaidblock,ip) from '/home/smartadmin/nodar/smartnodelist.csv' with delimiter as ','
- ------------------------------------------------------------------------------
- INSERT INTO smartnodelist_full as sf (txid
- ,index
- ,status
- ,protocol
- ,address
- ,lastseen
- ,activeseconds
- ,lastpaidtime
- ,lastpaidblock
- ,ip )
- SELECT
- txid
- ,index
- ,status
- ,protocol
- ,address
- ,lastseen
- ,activeseconds
- ,lastpaidtime
- ,lastpaidblock
- ,ip
- from temp_smartnodelist_full as tsf
- ON CONFLICT (address,txid) DO update
- SET
- EXCLUDED.index=tsf.index
- ,EXCLUDED.status=tsf.status
- ,EXCLUDED.protocol=tsf.protocol
- ,EXCLUDED.lastseen=tsf.lastseen
- ,EXCLUDED.activeseconds=tsf.activeseconds
- ,EXCLUDED.lastpaidtime=tsf.lastpaidtime
- ,EXCLUDED.lastpaidblock=tsf.lastpaidblock
- ,EXCLUDED.ip=tsf.ip
- ;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement