Advertisement
Guest User

Untitled

a guest
Feb 25th, 2018
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.39 KB | None | 0 0
  1. ------------------------------------------------------------------------------
  2. --**Create temp_smartnodelist_full
  3. create temp table temp_smartnodelist_full (
  4. txid varchar(64)
  5. ,index int
  6. ,status varchar(100)
  7. ,protocol int
  8. ,address varchar(34)
  9. ,lastseen int
  10. ,activeseconds int
  11. ,lastpaidtime int
  12. ,lastpaidblock INT
  13. ,ip varchar(20)
  14. ,PRIMARY KEY(address, txid)
  15. );
  16. ------------------------------------------------------------------------------
  17. --**Copy csv file into temp_smartnodelist_full
  18. \copy temp_smartnodelist_full (txid, index,status,protocol,address,lastseen,activeseconds,lastpaidtime,lastpaidblock,ip) from '/home/smartadmin/nodar/smartnodelist.csv' with delimiter as ','
  19.  
  20. ------------------------------------------------------------------------------
  21. INSERT INTO smartnodelist_full as sf (txid
  22. ,index
  23. ,status
  24. ,protocol
  25. ,address
  26. ,lastseen
  27. ,activeseconds
  28. ,lastpaidtime
  29. ,lastpaidblock
  30. ,ip )
  31. SELECT
  32. txid
  33. ,index
  34. ,status
  35. ,protocol
  36. ,address
  37. ,lastseen
  38. ,activeseconds
  39. ,lastpaidtime
  40. ,lastpaidblock
  41. ,ip
  42. from temp_smartnodelist_full as tsf
  43. ON CONFLICT (address,txid) DO update
  44. SET
  45. EXCLUDED.index=tsf.index
  46. ,EXCLUDED.status=tsf.status
  47. ,EXCLUDED.protocol=tsf.protocol
  48. ,EXCLUDED.lastseen=tsf.lastseen
  49. ,EXCLUDED.activeseconds=tsf.activeseconds
  50. ,EXCLUDED.lastpaidtime=tsf.lastpaidtime
  51. ,EXCLUDED.lastpaidblock=tsf.lastpaidblock
  52. ,EXCLUDED.ip=tsf.ip
  53. ;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement