[GENERAL] Transactions and functions

2016-09-23 Thread Арсен Арутюнян
Hello all i have the table create table testpr(id serial,priority integer,unique(priority) DEFERRABLE, primary key(id)); and procedure: CREATE OR REPLACE FUNCTION JobPriorityChange(JobId bigint,NewPrior integer) RETURNS void AS $$ DECLARE PrevPrior integer; BEGIN PrevPrior := (select priority

[GENERAL] Multiple multithreaded insert

2016-10-14 Thread Арсен Арутюнян
Hi, everyone! I have a table: create table testpr(id serial,priority integer,unique(priority) DEFERRABLE, primary key(id)); and a trigger which, when added to this table, automatically sets priority as the maximum value +1 CREATE OR REPLACE FUNCTION PriorityCheck() RETURNS trigger AS $$ BEGIN  

[GENERAL] Indexes and loops or some kind of pg error?

2016-12-27 Thread Арсен Арутюнян
Hello. I have a few questions: 1)  JobStatusTest1 function has only one request and JobStatusTest2 function has as many as six requests. Why function JobStatusTest2 is faster?  JobStatusTest1 : 981.596 ms JobStatusTest2 : 849.133 ms 2) Two functions JobStatusTest3 and JobStatusTest4 perform the

[GENERAL] Indexes and loops

2016-12-28 Thread Арсен Арутюнян
Hello. I have a few questions: 1)  JobStatusTest1 function has only one request and JobStatusTest2 function has as many as six requests. Why function JobStatusTest2 is faster?  JobStatusTest1 : 981.596 ms JobStatusTest2 : 849.133 ms 2) Two functions JobStatusTest3 and JobStatusTest4 perform the

[GENERAL] SPI_execute_plan and vardata

2017-06-22 Thread Арсен Арутюнян
Hello I can't:convert char* to Datum Datum Values[2]; Values[0]-is integer type  but Values[1] is string type so  Values[0] = SET_4_BYTES(227); please assist how can i convert som char* string to Datum Values[1] = CONVERT_STRING_TO DATUM(char *); etc best -- Арсен Арутюнян

[GENERAL] Re[2]: [GENERAL] SPI_execute_plan and vardata

2017-06-28 Thread Арсен Арутюнян
Thank you next question - how i can call pg_notify or NOTIFY query from c function Arsen >Пятница, 23 июня 2017, 0:33 +03:00 от Tom Lane : > >=?UTF-8?B?0JDRgNGB0LXQvSDQkNGA0YPRgtGO0L3Rj9C9?= < aru...@bk.ru > writes: >> Datum Values[2]; > >> Values[0]-is integer type  >> but Values[1] is string

[GENERAL] BUG in Prepared transactions from C code using JSON

2017-06-28 Thread Арсен Арутюнян
// Data inserted  } after selection inserted data looks like   "Command":227,"Status":2,"JobId":4} first { simboll is lost Arsen -- Арсен Арутюнян

[GENERAL] EXCEPTION handling from с function

2017-07-03 Thread Арсен Арутюнян
Hello please assist How i can handle nowait EXCEPTION from c function; select for update nowait SPI_execute_plan(UpdateStat, Values, NULL, false, 1); Arsen  -- Арсен Арутюнян