reset role; -- SELECT ftruncatetables(); select fresetmarket(); INFO: market_status OPENED->STOPPING CONTEXT: PL/pgSQL function "fresetmarket" line 7 at assignment INFO: The market is now stopping for clients CONTEXT: PL/pgSQL function "fresetmarket" line 7 at assignment NOTICE: truncate cascades to table "torder" CONTEXT: SQL statement "TRUNCATE towner CASCADE" PL/pgSQL function "fresetmarket_int" line 13 at SQL statement SQL statement "SELECT fresetmarket_int()" PL/pgSQL function "fresetmarket" line 9 at PERFORM NOTICE: truncate cascades to table "tmvt" CONTEXT: SQL statement "TRUNCATE towner CASCADE" PL/pgSQL function "fresetmarket_int" line 13 at SQL statement SQL statement "SELECT fresetmarket_int()" PL/pgSQL function "fresetmarket" line 9 at PERFORM NOTICE: truncate cascades to table "tmvtremoved" CONTEXT: SQL statement "TRUNCATE towner CASCADE" PL/pgSQL function "fresetmarket_int" line 13 at SQL statement SQL statement "SELECT fresetmarket_int()" PL/pgSQL function "fresetmarket" line 9 at PERFORM NOTICE: truncate cascades to table "treltried" CONTEXT: SQL statement "TRUNCATE tquality CASCADE" PL/pgSQL function "fresetmarket_int" line 14 at SQL statement SQL statement "SELECT fresetmarket_int()" PL/pgSQL function "fresetmarket" line 9 at PERFORM NOTICE: truncate cascades to table "torder" CONTEXT: SQL statement "TRUNCATE tquality CASCADE" PL/pgSQL function "fresetmarket_int" line 14 at SQL statement SQL statement "SELECT fresetmarket_int()" PL/pgSQL function "fresetmarket" line 9 at PERFORM NOTICE: truncate cascades to table "tmvt" CONTEXT: SQL statement "TRUNCATE tquality CASCADE" PL/pgSQL function "fresetmarket_int" line 14 at SQL statement SQL statement "SELECT fresetmarket_int()" PL/pgSQL function "fresetmarket" line 9 at PERFORM NOTICE: truncate cascades to table "tmvtremoved" CONTEXT: SQL statement "TRUNCATE tquality CASCADE" PL/pgSQL function "fresetmarket_int" line 14 at SQL statement SQL statement "SELECT fresetmarket_int()" PL/pgSQL function "fresetmarket" line 9 at PERFORM INFO: market_status STOPPING->CLOSED CONTEXT: PL/pgSQL function "fresetmarket" line 7 at assignment INFO: market_session = n->n+1 CONTEXT: PL/pgSQL function "fresetmarket" line 7 at assignment INFO: market_status CLOSED->STARTING CONTEXT: PL/pgSQL function "fresetmarket" line 7 at assignment INFO: Run the command: CONTEXT: PL/pgSQL function "fchangestatemarket" line 59 at assignment PL/pgSQL function "fresetmarket" line 7 at assignment INFO: VACUUM FULL ANALYZE CONTEXT: PL/pgSQL function "fchangestatemarket" line 59 at assignment PL/pgSQL function "fresetmarket" line 7 at assignment INFO: before starting the market CONTEXT: PL/pgSQL function "fchangestatemarket" line 59 at assignment PL/pgSQL function "fresetmarket" line 7 at assignment INFO: market_status STARTING->OPENED CONTEXT: PL/pgSQL function "fresetmarket" line 7 at assignment INFO: The market is now opened for clients CONTEXT: PL/pgSQL function "fresetmarket" line 7 at assignment INFO: The market is reset and opened fresetmarket -------------- (1 row) -- two concurrent paths, (a) is the best -- path (b) -- select finsertorder('A','x',25 ,100 ,'z'); select finsertorder('A','z',200 ,200 ,'x'); INFO: owner A created CONTEXT: PL/pgSQL function "fgetowner" line 10 at assignment PL/pgSQL function "finsertorder" line 19 at assignment finsertorder ---------------------------- (1,1,2,200,1,200,0,0,{},,) (1 row) -- path (a) -- select finsertorder('B','x',25 ,200 ,'y'); select finsertorder('B','y',200 ,25 ,'x'); INFO: owner B created CONTEXT: PL/pgSQL function "fgetowner" line 10 at assignment PL/pgSQL function "finsertorder" line 19 at assignment finsertorder --------------------------- (2,2,2,25,3,200,0,0,{},,) (1 row) --select finsertorder('C','y',100 ,100 ,'z'); select finsertorder('C','z',100 ,100 ,'y'); INFO: owner C created CONTEXT: PL/pgSQL function "fgetowner" line 10 at assignment PL/pgSQL function "finsertorder" line 19 at assignment finsertorder ---------------------------- (3,3,3,100,1,100,0,0,{},,) (1 row) -- no exchange select id,nb,oruuid,grp,provider,quality,qtt,receiver from vmvt; id | nb | oruuid | grp | provider | quality | qtt | receiver ----+----+--------+-----+----------+---------+-----+---------- (0 rows) --select finsertorder('D','z',250 ,250 ,'x'); select finsertorder('D','x',250 ,250 ,'z'); INFO: owner D created CONTEXT: PL/pgSQL function "fgetowner" line 10 at assignment PL/pgSQL function "finsertorder" line 19 at assignment finsertorder ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- (4,4,1,250,2,250,300,250,"{""[(2, 2, 2, 25, 3, 200, 200),(3, 3, 3, 100, 1, 100, 100),(4, 4, 1, 250, 2, 250, 250)]"",""[(1, 1, 2, 200, 1, 200, 200),(4, 4, 1, 250, 2, 250, 200)]""}",,) (1 row) --two exchanges in a single transaction select id,nb,oruuid,grp,provider,quality,qtt,receiver from vmvt; id | nb | oruuid | grp | provider | quality | qtt | receiver ----+----+--------+-----+----------+---------+-----+---------- 2 | 3 | 4-2 | 1 | B | y | 200 | C 3 | 3 | 4-3 | 1 | C | z | 100 | D 1 | 3 | 4-4 | 1 | D | x | 50 | B 5 | 2 | 4-1 | 4 | A | z | 200 | D 4 | 2 | 4-4 | 4 | D | x | 200 | A (5 rows) select id,qtt from tquality; id | qtt ----+----- 3 | 200 1 | 300 2 | 250 (3 rows) select * from fgetstats(true); _name | cnt -----------------------------+----- number of qualities | 3 number of owners | 4 number of quotes | 0 number of orders | 4 number of movements | 5 number of quotes removed | 0 number of orders removed | 4 number of movements removed | 0 number of agreements | 2 number of orders rejected | 0 agreements with 2 partners | 1 agreements with 3 partners | 1 (12 rows)