create table tab0(c0 integer); create table tab1(c1 integer); create table tab2(c2 integer); create table tab3(c3 integer); create table tab4(c4 integer); create table tab5(c5 integer); create table tab6(c6 integer); create table tab7(c7 integer); create table tab8(c8 integer); create table tab9(c9 integer); create table tab10(c10 integer); create table tab11(c11 integer); create table tab12(c12 integer); create table tab13(c13 integer); create table tab14(c14 integer); create table tab15(c15 integer); create table tab16(c16 integer); create table tab17(c17 integer); create table tab18(c18 integer); create table tab19(c19 integer); create index idx0 on tab0 (c0); create index idx1 on tab1 (c1); create index idx2 on tab2 (c2); create index idx3 on tab3 (c3); create index idx4 on tab4 (c4); create index idx5 on tab5 (c5); create index idx6 on tab6 (c6); create index idx7 on tab7 (c7); create index idx8 on tab8 (c8); create index idx9 on tab9 (c9); create index idx10 on tab10 (c10); create index idx11 on tab11 (c11); create index idx12 on tab12 (c12); create index idx13 on tab13 (c13); create index idx14 on tab14 (c14); create index idx15 on tab15 (c15); create index idx16 on tab16 (c16); create index idx17 on tab17 (c17); create index idx18 on tab18 (c18); create index idx19 on tab19 (c19); insert into tab0 select id from generate_series(1,10) as g(id); insert into tab1 select id from generate_series(1,10) as g(id); insert into tab2 select id from generate_series(1,10) as g(id); insert into tab3 select id from generate_series(1,10) as g(id); insert into tab4 select id from generate_series(1,10) as g(id); insert into tab5 select id from generate_series(1,10) as g(id); insert into tab6 select id from generate_series(1,10) as g(id); insert into tab7 select id from generate_series(1,10) as g(id); insert into tab8 select id from generate_series(1,10) as g(id); insert into tab9 select id from generate_series(1,10) as g(id); insert into tab10 select id from generate_series(1,10) as g(id); insert into tab11 select id from generate_series(1,10) as g(id); insert into tab12 select id from generate_series(1,10) as g(id); insert into tab13 select id from generate_series(1,10) as g(id); insert into tab14 select id from generate_series(1,10) as g(id); insert into tab15 select id from generate_series(1,10) as g(id); insert into tab16 select id from generate_series(1,10) as g(id); insert into tab17 select id from generate_series(1,10) as g(id); insert into tab18 select id from generate_series(1,10) as g(id); insert into tab19 select id from generate_series(1,10) as g(id); -------------------------------------------------------stand CREATE DOMAIN dsspid AS numeric(15,0) DEFAULT 0; CREATE DOMAIN dsidentifier AS numeric(15,0) DEFAULT 0; CREATE DOMAIN dsoperday AS timestamp(0) without time zone DEFAULT '1900-01-01 00:00:00'::timestamp without time zone; CREATE DOMAIN dsfullname AS character(60) DEFAULT ''::bpchar; CREATE DOMAIN dsbriefname AS character(10) DEFAULT ''::bpchar; CREATE DOMAIN dsfieldnamevar AS character varying(30) DEFAULT ''::character varying; CREATE DOMAIN dstinyint AS smallint DEFAULT 0; CREATE DOMAIN dscomment AS character varying(255) DEFAULT ''::character varying; CREATE DOMAIN dsacc_swift AS character(35) DEFAULT ''::bpchar; CREATE DOMAIN dsbigmoney AS numeric(28,10) DEFAULT 0; CREATE DOMAIN dsfloat AS double precision DEFAULT 0; CREATE DOMAIN dsmoney AS numeric(19,4) DEFAULT 0; CREATE DOMAIN dsaccnumvar AS character varying(25) DEFAULT ''::character varying; CREATE DOMAIN dsaccnumber AS character(25) DEFAULT ''::bpchar; CREATE DOMAIN dsint_key AS integer DEFAULT 0; CREATE DOMAIN dsdatetime AS timestamp(3) without time zone DEFAULT '1900-01-01 00:00:00'::timestamp without time zone; CREATE DOMAIN dsvarfullname AS character varying(60) DEFAULT ''::character varying; CREATE DOMAIN dssmallint AS smallint DEFAULT 0; CREATE DOMAIN dsfieldname AS character(30) DEFAULT ''::bpchar; CREATE DOMAIN day AS timestamp(0) without time zone DEFAULT (((to_char(CURRENT_TIMESTAMP, 'YEAR'::text) || to_char(CURRENT_TIMESTAMP, 'MONTH'::text)) || to_char(CURRENT_TIMESTAMP, 'DAY'::text)))::timestamp(0) without time zone; CREATE DOMAIN dsvarfullname40 AS character varying(40) DEFAULT ''::character varying; CREATE DOMAIN dsbic AS character varying(15) DEFAULT ''::character varying; CREATE DOMAIN dsusername AS character(30) DEFAULT ''::bpchar; CREATE DOMAIN dsvarfullname160 AS character varying(160) DEFAULT ''::character varying; CREATE DOMAIN dsnumber20 AS character(20) DEFAULT ' 0'::bpchar; CREATE DOMAIN dsbriefvar AS character varying(10) DEFAULT ''::character varying; CREATE DOMAIN dshash AS character varying(120) DEFAULT '%'::character varying; CREATE DOMAIN dslabel AS character varying(80) DEFAULT ''::character varying; CREATE DOMAIN dsnumber AS character(10) DEFAULT ' 0'::bpchar; CREATE DOMAIN dsbit0 AS smallint DEFAULT 0; CREATE UNLOGGED SEQUENCE prest2_numid_seq START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1 CYCLE; ---plastdate2 CREATE UNLOGGED TABLE plastdate2 ( spid dsspid, resourceid dsidentifier, lastdate dsoperday, fundid dsidentifier ); ALTER TABLE ONLY plastdate2 ADD CONSTRAINT plastdate2_xpkplastdate2 UNIQUE (spid, resourceid, fundid, lastdate) DEFERRABLE; ---prest2 CREATE UNLOGGED TABLE prest2 ( spid dsspid, resourceid dsidentifier, rest dsbigmoney, restbs dsbigmoney, turndeb dsbigmoney, turncre dsbigmoney, turndebbs dsbigmoney, turncrebs dsbigmoney, lastdate dsoperday, fundid dsidentifier, securityid dsidentifier, resourcetype dstinyint, numdoc dsint_key, parentid dsidentifier, numid dsidentifier DEFAULT nextval('prest2_numid_seq'::regclass), flagparent dstinyint ); ALTER TABLE ONLY prest2 ADD CONSTRAINT prest2_xpktrest UNIQUE (spid, resourceid, fundid) DEFERRABLE; CREATE INDEX prest2_xie8trest ON prest2 USING btree (spid, numid); ---trest CREATE TABLE trest ( date dsoperday NOT NULL, resourceid dsidentifier NOT NULL, confirmed dstinyint NOT NULL, institutionid dsidentifier NOT NULL, rest dsbigmoney NOT NULL, restbs dsbigmoney NOT NULL, turndeb dsbigmoney NOT NULL, turncre dsbigmoney NOT NULL, turndebbs dsbigmoney NOT NULL, turncrebs dsbigmoney NOT NULL, lastdate dsoperday NOT NULL, fundid dsidentifier NOT NULL, securityid dsidentifier NOT NULL, resourcetype dstinyint NOT NULL, balanceid dsidentifier NOT NULL, numdoc dsint_key NOT NULL, accountingtype dsint_key NOT NULL ); ALTER TABLE ONLY trest ADD CONSTRAINT trest_xpktrest UNIQUE (accountingtype, date, resourceid, fundid, institutionid) DEFERRABLE; CREATE INDEX trest_xie2trest ON trest USING btree (resourceid, accountingtype, date, lastdate); CREATE INDEX trest_xie3trest ON trest USING btree (accountingtype, institutionid, date); CREATE INDEX trest_xie4trest ON trest USING btree (accountingtype, fundid, securityid); CREATE INDEX trest_xie5trest ON trest USING btree (accountingtype, institutionid, resourceid, date); CREATE INDEX trest_xie6trest ON trest USING btree (accountingtype, balanceid, institutionid, date); ---tMMRegAnalytics CREATE TABLE tmmreganalytics ( mmregid dsidentifier NOT NULL, mmanalyticsid dsidentifier NOT NULL ); ALTER TABLE ONLY tmmreganalytics ADD CONSTRAINT tmmreganalytics_xak1tmmreganalytics UNIQUE (mmanalyticsid, mmregid) DEFERRABLE; ALTER TABLE ONLY tmmreganalytics ADD CONSTRAINT tmmreganalytics_xpktmmreganalytics UNIQUE (mmregid, mmanalyticsid) DEFERRABLE; ---pMMRegisterID CREATE UNLOGGED TABLE pmmregisterid ( spid dsspid, linkid dsidentifier, mmregid dsidentifier, id bigint NOT NULL ); ALTER TABLE ONLY pmmregisterid ALTER COLUMN spid SET STATISTICS 0; ALTER TABLE pmmregisterid ALTER COLUMN id ADD GENERATED ALWAYS AS IDENTITY ( SEQUENCE NAME pmmregisterid_id_seq1 START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1 ); ALTER SEQUENCE pmmregisterid_id_seq1 SET LOGGED; CREATE UNIQUE INDEX pmmregisterid_xakpmmregisterid ON pmmregisterid USING btree (spid, id); CREATE UNIQUE INDEX pmmregisterid_xpkpmmregisterid ON pmmregisterid USING btree (spid, linkid); ---pMMAnalyticMassInsert CREATE UNLOGGED TABLE pmmanalyticmassinsert ( spid dsspid, linkid dsidentifier, mmanalyticstypeid dsidentifier, analyticsobjectid dsidentifier ); ALTER TABLE ONLY pmmanalyticmassinsert ALTER COLUMN spid SET STATISTICS 0; CREATE UNIQUE INDEX pmmanalyticmassinsert_xpkpmmanalyticmassinsert ON pmmanalyticmassinsert USING btree (spid, linkid, mmanalyticstypeid); ---pMMAnalyticDeal2 CREATE UNLOGGED TABLE pmmanalyticdeal2 ( spid dsspid, mmanalyticstypeid dsidentifier, analyticsobjectid dsidentifier, mmanalyticsid dsidentifier, id bigint NOT NULL ); ALTER TABLE ONLY pmmanalyticdeal2 ALTER COLUMN spid SET STATISTICS 0; ALTER TABLE pmmanalyticdeal2 ALTER COLUMN id ADD GENERATED ALWAYS AS IDENTITY ( SEQUENCE NAME pmmanalyticdeal2_id_seq1 START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1 ); ALTER SEQUENCE pmmanalyticdeal2_id_seq1 SET LOGGED; CREATE UNIQUE INDEX pmmanalyticdeal2_xpkpmmanalyticdeal2 ON pmmanalyticdeal2 USING btree (spid, mmanalyticstypeid, analyticsobjectid); ---pdpt_accrual_advlucre CREATE UNLOGGED TABLE pdpt_accrual_advlucre ( spid dsspid, objectid dsidentifier, fundid dsidentifier, advtax dsmoney, templatenumber dsidentifier, begindate dsoperday, prcdate dsoperday, enddate dsoperday, value dsmoney, prcnt dsfloat, preparedqty dsmoney, templatenumberprc dsint_key, protocolid dsidentifier ); CREATE INDEX pdpt_accrual_advlucre_xpkpdpt_accrual_advlucre ON pdpt_accrual_advlucre USING btree (spid, objectid, templatenumber); ---pdealid_mark CREATE UNLOGGED TABLE pdealid_mark ( spid dsspid, dealid dsidentifier, datebegin dsoperday, dateend dsoperday, instrumentid dsidentifier, flag dstinyint ); CREATE INDEX pdealid_mark_xie0pdealid_mark ON pdealid_mark USING btree (spid, dealid); CREATE INDEX pdealid_mark_xie1pdealid_mark ON pdealid_mark USING btree (spid, instrumentid, datebegin, dateend); ---pdpt_accrual_advac CREATE UNLOGGED TABLE pdpt_accrual_advac ( spid dsspid, objectid dsidentifier, templatenumber dsidentifier, fundid dsidentifier, advondate dsoperday, advtaxrub dsmoney, corrdate dsoperday, prcnt dsfloat ); ALTER TABLE ONLY pdpt_accrual_advac ADD CONSTRAINT pdpt_accrual_advac_xpkpdpt_accrual_advac UNIQUE (spid, objectid, templatenumber, advondate) DEFERRABLE; CREATE INDEX pdpt_accrual_advac_xak1pdpt_accrual_advac ON pdpt_accrual_advac USING btree (spid, templatenumber, objectid); ---pTmp_DocumentBuffer CREATE TABLE pTmp_DocumentBuffer ( id bigint GENERATED ALWAYS AS IDENTITY, opcode DSTINYINT, batchid DSIDENTIFIER, confirmed DSTINYINT, qtydeb DSBIGMONEY, funddebid DSIDENTIFIER, qtycre DSBIGMONEY, fundcreid DSIDENTIFIER, comment DSCOMMENT, branchid DSIDENTIFIER, balanceid DSIDENTIFIER, accanlid DSIDENTIFIER, accanlsecid DSIDENTIFIER, priority DSFLOAT, paymenttype DSIDENTIFIER, templatetype DSIDENTIFIER, docinstrumentid DSIDENTIFIER, resdebid DSIDENTIFIER, rescreid DSIDENTIFIER, date DSOPERDAY, debsubcontosetid DSIDENTIFIER, cresubcontosetid DSIDENTIFIER, dealprotocolid DSIDENTIFIER, qtybs DSBIGMONEY, course DSFLOAT, objectid DSIDENTIFIER, opertemplateid DSIDENTIFIER, instrumentid DSIDENTIFIER, dealid DSIDENTIFIER, mainobjectid DSIDENTIFIER, groupid DSIDENTIFIER, flags DSINT_KEY, accountingtype DSINT_KEY, retcode DSIDENTIFIER, fundid DSIDENTIFIER, qtypsv DSBIGMONEY, fundpsvid DSIDENTIFIER, qtycrebs DSBIGMONEY, tradingsysid DSIDENTIFIER, resourcepid DSIDENTIFIER, resourcemid DSIDENTIFIER, centcopeck DSSMALLINT, docnumber DSACCNUMBER null ); CREATE INDEX pTmp_DocumentBuffer_XIE0DocumentBuffer ON pTmp_DocumentBuffer(RetCode); CREATE INDEX pTmp_DocumentBuffer_XIE1DocumentBuffer ON pTmp_DocumentBuffer(OperTemplateID,ObjectID); CREATE INDEX pTmp_DocumentBuffer_XIE2DocumentBuffer ON pTmp_DocumentBuffer(GroupID); CREATE UNIQUE INDEX pTmp_DocumentBuffer_XIE3DocumentBuffer ON pTmp_DocumentBuffer(ID); ; INSERT INTO pTmp_DocumentBuffer(objectid) SELECT 10042002030 + i FROM generate_series(1, 30000) s(i) ; ---pFX_TermRegister CREATE UNLOGGED TABLE pfx_termregister ( spid dsspid, objectid dsidentifier, mmregid dsidentifier, value dsbigmoney, liabtype dsidentifier, currencyid dsidentifier, termrule dsidentifier, termtype dsidentifier, termoperation dsidentifier, maturity dsidentifier ); ALTER TABLE ONLY pfx_termregister ALTER COLUMN spid SET STATISTICS 0; CREATE INDEX pfx_termregister_xie1pfx_termregister ON pfx_termregister USING btree (spid, liabtype, objectid); CREATE INDEX pfx_termregister_xpkpfx_termregister ON pfx_termregister USING btree (spid, objectid); ---tMMReg CREATE TABLE tmmreg ( mmregid dsidentifier NOT NULL, date dsoperday NOT NULL, value dsbigmoney NOT NULL, mmregtypeid dsidentifier NOT NULL, objecttypeid dsint_key NOT NULL, objectid dsidentifier NOT NULL, parentid dsidentifier NOT NULL, userid dsidentifier NOT NULL, indatetime dsdatetime NOT NULL, comment dscomment NOT NULL, protocolid dsidentifier, dsmoduleid dsidentifier, currencyid dsidentifier, processingstatus dstinyint ); ALTER TABLE ONLY tmmreg ADD CONSTRAINT tmmreg_xak1tmmreg UNIQUE (protocolid, mmregid) DEFERRABLE; ALTER TABLE ONLY tmmreg ADD CONSTRAINT tmmreg_xpktmmreg UNIQUE (mmregid) DEFERRABLE; CREATE INDEX tmmreg_xie1tmmreg ON tmmreg USING btree (date, mmregtypeid, objecttypeid, dsmoduleid); CREATE INDEX tmmreg_xie2tmmreg ON tmmreg USING btree (objectid, objecttypeid, date); CREATE INDEX tmmreg_xie3tmmreg ON tmmreg USING btree (parentid); ---tMMAnalytics CREATE TABLE tmmanalytics ( mmanalyticsid dsidentifier NOT NULL, mmanalyticstypeid dsidentifier NOT NULL, analyticsobjectid dsidentifier NOT NULL ); ALTER TABLE ONLY tmmanalytics ADD CONSTRAINT tmmanalytics_xak1tmmanalytics UNIQUE (mmanalyticstypeid, analyticsobjectid) DEFERRABLE; ALTER TABLE ONLY tmmanalytics ADD CONSTRAINT tmmanalytics_xpktmmanalytics UNIQUE (mmanalyticsid) DEFERRABLE; ---pobject2_numid_seq CREATE UNLOGGED SEQUENCE pobject2_numid_seq START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1 CYCLE; ---pObject2 CREATE UNLOGGED TABLE pobject2 ( spid dsidentifier, objectid dsidentifier, instrumentid dsidentifier, actionid dsidentifier, date dsoperday, operdate dsoperday, plandate dsoperday, errorcode dsint_key, legalbaseid dsidentifier, numid dsidentifier DEFAULT nextval('pobject2_numid_seq'::regclass), unneedrlbckprot dstinyint, errormessage dscomment ); ALTER TABLE ONLY pobject2 ADD CONSTRAINT pobject2_xpkpobject2 UNIQUE (spid, objectid) DEFERRABLE; CREATE INDEX pobject2_xak1pobject2 ON pobject2 USING btree (spid, numid); CREATE INDEX pobject2_xie1pobject2 ON pobject2 USING btree (spid, errorcode, objectid); ---pfx_termdealparam CREATE UNLOGGED TABLE pfx_termdealparam ( spid dsspid, objectid dsidentifier, instrumentid dsidentifier, branchid dsidentifier, institutionid dsidentifier, keeperid dsidentifier, dealnumber dsaccnumvar, securityid dsidentifier, fundid dsidentifier, instpercent dsfloat, dealtype dstinyint, dealdate dsoperday, registdate dsoperday, contrdate dsoperday, qty dsbigmoney, registpaytype dsidentifier, trmregdemvalue dsbigmoney, trmregdemcurrencyid dsidentifier, trmregdemmaturity dsidentifier, trmregliabvalue dsbigmoney, trmregliabcurrencyid dsidentifier, trmregliabmaturity dsidentifier, rdcregdemvalue dsbigmoney, rdcregdemcurrencyid dsidentifier, rdcregliabvalue dsbigmoney, rdcregliabcurrencyid dsidentifier ); ALTER TABLE ONLY pfx_termdealparam ALTER COLUMN spid SET STATISTICS 0; CREATE UNIQUE INDEX pfx_termdealparam_xpkpfx_termdealparam ON pfx_termdealparam USING btree (spid, objectid); ---pobject_numid_seq CREATE UNLOGGED SEQUENCE pobject_numid_seq START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1 CYCLE; ---pobject CREATE UNLOGGED TABLE pobject ( spid dsidentifier, objectid dsidentifier, instrumentid dsidentifier, actionid dsidentifier, date dsoperday, operdate dsoperday, plandate dsoperday, errorcode dsint_key, legalbaseid dsidentifier, numid dsidentifier DEFAULT nextval('pobject_numid_seq'::regclass), unneedrlbckprot dstinyint ); ALTER TABLE ONLY pobject ADD CONSTRAINT pobject_xpkpobject UNIQUE (spid, objectid) DEFERRABLE; CREATE INDEX pobject_xak1pobject ON pobject USING btree (spid, numid); CREATE INDEX pobject_xie1pobject ON pobject USING btree (spid, errorcode); ---tactionperiod CREATE TABLE tactionperiod ( actionperiodid dsidentifier NOT NULL, nodeid dsidentifier NOT NULL, schemeperiodid dsidentifier NOT NULL, priority dsint_key NOT NULL, objectid dsidentifier NOT NULL ); CREATE INDEX tactionperiod_xie1tactionperiod ON tactionperiod USING btree (nodeid, objectid, schemeperiodid); CREATE INDEX tactionperiod_xie2tactionperiod ON tactionperiod USING btree (schemeperiodid); CREATE UNIQUE INDEX tactionperiod_xpktactionperiod ON tactionperiod USING btree (actionperiodid); ---tDocMark CREATE TABLE tdocmark ( spid dsspid, type dsint_key, id dsidentifier ); ALTER TABLE ONLY tdocmark ADD CONSTRAINT tdocmark_xpktdocmark UNIQUE (spid, type, id) DEFERRABLE; ---tActionPlan CREATE TABLE tactionplan ( actionplanid dsidentifier NOT NULL, objectid dsidentifier NOT NULL, actionperiodid dsidentifier NOT NULL, plandate dsoperday NOT NULL, factdate dsoperday NOT NULL, operdate dsoperday NOT NULL, branchid dsidentifier NOT NULL ); ALTER TABLE ONLY tactionplan ADD CONSTRAINT tactionplan_xak1tactionplan UNIQUE (objectid, actionperiodid) DEFERRABLE; ALTER TABLE ONLY tactionplan ADD CONSTRAINT tactionplan_xpktactionplan UNIQUE (actionplanid) DEFERRABLE; CREATE INDEX tactionplan_xie1tactionplan ON tactionplan USING btree (actionperiodid, branchid, operdate); ---pTblCursor5 CREATE UNLOGGED TABLE ptblcursor5 ( spid dsspid, type dstinyint, id dsidentifier ); ALTER TABLE ONLY ptblcursor5 ADD CONSTRAINT ptblcursor5_xpkptblcursor5 UNIQUE (spid, type, id) DEFERRABLE; ---tObject CREATE TABLE tobject ( objectid dsidentifier NOT NULL, objecttypeid dsint_key NOT NULL, id dsidentifier NOT NULL, instrumentid dsidentifier NOT NULL, currprotocolid dsidentifier NOT NULL, branchid dsidentifier NOT NULL ); ALTER TABLE ONLY tobject ADD CONSTRAINT tobject_xak2tobject UNIQUE (instrumentid, id) DEFERRABLE; ALTER TABLE ONLY tobject ADD CONSTRAINT tobject_xpktobject UNIQUE (objectid) DEFERRABLE; CREATE INDEX tobject_xak1tobject ON tobject USING btree (id, objecttypeid); CREATE INDEX tobject_xie2tobject ON tobject USING btree (currprotocolid); ---tProtocol CREATE TABLE tprotocol ( protocolid dsidentifier NOT NULL, objectid dsidentifier NOT NULL, date dsoperday NOT NULL, transitionid dsidentifier NOT NULL, stateorder dsint_key NOT NULL, auditid dsidentifier NOT NULL ); ALTER TABLE ONLY tprotocol ADD CONSTRAINT tprotocol_xpktprotocol UNIQUE (protocolid) DEFERRABLE; CREATE INDEX tprotocol_xak1tprotocol ON tprotocol USING btree (objectid, stateorder); CREATE INDEX tprotocol_xie1tprotocol ON tprotocol USING btree (transitionid); ---tTransition CREATE TABLE ttransition ( transitionid dsidentifier NOT NULL, instrumentid dsidentifier NOT NULL, sourcestateid dsidentifier NOT NULL, actionid dsidentifier NOT NULL, targetstateid dsidentifier NOT NULL ); ALTER TABLE ONLY ttransition ADD CONSTRAINT ttransition_xak1ttransition UNIQUE (instrumentid, sourcestateid, targetstateid, actionid) DEFERRABLE; ALTER TABLE ONLY ttransition ADD CONSTRAINT ttransition_xpkttransition UNIQUE (transitionid) DEFERRABLE; CREATE INDEX ttransition_xie1ttransition ON ttransition USING btree (sourcestateid); ---tOperSet CREATE TABLE toperset ( opersetid dsidentifier NOT NULL, instrumentid dsidentifier NOT NULL, name dsfullname NOT NULL, brief dsfieldname NOT NULL, dealtype dstinyint NOT NULL, number dstinyint NOT NULL, actiontype dstinyint NOT NULL, oninput dstinyint NOT NULL, onconfirm dstinyint NOT NULL, parentid dsidentifier NOT NULL, childid dsidentifier NOT NULL, objectid dsidentifier NOT NULL, configstyleid dsidentifier NOT NULL, date dsoperday NOT NULL ); ALTER TABLE ONLY toperset ADD CONSTRAINT toperset_xak0toperset UNIQUE (parentid, childid, configstyleid, date, number) DEFERRABLE; ALTER TABLE ONLY toperset ADD CONSTRAINT toperset_xak1toperset UNIQUE (parentid, childid, number) DEFERRABLE; ALTER TABLE ONLY toperset ADD CONSTRAINT toperset_xpktoperset UNIQUE (opersetid) DEFERRABLE; CREATE INDEX toperset_xie0toperset ON toperset USING btree (actiontype, configstyleid); CREATE INDEX toperset_xie1toperset ON toperset USING btree (childid); ---tPeriod CREATE TABLE tperiod ( periodid dsidentifier NOT NULL, schemeperiodid dsidentifier NOT NULL, name dsfullname NOT NULL, type dsint_key NOT NULL, algorithm dsidentifier NOT NULL, starttype dsidentifier NOT NULL, startdate dsoperday NOT NULL, startalgorithm dsidentifier NOT NULL, period dsint_key NOT NULL, periodtype dsint_key NOT NULL, periodalgorithm dsidentifier NOT NULL, periodvalue dsint_key NOT NULL, adddays dsint_key NOT NULL, payperiod dsint_key NOT NULL, payday dsint_key NOT NULL, paymonth dsint_key NOT NULL, factalgorithm dsidentifier NOT NULL, operalgorithm dsidentifier NOT NULL, specalgorithm dsidentifier NOT NULL, endtype dsint_key NOT NULL, paydirection dsint_key NOT NULL, calendarid dsidentifier NOT NULL, correcttypestart dsint_key NOT NULL, correctvaluestart dsint_key NOT NULL, correcttypeperiod dsint_key NOT NULL, correctend dsint_key NOT NULL, periodpriority dsint_key NOT NULL, calendarfactid dsidentifier NOT NULL, calendarspecid dsidentifier NOT NULL ); ALTER TABLE ONLY tperiod ADD CONSTRAINT tperiod_xpktperiod UNIQUE (periodid) DEFERRABLE; CREATE INDEX tperiod_xie1tperiod ON tperiod USING btree (schemeperiodid); ---pErrorObject CREATE UNLOGGED TABLE perrorobject ( spid dsspid, objectid dsidentifier, instrumentid dsidentifier, nodeid dsidentifier, errorcode dsint_key ); ALTER TABLE ONLY perrorobject ADD CONSTRAINT perrorobject_xpkperrorobject UNIQUE (spid, objectid, instrumentid, nodeid) DEFERRABLE; CREATE INDEX perrorobject_xie1perrorobject ON perrorobject USING btree (spid, nodeid); ---papi_prmd_idlist CREATE UNLOGGED TABLE papi_prmd_idlist ( accountid dsidentifier, accountnumber dsacc_swift, linkid dsidentifier, objectid dsidentifier, objecttype dstinyint, prmdid dsidentifier, spid dsspid, prmdtype dstinyint ); CREATE INDEX papi_prmd_idlist_xie1papi_prmd_idlist ON papi_prmd_idlist USING btree (spid, linkid); CREATE INDEX papi_prmd_idlist_xpkpapi_prmd_idlist ON papi_prmd_idlist USING btree (spid, prmdid); ---prko_prmd_accidlist CREATE UNLOGGED TABLE prko_prmd_accidlist ( spid dsspid, accountid dsidentifier, accountnumber dsacc_swift, foundedaccid dsidentifier ); CREATE INDEX prko_prmd_accidlist_xpkprko_prmd_accidlist ON prko_prmd_accidlist USING btree (spid, foundedaccid); ---tdealtransact CREATE TABLE tdealtransact ( dealtransactid dsidentifier NOT NULL, dealid dsidentifier NOT NULL, instrumentid dsidentifier NOT NULL, transacttype dstinyint NOT NULL, resourceid dsidentifier NOT NULL, ressecondid dsidentifier NOT NULL, fundid dsidentifier NOT NULL, date dsoperday NOT NULL, qty dsbigmoney NOT NULL, fixqty dsbigmoney NOT NULL, fixcourse dsfloat NOT NULL, fixdate dsoperday NOT NULL, realcourse dsfloat NOT NULL, realqty dsbigmoney NOT NULL, confirmed dstinyint NOT NULL, direction dstinyint NOT NULL, type dstinyint NOT NULL, parentid dsidentifier NOT NULL, nettqty dsmoney NOT NULL, securityid dsidentifier NOT NULL, institutionid dsidentifier NOT NULL, userid dsidentifier NOT NULL, instsecondid dsidentifier NOT NULL, indatetime day NOT NULL, pass dstinyint NOT NULL, expenseprc dsfloat NOT NULL, expenseqty dsmoney NOT NULL, expensefundid dsidentifier NOT NULL, expensecourse dsfloat NOT NULL, balancecourse dsfloat NOT NULL, balanceqty dsbigmoney NOT NULL, docdate dsoperday NOT NULL, docnumber dsaccnumvar NOT NULL, courierid dsidentifier NOT NULL, comment dscomment NOT NULL, secissueid dsidentifier NOT NULL, resourcepsvid dsidentifier NOT NULL, ressecondpsvid dsidentifier NOT NULL, dealprotocolid dsidentifier NOT NULL, certificateid dsidentifier NOT NULL, series dsaccnumvar NOT NULL, numberext dsaccnumber NOT NULL, numberlow dsint_key NOT NULL, numberhigh dsint_key NOT NULL, nominal dsmoney NOT NULL, couponid dsidentifier NOT NULL, batchid dsidentifier NOT NULL, opcode dsidentifier NOT NULL, proctype dsidentifier NOT NULL, priority dsidentifier NOT NULL, termdate dsdatetime NOT NULL, prognumber dsidentifier NOT NULL, valuedate dsdatetime NOT NULL, docname dsvarfullname NOT NULL, balanceid dsidentifier NOT NULL, fundpsvid dsidentifier NOT NULL, activeflag dstinyint NOT NULL, nettresultid dsidentifier NOT NULL, nettobjectid dsidentifier NOT NULL, objectstate dsidentifier NOT NULL, paymenttype dsidentifier NOT NULL, accanlid dsidentifier NOT NULL, accanlsecid dsidentifier NOT NULL, initiatorid dsidentifier NOT NULL ); ALTER TABLE ONLY tdealtransact ADD CONSTRAINT tdealtransact_xpktdealtransact UNIQUE (dealtransactid) DEFERRABLE; CREATE INDEX tdealtransact_xie10tdealtransact ON tdealtransact USING btree (initiatorid); CREATE INDEX tdealtransact_xie11tdealtransact ON tdealtransact USING btree (fundid, expensefundid, securityid, secissueid); CREATE INDEX tdealtransact_xie12tdealtransact ON tdealtransact USING btree (fixdate, transacttype, securityid); CREATE INDEX tdealtransact_xie13tdealtransact ON tdealtransact USING btree (transacttype, docdate, accanlid, instrumentid); CREATE INDEX tdealtransact_xie14tdealtransact ON tdealtransact USING btree (resourcepsvid, date); CREATE INDEX tdealtransact_xie1tdealtransact ON tdealtransact USING btree (dealid, transacttype, dealprotocolid); CREATE INDEX tdealtransact_xie2tdealtransact ON tdealtransact USING btree (parentid, transacttype, type); CREATE INDEX tdealtransact_xie3tdealtransact ON tdealtransact USING btree (transacttype, date, instrumentid, resourcepsvid, prognumber); CREATE INDEX tdealtransact_xie4tdealtransact ON tdealtransact USING btree (transacttype, activeflag, balanceid, couponid); CREATE INDEX tdealtransact_xie6tdealtransact ON tdealtransact USING btree (dealprotocolid); CREATE INDEX tdealtransact_xie8tdealtransact ON tdealtransact USING btree (transacttype, date, qty); CREATE INDEX tdealtransact_xie9tdealtransact ON tdealtransact USING btree (resourceid, date); ---papi_sm_linkedprotocol CREATE UNLOGGED TABLE papi_sm_linkedprotocol ( spid dsspid, finoperid dsidentifier, objectid dsidentifier, objecttypeid dsidentifier, protocolid dsidentifier, relationtype dsint_key ); CREATE INDEX papi_sm_linkedprotocol_xpkpapi_sm_linkedprotocol ON papi_sm_linkedprotocol USING btree (spid, relationtype, protocolid); ---tprotocolrelation CREATE TABLE tprotocolrelation ( parentid dsidentifier NOT NULL, childid dsidentifier NOT NULL ); ALTER TABLE ONLY tprotocolrelation ADD CONSTRAINT tprotocolrelation_xpktprotocolrelation UNIQUE (parentid, childid) DEFERRABLE; CREATE INDEX tprotocolrelation_xie1tprotocolrelation ON tprotocolrelation USING btree (childid); ---pdpt_accrual_advbase CREATE UNLOGGED TABLE pdpt_accrual_advbase ( spid dsspid, objectid dsidentifier, basevalue dsmoney, tax dsfloat, advtax dsfloat, qty dsfloat, refqty dsfloat, templatenumber dsidentifier, begindate dsoperday, enddate dsoperday, protocolid dsidentifier ); CREATE INDEX pdpt_accrual_advbase_xak1pdpt_accrual_advbase ON pdpt_accrual_advbase USING btree (spid, templatenumber, objectid); CREATE INDEX pdpt_accrual_advbase_xpkpdpt_accrual_advbase ON pdpt_accrual_advbase USING btree (spid, objectid, templatenumber); ---papi_accrual_object CREATE UNLOGGED TABLE papi_accrual_object ( spid dsspid, objectid dsidentifier, objecttypeid dsidentifier, finoperid dsidentifier, institutionid dsidentifier, branchid dsidentifier, date dsoperday, plandate dsoperday, operdate dsoperday, creationdate dsdatetime, valuedate dsdatetime, closedate dsdatetime, crnid dsidentifier, number dsvarfullname40, period dsint_key, ntfid dsint_key, initialobjectid dsidentifier ); ALTER TABLE ONLY papi_accrual_object ADD CONSTRAINT papi_accrual_object_xpkpapi_accrual_object UNIQUE (spid, objectid) DEFERRABLE; CREATE INDEX papi_accrual_object_xie1papi_accrual_object ON papi_accrual_object USING btree (spid, ntfid, finoperid); CREATE INDEX papi_accrual_object_xie2papi_accrual_object ON papi_accrual_object USING btree (spid, crnid); CREATE INDEX papi_accrual_object_xie3papi_accrual_object ON papi_accrual_object USING btree (spid, operdate); --papi_accrual_date CREATE UNLOGGED TABLE papi_accrual_date ( spid dsspid, initialobjectid dsidentifier, ntfid dsint_key, objectid dsidentifier, templatenumber dsidentifier, begindate dsoperday, enddate dsoperday ); ALTER TABLE ONLY papi_accrual_date ADD CONSTRAINT papi_accrual_date_xpkpapi_accrual_date UNIQUE (spid, templatenumber, objectid) DEFERRABLE; CREATE INDEX papi_accrual_date_xie1papi_accrual_date ON papi_accrual_date USING btree (spid, templatenumber, begindate, enddate); ----pqtyobjectmember CREATE UNLOGGED TABLE pqtyobjectmember ( spid dsint_key, objectid dsidentifier, partnumber dsint_key, opertemplateid dsidentifier, sumorder dsint_key, fundid dsidentifier, const dsfloat, mult1 dsfloat, mult2 dsfloat, mult3 dsfloat, mult4 dsfloat, mult5 dsfloat, div1 dsfloat, div2 dsfloat, div3 dsfloat, div4 dsfloat, div5 dsfloat ); ALTER TABLE ONLY pqtyobjectmember ADD CONSTRAINT pqtyobjectmember_xpkpqtyobjectmember UNIQUE (spid, partnumber, objectid, opertemplateid, sumorder, div1, div2, div3, div4, div5) DEFERRABLE; --palltemplate CREATE UNLOGGED TABLE palltemplate ( spid dsspid, prio dsint_key, type dsint_key, opertemplateid dsidentifier, number dsfieldname, security dsidentifier, qtyfrmtext dscomment, sysname dsbic ); CREATE INDEX palltemplate_xie1palltemplate ON palltemplate USING btree (spid); CREATE INDEX palltemplate_xie2palltemplate ON palltemplate USING btree (spid, opertemplateid); ---paccr_object_cprotocol CREATE UNLOGGED TABLE paccr_object_cprotocol ( spid dsspid, objectid dsidentifier, finoperid dsidentifier, currprotocolid dsidentifier ); ALTER TABLE ONLY paccr_object_cprotocol ADD CONSTRAINT paccr_object_cprotocol_xpkpaccr_object_cprotocol UNIQUE (spid, objectid, finoperid) DEFERRABLE; ---palltemplatedoc CREATE UNLOGGED TABLE palltemplatedoc ( spid dsspid, opertemplateid dsidentifier, priority dstinyint ); CREATE INDEX palltemplatedoc_xie1palltemplatedoc ON palltemplatedoc USING btree (spid); CREATE INDEX palltemplatedoc_xie2palltemplatedoc ON palltemplatedoc USING btree (spid, opertemplateid); ---pdocumenttemplate CREATE UNLOGGED TABLE pdocumenttemplate ( spid dsspid, opertemplateid dsidentifier ); CREATE INDEX pdocumenttemplate_xpkpdocumenttemplate ON pdocumenttemplate USING btree (spid, opertemplateid); ---papi_accrual_objaccount CREATE UNLOGGED TABLE papi_accrual_objaccount ( spid dsspid, objectid dsidentifier, accountid dsidentifier, crnid dsidentifier, tmpid dsidentifier, tmp2id dsidentifier, templatenumber dsidentifier, ntfid dsint_key ); ALTER TABLE ONLY papi_accrual_objaccount ADD CONSTRAINT papi_accrual_objaccount_xpkpapi_accrual_objaccount UNIQUE (spid, templatenumber, objectid) DEFERRABLE; CREATE INDEX papi_accrual_objaccount_xie2papi_accrual_objaccount ON papi_accrual_objaccount USING btree (spid, objectid, templatenumber); CREATE INDEX papi_accrual_objaccount_xie3papi_accrual_objaccount ON papi_accrual_objaccount USING btree (spid, templatenumber, tmp2id); CREATE INDEX papi_accrual_objaccount_xie4papi_accrual_objaccount ON papi_accrual_objaccount USING btree (spid, objectid, crnid); ---papi_cacc_letterauthority CREATE UNLOGGED TABLE papi_cacc_letterauthority ( spid dsspid, currentaccountid dsidentifier, letterauthorityid dsidentifier, kind dstinyint, branchid dsidentifier, branchbrief dsaccnumber, authorid dsidentifier, authorbrief dsusername, authorname dsvarfullname160, number dsnumber20, datecreation dsoperday, ownerid dsidentifier, ownerkind dstinyint, ownerbrief dsusername, ownername dsfullname, ownericardid dsidentifier, ownericardtypebrief dsbriefvar, ownericardregnumber dshash, ownericardregseries dslabel, agentid dsidentifier, agentbrief dsusername, agentname dsfullname, agenticardid dsidentifier, agenticardtypebrief dsbriefvar, agenticardregnumber dshash, agenticardregseries dslabel, dateoper dsoperday, datestart dsoperday, termday dsfloat, termmonth dsfloat, dateend dsoperday, status dstinyint, comment dscomment, finoperid dsidentifier, stateid dsidentifier, statebrief dsbriefname, statename dsfullname ); CREATE INDEX papi_cacc_letterauthority_xie1papi_cacc_letterauthority ON papi_cacc_letterauthority USING btree (spid, currentaccountid); ---ptdpt_jr CREATE UNLOGGED TABLE ptdpt_jr ( spid dsspid, jrelid dsidentifier, jrdocid dsidentifier, agentid dsidentifier, agentkind dstinyint ); CREATE INDEX ptdpt_jr_xpkptdpt_jr ON ptdpt_jr USING btree (spid, jrelid, jrdocid); ---papi_jrel_findlist CREATE UNLOGGED TABLE papi_jrel_findlist ( agent dsaccnumber, agentid dsidentifier, jrdocfinoper dsbriefname, jrdocfinoperid dsidentifier, jrdocid dsidentifier, jrelid dsidentifier, jrole dsbriefname, partctype dstinyint, spid dsspid, status dsbriefname ); CREATE INDEX papi_jrel_findlist_xpkpapi_jrel_findlist ON papi_jrel_findlist USING btree (spid, jrelid); ---papi_juraldoc_findlist CREATE UNLOGGED TABLE papi_juraldoc_findlist ( agenticardid dsidentifier, agentid dsidentifier, authorid dsidentifier, authorname dsvarfullname160, branchid dsidentifier, comment dscomment, dateaccount dsoperday, dateclose dsoperday, datecreation dsoperday, dateoper dsoperday, finoperid dsidentifier, flallacc dstinyint, icardid dsidentifier, internalnumber dsaccnumvar, jrdocid dsidentifier, juraldoctype dstinyint, linkid dsidentifier, main dstinyint, notusedflag dstinyint, originalnumber dshash, ownerid dsidentifier, periodday dsint_key, periodmonth dsint_key, spid dsspid, statebrief dsbriefname, type dstinyint, typebrief dsbriefname, typename dsfullname ); ALTER TABLE ONLY papi_juraldoc_findlist ADD CONSTRAINT papi_juraldoc_findlist_xpkpapi_juraldoc_findlist UNIQUE (spid, jrdocid, type) DEFERRABLE; ---tdpt_finoper_sync CREATE TABLE tdpt_finoper_sync ( finoperid dsidentifier NOT NULL, parentid dsidentifier NOT NULL, initialstateid dsidentifier NOT NULL, brief dsbriefname NOT NULL, name dsfullname NOT NULL, type dsidentifier NOT NULL, comment dscomment NOT NULL, autocomment dscomment NOT NULL, dsmoduleid dsidentifier NOT NULL, interfaceobjectid dsidentifier NOT NULL, verify dsidentifier NOT NULL, haveperiod dstinyint NOT NULL, findprconobject dstinyint NOT NULL, replicatorscript dscomment NOT NULL ); ALTER TABLE ONLY tdpt_finoper_sync ADD CONSTRAINT tdpt_finoper_sync_xpktdpt_finoper_sync UNIQUE (finoperid) DEFERRABLE; CREATE INDEX tdpt_finoper_sync_xie0tdpt_finoper_sync ON tdpt_finoper_sync USING btree (interfaceobjectid, finoperid); CREATE INDEX tdpt_finoper_sync_xie1tdpt_finoper_sync ON tdpt_finoper_sync USING btree (((lower((brief)::text))::dsbriefname)); ---papi_sm_currentstate CREATE UNLOGGED TABLE papi_sm_currentstate ( spid dsspid, editenabled dsidentifier, auditid dsidentifier, brief dsaccnumber, date dsoperday, finoperid dsidentifier, id dsidentifier, incomplete dsint_key, name dsfullname, objectid dsidentifier, objecttypeid dsidentifier, protocolid dsidentifier, stateid dsidentifier, usertype dsidentifier, usertypebrief dsbriefvar ); ALTER TABLE ONLY papi_sm_currentstate ADD CONSTRAINT papi_sm_currentstate_xpkpapi_sm_currentstate UNIQUE (spid, id, finoperid) DEFERRABLE; ---tdpt_partc_sync CREATE TABLE tdpt_partc_sync ( participantid dsidentifier NOT NULL, proptype dstinyint NOT NULL, brief dsaccnumber NOT NULL, name dsvarfullname160 NOT NULL, name1 dsvarfullname160 NOT NULL, name2 dsvarfullname160 NOT NULL, resident dstinyint NOT NULL, inn dsbic NOT NULL, countryid dsidentifier NOT NULL, country dsaccnumvar NOT NULL, portal dsnumber NOT NULL, externalid dsidentifier NOT NULL, branchid dsidentifier NOT NULL, indatetime dsdatetime NOT NULL, birthday dsoperday NOT NULL, isbankrupt dstinyint ); ALTER TABLE ONLY tdpt_partc_sync ADD CONSTRAINT tdpt_partc_sync_xak1tdpt_partc_sync UNIQUE (((lower((brief)::text))::dsaccnumber), proptype) DEFERRABLE; ALTER TABLE ONLY tdpt_partc_sync ADD CONSTRAINT tdpt_partc_sync_xpktdpt_partc_sync UNIQUE (participantid) DEFERRABLE; ---papi_prs_icard CREATE UNLOGGED TABLE papi_prs_icard ( spid dsspid, personid dsidentifier, doctypeid dsidentifier, doctype dsbriefname, regnumber dshash, regseries dslabel, regdepartment dscomment, codepasspdepartment dsfieldname, dateofissue dsoperday, dateregend dsoperday, flmain dstinyint, fldead dstinyint, icardid dsidentifier, icardstartdate dsoperday ); CREATE INDEX papi_prs_icard_xie1papi_prs_icard ON papi_prs_icard USING btree (spid, personid); CREATE INDEX papi_prs_icard_xpkpapi_prs_icard ON papi_prs_icard USING btree (spid, icardid); ---tdptlegalclientlink CREATE TABLE tdptlegalclientlink ( dptlegalclientlinkid dsidentifier NOT NULL, objectid dsidentifier NOT NULL, legalbaseid dsidentifier NOT NULL, instrole dsint_key NOT NULL, general dsint_key NOT NULL, instchildid dsidentifier NOT NULL, issingle dsint_key NOT NULL, status dsint_key NOT NULL ); ALTER TABLE ONLY tdptlegalclientlink ADD CONSTRAINT tdptlegalclientlink_xpktdptlegalclientlink UNIQUE (dptlegalclientlinkid) DEFERRABLE; CREATE INDEX tdptlegalclientlink_xie1tdptlegalclientlink ON tdptlegalclientlink USING btree (objectid); CREATE INDEX tdptlegalclientlink_xie2tdptlegalclientlink ON tdptlegalclientlink USING btree (legalbaseid); CREATE INDEX tdptlegalclientlink_xie3tdptlegalclientlink ON tdptlegalclientlink USING btree (instchildid, instrole, status); ---papi_chacc_fndlstidchange CREATE UNLOGGED TABLE papi_chacc_fndlstidchange ( spid dsspid, chartaccid dsidentifier, changekind dstinyint, changedate dsdatetime ); CREATE INDEX papi_chacc_fndlstidchange_xpkpapi_chacc_fndlstidchange ON papi_chacc_fndlstidchange USING btree (spid); ---taudit CREATE TABLE taudit ( auditid dsidentifier NOT NULL, userid dsidentifier NOT NULL, indatetime dsdatetime NOT NULL, action dstinyint NOT NULL, objectid dsidentifier NOT NULL, objectname dsfieldnamevar NOT NULL, comment dscomment NOT NULL, hostinfoid dsidentifier NOT NULL, verified dsbit0 NOT NULL, objectreference dsbit0 NOT NULL ); ALTER TABLE ONLY taudit ADD CONSTRAINT taudit_xpktaudit UNIQUE (auditid) DEFERRABLE; CREATE INDEX taudit_xie0taudit ON taudit USING btree (userid, indatetime); CREATE INDEX taudit_xie3taudit ON taudit USING btree (objectid, action); CREATE INDEX taudit_xie4taudit ON taudit USING btree (indatetime); ---tresource CREATE TABLE tresource ( resourceid dsidentifier NOT NULL, balanceid dsidentifier NOT NULL, institutionid dsidentifier NOT NULL, instownerid dsidentifier NOT NULL, fundid dsidentifier NOT NULL, securityid dsidentifier NOT NULL, secissueid dsidentifier NOT NULL, name dscomment NOT NULL, brief dsacc_swift NOT NULL, parentmask dsvarfullname40 NOT NULL, mask dsvarfullname NOT NULL, parentid dsidentifier NOT NULL, resourcetype dstinyint NOT NULL, objectid dsidentifier NOT NULL, chartype dstinyint NOT NULL, restricttype dstinyint NOT NULL, proptype dsidentifier NOT NULL, mainacc dssmallint NOT NULL, defaultacc dstinyint NOT NULL, revaltype dsidentifier NOT NULL, blocked dstinyint NOT NULL, datestart day NOT NULL, dateend dsoperday NOT NULL, note dscomment NOT NULL, note1 dscomment NOT NULL, reshash dslabel NOT NULL, accanlid dsidentifier NOT NULL, parenthash dslabel NOT NULL, accountlength dsidentifier NOT NULL, restcheck dsmoney NOT NULL, resbenefid dsidentifier NOT NULL, instbenefid dsidentifier NOT NULL, revalid dsidentifier NOT NULL, acclinkedid dsidentifier NOT NULL, levelid dsidentifier NOT NULL, usermainid dsidentifier NOT NULL, userid dsidentifier NOT NULL, indatetime dsdatetime NOT NULL, dealprotocolid dsidentifier NOT NULL, bankcontractnum dsaccnumvar NOT NULL, bankcontractdate dsoperday NOT NULL, datenotifygni dsoperday NOT NULL, datenotifypf dsoperday NOT NULL, datenotifyfoms dsoperday NOT NULL, isrestcheck dstinyint NOT NULL, accorder dsaccnumber NOT NULL, keyposition dsidentifier NOT NULL, subdivisionid dsidentifier NOT NULL, settings dsidentifier NOT NULL, ownercontrol dsidentifier NOT NULL, clientinstructid dsidentifier NOT NULL, altername dscomment NOT NULL, accprofileid dsidentifier NOT NULL, instrumentid dsidentifier NOT NULL, clientcloseinstructid dsidentifier, dealcloseprotocolid dsidentifier ); ALTER TABLE ONLY tresource ADD CONSTRAINT tresource_xak1tresource UNIQUE (((lower((brief)::text))::dsacc_swift), ((lower((parentmask)::text))::dsvarfullname40), institutionid, fundid, dateend) DEFERRABLE; ALTER TABLE ONLY tresource ADD CONSTRAINT tresource_xak2tresource UNIQUE (resourcetype, balanceid, institutionid, fundid, ((lower((parentmask)::text))::dsvarfullname40), ((lower((brief)::text))::dsacc_swift), dateend) DEFERRABLE; ALTER TABLE ONLY tresource ADD CONSTRAINT tresource_xak3tresource UNIQUE (parentid, institutionid, fundid, ((lower((reshash)::text))::dslabel), dateend) DEFERRABLE; ALTER TABLE ONLY tresource ADD CONSTRAINT tresource_xak4tresource UNIQUE (resourcetype, balanceid, institutionid, ((lower((accorder)::text))::dsaccnumber), dateend) DEFERRABLE; ALTER TABLE ONLY tresource ADD CONSTRAINT tresource_xpktresource UNIQUE (resourceid) DEFERRABLE; CREATE INDEX tresource_xie10tresource ON tresource USING btree (usermainid); CREATE INDEX tresource_xie11tresource ON tresource USING btree (parentid, institutionid, fundid, ((lower((brief)::text))::dsacc_swift)); CREATE INDEX tresource_xie1tresource ON tresource USING btree (((lower((parenthash)::text))::dslabel)); CREATE INDEX tresource_xie2tresource ON tresource USING btree (instownerid, parentid); CREATE INDEX tresource_xie3tresource ON tresource USING btree (resbenefid); CREATE INDEX tresource_xie4tresource ON tresource USING btree (instbenefid, institutionid, fundid); CREATE INDEX tresource_xie5tresource ON tresource USING btree (parentid, fundid, resourcetype); CREATE INDEX tresource_xie7tresource ON tresource USING btree (accanlid); CREATE INDEX tresource_xie8tresource ON tresource USING btree (dealprotocolid); CREATE INDEX tresource_xie9tresource ON tresource USING btree (institutionid, fundid, defaultacc); ---hresource CREATE TABLE hresource ( historyheaderid dsidentifier NOT NULL, resourceid dsidentifier NOT NULL, balanceid dsidentifier NOT NULL, institutionid dsidentifier NOT NULL, instownerid dsidentifier NOT NULL, fundid dsidentifier NOT NULL, securityid dsidentifier NOT NULL, secissueid dsidentifier NOT NULL, name dscomment NOT NULL, brief dsacc_swift NOT NULL, parentmask dsvarfullname40 NOT NULL, mask dsvarfullname NOT NULL, parentid dsidentifier NOT NULL, resourcetype dstinyint NOT NULL, objectid dsidentifier NOT NULL, chartype dstinyint NOT NULL, restricttype dstinyint NOT NULL, proptype dsidentifier NOT NULL, mainacc dssmallint NOT NULL, defaultacc dstinyint NOT NULL, revaltype dsidentifier NOT NULL, blocked dstinyint NOT NULL, datestart day NOT NULL, dateend dsoperday NOT NULL, note dscomment NOT NULL, note1 dscomment NOT NULL, reshash dslabel NOT NULL, accanlid dsidentifier NOT NULL, parenthash dslabel NOT NULL, accountlength dsidentifier NOT NULL, restcheck dsmoney NOT NULL, resbenefid dsidentifier NOT NULL, instbenefid dsidentifier NOT NULL, revalid dsidentifier NOT NULL, acclinkedid dsidentifier NOT NULL, levelid dsidentifier NOT NULL, usermainid dsidentifier NOT NULL, userid dsidentifier NOT NULL, indatetime dsdatetime NOT NULL, dealprotocolid dsidentifier NOT NULL, bankcontractnum dsaccnumvar NOT NULL, bankcontractdate dsoperday NOT NULL, datenotifygni dsoperday NOT NULL, datenotifypf dsoperday NOT NULL, datenotifyfoms dsoperday NOT NULL, isrestcheck dstinyint NOT NULL, accorder dsaccnumber NOT NULL, keyposition dsidentifier NOT NULL, subdivisionid dsidentifier NOT NULL, settings dsidentifier NOT NULL, ownercontrol dsidentifier NOT NULL, clientinstructid dsidentifier NOT NULL, altername dscomment NOT NULL, accprofileid dsidentifier NOT NULL, instrumentid dsidentifier NOT NULL, clientcloseinstructid dsidentifier, dealcloseprotocolid dsidentifier ); ALTER TABLE ONLY hresource ADD CONSTRAINT hresource_xpkhresource UNIQUE (historyheaderid) DEFERRABLE; --tpoolstorerest CREATE TABLE tpoolstorerest ( poolstorerestid dsidentifier NOT NULL, accountid dsidentifier NOT NULL, accrualdate dsoperday NOT NULL, qty dsbigmoney NOT NULL, currencyid dsidentifier NOT NULL, accrualqty dsbigmoney NOT NULL, accrualcurrid dsidentifier NOT NULL, dealprotid dsidentifier NOT NULL, docdealprotid dsidentifier NOT NULL, poolid dsidentifier NOT NULL, flag dsint_key NOT NULL, contractid dsidentifier ); ALTER TABLE ONLY tpoolstorerest ADD CONSTRAINT tpoolstorerest_xpktpoolstorerest UNIQUE (poolstorerestid) DEFERRABLE; CREATE INDEX tpoolstorerest_xie1tpoolstorerest ON tpoolstorerest USING btree (dealprotid); CREATE INDEX tpoolstorerest_xie2tpoolstorerest ON tpoolstorerest USING btree (accrualdate, accountid); CREATE INDEX tpoolstorerest_xie3tpoolstorerest ON tpoolstorerest USING btree (docdealprotid); CREATE INDEX tpoolstorerest_xie4tpoolstorerest ON tpoolstorerest USING btree (accountid, accrualdate); ---papi_sm_findparamprotocol CREATE UNLOGGED TABLE papi_sm_findparamprotocol ( spid dsspid, actionbrief dsaccnumber, actionid dsidentifier, actionname dsfullname, actiontype dsint_key, auditid dsidentifier, date dsoperday, incomplete dsint_key, objectid dsidentifier, protocolid dsidentifier, stateid dsidentifier, stateorder dsint_key ); ALTER TABLE ONLY papi_sm_findparamprotocol ADD CONSTRAINT papi_sm_findparamprotocol_xak1papi_sm_findparamprotocol UNIQUE (spid, protocolid) DEFERRABLE; ALTER TABLE ONLY papi_sm_findparamprotocol ADD CONSTRAINT papi_sm_findparamprotocol_xpkpapi_sm_findparamprotocol UNIQUE (spid, objectid, protocolid) DEFERRABLE; ---padm_sm_paramobject CREATE UNLOGGED SEQUENCE padm_sm_paramobject_autoid_seq START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1 CYCLE; CREATE UNLOGGED TABLE padm_sm_paramobject ( spid dsspid, objectid dsidentifier, id dsidentifier, ispfo dstinyint, datestart dsoperday, dateend dsoperday, autoid dsidentifier DEFAULT nextval('padm_sm_paramobject_autoid_seq'::regclass) ); ALTER TABLE ONLY padm_sm_paramobject ADD CONSTRAINT padm_sm_paramobject_xpkpadm_sm_paramobject UNIQUE (spid, autoid) DEFERRABLE; CREATE INDEX padm_sm_paramobject_xak1padm_sm_paramobject ON padm_sm_paramobject USING btree (spid, ispfo, autoid, objectid, datestart, dateend, id); ---tnodeattr CREATE TABLE tnodeattr ( nodeid dsidentifier NOT NULL, periodtype dsint_key NOT NULL, required dsint_key NOT NULL, propval dsint_key NOT NULL, priority dsint_key NOT NULL, flags dsint_key NOT NULL ); ALTER TABLE ONLY tnodeattr ADD CONSTRAINT tnodeattr_xpktnodeattr UNIQUE (nodeid) DEFERRABLE; ---tprotocolsuspend CREATE TABLE tprotocolsuspend ( protocolid dsidentifier NOT NULL ); ALTER TABLE ONLY tprotocolsuspend ADD CONSTRAINT tprotocolsuspend_xpktprotocolsuspend UNIQUE (protocolid) DEFERRABLE; ---papi_sm_paramobjectaction CREATE UNLOGGED TABLE papi_sm_paramobjectaction ( spid dsspid, actionid dsidentifier, actiontype dsint_key ); ALTER TABLE ONLY papi_sm_paramobjectaction ADD CONSTRAINT papi_sm_paramobjectaction_xak1papi_sm_paramobjectaction UNIQUE (spid, actiontype, actionid) DEFERRABLE; ALTER TABLE ONLY papi_sm_paramobjectaction ADD CONSTRAINT papi_sm_paramobjectaction_xpkpapi_sm_paramobjectaction UNIQUE (spid, actionid, actiontype) DEFERRABLE; ---tnode CREATE TABLE tnode ( nodeid dsidentifier NOT NULL, instrumentid dsidentifier NOT NULL, configstyleid dsidentifier NOT NULL, dealtype dstinyint NOT NULL, brief dsbriefname NOT NULL, name dsfullname NOT NULL, nodetype dstinyint NOT NULL, note dsfullname NOT NULL, contextid dsidentifier NOT NULL, type dsidentifier NOT NULL, closed dsidentifier NOT NULL, settings dsidentifier NOT NULL, statetype dsidentifier ); ALTER TABLE ONLY tnode ADD CONSTRAINT tnode_xak0tnode UNIQUE (configstyleid, nodeid) DEFERRABLE; ALTER TABLE ONLY tnode ADD CONSTRAINT tnode_xpktnode UNIQUE (nodeid) DEFERRABLE; CREATE INDEX tnode_xie1tnode ON tnode USING btree (contextid, type); ---tlegalbase CREATE TABLE tlegalbase ( legalbaseid dsidentifier NOT NULL, instrumentid dsidentifier NOT NULL, instparentid dsidentifier NOT NULL, instlicenseparentid dsidentifier NOT NULL, instchildid dsidentifier NOT NULL, instlicensechildid dsidentifier NOT NULL, instcompilerid dsidentifier NOT NULL, branchid dsidentifier NOT NULL, originalnumber dsaccnumvar NOT NULL, internalnumber dsaccnumvar NOT NULL, datecreation dsoperday NOT NULL, dateoperating dsoperday NOT NULL, dateaccount dsoperday NOT NULL, dateclosing dsoperday NOT NULL, comment dscomment NOT NULL ); ALTER TABLE ONLY tlegalbase ADD CONSTRAINT tlegalbase_xak0tlegalbase UNIQUE (instrumentid, ((lower((internalnumber)::text))::dsaccnumvar)) DEFERRABLE; ALTER TABLE ONLY tlegalbase ADD CONSTRAINT tlegalbase_xpktlegalbase UNIQUE (legalbaseid) DEFERRABLE; CREATE INDEX tlegalbase_xie1tlegalbase ON tlegalbase USING btree (instparentid); CREATE INDEX tlegalbase_xie2tlegalbase ON tlegalbase USING btree (instlicenseparentid); CREATE INDEX tlegalbase_xie3tlegalbase ON tlegalbase USING btree (instchildid); CREATE INDEX tlegalbase_xie4tlegalbase ON tlegalbase USING btree (instlicensechildid); CREATE INDEX tlegalbase_xie5tlegalbase ON tlegalbase USING btree (instcompilerid); CREATE INDEX tlegalbase_xie6tlegalbase ON tlegalbase USING btree (branchid); --- CREATE UNLOGGED TABLE papi_lawsuit_notification ( spid dsspid, lawsuitid dsidentifier, ntfid dsidentifier, ntfmessage dscomment ); ALTER TABLE ONLY papi_lawsuit_notification ADD CONSTRAINT papi_lawsuit_notification_xpkpapi_lawsuit_notification UNIQUE (spid, lawsuitid, ntfid) DEFERRABLE; --- CREATE UNLOGGED TABLE papi_lawsuit_massupdate ( spid dsspid, lawsuitid dsidentifier, branchid dsidentifier, branchbrief dsaccnumber, lawsuitnumber dsaccnumvar, datecreation dsoperday, courtid dsidentifier, ownerid dsidentifier, agentid dsidentifier, claimcourtorderdate dsoperday, lawsuitcurrency dsbriefname, lawsuitamount dsmoney, comment dscomment ); ALTER TABLE ONLY papi_lawsuit_massupdate ADD CONSTRAINT papi_lawsuit_massupdate_xpkpapi_lawsuit_massupdate UNIQUE (spid, lawsuitid) DEFERRABLE; --- CREATE TABLE tinstitution ( institutionid dsidentifier NOT NULL, brief dsaccnumber NOT NULL, name character varying(160) NOT NULL, name1 character varying(160) NOT NULL, name2 character varying(160) NOT NULL, countryid dsidentifier NOT NULL, instgroupid dsidentifier NOT NULL, address1 dscomment NOT NULL, address2 dscomment NOT NULL, address3 dscomment NOT NULL, okohx character varying(40) NOT NULL, okpo character varying(40) NOT NULL, bic character varying(15) NOT NULL, inn character varying(15) NOT NULL, insttype dstinyint NOT NULL, propdealpart dstinyint NOT NULL, phone1 character varying(40) NOT NULL, phone2 character varying(40) NOT NULL, fax character varying(40) NOT NULL, telex character varying(30) NOT NULL, swift character varying(15) NOT NULL, email character varying(25) NOT NULL, sex dstinyint NOT NULL, rating dsidentifier NOT NULL, poufor dstinyint NOT NULL, portal dsnumber NOT NULL, parentid dsidentifier NOT NULL, typeofuse dsidentifier NOT NULL, userid dsidentifier NOT NULL, userid1 dsidentifier NOT NULL, tradingsysid dsidentifier NOT NULL, tradingsysnum character varying(10) NOT NULL, partner dstinyint NOT NULL, mainmember dstinyint NOT NULL, commission dsfloat NOT NULL, accrcv character varying(35) NOT NULL, accrcv1 character varying(10) NOT NULL, resbenefid dsidentifier NOT NULL, capital dsmoney NOT NULL, doctypeid dsidentifier NOT NULL, externalid dsidentifier NOT NULL, exportstatus dsidentifier NOT NULL, branchnumber character varying(10) NOT NULL, instpaytype character(2) NOT NULL, region character(2) NOT NULL, "real" dstinyint NOT NULL, datedel dsoperday NOT NULL, instrumentid dsidentifier NOT NULL, changedate dsoperday NOT NULL, branchid dsidentifier NOT NULL ); ALTER TABLE ONLY tinstitution ADD CONSTRAINT tinstitution_xak2tinstitution UNIQUE (((lower((brief)::text))::dsaccnumber), propdealpart) DEFERRABLE; ALTER TABLE ONLY tinstitution ADD CONSTRAINT tinstitution_xak3tinstitution UNIQUE (parentid, ((lower((brief)::text))::dsaccnumber), propdealpart) DEFERRABLE; ALTER TABLE ONLY tinstitution ADD CONSTRAINT tinstitution_xpktinstitution UNIQUE (institutionid) DEFERRABLE; CREATE INDEX tinstitution_idx2 ON tinstitution USING btree (((lower((name)::text))::character varying(160)), ((lower((name1)::text))::character varying(160)), ((lower((name2)::text))::character varying(160))); CREATE INDEX tinstitution_xak1tinstitution ON tinstitution USING btree (propdealpart); CREATE INDEX tinstitution_xak4tinstitution ON tinstitution USING btree (((lower((portal)::text))::dsnumber)); CREATE INDEX tinstitution_xie1tinstitution ON tinstitution USING btree (((lower((name1)::text))::character varying(160))); CREATE INDEX tinstitution_xie2tinstitution ON tinstitution USING btree (((lower((bic)::text))::character varying(15)), "real", datedel); CREATE INDEX tinstitution_xie3tinstitution ON tinstitution USING btree (insttype, ((lower((bic)::text))::character varying(15))); CREATE INDEX tinstitution_xie4tinstitution ON tinstitution USING btree (((lower((swift)::text))::character varying(15))); CREATE INDEX tinstitution_xie5tinstitution ON tinstitution USING btree (((lower((inn)::text))::character varying(15))); CREATE INDEX tinstitution_xie6tinstitution ON tinstitution USING btree (((lower((accrcv1)::text))::character varying(10))); CREATE INDEX tinstitution_xie7tinstitution ON tinstitution USING btree (branchid, externalid); CREATE INDEX tinstitution_xie8tinstitution ON tinstitution USING btree (((lower((name)::text))::character varying(160))); CREATE INDEX tinstitution_xie9tinstitution ON tinstitution USING btree (countryid); --- CREATE UNLOGGED TABLE pgna_findlistbyparam ( spid dsspid, linkid dsidentifier, typeacclinkid dsidentifier, cnttypeacclink integer, linkcrnid dsidentifier, residentflag dstinyint, branchid dsidentifier ); ALTER TABLE ONLY pgna_findlistbyparam ADD CONSTRAINT pgna_findlistbyparam_xpkpgna_findlistbyparam UNIQUE (spid, linkid, linkcrnid, typeacclinkid, residentflag) DEFERRABLE; --- CREATE UNLOGGED TABLE papi_gna_param ( spid dsspid, branchbrief dsaccnumber, branchid dsidentifier, date dsoperday, linkcrnid dsidentifier, linkcrnnumber dsbriefname, linkid dsidentifier, reltype dstinyint, reltypeid dsidentifier, systypebrief dsbriefname, systypeid dsidentifier, typebrief dsbriefname, typeid dsidentifier, residentflag dstinyint, linkbranchid dsidentifier ); ALTER TABLE ONLY papi_gna_param ADD CONSTRAINT papi_gna_param_xpkpapi_gna_param UNIQUE (spid, linkid) DEFERRABLE; --- CREATE UNLOGGED TABLE papi_finoper_findlst ( spid dsspid, finoperid dsidentifier, parentid dsidentifier, initialstateid dsidentifier, brief dsbriefname, name dsfullname, type dsidentifier, comment dscomment, autocomment dscomment, dsmoduleid dsidentifier, interfaceobjectid dsidentifier, verify dsidentifier, isdefault dsidentifier, clearcheck dsidentifier, haveperiod dstinyint, transitionmode dsidentifier, findprconobject dstinyint, replicatorscript dscomment ); CREATE INDEX papi_finoper_findlst_xpkpapi_finoper_findlst ON papi_finoper_findlst USING btree (spid, finoperid); --- CREATE TABLE ttypeacclink ( typeacclinkid dsidentifier NOT NULL, reltype dsidentifier NOT NULL, objectid dsidentifier NOT NULL, name dslabel NOT NULL, brief dsaccnumber NOT NULL, acctype dsidentifier NOT NULL, accmain dsidentifier NOT NULL, accowner dsint_key NOT NULL, accbalance dsint_key NOT NULL, nodeid dsidentifier NOT NULL, comment dscomment NOT NULL, linktype dsidentifier NOT NULL, isresident dsidentifier NOT NULL, autoopen dsidentifier NOT NULL, branchid dsidentifier NOT NULL, fundid dsidentifier NOT NULL, objclassifierid dsidentifier NOT NULL, objclassifier2id dsidentifier NOT NULL, insttype dsidentifier NOT NULL, chartype dstinyint NOT NULL, balanceid dsidentifier NOT NULL, accountfundid dsidentifier NOT NULL, maskaccountpicture dsvarfullname NOT NULL, maskaccountname dscomment NOT NULL, acctypeid dsidentifier NOT NULL, isactive dssmallint NOT NULL, datefrom dsdatetime NOT NULL, dateto dsdatetime NOT NULL, flags dsint_key NOT NULL, algorithm1 dstinyint NOT NULL, algorithm2 dstinyint NOT NULL, accprofileid dsidentifier NOT NULL, rating dsidentifier NOT NULL, algfindaccprofile dsint_key NOT NULL, formbelong dsint_key NOT NULL, modulealgorithm1 dsint_key NOT NULL, modulealgorithm2 dsint_key NOT NULL, defusermain dsint_key NOT NULL, usermainid dsidentifier NOT NULL, linkedpersonalpartid dsidentifier, linkedtypeacclinkid dsidentifier, ownerkinddetail dstinyint ); ALTER TABLE ONLY ttypeacclink ADD CONSTRAINT ttypeacclink_xpktinstracclink UNIQUE (typeacclinkid) DEFERRABLE; CREATE INDEX ttypeacclink_xie0tinstracclink ON ttypeacclink USING btree (reltype, objectid); CREATE INDEX ttypeacclink_xie1ttypeacclink ON ttypeacclink USING btree (nodeid); CREATE INDEX ttypeacclink_xie2ttypeacclink ON ttypeacclink USING btree (reltype, linktype, acctype, objectid); CREATE INDEX ttypeacclink_xie3ttypeacclink ON ttypeacclink USING btree (reltype, linktype, objectid, autoopen); --- CREATE TABLE tlinkedacctype ( linkedacctypeid dsidentifier NOT NULL, brief dsbriefname NOT NULL, name dsvarfullname40 NOT NULL, propval dsidentifier NOT NULL ); ALTER TABLE ONLY tlinkedacctype ADD CONSTRAINT tlinkedacctype_xpktlinkedacctype UNIQUE (linkedacctypeid) DEFERRABLE; CREATE INDEX tlinkedacctype_xie1tlinkedacctype ON tlinkedacctype USING btree (propval); CREATE INDEX tlinkedacctype_xie2tlinkedacctype ON tlinkedacctype USING btree (((lower((brief)::text))::dsbriefname)); --- CREATE UNLOGGED TABLE papi_gna_fndlstbyparamntf ( spid dsspid, linkid dsidentifier, ntfid dsidentifier, ntfmessage dscomment ); ALTER TABLE ONLY papi_gna_fndlstbyparamntf ADD CONSTRAINT papi_gna_fndlstbyparamntf_xpkpapi_gna_fndlstbyparamntf UNIQUE (spid, linkid) DEFERRABLE; --- CREATE UNLOGGED TABLE papi_prmd_attriblist ( spid dsspid, prmdid dsidentifier, documenttype dstinyint, number dsaccnumvar, date dsoperday, operationdate dsoperday, batchbrief dsbriefname, documentgroupbrief dsbriefname, documentgroupid dsidentifier, debitaccountnumber dsacc_swift, debitaccountid dsidentifier, creditaccountnumber dsacc_swift, creditaccountid dsidentifier, debitcurrencyid dsidentifier, creditcurrencyid dsidentifier, creditamount dsbigmoney, debitamount dsbigmoney, finoperbrief dsbriefname, finoperid dsidentifier, userid dsidentifier, status dstinyint, purpose dscomment, statebrief dsbriefname, stateid dsidentifier, parentdocumentid dsidentifier, maindocumentid dsidentifier, branchid dsidentifier, linkid dsidentifier, branchbrief dsaccnumvar, batchid dsidentifier, creditcurrencybrief dsbriefvar, debitcurrencybrief dsbriefvar, indatetime dsdatetime, nettqty dsmoney, uniquecode dsacc_swift, parentdocfileid dsidentifier ); CREATE INDEX papi_prmd_attriblist_xie1papi_prmd_attriblist ON papi_prmd_attriblist USING btree (spid, linkid); CREATE INDEX papi_prmd_attriblist_xie2papi_prmd_attriblist ON papi_prmd_attriblist USING btree (spid, debitaccountid); CREATE INDEX papi_prmd_attriblist_xie3papi_prmd_attriblist ON papi_prmd_attriblist USING btree (spid, creditaccountid); CREATE INDEX papi_prmd_attriblist_xpkpapi_prmd_attriblist ON papi_prmd_attriblist USING btree (spid, prmdid); --- CREATE UNLOGGED TABLE papi_cashorder_cashsymbol ( spid dsspid, cashorderid dsidentifier, number dsaccnumber, amount dsmoney, purpose dscomment, cashsymbolid dsidentifier, symboltypeflag dstinyint, reportflag dstinyint ); CREATE INDEX papi_cashorder_cashsymbol_xie1papi_cashorder_cashsymbol ON papi_cashorder_cashsymbol USING btree (spid, cashorderid); CREATE INDEX papi_cashorder_cashsymbol_xpkpapi_cashorder_cashsymbol ON papi_cashorder_cashsymbol USING btree (spid); --- CREATE TABLE tdptaccountlink ( dptaccountlinkid dsidentifier NOT NULL, objectid dsidentifier NOT NULL, ruleaccid dsidentifier NOT NULL, ondate dsoperday NOT NULL, accountid dsidentifier NOT NULL, datelast dsdatetime NOT NULL, currencyid dsidentifier NOT NULL, flags dsint_key NOT NULL, datestartaccount dsoperday NOT NULL, dateendaccount dsoperday NOT NULL, briefaccount dsacc_swift NOT NULL, currencylinkid dsidentifier NOT NULL ); ALTER TABLE ONLY tdptaccountlink ADD CONSTRAINT tdptaccountlink_xpktdptaccountlink UNIQUE (dptaccountlinkid) DEFERRABLE; CREATE INDEX tdptaccountlink_xie1tdptaccountlink ON tdptaccountlink USING btree (objectid, ruleaccid); CREATE INDEX tdptaccountlink_xie2tdptaccountlink ON tdptaccountlink USING btree (accountid, ruleaccid, objectid); CREATE INDEX tdptaccountlink_xie3tdptaccountlink ON tdptaccountlink USING btree (((lower((briefaccount)::text))::dsacc_swift)); --- CREATE UNLOGGED TABLE pdpt_objectbytype ( spid dsspid, type dsint_key, id dsidentifier ); ALTER TABLE ONLY pdpt_objectbytype ADD CONSTRAINT pdpt_objectbytype_xpkpdpt_objectbytype UNIQUE (spid, id, type) DEFERRABLE; --- CREATE UNLOGGED TABLE papi_ruledoc_csordsubaccount ( spid dsspid, amount dsbigmoney, linkid dsidentifier, number dsint_key, text dscomment ); CREATE INDEX papi_ruledoc_csordsubaccount_xie1papi_ruledoc_csordsubacc ON papi_ruledoc_csordsubaccount USING btree (spid, linkid); --- CREATE UNLOGGED TABLE pgaapallsubcontoresource ( spid dsspid, id dsidentifier, chartype dssmallint, resourceid dsidentifier, countsubconto dstinyint, opertemplateid dsidentifier, depid1 dsidentifier, depid2 dsidentifier, depid3 dsidentifier, depid4 dsidentifier, depid5 dsidentifier, depid6 dsidentifier ); ALTER TABLE ONLY pgaapallsubcontoresource ADD CONSTRAINT pgaapallsubcontoresource_xak1allsubcontoresource UNIQUE (spid, chartype, id) DEFERRABLE; CREATE INDEX pgaapallsubcontoresource_xie1allsubcontoresource ON pgaapallsubcontoresource USING btree (spid, chartype, countsubconto); --- CREATE TABLE tdepartment ( departmentid dsidentifier NOT NULL, name dshash NOT NULL, brief dsaccnumber NOT NULL, parentid dsidentifier NOT NULL, deptype dstinyint NOT NULL, subcontotype dsidentifier NOT NULL, objectid dsidentifier NOT NULL, datestart dsoperday NOT NULL, dateend dsoperday NOT NULL, dephash dshash NOT NULL, depkey dsvarfullname40 NOT NULL, blocked dstinyint NOT NULL ); ALTER TABLE ONLY tdepartment ADD CONSTRAINT tdepartment_xak1tdepartment UNIQUE (((lower((depkey)::text))::dsvarfullname40)) DEFERRABLE; ALTER TABLE ONLY tdepartment ADD CONSTRAINT tdepartment_xak2tdepartment UNIQUE (parentid, ((lower((brief)::text))::dsaccnumber)) DEFERRABLE; ALTER TABLE ONLY tdepartment ADD CONSTRAINT tdepartment_xak3tdepartment UNIQUE (((lower((brief)::text))::dsaccnumber), subcontotype) DEFERRABLE; ALTER TABLE ONLY tdepartment ADD CONSTRAINT tdepartment_xpktdepartment UNIQUE (departmentid) DEFERRABLE; CREATE INDEX tdepartment_xie1tdepartment ON tdepartment USING btree (subcontotype, objectid); CREATE INDEX tdepartment_xie2tdepartment ON tdepartment USING btree (((lower((dephash)::text))::dshash)); --- CREATE DOMAIN public.dscomment300 AS character varying(300) DEFAULT ''::character varying; CREATE UNLOGGED SEQUENCE pdoccas_pdoccasid_seq START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1 CYCLE; CREATE UNLOGGED TABLE pdoccas ( spid dsspid, protocolid dsidentifier, pdoccasid dsidentifier DEFAULT nextval('pdoccas_pdoccasid_seq'::regclass), instrumentid dsidentifier, dealid dsidentifier, parentid dsidentifier, initiatorid dsidentifier, doclinkid dsidentifier, docnumber character varying(20), batchid dsidentifier, opcode dsidentifier, date timestamp(0) without time zone, confirmed smallint, qtydeb numeric(20,4), qtycre numeric(20,4), course double precision, rescompensid dsidentifier, docdate timestamp(0) without time zone, comment dscomment, resdebid dsidentifier, rescreid dsidentifier, flag character(25), reskartid dsidentifier, termdate timestamp(0) without time zone, contract character varying(25), valuedate timestamp(0) without time zone, groupdocumentid dsidentifier, knf character varying(6), modecashplan integer, cashplan1 integer, cashqty1 numeric(20,4), cashprim1 dscomment, cashplan2 integer, cashqty2 numeric(20,4), cashprim2 dscomment, cashplan3 integer, cashqty3 numeric(20,4), cashprim3 dscomment, cashid dsidentifier, cashclientid dsidentifier, cashclientname1 character(35), cashclientname2 character(35), cashclientname3 character(35), cashclientsignresident dsidentifier, cashdoctypeid dsidentifier, cashdocseries character(35), cashdocnumber character(35), cashdocdate timestamp(0) without time zone, cashdocplace dscomment, cashauthority dsidentifier, cashsecurityid dsidentifier, cashsecpart character(35), cashsecnumber integer, cashsecsignblank dsidentifier, cashprintbasis dscomment, resincomid dsidentifier, servicevariantid dsidentifier, comissbankresclientid dsidentifier, comissbankresincomid dsidentifier, comissbankqty numeric(20,4), comissbankfundid dsidentifier, autonumber integer, dealprotocolid dsidentifier, dispatchparam integer, swiftid dsidentifier, modeattr integer, noregenerate integer, docmode integer, priority dsidentifier, opertemplateid dsidentifier, objectid dsidentifier, instrumentobjectid dsidentifier, clientlicenseid dsidentifier, citizenship dsaccnumvar, inn dsaccnumvar, resreceiver character varying(35), receiverkpp dsbriefvar, receiverokato dsaccnumvar, receiverbankbic dsbic, receivername dscomment300, receiverinn dsaccnumvar, country dsaccnumvar, city dsvarfullname, birthdate dsoperday, address dscomment, transitflag dstinyint, receiveraccbank character varying(35), juraldocid dsidentifier, authorid dsidentifier ); CREATE INDEX pdoccas_xpkpdoccas ON pdoccas USING btree (spid, protocolid); --- CREATE TABLE tcurrency ( currencyid dsidentifier NOT NULL, name dscomment NOT NULL, brief dsaccnumber NOT NULL, number dsbriefname NOT NULL, isonumber dsbriefname NOT NULL, cashbrief dsbriefname NOT NULL, scale dsint_key NOT NULL, countdayyear dsint_key NOT NULL, namehi1 dsusername NOT NULL, namehi24 dsusername NOT NULL, namehi5 dsusername NOT NULL, namelo1 dsusername NOT NULL, namelo24 dsusername NOT NULL, namelo5 dsusername NOT NULL, flags dsint_key NOT NULL, instrumentid dsidentifier NOT NULL, ratetype dsint_key ); ALTER TABLE ONLY tcurrency ADD CONSTRAINT tcurrency_xak1tcurrency UNIQUE (((lower((brief)::text))::dsaccnumber)) DEFERRABLE; ALTER TABLE ONLY tcurrency ADD CONSTRAINT tcurrency_xpktcurrency UNIQUE (currencyid) DEFERRABLE; CREATE INDEX tcurrency_xie1tcurrency ON tcurrency USING btree (((lower((number)::text))::dsbriefname)); CREATE INDEX tcurrency_xie2tcurrency ON tcurrency USING btree (((lower((cashbrief)::text))::dsbriefname)); CREATE INDEX tcurrency_xie3tcurrency ON tcurrency USING btree (((lower((isonumber)::text))::dsbriefname)); --- CREATE UNLOGGED TABLE preslist ( spid dsspid, resourceid dsidentifier, date dsoperday, dephash dshash, turndeb dsbigmoney, turncre dsbigmoney, turndebbs dsbigmoney, turncrebs dsbigmoney, rest dsbigmoney, restbs dsbigmoney, securityid dsidentifier, portfolioid dsidentifier, fundid dsidentifier, lastdate dsoperday, departmentid dsidentifier, restfict dsbigmoney, turndebfict dsbigmoney, turncrefict dsbigmoney, balanceid dsidentifier, institutionid dsidentifier ); ALTER TABLE ONLY preslist ADD CONSTRAINT preslist_xpkpreslist UNIQUE (spid, resourceid, date, ((lower((dephash)::text))::dshash)) DEFERRABLE; CREATE INDEX preslist_xie1preslist ON preslist USING btree (spid, balanceid, institutionid, resourceid, date); CREATE INDEX preslist_xie2preslist ON preslist USING btree (spid, portfolioid); CREATE INDEX preslist_xie3preslist ON preslist USING btree (spid, date, resourceid, fundid); --- CREATE TABLE tgl_userright_sync ( userid dsidentifier NOT NULL, righttype dsidentifier NOT NULL, objectid dsidentifier NOT NULL ); ALTER TABLE ONLY tgl_userright_sync ADD CONSTRAINT tgl_userright_sync_xpktgl_userright_sync UNIQUE (userid, righttype, objectid) DEFERRABLE; CREATE INDEX tgl_userright_sync_xietgl_userright_sync ON tgl_userright_sync USING btree (righttype, objectid); --- CREATE TABLE pTmp_UserPost ( postid numeric (15, 0) ); --- CREATE TABLE tuserres ( userid dsidentifier NOT NULL, userrestype dsidentifier NOT NULL, resourceid dsidentifier NOT NULL, accesstype dsint_key NOT NULL, inuserid dsidentifier NOT NULL, indatetime dsdatetime NOT NULL ); ALTER TABLE ONLY tuserres ADD CONSTRAINT tuserres_xpktuserres UNIQUE (userid, userrestype, resourceid) DEFERRABLE; CREATE INDEX tuserres_xie1tuserres ON tuserres USING btree (userrestype, resourceid); --- CREATE TABLE tresourcebind ( parentid dsidentifier NOT NULL, childid dsidentifier NOT NULL, parentdepth dsint_key NOT NULL, childdepth dsint_key NOT NULL, childrestype dstinyint NOT NULL ); ALTER TABLE ONLY tresourcebind ADD CONSTRAINT tresourcebind_xak1tresourcebind UNIQUE (childid, parentid) DEFERRABLE; ALTER TABLE ONLY tresourcebind ADD CONSTRAINT tresourcebind_xpktresourcebind UNIQUE (parentid, childid) DEFERRABLE; CREATE INDEX tresourcebind_xie1tresourcebind ON tresourcebind USING btree (parentid, childdepth); CREATE INDEX tresourcebind_xie2tresourcebind ON tresourcebind USING btree (childid, parentdepth); CREATE INDEX tresourcebind_xie3tresourcebind ON tresourcebind USING btree (parentid, childrestype); --- CREATE UNLOGGED TABLE prko_f251_docum ( spid dsspid, dealtransactid dsidentifier, debid dsidentifier, creid dsidentifier, qty dsmoney, fixqty dsmoney, iscur dstinyint, opcode dsint_key, batchid dsidentifier, eldoc2 dstinyint, eldoc3 dstinyint, isclientbank dstinyint, date dsoperday, operid dsidentifier, isinc dstinyint, datecurs dsoperday, instrflags dsint_key, opcnt dsint_key ); CREATE INDEX prko_f251_docum_xie1prko_f251_docum ON prko_f251_docum USING btree (spid, instrflags, opcode); CREATE INDEX prko_f251_docum_xie2prko_f251_docum ON prko_f251_docum USING btree (spid, dealtransactid, instrflags); CREATE INDEX prko_f251_docum_xie3prko_f251_docum ON prko_f251_docum USING btree (spid, operid); CREATE INDEX prko_f251_docum_xie4prko_f251_docum ON prko_f251_docum USING btree (spid, instrflags, debid, creid, opcode, batchid); CREATE INDEX prko_f251_docum_xpkprko_f251_docum ON prko_f251_docum USING btree (spid, instrflags, dealtransactid, operid); --- CREATE UNLOGGED TABLE prkocomiss_docterm ( spid dsspid, resourceid dsidentifier NOT NULL, instreltypeid dsidentifier NOT NULL, resourcefundid dsidentifier NOT NULL, clientid dsidentifier NOT NULL, institutionid dsidentifier NOT NULL, maxdate timestamp(0) without time zone, nonfundid dsidentifier, interestvalueid dsidentifier, interestid dsidentifier, fixqty dsidentifier, fixcomissfundid dsidentifier, accountmethodid dsidentifier, flagaccrual integer, prcnt dsfloat ); CREATE INDEX prkocomiss_docterm_xie0prkocomiss_docterm ON prkocomiss_docterm USING btree (spid, resourceid, accountmethodid); --- CREATE UNLOGGED TABLE prkoresource ( spid dsspid, resourceid dsidentifier, num dstinyint, depid1 dsidentifier, depid2 dsidentifier, depid3 dsidentifier, depid4 dsidentifier, depid5 dsidentifier ); ALTER TABLE ONLY prkoresource ADD CONSTRAINT prkoresource_xpkprkoresource UNIQUE (spid, resourceid, num) DEFERRABLE; --- CREATE UNLOGGED TABLE papi_oper_fndlstbylstacc ( accountcreditid dsidentifier, accountdebitid dsidentifier, accountnumbercredit dsacc_swift, accountnumberdebit dsacc_swift, amountbs dsbigmoney, amountcredit dsbigmoney, amountdebit dsbigmoney, batchid dsidentifier, comment dscomment, course dsfloat, linkid dsidentifier, number dsaccnumber, operationid dsidentifier, opercode dstinyint, operdate dsoperday, spid dsspid, status dstinyint ); CREATE INDEX papi_oper_fndlstbylstacc_xie1papi_oper_fndlstbylstacc ON papi_oper_fndlstbylstacc USING btree (spid, accountdebitid); CREATE INDEX papi_oper_fndlstbylstacc_xie2papi_oper_fndlstbylstacc ON papi_oper_fndlstbylstacc USING btree (spid, accountcreditid); CREATE INDEX papi_oper_fndlstbylstacc_xpkpapi_oper_fndlstbylstacc ON papi_oper_fndlstbylstacc USING btree (spid, operationid, linkid); --- CREATE UNLOGGED TABLE papi_accrual_objdate ( spid dsspid, ntfid dsint_key, initialobjectid dsidentifier, objectid dsidentifier, qty dsmoney, templatenumber dsint_key, begindate dsoperday, enddate dsoperday, crnid dsidentifier ); CREATE INDEX papi_accrual_objdate_xie1papi_accrual_objdate ON papi_accrual_objdate USING btree (spid, templatenumber, objectid); CREATE INDEX papi_accrual_objdate_xie2papi_accrual_objdate ON papi_accrual_objdate USING btree (spid, objectid, templatenumber, begindate); CREATE INDEX papi_accrual_objdate_xpkpapi_accrual_objdate ON papi_accrual_objdate USING btree (spid, objectid); ---pdpt_accrual_objdatecorrect CREATE UNLOGGED TABLE pdpt_accrual_objdatecorrect ( spid dsspid, objectid dsidentifier, trandate dsoperday, minobjectdate dsoperday, maxobjectdate dsoperday, minrestdate dsoperday, ntfid dsint_key ); CREATE INDEX pdpt_accrual_objdatecorrect_xpkpdpt_accrual_objdatecorrect ON pdpt_accrual_objdatecorrect USING btree (spid, objectid); --- create table tmp_test_1(tt1 numeric); create table tmp_test_2(tt2 integer);