Closed pavitrakumar78 closed 3 years ago
Looks like the problem is somehow related with autoloading of data. But I could not understand the reason. Can you send me complete sample reproducing the problem (complete sql script for initializing database schema and populating it with some dummy data)?
Here's a pg dump + testing queries pastebin: https://pastebin.com/k6TP8SMw
The problem is mainly from a symbol present in us_eod_securities
but not in any of the other tables. Another issue is - why does us_eod_get
still have a deleted data from the original table?
Edit: updated pastebin with error again for adding new data. As you said, the problem is with autoloading of data - probably triggers not firing properly?
I have committed the patch. Please notice that I have changed implementation of generated *_get() function. So to make this function works correctly you will have to recreate IMCS tables (call cs_create). If you have not do it: just rebuild extension and restart postgres, then there will be no autoload problem any more, but get will return empty row for absent symbol.
Thank you for the fix!
I always reinstall imcs after any patch and then reload all tables for testing so should be no more problems!
I will close this issue.
Hi,
I've been having some issues with using projections to get results for many symbols at once (like the VWAP for all symbols example).
Issue:
All the above statements give the following error:
Here's what I do to get these tables:
Table
us_symbols
contains list of all symbols (columns: symbol_id (p.key), symbol_code ...) which gets updated everyday with new symbols, removal of some symbols etc.,Table
us_eod
is the main table (symbol_id,symbol_date,o,h,l,c,v) which gets updated everyday with new symbols, removal of some symbols etc., This table'ssymbol_id
is foreign key fromus_symbols
's symbol_id.Following example similar to VWAP for all symbols in docs:
Because there are additions and removals, I also update the
us_eod_securities
table using triggers like below.This, along with the already existing triggers created by
cs_create
forus_eod
should mean loading issues multi-symbols usingus_eod_quotes
should work. But still, I frequently get the error mentioned at the top of this post. Sometimes, I have to reinstall imcs, restart the server, and do the process again to make it work. Is there a solution for this?Also, queries using plain *_get (`us_eod_get) work fine:
The issue is only with the projection which is why I thought it had something to do with missing symbol_ids with the us_eod_securities table - but even after double checking all symbol tables have the same no.of rows, I still keep keep getting the error after every main table update.
Edit: the only solution I have so far for this issue is: -restart pgsql server -execute: