SET search_path TO market; truncate torder; truncate tstack; truncate tmvt; truncate towner; SELECT setval('tstack_id_seq',1,false); setval -------- 1 (1 row) copy torder(usr,ord,created,updated) from '/home/olivier/ob92/src/sql/torder_test_10000.sql'; copy towner from '/home/olivier/ob92/src/sql/towner_test_10000.sql'; truncate tstack; SELECT setval('tstack_id_seq',10000,true); setval -------- 10000 (1 row) SELECT setval('tmvt_id_seq',1,true); setval -------- 1 (1 row) select * from fsubmitquote(2,'own82','qlt22','qlt23');select * from fproducemvt(); id | diag -------+------ 10001 | 0 (1 row) ord | ordp | qtt_requ | qtt_prov | qtt | qtt_reci | qtt_give | err | json | own | type | stackid ----------------------------------------+------------+----------+----------+-------+----------+----------+-----+-------------------------------------------------------------------------------------------------------------------+-------+------+--------- (142,10001,72,10001,1,qlt22,1,qlt23,0) | (,,,,,,,,) | 67432 | 30183 | 91811 | 149475 | 91811 | 1 | {"qtt_requ":67432,"qtt_prov":30183,"qtt":91811,"qtt_reci":149475,"qtt_give":91811,"paths":[ +| own82 | 142 | 10001 | | | | | | | | [{"type":2, "id":8928, "oid":8928, "own":72, "qtt_requ":49263, "qtt_prov":87732, "qtt":87732, "flowr":53751}, +| | | | | | | | | | | {"type":1, "id":515, "oid":515, "own":69, "qtt_requ":53751, "qtt_prov":67432, "qtt":67432, "flowr":67432}, +| | | | | | | | | | | {"type":142, "id":10001, "oid":10001, "own":72, "qtt_requ":67432, "qtt_prov":30183, "qtt":30183, "flowr":30183}],+| | | | | | | | | | | [{"type":2, "id":3288, "oid":3288, "own":34, "qtt_requ":45276, "qtt_prov":61017, "qtt":61017, "flowr":61017}, +| | | | | | | | | | | {"type":134, "id":10001, "oid":10001, "own":72, "qtt_requ":67432, "qtt_prov":30183, "qtt":35165, "flowr":35165}],+| | | | | | | | | | | [{"type":2, "id":4604, "oid":4604, "own":1, "qtt_requ":74412, "qtt_prov":6118, "qtt":6118, "flowr":6118}, +| | | | | | | | | | | {"type":2, "id":490, "oid":490, "own":82, "qtt_requ":23425, "qtt_prov":28631, "qtt":28631, "flowr":21026}, +| | | | | | | | | | | {"type":134, "id":10001, "oid":10001, "own":72, "qtt_requ":67432, "qtt_prov":30183, "qtt":26463, "flowr":26463}] +| | | | | | | | | | | ]} | | | (1 row) select * from fsubmitquote(2,'own82','qlt22',67432,'qlt23',30183);select * from fproducemvt(); id | diag -------+------ 10002 | 0 (1 row) ord | ordp | qtt_requ | qtt_prov | qtt | qtt_reci | qtt_give | err | json | own | type | stackid ------------------------------------------------+------------+----------+----------+-------+----------+----------+-----+-------------------------------------------------------------------------------------------------------------------+-------+------+--------- (134,10002,72,10002,67432,qlt22,30183,qlt23,0) | (,,,,,,,,) | 67432 | 30183 | 91811 | 149475 | 91811 | 1 | {"qtt_requ":67432,"qtt_prov":30183,"qtt":91811,"qtt_reci":149475,"qtt_give":91811,"paths":[ +| own82 | 134 | 10002 | | | | | | | | [{"type":2, "id":8928, "oid":8928, "own":72, "qtt_requ":49263, "qtt_prov":87732, "qtt":87732, "flowr":53752}, +| | | | | | | | | | | {"type":1, "id":515, "oid":515, "own":69, "qtt_requ":53751, "qtt_prov":67432, "qtt":67432, "flowr":67432}, +| | | | | | | | | | | {"type":134, "id":10002, "oid":10002, "own":72, "qtt_requ":67432, "qtt_prov":30183, "qtt":30183, "flowr":30183}],+| | | | | | | | | | | [{"type":2, "id":3288, "oid":3288, "own":34, "qtt_requ":45276, "qtt_prov":61017, "qtt":61017, "flowr":61017}, +| | | | | | | | | | | {"type":134, "id":10002, "oid":10002, "own":72, "qtt_requ":67432, "qtt_prov":30183, "qtt":35165, "flowr":35165}],+| | | | | | | | | | | [{"type":2, "id":4604, "oid":4604, "own":1, "qtt_requ":74412, "qtt_prov":6118, "qtt":6118, "flowr":6118}, +| | | | | | | | | | | {"type":2, "id":490, "oid":490, "own":82, "qtt_requ":23425, "qtt_prov":28631, "qtt":28631, "flowr":21026}, +| | | | | | | | | | | {"type":134, "id":10002, "oid":10002, "own":72, "qtt_requ":67432, "qtt_prov":30183, "qtt":26463, "flowr":26463}] +| | | | | | | | | | | ]} | | | (1 row) select * from fsubmitquote(2,'own82','qlt22',67432,'qlt23',30183,91809);select * from fproducemvt(); id | diag -------+------ 10003 | 0 (1 row) ord | ordp | qtt_requ | qtt_prov | qtt | qtt_reci | qtt_give | err | json | own | type | stackid ----------------------------------------------------+------------+----------+----------+-------+----------+----------+-----+-------------------------------------------------------------------------------------------------------------------+-------+------+--------- (130,10003,72,10003,67432,qlt22,30183,qlt23,91809) | (,,,,,,,,) | 67432 | 30183 | 91809 | 149473 | 91809 | 1 | {"qtt_requ":67432,"qtt_prov":30183,"qtt":91809,"qtt_reci":149473,"qtt_give":91809,"paths":[ +| own82 | 130 | 10003 | | | | | | | | [{"type":2, "id":8928, "oid":8928, "own":72, "qtt_requ":49263, "qtt_prov":87732, "qtt":87732, "flowr":53752}, +| | | | | | | | | | | {"type":1, "id":515, "oid":515, "own":69, "qtt_requ":53751, "qtt_prov":67432, "qtt":67432, "flowr":67432}, +| | | | | | | | | | | {"type":130, "id":10003, "oid":10003, "own":72, "qtt_requ":67432, "qtt_prov":30183, "qtt":91809, "flowr":30183}],+| | | | | | | | | | | [{"type":2, "id":3288, "oid":3288, "own":34, "qtt_requ":45276, "qtt_prov":61017, "qtt":61017, "flowr":61017}, +| | | | | | | | | | | {"type":130, "id":10003, "oid":10003, "own":72, "qtt_requ":67432, "qtt_prov":30183, "qtt":61626, "flowr":35165}],+| | | | | | | | | | | [{"type":2, "id":4604, "oid":4604, "own":1, "qtt_requ":74412, "qtt_prov":6118, "qtt":6118, "flowr":6117}, +| | | | | | | | | | | {"type":2, "id":490, "oid":490, "own":82, "qtt_requ":23425, "qtt_prov":28631, "qtt":28631, "flowr":21024}, +| | | | | | | | | | | {"type":130, "id":10003, "oid":10003, "own":72, "qtt_requ":67432, "qtt_prov":30183, "qtt":26461, "flowr":26461}] +| | | | | | | | | | | ]} | | | (1 row) select * from fsubmitbarter(2,'own82',NULL,'qlt22',67432,'qlt23',30183,91809,'1 hour'::interval);select * from fproducemvt(); id | diag -------+------ 10004 | 0 (1 row) ord | ordp | qtt_requ | qtt_prov | qtt | qtt_reci | qtt_give | err | json | own | type | stackid --------------------------------------------------+------------+----------+----------+-------+----------+----------+-----+------+-------+------+--------- (2,10004,72,10004,67432,qlt22,30183,qlt23,91809) | (,,,,,,,,) | 67432 | 30183 | 91809 | 149473 | 91809 | 0 | | own82 | 2 | 10004 (1 row) select id,nbt,nbc,xid,own_src,own_dst,qtt,nat from tmvt where id >4; id | nbt | nbc | xid | own_src | own_dst | qtt | nat ----+-----+-----+-------+---------+---------+-------+------- 5 | 8 | 3 | 10004 | own82 | own82 | 30183 | qlt23 6 | 8 | 3 | 8928 | own82 | own91 | 53752 | qlt53 7 | 8 | 3 | 515 | own91 | own82 | 67432 | qlt22 8 | 8 | 2 | 10004 | own82 | own16 | 35165 | qlt23 9 | 8 | 2 | 3288 | own16 | own82 | 61017 | qlt22 10 | 8 | 3 | 10004 | own82 | own52 | 26461 | qlt23 11 | 8 | 3 | 4604 | own52 | own19 | 6117 | qlt49 12 | 8 | 3 | 490 | own19 | own82 | 21024 | qlt22 (8 rows) select sum(qtt) from tmvt where own_src='own82' and nat='qlt23' and id>4; sum ------- 91809 (1 row) select sum(qtt) from tmvt where own_dst='own82' and nat='qlt22' and id>4; sum -------- 149473 (1 row) /* select * from fsubmitquote(1,'own82','qlt22','qlt10');select * from fproducemvt(); select * from fsubmitquote(1,'own82','qlt22',49252,'qlt10',2177,2176);select * from fproducemvt(); select * from fsubmitbarter(1,'own82',NULL,'qlt22',49252,'qlt10',2177,2176);select * from fproducemvt(); select xid,own_src,own_dst,qtt,nat from tmvt order by id desc limit 3; select * from fsubmitquote(1,'own82','qlt2',60000,'qlt23',45276,45276);select * from fproducemvt(); select * from fsubmitbarter(1,'own82',NULL,'qlt2',60000,'qlt23',45276,45276);select * from fproducemvt(); select id,nbt,nbc,xid,own_src,own_dst,qtt,nat from tmvt order by id desc limit 12; select sum(qtt) from tmvt where own_src='own82' and nat='qlt23' and id>18; select sum(qtt) from tmvt where own_dst='own82' and nat='qlt2' and id>18; select * from fsubmitquote(1,'own1','qlt1','qlt2');select * from fproducemvt(); select * from fsubmitquote(1,'own1','qlt1',30822,'qlt2',9667,0);select * from fproducemvt(); select * from fsubmitquote(1,'own1','qlt1',30822,'qlt2',9667,7563);select * from fproducemvt(); select * from fsubmitbarter(1,'own1',NULL,'qlt1',30822,'qlt2',9667,7563);select * from fproducemvt(); select id,nbt,nbc,xid,own_src,own_dst,qtt,nat from tmvt d where id>33; select sum(qtt) from tmvt where own_src='own1' and nat='qlt2' and id>33; select sum(qtt) from tmvt where own_dst='own1' and nat='qlt1' and id>33; */