text stringlengths 2.5k 6.39M | kind stringclasses 3
values |
|---|---|
/*** User schema: the sample refers to sample data to be stored in the database schema HANAML_SAMPLES ****************************/
/*********************************************************************************************************************************/
/*********************************************************************************************************************************/
/*** Scenario: Train a RandomDecisionTree model to predict who would be interested in buying a caravan insurance policy **********/
/*** The use case is based on: P. van der Putten and M. van Someren (eds) . CoIL Challenge 2000: The Insurance Company Case. *****/
/**************************** Published by Sentient Machine Research, Amsterdam. Also a Leiden Institute of Advanced Computer ***/
/**************************** Science Technical Report 2000-09. June 22, 2000. See http://www.liacs.nl/~putten/library/cc2000/ **/
/*** The referenced datasets have to downloaded and loaded into the tables defined in the appendix *******************************/
/*** The objective is to predict as many true positives on the test set as possible **********************************************/
/*********************************************************************************************************************************/
/*** The sample code is based on SQLScript anonymous block, including the following steps: ***************************************/
-- 1. Declaring variables;
-- 2. Defining the input train and test data;
-- 3. Setting the algorithm parameters and training the RandomDecisionTree model ;
-- 4. Evaluating the model against the test data using AUC, ConfusionMatrix and its statistics;
-- Appendix: Table definitions;
/*********************************************************************************************************************************/
DO
begin
/*** STEP1 - Declaration of Variables **************************************/
DECLARE lt_PAL_PARAMETER_TBL TABLE("PARAM_NAME" VARCHAR (100), "INT_VALUE" INTEGER, "DOUBLE_VALUE" DOUBLE, "STRING_VALUE" VARCHAR (100));
DECLARE lt_PAL_RDT_MODEL_TBL TABLE("ROW_INDEX" INTEGER, "TREE_INDEX" INTEGER, "MODEL_CONTENT" NVARCHAR(5000));
DECLARE lt_P4 /*VARIABLE_IMPORTANCE*/ TABLE ("VARIABLE_NAME" NVARCHAR(48), "IMPORTANCE" DOUBLE);
DECLARE lt_P5 /*OUT_OF_BAG_ERROR*/ TABLE ("TREE_INDEX" INTEGER, "ERROR" DOUBLE );
DECLARE lt_P6 /*CONFUSION_MATRIX*/ TABLE ("ACTUAL_CLASS" NVARCHAR(100), "PREDICTED_CLASS" NVARCHAR(100), "COUNT" Double );
DECLARE lt_PAL_PREDICT_RESULT TABLE ("ID" INTEGER, "SCORE" NVARCHAR(100), "CONFIDENCE" Double );
DECLARE lt_PAL_AUC_OUT_ROCdata TABLE ("ID" INTEGER, "FPR" DOUBLE, "TPR" DOUBLE);
DECLARE lt_PAL_AUC_OUT_AUCstats TABLE ( "STAT_NAME" NVARCHAR(100), "STAT_VALUE" DOUBLE);
DECLARE lt_PAL_CF_MATRIX /*CONFUSION_Matrix */ TABLE ("ORIGINAL_LABEL" NVARCHAR(100), "PREDICTED_LABEL" NVARCHAR(100), "COUNT" Double );
DECLARE lt_PAL_CF_CLASSREPORT /*CLASSIFICATION REPORT*/ TABLE (CLASS NVARCHAR(100), RECALL DOUBLE, "PRECISION" DOUBLE, F_MEASURE DOUBLE, SUPPORT INTEGER);
/*** STEP2 - Define INPUT DATA **********************************************/
lt_traindata= select * from "HANAML_SAMPLES"."INSURANCE_TRAIN";
lt_testdata= select * from "HANAML_SAMPLES"."INSURANCE_TEST";
lt_testdata_PRED = SELECT "ID", "Customer_Subtype","Number_of_houses","Avg_size_household","Avg_age","Customer_main_type","Roman_catholic","Protestant","Other_religion","No_religion","Married","Living_together",
"Other_relation","Singles","Household_without_children","Household_with_children","High_level_education","Medium_level_education","Lower_level_education","High_status","Entrepreneur",
"Farmer","Middle_management","Skilled_labourers","Unskilled_labourers","Social_class_A","Social_class_B1","Social_class_B2","Social_class_C","Social_class_D","Rented_house","Home_owners",
"One_car","Two_cars","No_car","National_Health_Service","Private_health_insurance","Income_LT_30000","Income_30_45000","Income_45_75000","Income_75_122000","Income_GT123000","Average_income",
"Purchasing_power_class","Contribution_third_party_insurance_firms","Contribution_third_party_insurane_agriculture","Contribution_car_policies","Contribution_delivery_van_policies",
"Contribution_motorcycle_scooter_policies","Contribution_lorry_policies","Contribution_trailer_policies","Contribution_tractor_policies","Contribution_agricultural_machines_policies",
"Contribution_moped_policies","Contribution_life_insurances","Contribution_private_accident_insurance_policies","Contribution_family_accidents_insurance_policies",
"Contribution_disability_insurance_policies","Contribution_fire_policies","Contribution_surfboard_policies","Contribution_boat_policies","Contribution_bicycle_policies",
"Contribution_property_insurance_policies","Contribution_social_security_insurance_policies","Number_of_private_third_party_insurance","Number_of_third_party_insurance_firms",
"Number_of_third_party_insurane_agriculture","Number_of_car_policies","Number_of_delivery_van_policies","Number_of_motorcycle_scooter_policies","Number_of_lorry_policies",
"Number_of_trailer_policies","Number_of_tractor_policies","Number_of_agricultural_machines_policies","Number_of_moped_policies","Number_of_life_insurances",
"Number_of_private_accident_insurance_policies","Number_of_family_accidents_insurance_policies","Number_of_disability_insurance_policies","Number_of_fire_policies",
"Number_of_surfboard_policies","Number_of_boat_policies","Number_of_bicycle_policies","Number_of_property_insurance_policies","Number_of_social_security_insurance_policies" from :lt_testdata;
--select * from :lt_traindata;
--select * from :lt_traindata_PRED;
/*** STEP3 - FIT MODEL ********************************************************/
/* STEP3.1 Populating the Paramter Table Variable */
:lt_PAL_PARAMETER_TBL.DELETE();
:lt_PAL_PARAMETER_TBL.INSERT(('HAS_ID',1,NULL,NULL), 1); --first column is the ID column;
:lt_PAL_PARAMETER_TBL.INSERT(('DEPENDENT_VARIABLE',NULL,NULL,'Number_of_mobile_home_policies_num'),2); --Target or dependent variable;
:lt_PAL_PARAMETER_TBL.INSERT(('ALLOW_MISSING_LABEL',NULL,0 ,NULL),3); --Target variable must not have missing values;
:lt_PAL_PARAMETER_TBL.INSERT(('SEED',1234, NULL,NULL), 4); --Use this see for repeatability;
:lt_PAL_PARAMETER_TBL.INSERT(('THREAD_RATIO', NULL, 0.25 , NULL),5); --Use maximum of 25% of available threads;
:lt_PAL_PARAMETER_TBL.INSERT(('TREES_NUM', 200, NULL,NULL), 6); --n.estimators/number of modeled decision trees;
:lt_PAL_PARAMETER_TBL.INSERT(('TRY_NUM', 8, NULL, NULL), 7); -- max_features/max number of randomly selected splitting variables;
:lt_PAL_PARAMETER_TBL.INSERT(('NODE_SIZE', 1, NULL, NULL),8); -- min_samples_leaf/minimum number of records in a leaf;
:lt_PAL_PARAMETER_TBL.INSERT(('MAX_DEPTH', 55, NULL, NULL),9); -- The maximum depth of each tree;
:lt_PAL_PARAMETER_TBL.INSERT(('SPLIT_THRESHOLD', NULL, 0.0000001, NULL),10); -- If the improvement value of the best split is less than this value, the tree stops growing;
:lt_PAL_PARAMETER_TBL.INSERT(('CALCULATE_OOB', 1, NULL, NULL),11); --Indicates whether to calculate out-of-bag error;
--A possible setting for stratified sampling;
:lt_PAL_PARAMETER_TBL.INSERT(('SAMPLE_FRACTION', NULL, 1 , NULL),12);--The fraction of data used for training;
:lt_PAL_PARAMETER_TBL.INSERT(('STRATA', NULL, 0.05 , '0'),13); --The class label and its proportion that this class occupies in the sampling data.;
:lt_PAL_PARAMETER_TBL.INSERT(('STRATA', NULL, 0.95 , '1'),14);
-- A possible setting for prior probabilities for classification;
:lt_PAL_PARAMETER_TBL.INSERT(('PRIORS', NULL, 0.05 , '1'),15); -- The class label its prior probability in the data;
:lt_PAL_PARAMETER_TBL.INSERT(('PRIORS', NULL, 0.95 , '0'),16);
/* STEP3.2 Run the RandomDecisionTrees Algorithm and Populating the Parameter Table */
CALL _SYS_AFL.PAL_RANDOM_DECISION_TREES (:lt_traindata, :lt_PAL_PARAMETER_TBL, :lt_PAL_RDT_MODEL_TBL, :lt_P4, :lt_P5, :lt_P6) ;
select * from :lt_P4; --VAR IMPORTANCE;
select * from :lt_P5; --OUT_OF_BAG_ERROR ;
select * from :lt_P6; --confusion matrix for the traindata;
select * from :lt_PAL_RDT_MODEL_TBL;
/*** STEP4 - DEBRIEF and Evaluate **********************************/
/* Step4.1 Predict with model on test data */
:lt_PAL_PARAMETER_TBL.DELETE();
:lt_PAL_PARAMETER_TBL.INSERT(('THREAD_RATIO', NULL, 0.5, NULL),1);
:lt_PAL_PARAMETER_TBL.INSERT(('VERBOSE',0, NULL, NULL),2);
:lt_PAL_PARAMETER_TBL.INSERT(('HAS_ID',1, NULL, NULL),3);
CALL _SYS_AFL.PAL_RANDOM_DECISION_TREES_PREDICT (:lt_testdata_PRED, :lt_PAL_RDT_MODEL_TBL, :lt_PAL_PARAMETER_TBL, :lt_PAL_PREDICT_RESULT) ;
--Select * from :lt_PAL_PREDICT_RESULT;
/* Step4.2 Calculate AUC-ROC */
-- AUC-ROC Calculation;
lt_PAL_AUC_testdata=
select O."ID" as "ID", O."Number_of_mobile_home_policies_num" as "ORIGINAL_LABEL",
CASE
WHEN P."SCORE" = '1' Then P."CONFIDENCE"
ELSE 1-P."CONFIDENCE" END
as "PROBABILITY"
from :lt_testdata as O , :lt_PAL_PREDICT_RESULT as P
where O."ID"=P."ID";
--Select * from :lt_PAL_AUC_traindata;
:lt_PAL_PARAMETER_TBL.DELETE();
:lt_PAL_PARAMETER_TBL.INSERT(('POSITIVE_LABEL', NULL, NULL, '1'),1);
--Select * from :lt_PAL_PARAMETER_TBL;
CALL _SYS_AFL.PAL_AUC(:lt_PAL_AUC_testdata,:lt_PAL_PARAMETER_TBL,:lt_PAL_AUC_OUT_AUCstats , :lt_PAL_AUC_OUT_ROCdata);
select 'Test-data AUC' as "NOTE", * from :lt_PAL_AUC_OUT_AUCstats ;
--select * from :lt_PAL_AUC_OUT_ROCdata ;
/* Step4.2 Calculate the confusion matrix and statistics on the test data */
lt_PAL_CF_testdata= SELECT O.ID, O."Number_of_mobile_home_policies_num" as ORIGINAL_LABEL, P."SCORE" as PREDICTED_LABEL
from :lt_testdata as O , :lt_PAL_PREDICT_RESULT as P
where O."ID"=P."ID";
:lt_PAL_PARAMETER_TBL.DELETE();
:lt_PAL_PARAMETER_TBL.INSERT(('BETA',NULL,1,null),1); --F-BETA value;
CALL _SYS_AFL.PAL_CONFUSION_MATRIX(:lt_PAL_CF_testdata ,:lt_PAL_PARAMETER_TBL,:lt_PAL_CF_MATRIX,:lt_PAL_CF_CLASSREPORT);
select 'Test-data CF' as "NOTE", * from :lt_PAL_CF_MATRIX;
select * from :lt_PAL_CF_CLASSREPORT;
end;
/*** Inspect the last output, the confusion matrix statistics for the test data ***/
/*** and inspect the second last output, the confusion matrix ***/
/*** Out of 238 class '1' events, how many true positives could be predicted? ***/
/*********************************************************************************************************************************/
/*** Appendix ********************************************************************************************************************/
/*** SQL statements to create the "HANAML_SAMPLES"."INSURANCE_TRAIN" and "HANAML_SAMPLES"."INSURANCE_TRAIN" tables ***************/
/*** Note, both table have the same structure ************************************************************************************/
/*********************************************************************************************************************************/
/*
create column table ""HANAML_SAMPLES""."INSURANCE_TRAIN"(
"ID" INT null,
"Customer_Subtype" NVARCHAR (42) null,
"Number_of_houses" INT null,
"Avg_size_household" INT null,
"Avg_age" NVARCHAR (11) null,
"Customer_main_type" NVARCHAR (21) null,
"Roman_catholic" NVARCHAR (11) null,
"Protestant" INT null,
"Other_religion" INT null,
"No_religion" INT null,
"Married" INT null,
"Living_together" INT null,
"Other_relation" INT null,
"Singles" INT null,
"Household_without_children" INT null,
"Household_with_children" INT null,
"High_level_education" INT null,
"Medium_level_education" INT null,
"Lower_level_education" INT null,
"High_status" INT null,
"Entrepreneur" INT null,
"Farmer" INT null,
"Middle_management" INT null,
"Skilled_labourers" INT null,
"Unskilled_labourers" INT null,
"Social_class_A" INT null,
"Social_class_B1" INT null,
"Social_class_B2" INT null,
"Social_class_C" INT null,
"Social_class_D" INT null,
"Rented_house" INT null,
"Home_owners" INT null,
"One_car" INT null,
"Two_cars" INT null,
"No_car" INT null,
"National_Health_Service" INT null,
"Private_health_insurance" INT null,
"Income_LT_30000" INT null,
"Income_30_45000" INT null,
"Income_45_75000" INT null,
"Income_75_122000" INT null,
"Income_GT123000" INT null,
"Average_income" INT null,
"Purchasing_power_class" INT null,
"Contribution_private_third_party_insurance" NVARCHAR (11) null,
"Contribution_third_party_insurance_firms" INT null,
"Contribution_third_party_insurane_agriculture" INT null,
"Contribution_car_policies" INT null,
"Contribution_delivery_van_policies" INT null,
"Contribution_motorcycle_scooter_policies" INT null,
"Contribution_lorry_policies" INT null,
"Contribution_trailer_policies" INT null,
"Contribution_tractor_policies" INT null,
"Contribution_agricultural_machines_policies" INT null,
"Contribution_moped_policies" INT null,
"Contribution_life_insurances" INT null,
"Contribution_private_accident_insurance_policies" INT null,
"Contribution_family_accidents_insurance_policies" INT null,
"Contribution_disability_insurance_policies" INT null,
"Contribution_fire_policies" INT null,
"Contribution_surfboard_policies" INT null,
"Contribution_boat_policies" INT null,
"Contribution_bicycle_policies" INT null,
"Contribution_property_insurance_policies" INT null,
"Contribution_social_security_insurance_policies" INT null,
"Number_of_private_third_party_insurance" INT null,
"Number_of_third_party_insurance_firms" INT null,
"Number_of_third_party_insurane_agriculture" INT null,
"Number_of_car_policies" INT null,
"Number_of_delivery_van_policies" INT null,
"Number_of_motorcycle_scooter_policies" INT null,
"Number_of_lorry_policies" INT null,
"Number_of_trailer_policies" INT null,
"Number_of_tractor_policies" INT null,
"Number_of_agricultural_machines_policies" INT null,
"Number_of_moped_policies" INT null,
"Number_of_life_insurances" INT null,
"Number_of_private_accident_insurance_policies" INT null,
"Number_of_family_accidents_insurance_policies" INT null,
"Number_of_disability_insurance_policies" INT null,
"Number_of_fire_policies" INT null,
"Number_of_surfboard_policies" INT null,
"Number_of_boat_policies" INT null,
"Number_of_bicycle_policies" INT null,
"Number_of_property_insurance_policies" INT null,
"Number_of_social_security_insurance_policies" INT null,
"Number_of_mobile_home_policies_num" INT null );
*/ | the_stack |
create schema nodegroup_replication_test;
set current_schema = nodegroup_replication_test;
set enable_nodegroup_explain=true;
set expected_computing_nodegroup='group1';
create node group ng0 with (datanode1, datanode2, datanode3);
create node group ng1 with (datanode4, datanode5, datanode6);
create table t_row (c1 int, c2 int) distribute by hash(c1) to group ng1;
create table t1 (c1 int, c2 int) with (orientation = column, compression=middle) distribute by hash(c1) to group ng0;
create table t1_rep (c1 int, c2 int) with (orientation = column, compression=middle) distribute by replication to group ng0;
create table t2 (c1 int, c2 int) with (orientation = column, compression=middle) distribute by hash(c1) to group ng1;
create table t2_rep (c1 int, c2 int) with (orientation = column, compression=middle) distribute by replication to group ng1;
-- no distribute keys available
create table t2_rep_float (c1 float, c2 float) with (orientation = column, compression=middle) distribute by replication to group ng1;
insert into t_row select v,v from generate_series(1,10) as v;
insert into t1 select * from t_row;
insert into t1_rep select * from t1;
insert into t2 select * from t1;
insert into t2_rep select * from t2;
insert into t2_rep_float select * from t2;
analyze t_row;
analyze t1;
analyze t1_rep;
analyze t2;
analyze t2_rep;
analyze t2_rep_float;
set enable_mergejoin=off;
set enable_nestloop=off;
set enable_hashjoin=on;
-- replicate join replicate
set expected_computing_nodegroup = 'ng0';
explain (costs off) select * from t1_rep t1 join t1_rep t2 on t1.c1=t2.c1;
select * from t1_rep t1 join t1_rep t2 on t1.c1=t2.c1 order by 1,2,3,4 limit 5;
explain (costs off) select * from t2_rep t1 join t2_rep t2 on t1.c1=t2.c1;
select * from t1_rep t1 join t1_rep t2 on t1.c1=t2.c1 order by 1,2,3,4 limit 5;
explain (costs off) select * from t2_rep t1 join t1_rep t2 on t1.c1=t2.c1;
select * from t2_rep t1 join t1_rep t2 on t1.c1=t2.c1 order by 1,2,3,4 limit 5;
explain (costs off) select * from t2_rep_float t1 join t2_rep_float t2 on t1.c1=t2.c1;
select * from t2_rep_float t1 join t2_rep_float t2 on t1.c1=t2.c1 order by 1,2,3,4 limit 5;
explain (costs off) select * from t2_rep_float t1 join t2_rep t2 on t1.c1=t2.c1;
select * from t2_rep_float t1 join t2_rep t2 on t1.c1=t2.c1 order by 1,2,3,4 limit 5;
explain (costs off) select * from t2_rep_float t1 join t1_rep t2 on t1.c1=t2.c1;
select * from t2_rep_float t1 join t1_rep t2 on t1.c1=t2.c1 order by 1,2,3,4 limit 5;
explain (costs off) select * from t2_rep t1 where t1.c1 in (select c2 from t1_rep) order by 1,2 limit 5;
select * from t2_rep t1 where t1.c1 in (select c2 from t1_rep) order by 1,2 limit 5;
set expected_computing_nodegroup = 'ng1';
explain (costs off) select * from t2_rep_float t1 join t2_rep_float t2 on t1.c1=t2.c1;
select * from t2_rep_float t1 join t2_rep_float t2 on t1.c1=t2.c1 order by 1,2,3,4 limit 5;
explain (costs off) select * from t2_rep_float t1 join t2_rep t2 on t1.c1=t2.c1;
select * from t2_rep_float t1 join t2_rep t2 on t1.c1=t2.c1 order by 1,2,3,4 limit 5;
explain (costs off) select * from t2_rep_float t1 join t1_rep t2 on t1.c1=t2.c1;
select * from t2_rep_float t1 join t1_rep t2 on t1.c1=t2.c1 order by 1,2,3,4 limit 5;
explain (costs off) select * from t2_rep t1 where t1.c1 in (select c2 from t1_rep) order by 1,2 limit 5;
select * from t2_rep t1 where t1.c1 in (select c2 from t1_rep) order by 1,2 limit 5;
reset expected_computing_nodegroup;
explain (costs off) select * from t2_rep_float t1 join t2_rep_float t2 on t1.c1=t2.c1;
select * from t2_rep_float t1 join t2_rep_float t2 on t1.c1=t2.c1 order by 1,2,3,4 limit 5;
explain (costs off) select * from t2_rep_float t1 join t2_rep t2 on t1.c1=t2.c1;
select * from t2_rep_float t1 join t2_rep t2 on t1.c1=t2.c1 order by 1,2,3,4 limit 5;
explain (costs off) select * from t2_rep_float t1 join t1_rep t2 on t1.c1=t2.c1;
select * from t2_rep_float t1 join t1_rep t2 on t1.c1=t2.c1 order by 1,2,3,4 limit 5;
explain (costs off) select * from t2_rep t1 where t1.c1 in (select c2 from t1_rep) order by 1,2 limit 5;
select * from t2_rep t1 where t1.c1 in (select c2 from t1_rep) order by 1,2 limit 5;
-- replicate join hash
set expected_computing_nodegroup = 'ng0';
explain (costs off) select * from t1_rep t1 join t1 t2 on t1.c1=t2.c1;
select * from t1_rep t1 join t1 t2 on t1.c1=t2.c1 order by 1,2,3,4 limit 5;
explain (costs off) select * from t2_rep t1 join t1 t2 on t1.c1=t2.c1;
select * from t2_rep t1 join t1 t2 on t1.c1=t2.c1 order by 1,2,3,4 limit 5;
explain (costs off) select * from t2_rep_float t1 join t1 t2 on t1.c1=t2.c1;
select * from t2_rep_float t1 join t1 t2 on t1.c1=t2.c1 order by 1,2,3,4 limit 5;
explain (costs off) select * from t1_rep t1 join t2 t2 on t1.c1=t2.c1;
select * from t1_rep t1 join t2 t2 on t1.c1=t2.c1 order by 1,2,3,4 limit 5;
explain (costs off) select * from t2_rep t1 join t2 t2 on t1.c1=t2.c1;
select * from t2_rep t1 join t2 t2 on t1.c1=t2.c1 order by 1,2,3,4 limit 5;
explain (costs off) select * from t2_rep_float t1 join t2 t2 on t1.c1=t2.c1;
select * from t2_rep_float t1 join t2 t2 on t1.c1=t2.c1 order by 1,2,3,4 limit 5;
explain (costs off) select * from t2_rep t1 where t1.c1 in (select c2 from t1) order by 1,2 limit 5;
select * from t2_rep t1 where t1.c1 in (select c2 from t1) order by 1,2 limit 5;
reset expected_computing_nodegroup;
explain (costs off) select * from t1_rep t1 join t1 t2 on t1.c1=t2.c1;
select * from t1_rep t1 join t1 t2 on t1.c1=t2.c1 order by 1,2,3,4 limit 5;
explain (costs off) select * from t2_rep t1 join t1 t2 on t1.c1=t2.c1;
select * from t2_rep t1 join t1 t2 on t1.c1=t2.c1 order by 1,2,3,4 limit 5;
explain (costs off) select * from t2_rep_float t1 join t1 t2 on t1.c1=t2.c1;
select * from t2_rep_float t1 join t1 t2 on t1.c1=t2.c1 order by 1,2,3,4 limit 5;
explain (costs off) select * from t1_rep t1 join t2 t2 on t1.c1=t2.c1;
select * from t1_rep t1 join t2 t2 on t1.c1=t2.c1 order by 1,2,3,4 limit 5;
explain (costs off) select * from t2_rep t1 join t2 t2 on t1.c1=t2.c1;
select * from t2_rep t1 join t2 t2 on t1.c1=t2.c1 order by 1,2,3,4 limit 5;
explain (costs off) select * from t2_rep_float t1 join t2 t2 on t1.c1=t2.c1;
select * from t2_rep_float t1 join t2 t2 on t1.c1=t2.c1 order by 1,2,3,4 limit 5;
explain (costs off) select * from t2_rep t1 where t1.c1 in (select c2 from t1) order by 1,2 limit 5;
select * from t2_rep t1 where t1.c1 in (select c2 from t1) order by 1,2 limit 5;
set enable_nestloop=off;
set enable_hashjoin=off;
set enable_mergejoin=on;
-- replicate join replicate
set expected_computing_nodegroup = 'ng0';
explain (costs off) select * from t1_rep t1 join t1_rep t2 on t1.c1=t2.c1;
select * from t1_rep t1 join t1_rep t2 on t1.c1=t2.c1 order by 1,2,3,4 limit 5;
explain (costs off) select * from t2_rep t1 join t2_rep t2 on t1.c1=t2.c1;
select * from t1_rep t1 join t1_rep t2 on t1.c1=t2.c1 order by 1,2,3,4 limit 5;
explain (costs off) select * from t2_rep t1 join t1_rep t2 on t1.c1=t2.c1;
select * from t2_rep t1 join t1_rep t2 on t1.c1=t2.c1 order by 1,2,3,4 limit 5;
explain (costs off) select * from t2_rep_float t1 join t2_rep_float t2 on t1.c1=t2.c1;
select * from t2_rep_float t1 join t2_rep_float t2 on t1.c1=t2.c1 order by 1,2,3,4 limit 5;
explain (costs off) select * from t2_rep_float t1 join t2_rep t2 on t1.c1=t2.c1;
select * from t2_rep_float t1 join t2_rep t2 on t1.c1=t2.c1 order by 1,2,3,4 limit 5;
explain (costs off) select * from t2_rep_float t1 join t1_rep t2 on t1.c1=t2.c1;
select * from t2_rep_float t1 join t1_rep t2 on t1.c1=t2.c1 order by 1,2,3,4 limit 5;
explain (costs off) select * from t2_rep t1 where t1.c1 in (select c2 from t1_rep) order by 1,2 limit 5;
select * from t2_rep t1 where t1.c1 in (select c2 from t1_rep) order by 1,2 limit 5;
set expected_computing_nodegroup = 'ng1';
explain (costs off) select * from t2_rep_float t1 join t2_rep_float t2 on t1.c1=t2.c1;
select * from t2_rep_float t1 join t2_rep_float t2 on t1.c1=t2.c1 order by 1,2,3,4 limit 5;
explain (costs off) select * from t2_rep_float t1 join t2_rep t2 on t1.c1=t2.c1;
select * from t2_rep_float t1 join t2_rep t2 on t1.c1=t2.c1 order by 1,2,3,4 limit 5;
explain (costs off) select * from t2_rep_float t1 join t1_rep t2 on t1.c1=t2.c1;
select * from t2_rep_float t1 join t1_rep t2 on t1.c1=t2.c1 order by 1,2,3,4 limit 5;
explain (costs off) select * from t2_rep t1 where t1.c1 in (select c2 from t1_rep) order by 1,2 limit 5;
select * from t2_rep t1 where t1.c1 in (select c2 from t1_rep) order by 1,2 limit 5;
reset expected_computing_nodegroup;
explain (costs off) select * from t2_rep_float t1 join t2_rep_float t2 on t1.c1=t2.c1;
select * from t2_rep_float t1 join t2_rep_float t2 on t1.c1=t2.c1 order by 1,2,3,4 limit 5;
explain (costs off) select * from t2_rep_float t1 join t2_rep t2 on t1.c1=t2.c1;
select * from t2_rep_float t1 join t2_rep t2 on t1.c1=t2.c1 order by 1,2,3,4 limit 5;
explain (costs off) select * from t2_rep_float t1 join t1_rep t2 on t1.c1=t2.c1;
select * from t2_rep_float t1 join t1_rep t2 on t1.c1=t2.c1 order by 1,2,3,4 limit 5;
explain (costs off) select * from t2_rep t1 where t1.c1 in (select c2 from t1_rep) order by 1,2 limit 5;
select * from t2_rep t1 where t1.c1 in (select c2 from t1_rep) order by 1,2 limit 5;
-- replicate join hash
set expected_computing_nodegroup = 'ng0';
explain (costs off) select * from t1_rep t1 join t1 t2 on t1.c1=t2.c1;
select * from t1_rep t1 join t1 t2 on t1.c1=t2.c1 order by 1,2,3,4 limit 5;
explain (costs off) select * from t2_rep t1 join t1 t2 on t1.c1=t2.c1;
select * from t2_rep t1 join t1 t2 on t1.c1=t2.c1 order by 1,2,3,4 limit 5;
explain (costs off) select * from t2_rep_float t1 join t1 t2 on t1.c1=t2.c1;
select * from t2_rep_float t1 join t1 t2 on t1.c1=t2.c1 order by 1,2,3,4 limit 5;
explain (costs off) select * from t1_rep t1 join t2 t2 on t1.c1=t2.c1;
select * from t1_rep t1 join t2 t2 on t1.c1=t2.c1 order by 1,2,3,4 limit 5;
explain (costs off) select * from t2_rep t1 join t2 t2 on t1.c1=t2.c1;
select * from t2_rep t1 join t2 t2 on t1.c1=t2.c1 order by 1,2,3,4 limit 5;
explain (costs off) select * from t2_rep_float t1 join t2 t2 on t1.c1=t2.c1;
select * from t2_rep_float t1 join t2 t2 on t1.c1=t2.c1 order by 1,2,3,4 limit 5;
explain (costs off) select * from t2_rep t1 where t1.c1 in (select c2 from t1) order by 1,2 limit 5;
select * from t2_rep t1 where t1.c1 in (select c2 from t1) order by 1,2 limit 5;
reset expected_computing_nodegroup;
explain (costs off) select * from t1_rep t1 join t1 t2 on t1.c1=t2.c1;
select * from t1_rep t1 join t1 t2 on t1.c1=t2.c1 order by 1,2,3,4 limit 5;
explain (costs off) select * from t2_rep t1 join t1 t2 on t1.c1=t2.c1;
select * from t2_rep t1 join t1 t2 on t1.c1=t2.c1 order by 1,2,3,4 limit 5;
explain (costs off) select * from t2_rep_float t1 join t1 t2 on t1.c1=t2.c1;
select * from t2_rep_float t1 join t1 t2 on t1.c1=t2.c1 order by 1,2,3,4 limit 5;
explain (costs off) select * from t1_rep t1 join t2 t2 on t1.c1=t2.c1;
select * from t1_rep t1 join t2 t2 on t1.c1=t2.c1 order by 1,2,3,4 limit 5;
explain (costs off) select * from t2_rep t1 join t2 t2 on t1.c1=t2.c1;
select * from t2_rep t1 join t2 t2 on t1.c1=t2.c1 order by 1,2,3,4 limit 5;
explain (costs off) select * from t2_rep_float t1 join t2 t2 on t1.c1=t2.c1;
select * from t2_rep_float t1 join t2 t2 on t1.c1=t2.c1 order by 1,2,3,4 limit 5;
explain (costs off) select * from t2_rep t1 where t1.c1 in (select c2 from t1) order by 1,2 limit 5;
select * from t2_rep t1 where t1.c1 in (select c2 from t1) order by 1,2 limit 5;
set enable_hashjoin=off;
set enable_mergejoin=off;
set enable_nestloop=on;
-- replicate join replicate
set expected_computing_nodegroup = 'ng0';
explain (costs off) select * from t1_rep t1 join t1_rep t2 on t1.c1=t2.c1;
select * from t1_rep t1 join t1_rep t2 on t1.c1=t2.c1 order by 1,2,3,4 limit 5;
explain (costs off) select * from t2_rep t1 join t2_rep t2 on t1.c1=t2.c1;
select * from t1_rep t1 join t1_rep t2 on t1.c1=t2.c1 order by 1,2,3,4 limit 5;
explain (costs off) select * from t2_rep t1 join t1_rep t2 on t1.c1=t2.c1;
select * from t2_rep t1 join t1_rep t2 on t1.c1=t2.c1 order by 1,2,3,4 limit 5;
explain (costs off) select * from t2_rep_float t1 join t2_rep_float t2 on t1.c1=t2.c1;
select * from t2_rep_float t1 join t2_rep_float t2 on t1.c1=t2.c1 order by 1,2,3,4 limit 5;
explain (costs off) select * from t2_rep_float t1 join t2_rep t2 on t1.c1=t2.c1;
select * from t2_rep_float t1 join t2_rep t2 on t1.c1=t2.c1 order by 1,2,3,4 limit 5;
explain (costs off) select * from t2_rep_float t1 join t1_rep t2 on t1.c1=t2.c1;
select * from t2_rep_float t1 join t1_rep t2 on t1.c1=t2.c1 order by 1,2,3,4 limit 5;
explain (costs off) select * from t2_rep t1 where t1.c1 in (select c2 from t1_rep) order by 1,2 limit 5;
select * from t2_rep t1 where t1.c1 in (select c2 from t1_rep) order by 1,2 limit 5;
set expected_computing_nodegroup = 'ng1';
explain (costs off) select * from t2_rep_float t1 join t2_rep_float t2 on t1.c1=t2.c1;
select * from t2_rep_float t1 join t2_rep_float t2 on t1.c1=t2.c1 order by 1,2,3,4 limit 5;
explain (costs off) select * from t2_rep_float t1 join t2_rep t2 on t1.c1=t2.c1;
select * from t2_rep_float t1 join t2_rep t2 on t1.c1=t2.c1 order by 1,2,3,4 limit 5;
explain (costs off) select * from t2_rep_float t1 join t1_rep t2 on t1.c1=t2.c1;
select * from t2_rep_float t1 join t1_rep t2 on t1.c1=t2.c1 order by 1,2,3,4 limit 5;
explain (costs off) select * from t2_rep t1 where t1.c1 in (select c2 from t1_rep) order by 1,2 limit 5;
select * from t2_rep t1 where t1.c1 in (select c2 from t1_rep) order by 1,2 limit 5;
reset expected_computing_nodegroup;
explain (costs off) select * from t2_rep_float t1 join t2_rep_float t2 on t1.c1=t2.c1;
select * from t2_rep_float t1 join t2_rep_float t2 on t1.c1=t2.c1 order by 1,2,3,4 limit 5;
explain (costs off) select * from t2_rep_float t1 join t2_rep t2 on t1.c1=t2.c1;
select * from t2_rep_float t1 join t2_rep t2 on t1.c1=t2.c1 order by 1,2,3,4 limit 5;
explain (costs off) select * from t2_rep_float t1 join t1_rep t2 on t1.c1=t2.c1;
select * from t2_rep_float t1 join t1_rep t2 on t1.c1=t2.c1 order by 1,2,3,4 limit 5;
explain (costs off) select * from t2_rep t1 where t1.c1 in (select c2 from t1_rep) order by 1,2 limit 5;
select * from t2_rep t1 where t1.c1 in (select c2 from t1_rep) order by 1,2 limit 5;
-- replicate join hash
set expected_computing_nodegroup = 'ng0';
explain (costs off) select * from t1_rep t1 join t1 t2 on t1.c1=t2.c1;
select * from t1_rep t1 join t1 t2 on t1.c1=t2.c1 order by 1,2,3,4 limit 5;
explain (costs off) select * from t2_rep t1 join t1 t2 on t1.c1=t2.c1;
select * from t2_rep t1 join t1 t2 on t1.c1=t2.c1 order by 1,2,3,4 limit 5;
explain (costs off) select * from t2_rep_float t1 join t1 t2 on t1.c1=t2.c1;
select * from t2_rep_float t1 join t1 t2 on t1.c1=t2.c1 order by 1,2,3,4 limit 5;
explain (costs off) select * from t1_rep t1 join t2 t2 on t1.c1=t2.c1;
select * from t1_rep t1 join t2 t2 on t1.c1=t2.c1 order by 1,2,3,4 limit 5;
explain (costs off) select * from t2_rep t1 join t2 t2 on t1.c1=t2.c1;
select * from t2_rep t1 join t2 t2 on t1.c1=t2.c1 order by 1,2,3,4 limit 5;
explain (costs off) select * from t2_rep_float t1 join t2 t2 on t1.c1=t2.c1;
select * from t2_rep_float t1 join t2 t2 on t1.c1=t2.c1 order by 1,2,3,4 limit 5;
explain (costs off) select * from t2_rep t1 where t1.c1 in (select c2 from t1) order by 1,2 limit 5;
select * from t2_rep t1 where t1.c1 in (select c2 from t1) order by 1,2 limit 5;
reset expected_computing_nodegroup;
explain (costs off) select * from t1_rep t1 join t1 t2 on t1.c1=t2.c1;
select * from t1_rep t1 join t1 t2 on t1.c1=t2.c1 order by 1,2,3,4 limit 5;
explain (costs off) select * from t2_rep t1 join t1 t2 on t1.c1=t2.c1;
select * from t2_rep t1 join t1 t2 on t1.c1=t2.c1 order by 1,2,3,4 limit 5;
explain (costs off) select * from t2_rep_float t1 join t1 t2 on t1.c1=t2.c1;
select * from t2_rep_float t1 join t1 t2 on t1.c1=t2.c1 order by 1,2,3,4 limit 5;
explain (costs off) select * from t1_rep t1 join t2 t2 on t1.c1=t2.c1;
select * from t1_rep t1 join t2 t2 on t1.c1=t2.c1 order by 1,2,3,4 limit 5;
explain (costs off) select * from t2_rep t1 join t2 t2 on t1.c1=t2.c1;
select * from t2_rep t1 join t2 t2 on t1.c1=t2.c1 order by 1,2,3,4 limit 5;
explain (costs off) select * from t2_rep_float t1 join t2 t2 on t1.c1=t2.c1;
select * from t2_rep_float t1 join t2 t2 on t1.c1=t2.c1 order by 1,2,3,4 limit 5;
explain (costs off) select * from t2_rep t1 where t1.c1 in (select c2 from t1) order by 1,2 limit 5;
select * from t2_rep t1 where t1.c1 in (select c2 from t1) order by 1,2 limit 5;
drop table t_row;
drop table t1;
drop table t2;
drop table t1_rep;
drop table t2_rep;
drop table t2_rep_float;
reset expected_computing_nodegroup;
drop node group ng0;
drop node group ng1;
drop schema nodegroup_replication_test cascade; | the_stack |
-- 2020-04-05T11:02:42.780Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_Window (AD_Client_ID,AD_Element_ID,AD_Org_ID,AD_Window_ID,Created,CreatedBy,EntityType,IsActive,IsBetaFunctionality,IsDefault,IsEnableRemoteCacheInvalidation,IsOneInstanceOnly,IsSOTrx,Name,Processing,Updated,UpdatedBy,WindowType,WinHeight,WinWidth) VALUES (0,543226,0,540900,TO_TIMESTAMP('2020-04-05 14:02:42','YYYY-MM-DD HH24:MI:SS'),100,'D','Y','N','N','N','N','Y','Product Cost','N',TO_TIMESTAMP('2020-04-05 14:02:42','YYYY-MM-DD HH24:MI:SS'),100,'M',0,0)
;
-- 2020-04-05T11:02:42.806Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_Window_Trl (AD_Language,AD_Window_ID, Description,Help,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language, t.AD_Window_ID, t.Description,t.Help,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Window t WHERE l.IsActive='Y'AND (l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N') AND t.AD_Window_ID=540900 AND NOT EXISTS (SELECT 1 FROM AD_Window_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Window_ID=t.AD_Window_ID)
;
-- 2020-04-05T11:02:42.812Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
/* DDL */ select update_window_translation_from_ad_element(543226)
;
-- 2020-04-05T11:02:42.815Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
DELETE FROM AD_Element_Link WHERE AD_Window_ID=540900
;
-- 2020-04-05T11:02:42.822Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
/* DDL */ select AD_Element_Link_Create_Missing_Window(540900)
;
-- 2020-04-05T11:06:52.522Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_Tab (AD_Client_ID,AD_Element_ID,AD_Org_ID,AD_Tab_ID,AD_Table_ID,AD_Window_ID,AllowQuickInput,Created,CreatedBy,EntityType,HasTree,ImportFields,InternalName,IsActive,IsAdvancedTab,IsCheckParentsChanged,IsGenericZoomTarget,IsGridModeOnly,IsInfoTab,IsInsertRecord,IsQueryOnLoad,IsReadOnly,IsRefreshAllOnActivate,IsRefreshViewOnChangeEvents,IsSearchActive,IsSearchCollapsed,IsSingleRow,IsSortTab,IsTranslationTab,MaxQueryRecords,Name,Processing,SeqNo,TabLevel,Template_Tab_ID,Updated,UpdatedBy) VALUES (0,543226,0,542374,771,540900,'Y',TO_TIMESTAMP('2020-04-05 14:06:52','YYYY-MM-DD HH24:MI:SS'),100,'D','N','N','M_Cost','Y','N','Y','N','N','N','Y','Y','N','N','N','Y','Y','N','N','N',0,'Product Cost','N',10,0,701,TO_TIMESTAMP('2020-04-05 14:06:52','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 2020-04-05T11:06:52.533Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_Tab_Trl (AD_Language,AD_Tab_ID, CommitWarning,Description,Help,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language, t.AD_Tab_ID, t.CommitWarning,t.Description,t.Help,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Tab t WHERE l.IsActive='Y'AND (l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N') AND t.AD_Tab_ID=542374 AND NOT EXISTS (SELECT 1 FROM AD_Tab_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Tab_ID=t.AD_Tab_ID)
;
-- 2020-04-05T11:06:52.540Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
/* DDL */ select update_tab_translation_from_ad_element(543226)
;
-- 2020-04-05T11:06:52.544Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
/* DDL */ select AD_Element_Link_Create_Missing_Tab(542374)
;
-- 2020-04-05T11:07:32.675Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Element_Trl SET IsTranslated='Y', Name='Produktkosten', PrintName='Produktkosten',Updated=TO_TIMESTAMP('2020-04-05 14:07:32','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=543226 AND AD_Language='de_CH'
;
-- 2020-04-05T11:07:32.698Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
/* DDL */ select update_TRL_Tables_On_AD_Element_TRL_Update(543226,'de_CH')
;
-- 2020-04-05T11:07:44.261Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Element_Trl SET IsTranslated='Y', Name='Current Product Costs', PrintName='Current Product Costs',Updated=TO_TIMESTAMP('2020-04-05 14:07:44','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=543226 AND AD_Language='en_US'
;
-- 2020-04-05T11:07:44.264Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
/* DDL */ select update_TRL_Tables_On_AD_Element_TRL_Update(543226,'en_US')
;
-- 2020-04-05T11:09:32.547Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Element_Trl SET IsTranslated='Y', Name='Produkt aktuelle Kosten', PrintName='Produkt aktuelle Kosten',Updated=TO_TIMESTAMP('2020-04-05 14:09:32','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=543226 AND AD_Language='de_DE'
;
-- 2020-04-05T11:09:32.553Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
/* DDL */ select update_TRL_Tables_On_AD_Element_TRL_Update(543226,'de_DE')
;
-- 2020-04-05T11:09:32.629Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
/* DDL */ select update_ad_element_on_ad_element_trl_update(543226,'de_DE')
;
-- 2020-04-05T11:09:32.633Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Column SET ColumnName='M_Cost_ID', Name='Produkt aktuelle Kosten', Description=NULL, Help=NULL WHERE AD_Element_ID=543226
;
-- 2020-04-05T11:09:32.636Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Process_Para SET ColumnName='M_Cost_ID', Name='Produkt aktuelle Kosten', Description=NULL, Help=NULL, AD_Element_ID=543226 WHERE UPPER(ColumnName)='M_COST_ID' AND IsCentrallyMaintained='Y' AND AD_Element_ID IS NULL
;
-- 2020-04-05T11:09:32.639Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Process_Para SET ColumnName='M_Cost_ID', Name='Produkt aktuelle Kosten', Description=NULL, Help=NULL WHERE AD_Element_ID=543226 AND IsCentrallyMaintained='Y'
;
-- 2020-04-05T11:09:32.639Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Field SET Name='Produkt aktuelle Kosten', Description=NULL, Help=NULL WHERE (AD_Column_ID IN (SELECT AD_Column_ID FROM AD_Column WHERE AD_Element_ID=543226) AND AD_Name_ID IS NULL ) OR (AD_Name_ID = 543226)
;
-- 2020-04-05T11:09:32.660Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_PrintFormatItem pi SET PrintName='Produkt aktuelle Kosten', Name='Produkt aktuelle Kosten' WHERE IsCentrallyMaintained='Y' AND EXISTS (SELECT * FROM AD_Column c WHERE c.AD_Column_ID=pi.AD_Column_ID AND c.AD_Element_ID=543226)
;
-- 2020-04-05T11:09:32.661Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Tab SET Name='Produkt aktuelle Kosten', Description=NULL, Help=NULL, CommitWarning = NULL WHERE AD_Element_ID = 543226
;
-- 2020-04-05T11:09:32.663Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_WINDOW SET Name='Produkt aktuelle Kosten', Description=NULL, Help=NULL WHERE AD_Element_ID = 543226
;
-- 2020-04-05T11:09:32.665Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Menu SET Name = 'Produkt aktuelle Kosten', Description = NULL, WEBUI_NameBrowse = NULL, WEBUI_NameNew = NULL, WEBUI_NameNewBreadcrumb = NULL WHERE AD_Element_ID = 543226
;
-- 2020-04-05T11:09:48.066Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Element_Trl SET Name='Produkt aktuelle Kosten', PrintName='Produkt aktuelle Kosten',Updated=TO_TIMESTAMP('2020-04-05 14:09:48','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=543226 AND AD_Language='de_CH'
;
-- 2020-04-05T11:09:48.068Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
/* DDL */ select update_TRL_Tables_On_AD_Element_TRL_Update(543226,'de_CH')
;
-- 2020-04-05T11:10:51.972Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Tab SET AD_Element_ID=543226, CommitWarning=NULL, Description=NULL, Help=NULL, Name='Produkt aktuelle Kosten',Updated=TO_TIMESTAMP('2020-04-05 14:10:51','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=701
;
-- 2020-04-05T11:10:51.986Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
/* DDL */ select update_tab_translation_from_ad_element(543226)
;
-- 2020-04-05T11:10:51.993Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
/* DDL */ select AD_Element_Link_Create_Missing_Tab(701)
;
-- 2020-04-05T11:11:05.790Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
DELETE FROM AD_Element_Trl WHERE AD_Element_ID=573250
;
-- 2020-04-05T11:11:05.819Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
DELETE FROM AD_Element WHERE AD_Element_ID=573250
;
-- 2020-04-05T11:12:20.871Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_Menu (Action,AD_Client_ID,AD_Element_ID,AD_Menu_ID,AD_Org_ID,AD_Window_ID,Created,CreatedBy,EntityType,InternalName,IsActive,IsCreateNew,IsReadOnly,IsSOTrx,IsSummary,Name,Updated,UpdatedBy) VALUES ('W',0,543226,541455,0,540900,TO_TIMESTAMP('2020-04-05 14:12:20','YYYY-MM-DD HH24:MI:SS'),100,'D','productCosts','Y','N','N','N','N','Produkt aktuelle Kosten',TO_TIMESTAMP('2020-04-05 14:12:20','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 2020-04-05T11:12:20.885Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_Menu_Trl (AD_Language,AD_Menu_ID, Description,Name,WEBUI_NameBrowse,WEBUI_NameNew,WEBUI_NameNewBreadcrumb, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language, t.AD_Menu_ID, t.Description,t.Name,t.WEBUI_NameBrowse,t.WEBUI_NameNew,t.WEBUI_NameNewBreadcrumb, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Menu t WHERE l.IsActive='Y'AND (l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N') AND t.AD_Menu_ID=541455 AND NOT EXISTS (SELECT 1 FROM AD_Menu_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Menu_ID=t.AD_Menu_ID)
;
-- 2020-04-05T11:12:20.900Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_TreeNodeMM (AD_Client_ID,AD_Org_ID, IsActive,Created,CreatedBy,Updated,UpdatedBy, AD_Tree_ID, Node_ID, Parent_ID, SeqNo) SELECT t.AD_Client_ID,0, 'Y', now(), 100, now(), 100,t.AD_Tree_ID, 541455, 0, 999 FROM AD_Tree t WHERE t.AD_Client_ID=0 AND t.IsActive='Y' AND t.IsAllNodes='Y' AND t.AD_Table_ID=116 AND NOT EXISTS (SELECT * FROM AD_TreeNodeMM e WHERE e.AD_Tree_ID=t.AD_Tree_ID AND Node_ID=541455)
;
-- 2020-04-05T11:12:20.912Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
/* DDL */ select update_menu_translation_from_ad_element(543226)
;
-- 2020-04-05T11:12:21.563Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_TreeNodeMM SET Parent_ID=522, SeqNo=0, Updated=now(), UpdatedBy=100 WHERE Node_ID=370 AND AD_Tree_ID=10
;
-- 2020-04-05T11:12:21.564Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_TreeNodeMM SET Parent_ID=522, SeqNo=1, Updated=now(), UpdatedBy=100 WHERE Node_ID=521 AND AD_Tree_ID=10
;
-- 2020-04-05T11:12:21.565Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_TreeNodeMM SET Parent_ID=522, SeqNo=2, Updated=now(), UpdatedBy=100 WHERE Node_ID=520 AND AD_Tree_ID=10
;
-- 2020-04-05T11:12:21.566Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_TreeNodeMM SET Parent_ID=522, SeqNo=3, Updated=now(), UpdatedBy=100 WHERE Node_ID=541 AND AD_Tree_ID=10
;
-- 2020-04-05T11:12:21.567Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_TreeNodeMM SET Parent_ID=522, SeqNo=4, Updated=now(), UpdatedBy=100 WHERE Node_ID=540 AND AD_Tree_ID=10
;
-- 2020-04-05T11:12:21.569Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_TreeNodeMM SET Parent_ID=522, SeqNo=5, Updated=now(), UpdatedBy=100 WHERE Node_ID=542 AND AD_Tree_ID=10
;
-- 2020-04-05T11:12:21.570Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_TreeNodeMM SET Parent_ID=522, SeqNo=6, Updated=now(), UpdatedBy=100 WHERE Node_ID=541455 AND AD_Tree_ID=10
;
-- 2020-04-05T11:12:35.719Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_TreeNodeMM SET Parent_ID=1000015, SeqNo=0, Updated=now(), UpdatedBy=100 WHERE Node_ID=540905 AND AD_Tree_ID=10
;
-- 2020-04-05T11:12:35.724Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_TreeNodeMM SET Parent_ID=1000015, SeqNo=1, Updated=now(), UpdatedBy=100 WHERE Node_ID=540814 AND AD_Tree_ID=10
;
-- 2020-04-05T11:12:35.725Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_TreeNodeMM SET Parent_ID=1000015, SeqNo=2, Updated=now(), UpdatedBy=100 WHERE Node_ID=541297 AND AD_Tree_ID=10
;
-- 2020-04-05T11:12:35.727Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_TreeNodeMM SET Parent_ID=1000015, SeqNo=3, Updated=now(), UpdatedBy=100 WHERE Node_ID=540803 AND AD_Tree_ID=10
;
-- 2020-04-05T11:12:35.728Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_TreeNodeMM SET Parent_ID=1000015, SeqNo=4, Updated=now(), UpdatedBy=100 WHERE Node_ID=541377 AND AD_Tree_ID=10
;
-- 2020-04-05T11:12:35.729Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_TreeNodeMM SET Parent_ID=1000015, SeqNo=5, Updated=now(), UpdatedBy=100 WHERE Node_ID=540904 AND AD_Tree_ID=10
;
-- 2020-04-05T11:12:35.729Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_TreeNodeMM SET Parent_ID=1000015, SeqNo=6, Updated=now(), UpdatedBy=100 WHERE Node_ID=540749 AND AD_Tree_ID=10
;
-- 2020-04-05T11:12:35.730Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_TreeNodeMM SET Parent_ID=1000015, SeqNo=7, Updated=now(), UpdatedBy=100 WHERE Node_ID=540779 AND AD_Tree_ID=10
;
-- 2020-04-05T11:12:35.732Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_TreeNodeMM SET Parent_ID=1000015, SeqNo=8, Updated=now(), UpdatedBy=100 WHERE Node_ID=540910 AND AD_Tree_ID=10
;
-- 2020-04-05T11:12:35.732Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_TreeNodeMM SET Parent_ID=1000015, SeqNo=9, Updated=now(), UpdatedBy=100 WHERE Node_ID=541308 AND AD_Tree_ID=10
;
-- 2020-04-05T11:12:35.733Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_TreeNodeMM SET Parent_ID=1000015, SeqNo=10, Updated=now(), UpdatedBy=100 WHERE Node_ID=541313 AND AD_Tree_ID=10
;
-- 2020-04-05T11:12:35.733Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_TreeNodeMM SET Parent_ID=1000015, SeqNo=11, Updated=now(), UpdatedBy=100 WHERE Node_ID=540758 AND AD_Tree_ID=10
;
-- 2020-04-05T11:12:35.735Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_TreeNodeMM SET Parent_ID=1000015, SeqNo=12, Updated=now(), UpdatedBy=100 WHERE Node_ID=540759 AND AD_Tree_ID=10
;
-- 2020-04-05T11:12:35.736Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_TreeNodeMM SET Parent_ID=1000015, SeqNo=13, Updated=now(), UpdatedBy=100 WHERE Node_ID=540806 AND AD_Tree_ID=10
;
-- 2020-04-05T11:12:35.737Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_TreeNodeMM SET Parent_ID=1000015, SeqNo=14, Updated=now(), UpdatedBy=100 WHERE Node_ID=540891 AND AD_Tree_ID=10
;
-- 2020-04-05T11:12:35.737Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_TreeNodeMM SET Parent_ID=1000015, SeqNo=15, Updated=now(), UpdatedBy=100 WHERE Node_ID=540896 AND AD_Tree_ID=10
;
-- 2020-04-05T11:12:35.738Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_TreeNodeMM SET Parent_ID=1000015, SeqNo=16, Updated=now(), UpdatedBy=100 WHERE Node_ID=540903 AND AD_Tree_ID=10
;
-- 2020-04-05T11:12:35.739Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_TreeNodeMM SET Parent_ID=1000015, SeqNo=17, Updated=now(), UpdatedBy=100 WHERE Node_ID=541405 AND AD_Tree_ID=10
;
-- 2020-04-05T11:12:35.741Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_TreeNodeMM SET Parent_ID=1000015, SeqNo=18, Updated=now(), UpdatedBy=100 WHERE Node_ID=540906 AND AD_Tree_ID=10
;
-- 2020-04-05T11:12:35.741Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_TreeNodeMM SET Parent_ID=1000015, SeqNo=19, Updated=now(), UpdatedBy=100 WHERE Node_ID=541454 AND AD_Tree_ID=10
;
-- 2020-04-05T11:12:35.742Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_TreeNodeMM SET Parent_ID=1000015, SeqNo=20, Updated=now(), UpdatedBy=100 WHERE Node_ID=541455 AND AD_Tree_ID=10
;
-- 2020-04-05T11:12:35.743Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_TreeNodeMM SET Parent_ID=1000015, SeqNo=21, Updated=now(), UpdatedBy=100 WHERE Node_ID=540907 AND AD_Tree_ID=10
;
-- 2020-04-05T11:12:35.744Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_TreeNodeMM SET Parent_ID=1000015, SeqNo=22, Updated=now(), UpdatedBy=100 WHERE Node_ID=540908 AND AD_Tree_ID=10
;
-- 2020-04-05T11:12:35.744Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_TreeNodeMM SET Parent_ID=1000015, SeqNo=23, Updated=now(), UpdatedBy=100 WHERE Node_ID=541015 AND AD_Tree_ID=10
;
-- 2020-04-05T11:12:35.745Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_TreeNodeMM SET Parent_ID=1000015, SeqNo=24, Updated=now(), UpdatedBy=100 WHERE Node_ID=541016 AND AD_Tree_ID=10
;
-- 2020-04-05T11:12:35.746Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_TreeNodeMM SET Parent_ID=1000015, SeqNo=25, Updated=now(), UpdatedBy=100 WHERE Node_ID=541042 AND AD_Tree_ID=10
;
-- 2020-04-05T11:12:35.747Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_TreeNodeMM SET Parent_ID=1000015, SeqNo=26, Updated=now(), UpdatedBy=100 WHERE Node_ID=315 AND AD_Tree_ID=10
;
-- 2020-04-05T11:12:35.748Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_TreeNodeMM SET Parent_ID=1000015, SeqNo=27, Updated=now(), UpdatedBy=100 WHERE Node_ID=541368 AND AD_Tree_ID=10
;
-- 2020-04-05T11:12:35.748Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_TreeNodeMM SET Parent_ID=1000015, SeqNo=28, Updated=now(), UpdatedBy=100 WHERE Node_ID=541120 AND AD_Tree_ID=10
;
-- 2020-04-05T11:12:35.749Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_TreeNodeMM SET Parent_ID=1000015, SeqNo=29, Updated=now(), UpdatedBy=100 WHERE Node_ID=541125 AND AD_Tree_ID=10
;
-- 2020-04-05T11:12:35.749Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_TreeNodeMM SET Parent_ID=1000015, SeqNo=30, Updated=now(), UpdatedBy=100 WHERE Node_ID=1000056 AND AD_Tree_ID=10
;
-- 2020-04-05T11:12:35.750Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_TreeNodeMM SET Parent_ID=1000015, SeqNo=31, Updated=now(), UpdatedBy=100 WHERE Node_ID=541304 AND AD_Tree_ID=10
;
-- 2020-04-05T11:12:35.751Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_TreeNodeMM SET Parent_ID=1000015, SeqNo=32, Updated=now(), UpdatedBy=100 WHERE Node_ID=1000064 AND AD_Tree_ID=10
;
-- 2020-04-05T11:12:35.751Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_TreeNodeMM SET Parent_ID=1000015, SeqNo=33, Updated=now(), UpdatedBy=100 WHERE Node_ID=1000072 AND AD_Tree_ID=10
;
-- 2020-04-05T11:12:37.673Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_TreeNodeMM SET Parent_ID=1000015, SeqNo=0, Updated=now(), UpdatedBy=100 WHERE Node_ID=540905 AND AD_Tree_ID=10
;
-- 2020-04-05T11:12:37.674Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_TreeNodeMM SET Parent_ID=1000015, SeqNo=1, Updated=now(), UpdatedBy=100 WHERE Node_ID=540814 AND AD_Tree_ID=10
;
-- 2020-04-05T11:12:37.675Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_TreeNodeMM SET Parent_ID=1000015, SeqNo=2, Updated=now(), UpdatedBy=100 WHERE Node_ID=541297 AND AD_Tree_ID=10
;
-- 2020-04-05T11:12:37.677Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_TreeNodeMM SET Parent_ID=1000015, SeqNo=3, Updated=now(), UpdatedBy=100 WHERE Node_ID=540803 AND AD_Tree_ID=10
;
-- 2020-04-05T11:12:37.677Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_TreeNodeMM SET Parent_ID=1000015, SeqNo=4, Updated=now(), UpdatedBy=100 WHERE Node_ID=541377 AND AD_Tree_ID=10
;
-- 2020-04-05T11:12:37.679Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_TreeNodeMM SET Parent_ID=1000015, SeqNo=5, Updated=now(), UpdatedBy=100 WHERE Node_ID=540904 AND AD_Tree_ID=10
;
-- 2020-04-05T11:12:37.680Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_TreeNodeMM SET Parent_ID=1000015, SeqNo=6, Updated=now(), UpdatedBy=100 WHERE Node_ID=540749 AND AD_Tree_ID=10
;
-- 2020-04-05T11:12:37.680Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_TreeNodeMM SET Parent_ID=1000015, SeqNo=7, Updated=now(), UpdatedBy=100 WHERE Node_ID=540779 AND AD_Tree_ID=10
;
-- 2020-04-05T11:12:37.681Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_TreeNodeMM SET Parent_ID=1000015, SeqNo=8, Updated=now(), UpdatedBy=100 WHERE Node_ID=540910 AND AD_Tree_ID=10
;
-- 2020-04-05T11:12:37.682Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_TreeNodeMM SET Parent_ID=1000015, SeqNo=9, Updated=now(), UpdatedBy=100 WHERE Node_ID=541308 AND AD_Tree_ID=10
;
-- 2020-04-05T11:12:37.684Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_TreeNodeMM SET Parent_ID=1000015, SeqNo=10, Updated=now(), UpdatedBy=100 WHERE Node_ID=541313 AND AD_Tree_ID=10
;
-- 2020-04-05T11:12:37.685Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_TreeNodeMM SET Parent_ID=1000015, SeqNo=11, Updated=now(), UpdatedBy=100 WHERE Node_ID=540758 AND AD_Tree_ID=10
;
-- 2020-04-05T11:12:37.686Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_TreeNodeMM SET Parent_ID=1000015, SeqNo=12, Updated=now(), UpdatedBy=100 WHERE Node_ID=540759 AND AD_Tree_ID=10
;
-- 2020-04-05T11:12:37.687Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_TreeNodeMM SET Parent_ID=1000015, SeqNo=13, Updated=now(), UpdatedBy=100 WHERE Node_ID=540806 AND AD_Tree_ID=10
;
-- 2020-04-05T11:12:37.688Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_TreeNodeMM SET Parent_ID=1000015, SeqNo=14, Updated=now(), UpdatedBy=100 WHERE Node_ID=540891 AND AD_Tree_ID=10
;
-- 2020-04-05T11:12:37.689Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_TreeNodeMM SET Parent_ID=1000015, SeqNo=15, Updated=now(), UpdatedBy=100 WHERE Node_ID=540896 AND AD_Tree_ID=10
;
-- 2020-04-05T11:12:37.690Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_TreeNodeMM SET Parent_ID=1000015, SeqNo=16, Updated=now(), UpdatedBy=100 WHERE Node_ID=540903 AND AD_Tree_ID=10
;
-- 2020-04-05T11:12:37.691Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_TreeNodeMM SET Parent_ID=1000015, SeqNo=17, Updated=now(), UpdatedBy=100 WHERE Node_ID=541405 AND AD_Tree_ID=10
;
-- 2020-04-05T11:12:37.692Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_TreeNodeMM SET Parent_ID=1000015, SeqNo=18, Updated=now(), UpdatedBy=100 WHERE Node_ID=540906 AND AD_Tree_ID=10
;
-- 2020-04-05T11:12:37.693Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_TreeNodeMM SET Parent_ID=1000015, SeqNo=19, Updated=now(), UpdatedBy=100 WHERE Node_ID=541455 AND AD_Tree_ID=10
;
-- 2020-04-05T11:12:37.694Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_TreeNodeMM SET Parent_ID=1000015, SeqNo=20, Updated=now(), UpdatedBy=100 WHERE Node_ID=541454 AND AD_Tree_ID=10
;
-- 2020-04-05T11:12:37.695Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_TreeNodeMM SET Parent_ID=1000015, SeqNo=21, Updated=now(), UpdatedBy=100 WHERE Node_ID=540907 AND AD_Tree_ID=10
;
-- 2020-04-05T11:12:37.696Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_TreeNodeMM SET Parent_ID=1000015, SeqNo=22, Updated=now(), UpdatedBy=100 WHERE Node_ID=540908 AND AD_Tree_ID=10
;
-- 2020-04-05T11:12:37.697Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_TreeNodeMM SET Parent_ID=1000015, SeqNo=23, Updated=now(), UpdatedBy=100 WHERE Node_ID=541015 AND AD_Tree_ID=10
;
-- 2020-04-05T11:12:37.698Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_TreeNodeMM SET Parent_ID=1000015, SeqNo=24, Updated=now(), UpdatedBy=100 WHERE Node_ID=541016 AND AD_Tree_ID=10
;
-- 2020-04-05T11:12:37.700Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_TreeNodeMM SET Parent_ID=1000015, SeqNo=25, Updated=now(), UpdatedBy=100 WHERE Node_ID=541042 AND AD_Tree_ID=10
;
-- 2020-04-05T11:12:37.701Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_TreeNodeMM SET Parent_ID=1000015, SeqNo=26, Updated=now(), UpdatedBy=100 WHERE Node_ID=315 AND AD_Tree_ID=10
;
-- 2020-04-05T11:12:37.703Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_TreeNodeMM SET Parent_ID=1000015, SeqNo=27, Updated=now(), UpdatedBy=100 WHERE Node_ID=541368 AND AD_Tree_ID=10
;
-- 2020-04-05T11:12:37.704Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_TreeNodeMM SET Parent_ID=1000015, SeqNo=28, Updated=now(), UpdatedBy=100 WHERE Node_ID=541120 AND AD_Tree_ID=10
;
-- 2020-04-05T11:12:37.705Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_TreeNodeMM SET Parent_ID=1000015, SeqNo=29, Updated=now(), UpdatedBy=100 WHERE Node_ID=541125 AND AD_Tree_ID=10
;
-- 2020-04-05T11:12:37.706Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_TreeNodeMM SET Parent_ID=1000015, SeqNo=30, Updated=now(), UpdatedBy=100 WHERE Node_ID=1000056 AND AD_Tree_ID=10
;
-- 2020-04-05T11:12:37.708Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_TreeNodeMM SET Parent_ID=1000015, SeqNo=31, Updated=now(), UpdatedBy=100 WHERE Node_ID=541304 AND AD_Tree_ID=10
;
-- 2020-04-05T11:12:37.709Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_TreeNodeMM SET Parent_ID=1000015, SeqNo=32, Updated=now(), UpdatedBy=100 WHERE Node_ID=1000064 AND AD_Tree_ID=10
;
-- 2020-04-05T11:12:37.710Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_TreeNodeMM SET Parent_ID=1000015, SeqNo=33, Updated=now(), UpdatedBy=100 WHERE Node_ID=1000072 AND AD_Tree_ID=10
;
-- 2020-04-05T11:15:01.551Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Column SET IsSelectionColumn='Y', IsUpdateable='N', SelectionColumnSeqNo=10,Updated=TO_TIMESTAMP('2020-04-05 14:15:01','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=13469
;
-- 2020-04-05T11:15:01.575Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Column SET IsSelectionColumn='Y', IsUpdateable='N', SelectionColumnSeqNo=20,Updated=TO_TIMESTAMP('2020-04-05 14:15:01','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=13472
;
-- 2020-04-05T11:15:01.585Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Column SET IsSelectionColumn='Y', IsUpdateable='N', SelectionColumnSeqNo=30,Updated=TO_TIMESTAMP('2020-04-05 14:15:01','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=13470
;
-- 2020-04-05T11:15:01.597Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Column SET IsSelectionColumn='Y', IsUpdateable='N', SelectionColumnSeqNo=40,Updated=TO_TIMESTAMP('2020-04-05 14:15:01','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=13468
;
-- 2020-04-05T11:15:01.607Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Column SET IsSelectionColumn='Y', IsUpdateable='N', SelectionColumnSeqNo=50,Updated=TO_TIMESTAMP('2020-04-05 14:15:01','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=13471
; | the_stack |
-- Global setup for tests
CREATE DATABASE db1
GO
USE db1
GO
-- =============== OwnerId ===============
-- Setup
CREATE SCHEMA ownerid_schema
GO
CREATE TABLE ownerid_schema.ownerid_table(a int)
GO
-- Check for correct case
SELECT CASE
WHEN OBJECTPROPERTY(OBJECT_ID('ownerid_schema.ownerid_table'), 'OwnerId') = (SELECT principal_id
FROM sys.database_principals
WHERE name = CURRENT_USER)
Then 'SUCCESS'
ELSE
'FAILED'
END
GO
-- Check for system object. Should return 10 since that's the owner ID.
SELECT OBJECTPROPERTY(OBJECT_ID('sys.objects'), 'OwnerId')
GO
-- Invalid property ID (should return NULL)
SELECT OBJECTPROPERTY(0, 'OwnerId')
GO
-- Check for mix-cased property
SELECT OBJECTPROPERTY(OBJECT_ID('sys.objects'), 'oWnEriD')
GO
-- Check for trailing white spaces
SELECT OBJECTPROPERTY(OBJECT_ID('sys.objects'), 'OwnerId ')
GO
-- Check for trailing white spaces and mixed case
SELECT OBJECTPROPERTY(OBJECT_ID('sys.objects'), 'oWnEriD ')
GO
-- Cleanup
DROP TABLE ownerid_schema.ownerid_table
GO
DROP SCHEMA ownerid_schema
GO
-- =============== IsDefaultCnst ===============
-- Setup
CREATE TABLE isdefaultcnst_table(a int DEFAULT 10)
GO
CREATE TABLE isdefaultcnst_table2(a int DEFAULT 10, b int DEFAULT 20)
GO
-- Check for correct cases (should return 1)
SELECT OBJECTPROPERTY(ct.object_id, 'isdefaultcnst')
from sys.default_constraints ct
where parent_object_id = OBJECT_ID('isdefaultcnst_table')
GO
SELECT OBJECTPROPERTY(ct.object_id, 'isdefaultcnst')
from sys.default_constraints ct
where parent_object_id = OBJECT_ID('isdefaultcnst_table2')
GO
-- Check for object_id that exists, but not an index (should return 0)
SELECT OBJECTPROPERTY(OBJECT_ID('isdefaultcnst_table'), 'IsDefaultCnst')
GO
-- Check for invalid object_id (should return NULL)
SELECT OBJECTPROPERTY(0, 'IsDefaultCnst')
GO
-- Cleanup
DROP TABLE isdefaultcnst_table
GO
-- =============== ExecIsQuotedIdentOn ===============
-- Does not function properly due to sys.sql_modules not recording the correct settings
-- Setup
SET QUOTED_IDENTIFIER OFF
GO
CREATE PROC execisquotedident_proc_off
AS
RETURN 1
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROC execisquotedident_proc_on
AS
RETURN 1
GO
CREATE TABLE execisquotedident_table(a int)
GO
-- Currently does not work due to hardcoded value in sys.sql_modules (should be 0)
SELECT OBJECTPROPERTY(OBJECT_ID('execisquotedident_proc_off'), 'ExecIsQuotedIdentOn')
GO
SELECT OBJECTPROPERTY(OBJECT_ID('execisquotedident_proc_on'), 'ExecIsQuotedIdentOn')
GO
-- Check for object_id that exists, but not a proc, view, function, or sproc (should return NULL)
SELECT OBJECTPROPERTY(OBJECT_ID('execisquotedident_table'), 'ExecIsQuotedIdentOn')
GO
-- Check for invalid object_id (should return NULL)
SELECT OBJECTPROPERTY(0, 'ExecIsQuotedIdentOn')
GO
-- Cleanup
DROP PROC execisquotedident_proc_on
GO
DROP PROC execisquotedident_proc_off
GO
DROP TABLE execisquotedident_table
GO
-- =============== IsMSShipped ===============
-- Setup
CREATE TABLE is_ms_shipped_table(a int)
GO
-- Test for object that exists but isn't ms_shipped
SELECT OBJECTPROPERTY(OBJECT_ID('is_ms_shipped_table'), 'IsMSShipped')
GO
-- Test for object that is ms_shipped
SELECT OBJECTPROPERTY(OBJECT_ID('sys.sp_tables'), 'IsMSShipped')
GO
-- Test for invalid object
SELECT OBJECTPROPERTY(0, 'IsMSShipped')
GO
-- Cleanup
DROP TABLE is_ms_shipped_table
GO
-- =============== TableFullTextPopulateStatus ===============
-- Setup
CREATE TABLE tablefulltextpopulatestatus_table(a int)
GO
CREATE PROC tablefulltextpopulatestatus_proc
AS
RETURN 1
GO
-- Test with table object
SELECT OBJECTPROPERTY(OBJECT_ID('tablefulltextpopulatestatus_table'), 'TableFullTextPopulateStatus')
GO
-- Test with non-table object
SELECT OBJECTPROPERTY(OBJECT_ID('tablefulltextpopulatestatus_proc'), 'TableFullTextPopulateStatus')
GO
-- Test with invalid object id
SELECT OBJECTPROPERTY(0, 'TableFullTextPopulateStatus')
GO
-- Cleanup
DROP TABLE tablefulltextpopulatestatus_table
GO
DROP PROC tablefulltextpopulatestatus_proc
GO
-- =============== TableHasVarDecimalStorageFormat ===============
-- Setup
CREATE TABLE TableHasVarDecimalStorageFormat_table(a int)
GO
CREATE proc TableHasVarDecimalStorageFormat_proc
AS
RETURN 1
GO
-- Test with table object
SELECT OBJECTPROPERTY(OBJECT_ID('TableHasVarDecimalStorageFormat_table'), 'TableHasVarDecimalStorageFormat')
GO
-- Test with non-table object
SELECT OBJECTPROPERTY(OBJECT_ID('TableHasVarDecimalStorageFormat_proc'), 'TableHasVarDecimalStorageFormat')
GO
-- Test with invalid object id
SELECT OBJECTPROPERTY(0, 'TableHasVarDecimalStorageFormat')
GO
-- Cleanup
DROP TABLE TableHasVarDecimalStorageFormat_table
GO
DROP PROC TableHasVarDecimalStorageFormat_proc
GO
-- =============== IsSchemaBound ===============
-- Currently does not work due to hardcoded value in sys.sql_modules
-- Setup
CREATE FUNCTION IsSchemaBound_function_false()
RETURNS int
BEGIN
return 1
END
GO
CREATE FUNCTION IsSchemaBound_function_true()
RETURNS int
WITH SCHEMABINDING
BEGIN
return 1
END
GO
CREATE TABLE IsSchemaBound_table(a int)
GO
-- Test when object is not schema bound
SELECT OBJECTPROPERTY(OBJECT_ID('IsSchemaBound_function_false'), 'IsSchemaBound')
GO
-- Test when object is schema bound (Currently does not work due to hardcoded value in sys.sql_modules, should return 1)
SELECT OBJECTPROPERTY(OBJECT_ID('IsSchemaBound_function_true'), 'IsSchemaBound')
GO
-- Test with object that doesn't have schema bound settings
SELECT OBJECTPROPERTY(OBJECT_ID('IsSchemaBound_table'), 'IsSchemaBound')
GO
-- Test with invalid object id
SELECT OBJECTPROPERTY(0, 'IsSchemaBound')
GO
-- Cleanup
DROP TABLE IsSchemaBound_table
GO
DROP FUNCTION IsSchemaBound_function_false
GO
DROP FUNCTION IsSchemaBound_function_true
GO
-- =============== ExecIsAnsiNullsOn ===============
-- Currently does not work due to hardcoded value in sys.sql_modules
-- Setup
SET ANSI_NULLS OFF
GO
CREATE PROC ansi_nulls_off_proc
AS
SELECT CASE WHEN NULL = NULL then 1 else 0 end
GO
SET ANSI_NULLS ON
GO
CREATE PROC ansi_nulls_on_proc
AS
SELECT CASE WHEN NULL = NULL then 1 else 0 end
GO
CREATE TABLE ansi_nulls_on_table(a int)
GO
-- Tests when object is created with ansi nulls off and ansi nulls on
-- Currently does not work due to hardcoded value in sys.sql_modules (should return 0)
SELECT OBJECTPROPERTY(OBJECT_ID('ansi_nulls_off_proc'), 'ExecIsAnsiNullsOn')
GO
SELECT OBJECTPROPERTY(OBJECT_ID('ansi_nulls_on_proc'), 'ExecIsAnsiNullsOn')
GO
-- Test with invalid object id
SELECT OBJECTPROPERTY(0, 'ExecIsAnsiNullsOn')
GO
-- Check for object_id that exists, but not a proc, view, function, or sproc (should return NULL)
SELECT OBJECTPROPERTY(OBJECT_ID('ansi_nulls_on_table'), 'ExecIsAnsiNullsOn')
GO
-- Check for invalid object_id (should return NULL)
SELECT OBJECTPROPERTY(0, 'ExecIsAnsiNullsOn')
GO
-- Cleanup
DROP PROC ansi_nulls_off_proc
GO
DROP PROC ansi_nulls_on_proc
GO
DROP TABLE ansi_nulls_on_table
GO
-- =============== IsDeterministic ===============
-- Currently does not work since INFORMATION_SCHEMA.ROUTINES does not evaluate if a function is deterministic
-- Setup
CREATE FUNCTION IsDeterministic_function_yes()
RETURNS int
WITH SCHEMABINDING
BEGIN
return 1;
END
GO
CREATE FUNCTION IsDeterministic_function_no()
RETURNS sys.datetime
WITH SCHEMABINDING
BEGIN
return GETDATE();
END
GO
CREATE TABLE IsDeterministic_table(a int)
GO
-- Tests for a deterministic function (Currently does not work, should return 1)
SELECT OBJECTPROPERTY(OBJECT_ID('IsDeterministic_function_yes'), 'IsDeterministic')
GO
-- Tests for a non-deterministic function
SELECT OBJECTPROPERTY(OBJECT_ID('IsDeterministic_function_yes'), 'IsDeterministic')
GO
-- Tests for an object that is not a function
SELECT OBJECTPROPERTY(OBJECT_ID('IsDeterministic_table'), 'IsDeterministic')
GO
-- Tests for a non-valid object
SELECT OBJECTPROPERTY(0, 'IsDeterministic')
GO
-- Cleanup
DROP FUNCTION IsDeterministic_function_no
GO
DROP FUNCTION IsDeterministic_function_yes
GO
DROP TABLE IsDeterministic_table
GO
-- =============== IsProcedure ===============
-- Setup
CREATE PROC IsProcedure_proc AS
SELECT 1
GO
CREATE TABLE IsProcedure_table(a int)
GO
-- Test for success
SELECT OBJECTPROPERTY(OBJECT_ID('IsProcedure_proc'), 'IsProcedure')
GO
-- Test for failure
SELECT OBJECTPROPERTY(OBJECT_ID('IsProcedure_table'), 'IsProcedure')
GO
-- Test for invalid object
SELECT OBJECTPROPERTY(0, 'IsProcedure')
GO
-- Cleanup
DROP PROC IsProcedure_proc
GO
DROP TABLE IsProcedure_table
GO
-- =============== IsTable ===============
-- Setup
CREATE TABLE IsTable_table(a int)
GO
CREATE PROC IsTable_proc AS
SELECT 1
GO
-- Test for correct case
SELECT OBJECTPROPERTY(OBJECT_ID('IsTable_table'), 'IsTable')
GO
-- Test for incorrect case
SELECT OBJECTPROPERTY(OBJECT_ID('IsTable_proc'), 'IsTable')
GO
-- Test for invalid object
SELECT OBJECTPROPERTY(0, 'IsTable')
GO
-- Cleanup
DROP TABLE IsTable_table
GO
DROP PROC IsTable_proc
GO
-- =============== IsView ===============
-- Setup
CREATE VIEW IsView_view AS
SELECT 1
GO
CREATE TABLE IsView_table(a int)
GO
-- Test for correct case
SELECT OBJECTPROPERTY(OBJECT_ID('IsView_view'), 'IsView')
GO
-- Test for incorrect case
SELECT OBJECTPROPERTY(OBJECT_ID('IsView_table'), 'IsView')
GO
-- Test for invalid object
SELECT OBJECTPROPERTY(0, 'IsView')
GO
-- Cleanup
DROP VIEW IsView_view
GO
DROP TABLE IsView_table
GO
-- =============== IsUserTable ===============
-- Setup
CREATE TABLE IsUserTable_table(a int)
GO
CREATE VIEW IsUserTable_view AS
SELECT 1
GO
-- Test for correct case
SELECT OBJECTPROPERTY(OBJECT_ID('IsUserTable_table'), 'IsUserTable')
GO
-- Test for incorrect case
SELECT OBJECTPROPERTY(OBJECT_ID('IsUserTable_view'), 'IsUserTable')
GO
-- Test for invalid object
SELECT OBJECTPROPERTY(0, 'IsUserTable')
GO
-- Cleanup
DROP TABLE IsUserTable_table
GO
DROP VIEW IsUserTable_view
GO
-- =============== IsTableFunction ===============
-- NOTE: Currently will return 0 since sys.all_objects does not identify objects of type TF (BABELFISH-483)
-- Setup
CREATE FUNCTION IsTableFunction_tablefunction()
RETURNS @t TABLE (
c1 int,
c2 int
)
AS
BEGIN
INSERT INTO @t
SELECT 1 as c1, 2 as c2;
RETURN;
END
GO
CREATE FUNCTION IsTableFunction_inlinetablefunction()
RETURNS TABLE
AS
RETURN
(
SELECT 1 AS c1, 2 AS c2
)
GO
CREATE FUNCTION IsTableFunction_function()
RETURNS INT
AS
BEGIN
RETURN 1
END
GO
-- Test for valid table function (currently incorrect from note above, should return 1)
SELECT OBJECTPROPERTY(OBJECT_ID('IsTableFunction_tablefunction'), 'IsTableFunction')
GO
-- Test for valid inline table function (currently incorrect from note above, should return 1)
SELECT OBJECTPROPERTY(OBJECT_ID('IsTableFunction_inlinetablefunction'), 'IsTableFunction')
GO
-- Test for incorrect case
SELECT OBJECTPROPERTY(OBJECT_ID('IsTableFunction_function'), 'IsTableFunction')
GO
-- Test for invalid object
SELECT OBJECTPROPERTY(0, 'IsTableFunction')
GO
-- Cleanup
DROP FUNCTION IsTableFunction_tablefunction
GO
DROP FUNCTION IsTableFunction_function
GO
-- =============== IsInlineFunction ===============
-- NOTE: Currently will return 0 since BBF cannot currently identify if a function is inline or not
-- Setup
CREATE FUNCTION IsInlineFunction_tablefunction()
RETURNS INT
AS
BEGIN
RETURN 1
END
GO
CREATE FUNCTION IsInlineFunction_function()
RETURNS INT
AS
BEGIN
RETURN 1
END
GO
-- Test for correct case (currently incorrect from note above, should return 1)
SELECT OBJECTPROPERTY(OBJECT_ID('IsInlineFunction_tablefunction'), 'IsInlineFunction')
GO
-- Test for incorrect case
SELECT OBJECTPROPERTY(OBJECT_ID('IsInlineFunction_function'), 'IsInlineFunction')
GO
-- Test for invalid object
SELECT OBJECTPROPERTY(0, 'IsInlineFunction')
GO
-- Cleanup
DROP FUNCTION IsInlineFunction_tablefunction
GO
DROP FUNCTION IsInlineFunction_function
GO
-- =============== IsScalarFunction ===============
-- Setup
CREATE FUNCTION IsScalarFunction_function()
RETURNS INT
AS
BEGIN
RETURN 1
END
GO
CREATE TABLE IsScalarFunction_table(a int)
GO
-- Test for correct case
SELECT OBJECTPROPERTY(OBJECT_ID('IsScalarFunction_function'), 'IsScalarFunction')
GO
-- Test for incorrect case
SELECT OBJECTPROPERTY(OBJECT_ID('IsScalarFunction_table'), 'IsScalarFunction')
GO
-- Test for invalid object
SELECT OBJECTPROPERTY(0, 'IsScalarFunction')
GO
-- Cleanup
DROP FUNCTION IsScalarFunction_function
GO
DROP TABLE IsScalarFunction_table
GO
-- =============== IsPrimaryKey ===============
-- Setup
CREATE TABLE IsPrimaryKey_table(a int, CONSTRAINT pk_isprimarykey PRIMARY KEY(a))
GO
-- Test for correct case
SELECT OBJECTPROPERTY((SELECT TOP(1) object_id FROM sys.all_objects where name like 'pk_isprimarykey%' ), 'IsPrimaryKey')
GO
-- Test for incorrect case
SELECT OBJECTPROPERTY(OBJECT_ID('IsPrimaryKey_table'), 'IsPrimaryKey')
GO
-- Test for invalid object
SELECT OBJECTPROPERTY(0, 'IsPrimaryKey')
GO
-- Cleanup
DROP TABLE IsPrimaryKey_table
GO
-- =============== IsIndexed ===============
-- Setup
CREATE TABLE IsIndexed_table(a int, CONSTRAINT PK_isprimarykey PRIMARY KEY(a))
GO
CREATE TABLE IsIndexed_nonindexed_table(a int)
GO
-- Test for correct case
SELECT OBJECTPROPERTY(OBJECT_ID('IsIndexed_table'), 'IsIndexed')
GO
-- Test for incorrect case
SELECT OBJECTPROPERTY(OBJECT_ID('IsIndexed_nonindexed_table'), 'IsIndexed')
GO
-- Test for invalid object
SELECT OBJECTPROPERTY(0, 'IsIndexed')
GO
-- Cleanup
DROP TABLE IsIndexed_nonindexed_table
GO
DROP TABLE IsIndexed_table
GO
-- =============== IsDefault ===============
-- NOTE: Defaults are currently not supported so will return 0
-- Setup
CREATE TABLE IsDefault_table(a int)
GO
-- Test for valid object
SELECT OBJECTPROPERTY(OBJECT_ID('IsDefault_table'), 'IsDefault')
GO
-- Test for invalid object
SELECT OBJECTPROPERTY(0, 'IsDefault')
GO
-- Cleanup
DROP TABLE IsDefault_table
GO
-- =============== IsRule ===============
-- NOTE: Rules are currently not supported so will return 0
-- Setup
CREATE TABLE IsRule_table(a int)
GO
-- Test for valid object
SELECT OBJECTPROPERTY(OBJECT_ID('IsRule_table'), 'IsRule')
GO
-- Test for invalid object
SELECT OBJECTPROPERTY(0, 'IsRule')
GO
-- Cleanup
DROP TABLE IsRule_table
GO
-- =============== IsTrigger ===============
-- Setup
CREATE TABLE IsTrigger_table(a int)
GO
CREATE TRIGGER IsTrigger_trigger ON IsTrigger_table INSTEAD OF INSERT
AS
BEGIN
SELECT * FROM IsTrigger_table
END
GO
-- Test for correct case
SELECT OBJECTPROPERTY(OBJECT_ID('IsTrigger_trigger', 'TR'), 'IsTrigger')
GO
-- Test for incorrect case
SELECT OBJECTPROPERTY(OBJECT_ID('IsTrigger_table', 'TR'), 'IsTrigger')
GO
-- Test for invalid object
SELECT OBJECTPROPERTY(0, 'IsTrigger')
GO
-- Cleanup
DROP TABLE IsTrigger_table
GO
-- Global cleanup for tests
USE master
GO
DROP DATABASE db1
GO | the_stack |
---- prepare work
DROP SCHEMA IF EXISTS vec_numeric_to_bigintger_2 CASCADE;
CREATE SCHEMA vec_numeric_to_bigintger_2;
SET current_schema = vec_numeric_to_bigintger_2;
SET enable_fast_numeric = on;
create table num_row(id int, cu int, num numeric(30,5)) ;
create table num_col(id int, cu int, num numeric(30,5)) with (orientation = column) ;
-- int32
insert into num_row values (1, 1, 0),(1, 1, 0.0),(1, 1, 100),(1, 1, 100.1),(1, 1, 10000.1111),(1, 1, 10000.11111),(1, 1, 21474.83647);
-- int64
insert into num_row values (1, 2, 21474.83648),(1, 2, 1000000000.1),(1, 2, 1000000111.1),(1, 2, 1001000011.11),(1, 2, 1000000000000.11111),(1, 2, 1111111111111.11111);
-- numeric
insert into num_row values (1, 3, 110000000000000.11111),(1, 3, 9223372013685477.5807),(1, 3, 9223372036854775808);
-- int32 and int64
insert into num_row values (1, 4, 10000.1111),(1, 4, 1000000111.1),(1, 4, 10000.11111),(1, 4, 1001000011.11),(1, 4, 100.111);
-- int64 and numeric
insert into num_row values (1, 5, 1000000000.1),(1, 5, 9223372013685477.5807),(1, 5, 1000000111.1),(1, 5, 1001000011.11),(1, 5, 1000100111.1),(1, 5, 1010000111.1);
-- int32 and numeric
insert into num_row values (1, 6, 0.0),(1, 6, 10000.1111),(1, 6, 110000000000000.11111),(1, 6, 10000.11111),(1, 6, 10100.11111),(1, 6, 10101.1111);
-- int32, int64 and numeric
insert into num_row values (1, 7, 100),(1, 7, 100.1),(1, 7, 10000.1111),(1, 7, 10000.11111),(1, 7, 10000000000000.11111),(1, 7, 0),(1, 7, 1000000000.1),(1, 7, 1000000111.1),(1, 7, 1001000011.11);
-- null
insert into num_row values (1, 8, 1000000000.1),(1, 8, 9223372013685477.5807),(1, 8, 1000000111.1),(1, 8, 21474.83648),(1, 8, null),(1, 8, 0.0),(1, 8, 100.111),(1, 8, 10000.1111);
insert into num_row values (1, 8, null),(1, 8, 10101.0101),(1, 8, 1000000111.1),(1, 8, 1001000011.11),(1, 8, 100),(1, 8, 100.1),(1, 8, 1111111111111.11111);
-- same value
insert into num_row values (1, 9, 10101.0101),(1, 9, 10101.0101),(1, 9, 10101.0101),(1, 9, 1111111111111.11111),(1, 9, 1111111111111.11111),(1, 9, 1111111111111.11111);
insert into num_row values (1, 10, 0),(1, 10, 1111111111111.11111),(1, 10, 110000000000000.11111);
-- int128
insert into num_row values (1, 11, 10000000000000000000),(1, 11, 9e20),(1, 11, 11.11e20);
-- insert column table by cu
insert into num_col select * from num_row where cu>=1 and cu <=11;
select * from num_col order by 1, 2, 3;
truncate num_col;
-- copy
-- int32
copy num_col from stdin;
1 1 0
1 1 0.0
1 1 100
1 1 100.1
1 1 10000.1111
1 1 10000.11111
1 1 21474.83647
\.
-- int64
copy num_col from stdin;
1 2 21474.83648
1 2 1000000000.1
1 2 1000000111.1
1 2 1001000011.11
1 2 1000000000000.11111
1 2 1111111111111.11111
\.
-- numeric
copy num_col from stdin;
1 3 110000000000000.11111
1 3 9223372013685477.5807
1 3 9223372036854775808
\.
-- int32 and int64
copy num_col from stdin;
1 4 10000.1111
1 4 1000000111.1
1 4 10000.11111
1 4 1001000011.11
1 4 100.111
\.
-- int64 and numeric
copy num_col from stdin;
1 5 1000000000.1
1 5 9223372013685477.5807
1 5 1000000111.1
1 5 1001000011.11
1 5 1000100111.1
1 5 1010000111.1
\.
-- int32 and numeric
copy num_col from stdin;
1 6 0.0
1 6 10000.1111
1 6 110000000000000.11111
1 6 10000.11111
1 6 10100.11111
1 6 10101.1111
\.
-- int32,int64 and numeric
copy num_col from stdin;
1 7 100
1 7 100.1
1 7 10000.1111
1 7 10000.11111
1 7 10000000000000.11111
1 7 0
1 7 1000000000.1
1 7 1000000111.1
1 7 1001000011.11
\.
-- null
copy num_col from stdin;
1 8 1000000000.1
1 8 9223372013685477.5807
1 8 1000000111.1
1 8 21474.83648
1 8
1 8 0.0
1 8 100.111
1 8 10000.1111
1 8
1 8 10101.0101
1 8 1000000111.1
1 8 1001000011.11
1 8 100
1 8 100.1
1 8 1111111111111.11111
\.
-- same value
copy num_col from stdin;
1 9 10101.0101
1 9 10101.0101
1 9 10101.0101
1 9 1111111111111.11111
1 9 1111111111111.11111
1 9 1111111111111.11111
\.
copy num_col from stdin;
1 10 0
1 10 1111111111111.11111
1 10 110000000000000.11111
\.
-- int128
copy num_col from stdin;
1 11 10000000000000000000
1 11 9e20
1 11 11.11e20
\.
select * from num_col;
create table num_col2(like num_col including all);
insert into num_col2 select * from num_col;
select * from num_col2 order by 1, 2, 3;
SET ENABLE_HASHAGG=FALSE;
CREATE TABLE AGG_BATCH_1_005(
C_CHAR_1 CHAR(1),
C_CHAR_2 CHAR(10),
C_CHAR_3 CHAR(100),
C_VARCHAR_1 VARCHAR(1),
C_VARCHAR_2 VARCHAR(10),
C_VARCHAR_3 VARCHAR(1024),
C_INT BIGINT,
C_BIGINT BIGINT,
C_SMALLINT BIGINT,
C_FLOAT FLOAT,
C_NUMERIC numeric(20,5),
C_DP double precision,
C_DATE DATE,
C_TS_WITHOUT TIMESTAMP WITHOUT TIME ZONE,
C_TS_WITH TIMESTAMP WITH TIME ZONE
, PARTIAL CLUSTER KEY(C_NUMERIC,C_CHAR_2)) WITH (ORIENTATION=COLUMN);
INSERT INTO AGG_BATCH_1_005 VALUES('A','ABCfeefgeq','1111ABCDEFGGAHWGS','a','abcdx','1111ABHTFADFADFDAFAFEFAGEAFEAFEAGEAGEAGEE_',455,100000,87,0.0001,0.00001,0.000001,'2000-01-01','2000-01-01 01:01:01','2000-01-01 01:01:01+01');
-- TEST AVG
SELECT AVG(C_NUMERIC) FROM AGG_BATCH_1_005 GROUP BY C_CHAR_2 ORDER BY C_CHAR_2;
create table agg_batch_1 (id int, val1 numeric(20,0), val2 numeric(18, 18)) with (orientation=column) ;
insert into agg_batch_1 values (1, 888888888888888888, 0.999999999999999999);
---- bi64div64 bi128div128
select val1 / val2 from agg_batch_1;
select val1 / 0 from agg_batch_1;
select val1 / (val2 * 1.00) from agg_batch_1;
select (val2 * -1.00)/val1 from agg_batch_1;
---- bi64cmp64_smaller ---- bi64cmp64_larger
insert into agg_batch_1 values (1, -888888888888888888, -0.999999999999999999);
select id, min(case when val1 < 0 then val1 else 9999999999999999.99 end ), max(case when val1 < 0 then val1 else 9999999999999999.99 end ) from agg_batch_1 group by id;
select id, min(case when val1 < 0 then 888888888888888888 else 9999999999999999.99 end ), max(case when val1 < 0 then 888888888888888888 else 9999999999999999.99 end ) from agg_batch_1 group by id;
select id, min(case when val1 > 0 then 888888888888888888 else 9999999999999999.99 end ), max(case when val1 > 0 then 888888888888888888 else 9999999999999999.99 end ) from agg_batch_1 group by id;
select id, min(case when val1 > 0 then -888888888888888888 else 9999999999999999.99 end ), max(case when val1 > 0 then -888888888888888888 else 9999999999999999.99 end ) from agg_batch_1 group by id;
select id, min(case when val1 > 0 then val1 * 100 else val2 end), max(case when val1 > 0 then val1 * 100 else val2 end) from agg_batch_1 group by id;
select id, min(case when val1 > 0 then val1 * -100 else val2 end), max(case when val1 > 0 then val1 * -100 else val2 end) from agg_batch_1 group by id;
select id, min(case when val1 > 0 then val1 else val2 * 1.00 end), max(case when val1 > 0 then val1 else val2 * 1.00 end) from agg_batch_1 group by id;
select id, min(case when val1 > 0 then 9999999999999999999999999 else 0.88888888888888888888888 end), max(case when val1 > 0 then 9999999999999999999999999 else 0.88888888888888888888888 end) from agg_batch_1 group by id;
---- test int1_numeric_bi/int2_numeric_bi/int4_numeric_bi/int8_numeric_bi
create table agg_batch_2 (id int, val1 tinyint, val2 smallint, val3 int, val4 bigint, val5 numeric(7,2)) with (orientation = column);
insert into agg_batch_2 values (1,1,1,1,1,1),(1,2,2,2,2,2),(1,3,3,3,3,3);
select id, sum(val1 + val5), sum(val2 - val5), sum(val3 * val5), sum(val4 / val5) from agg_batch_2 group by id;
---- test numeric column partition info
create table item_less_1
(
id integer not null,
val decimal(19,18)
) with (orientation=column) partition by range(val)
(
partition p1 values less than(-5.00000),
partition p2 values less than(-1.00000),
partition p3 values less than(0.00000),
partition p4 values less than(1.00000),
partition p5 values less than(3.0000),
partition p6 values less than(5.000000),
partition p7 values less than(maxvalue)
);
create table item_less_2
(
id integer not null,
val decimal(19,18)
)
partition by range(val)
(
partition p1 values less than(-5.00000),
partition p2 values less than(-1.00000),
partition p3 values less than(0.00000),
partition p4 values less than(1.00000),
partition p5 values less than(3.0000),
partition p6 values less than(5.000000),
partition p7 values less than(maxvalue)
);
copy item_less_2 from stdin DELIMITER as ',' NULL as '' ;
1,-6.1
2,-7.4
3,-3.2
4,-4.7
5,-2.2
6,-1.1
7,-0.9
8,0.2
9,1.2
10,3
\.
insert into item_less_1 select * from item_less_2;
select count(*) from item_less_1 where val <= -5;
select count(*) from item_less_2 where val <= -5;
---- test hash_bi
create table test_vec_numeric_hash (id int, val1 numeric(18,5), val2 numeric(39, 5), val3 numeric(100, 50), val4 numeric) with (orientation=column);
insert into test_vec_numeric_hash values (1, 999999999999, 9999999999999999999999999999999999.99999, 9999999999999999999999999999999999.99999, 9999999999999999999999999999999999.99999);
insert into test_vec_numeric_hash values (1, 999999999999, 9999999999999999999999999999999999.99999, 9999999999999999999999999999999999.99999, 9999999999999999999999999999999999.99999);
insert into test_vec_numeric_hash values (1, 1, 1, 1, 1),(1, 1, 1, 1, 1),(1, 1, 1, 1, 1),(1, 0, 0, 0, 0);
select sum(id), val1 from test_vec_numeric_hash group by val1 order by 1,2;
select sum(id), val1 * val1 from test_vec_numeric_hash group by val1 * val1 order by 1,2;
select sum(id), val2 from test_vec_numeric_hash group by val2 order by 1,2;
select sum(id), sum(val1) from test_vec_numeric_hash group by case when id >= 0 and id <= 2 then val2 when id >= 3 and id <= 4 then 9999999999999999999999999999999999.99999 else 1 end order by 1,2;
select sum(id), val1 * val2, val1 * val3 from test_vec_numeric_hash group by val1 * val2, val1 * val3 order by 1,2;
select count(*) from test_vec_numeric_hash as t1, test_vec_numeric_hash as t2 where t1.val2 = t2.val1;
select count(*) from test_vec_numeric_hash as t1, test_vec_numeric_hash as t2 where t1.val2 = t2.val2;
select count(*) from test_vec_numeric_hash as t1, test_vec_numeric_hash as t2 where t1.val2 = t2.val3;
select count(*) from test_vec_numeric_hash as t1, test_vec_numeric_hash as t2 where t1.val2 = t2.val4;
select count(*) from test_vec_numeric_hash t1 inner join test_vec_numeric_hash t2 on t1.val1 = t2.val4;
drop table test_vec_numeric_hash;
create table test_vec_numeric_hash (id int, num numeric(40,4)) with (orientation=column);
insert into test_vec_numeric_hash values (1, 11111111111111111111111111111111111.1), (1, 11111111111111111111111111111111111.01), (1, 11111111111111111111111111111111111.001), (1, 11111111111111111111111111111111111.0001), (1, 1), (1, 2);
select num, sum(id) from test_vec_numeric_hash group by num order by 1, 2;
select ln(num), sqrt(num), num::bigint, num::int, num::smallint, num::tinyint from test_vec_numeric_hash where num < 2 order by 1,2,3;
---- DROP SCHEMA
DROP SCHEMA vec_numeric_to_bigintger_2 CASCADE; | the_stack |
-- ----------------------------
-- DATABASE structure for `mq-cloud`
-- ----------------------------
CREATE DATABASE IF NOT EXISTS `mq-cloud` DEFAULT CHARACTER SET utf8;
use `mq-cloud`;
-- ----------------------------
-- Table structure for `audit`
-- ----------------------------
DROP TABLE IF EXISTS `audit`;
CREATE TABLE `audit` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`uid` int(11) NOT NULL COMMENT '用户id',
`type` tinyint(4) NOT NULL COMMENT '申请类型:0:新建TOPIC,1:修改TOPIC ,2:删除TOPIC ,3:新建消费者,4:删除消费者,5:重置offset,6:跳过堆积,7:关联生产者,8:关联消费者,9:成为管理员',
`info` varchar(360) DEFAULT NULL COMMENT '申请描述',
`status` tinyint(4) NOT NULL DEFAULT '0' COMMENT '0:等待审批,1:审批通过,2:驳回',
`refuse_reason` varchar(360) DEFAULT NULL COMMENT '驳回理由',
`auditor` varchar(64) DEFAULT NULL COMMENT '审计员(邮箱)',
`create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='审核主表';
-- ----------------------------
-- Table structure for `audit_associate_consumer`
-- ----------------------------
DROP TABLE IF EXISTS `audit_associate_consumer`;
CREATE TABLE `audit_associate_consumer` (
`uid` int(11) NOT NULL COMMENT '关联的用户ID',
`aid` int(11) NOT NULL COMMENT '审核id',
`tid` int(11) NOT NULL COMMENT 'topic id',
`cid` int(11) NOT NULL COMMENT 'consumer id',
PRIMARY KEY (`aid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='审核关联消费者相关表';
-- ----------------------------
-- Table structure for `audit_associate_producer`
-- ----------------------------
DROP TABLE IF EXISTS `audit_associate_producer`;
CREATE TABLE `audit_associate_producer` (
`uid` int(11) NOT NULL COMMENT '关联的用户ID',
`aid` int(11) NOT NULL COMMENT '审核id',
`tid` int(11) NOT NULL COMMENT 'topic id',
`producer` varchar(64) NOT NULL COMMENT '关联的生产者名字',
PRIMARY KEY (`aid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='审核关联生产者相关表';
-- ----------------------------
-- Table structure for `audit_consumer`
-- ----------------------------
DROP TABLE IF EXISTS `audit_consumer`;
CREATE TABLE `audit_consumer` (
`aid` int(11) NOT NULL COMMENT '审核id',
`tid` int(11) NOT NULL COMMENT 'topic id',
`consumer` varchar(64) NOT NULL COMMENT '消费者名字',
`consume_way` int(4) NOT NULL DEFAULT '0' COMMENT '0:集群消费,1:广播消费',
`trace_enabled` int(4) NOT NULL DEFAULT '0' COMMENT '0:不开启trace,1:开启trace',
`permits_per_second` int(11) DEFAULT NULL COMMENT 'qps',
UNIQUE KEY `tid` (`tid`,`consumer`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='审核消费者相关表';
-- ----------------------------
-- Table structure for `audit_consumer_delete`
-- ----------------------------
DROP TABLE IF EXISTS `audit_consumer_delete`;
CREATE TABLE `audit_consumer_delete` (
`aid` int(11) NOT NULL COMMENT '审核id',
`cid` int(11) NOT NULL COMMENT 'consumer id',
`consumer` varchar(64) DEFAULT NULL COMMENT 'consumer名字',
`topic` varchar(64) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='审核消费者删除相关表';
-- ----------------------------
-- Table structure for `audit_producer_delete`
-- ----------------------------
DROP TABLE IF EXISTS `audit_producer_delete`;
CREATE TABLE `audit_producer_delete` (
`uid` int(11) NOT NULL,
`aid` int(11) NOT NULL COMMENT '审核id',
`pid` int(11) NOT NULL COMMENT 'userProducer id',
`producer` varchar(64) DEFAULT NULL,
`topic` varchar(64) DEFAULT NULL,
PRIMARY KEY (`aid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='审核用户与生产者组关系删除相关表';
-- ----------------------------
-- Table structure for `audit_reset_offset`
-- ----------------------------
DROP TABLE IF EXISTS `audit_reset_offset`;
CREATE TABLE `audit_reset_offset` (
`aid` int(11) NOT NULL COMMENT '审核id',
`tid` int(11) NOT NULL COMMENT 'topic id',
`consumer_id` int(11) DEFAULT NULL COMMENT 'consumer id',
`offset` varchar(64) DEFAULT NULL COMMENT 'null:重置为最大offset,时间戳:重置为某时间点(yyyy-MM-dd#HH:mm:ss:SSS)'
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='审核offset相关表';
-- ----------------------------
-- Table structure for `audit_topic`
-- ----------------------------
DROP TABLE IF EXISTS `audit_topic`;
CREATE TABLE `audit_topic` (
`aid` int(11) NOT NULL COMMENT '审核id',
`name` varchar(64) NOT NULL COMMENT 'topic名',
`queue_num` int(11) NOT NULL COMMENT '队列长度',
`producer` varchar(64) NOT NULL COMMENT '生产者名字',
`ordered` int(4) NOT NULL DEFAULT '0' COMMENT '0:无序,1:有序',
`trace_enabled` int(4) NOT NULL DEFAULT '0' COMMENT '0:不开启trace,1:开启trace',
`transaction_enabled` int(4) NOT NULL DEFAULT '0' COMMENT '0:不开启事务,1:开启事务',
`delay_enabled` int(4) NOT NULL DEFAULT '0' COMMENT '0:不发送延迟消息,1:发送延迟消息。注:此字段不强制该topic的消息类型',
`test_enabled` int(4) NOT NULL DEFAULT '0' COMMENT '0:非测试topic,1:测试topic',
`info` varchar(360) DEFAULT NULL COMMENT 'topic描述',
`qps` int(11) DEFAULT NULL COMMENT '消息量qps预估',
`qpd` int(11) DEFAULT NULL COMMENT '一天消息量预估',
`serializer` int(4) NOT NULL DEFAULT '0' COMMENT '序列化器 0:Protobuf,1:String'
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='审核topic相关表';
-- ----------------------------
-- Table structure for `audit_topic_delete`
-- ----------------------------
DROP TABLE IF EXISTS `audit_topic_delete`;
CREATE TABLE `audit_topic_delete` (
`aid` int(11) NOT NULL COMMENT '审核id',
`tid` int(11) NOT NULL COMMENT 'topic id',
`topic` varchar(64) DEFAULT NULL COMMENT 'topic名字'
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='审核topic删除相关表';
-- ----------------------------
-- Table structure for `audit_topic_update`
-- ----------------------------
DROP TABLE IF EXISTS `audit_topic_update`;
CREATE TABLE `audit_topic_update` (
`aid` int(11) NOT NULL COMMENT '审核id',
`tid` int(11) NOT NULL COMMENT 'topic id',
`queue_num` int(11) NOT NULL COMMENT '队列长度'
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='审核topic更新相关表';
-- ----------------------------
-- Table structure for `audit_user_consumer_delete`
-- ----------------------------
DROP TABLE IF EXISTS `audit_user_consumer_delete`;
CREATE TABLE `audit_user_consumer_delete` (
`aid` int(11) NOT NULL COMMENT '审核id',
`uid` int(11) NOT NULL COMMENT '此消费者对应的用户',
`ucid` int(11) NOT NULL COMMENT 'user_consumer id',
`consumer` varchar(64) DEFAULT NULL,
`topic` varchar(64) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='审核用户与消费者组关系删除相关表';
-- ----------------------------
-- Table structure for `audit_resend_message`
-- ----------------------------
DROP TABLE IF EXISTS `audit_resend_message`;
CREATE TABLE `audit_resend_message` (
`aid` int(11) NOT NULL COMMENT '审核id',
`tid` int(11) NOT NULL COMMENT 'topic id',
`msgId` char(32) NOT NULL COMMENT 'broker offset msg id',
`status` tinyint(4) NOT NULL DEFAULT '0' COMMENT '申请类型:0:未处理,1:发送成功,2:发送失败',
`times` int(11) NOT NULL DEFAULT '0' COMMENT '发送次数',
`send_time` datetime COMMENT '发送时间'
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='消息重发审核表';
-- ----------------------------
-- Table structure for `audit_resend_message_consumer`
-- ----------------------------
CREATE TABLE `audit_resend_message_consumer` (
`aid` int(11) NOT NULL COMMENT '审核id',
`consumer_id` int(11) NOT NULL COMMENT 'consumer id'
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='消息重发给消费者审核表';
-- ----------------------------
-- Table structure for `audit_topic_trace`
-- ----------------------------
CREATE TABLE `audit_topic_trace` (
`aid` int(11) NOT NULL COMMENT '审核id',
`tid` int(11) NOT NULL COMMENT 'topic id',
`trace_enabled` int(11) NOT NULL COMMENT '0:不开启trece,1:开启trace'
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='审核topic trace相关表';
-- ----------------------------
-- Table structure for `broker_traffic`
-- ----------------------------
DROP TABLE IF EXISTS `broker_traffic`;
CREATE TABLE `broker_traffic` (
`ip` varchar(255) NOT NULL COMMENT 'addr',
`create_date` date NOT NULL COMMENT '数据收集天',
`create_time` char(4) NOT NULL COMMENT '数据收集小时分钟,格式:HHMM',
`cluster_id` int(11) NOT NULL COMMENT 'cluster_id',
`put_count` bigint(20) NOT NULL DEFAULT '0' COMMENT '生产消息量',
`put_size` bigint(20) NOT NULL DEFAULT '0' COMMENT '生产消息大小',
`get_count` bigint(20) NOT NULL DEFAULT '0' COMMENT '消费消息量',
`get_size` bigint(20) NOT NULL DEFAULT '0' COMMENT '消费消息大小',
PRIMARY KEY (`ip`,`create_date`,`create_time`),
KEY `time` (`create_date`,`cluster_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='broker流量表';
-- ----------------------------
-- Table structure for `client_version`
-- ----------------------------
DROP TABLE IF EXISTS `client_version`;
CREATE TABLE `client_version` (
`topic` varchar(255) NOT NULL,
`client` varchar(255) NOT NULL,
`role` tinyint(4) NOT NULL COMMENT '1:producer,2:consumer',
`version` varchar(255) NOT NULL,
`create_date` date NOT NULL,
`update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
UNIQUE KEY `topic` (`topic`,`client`,`role`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='topic客户端版本';
-- ----------------------------
-- Table structure for `cluster`
-- ----------------------------
DROP TABLE IF EXISTS `cluster`;
CREATE TABLE `cluster` (
`id` int(11) NOT NULL COMMENT '集群id,也会作为ns发现的一部分',
`name` varchar(64) NOT NULL COMMENT '集群名',
`vip_channel_enabled` tinyint(4) NOT NULL DEFAULT '0' COMMENT '是否开启vip通道, 1:开启, 0:关闭, rocketmq 4.x版本默认开启',
`online` tinyint(4) NOT NULL DEFAULT '0' COMMENT '是否为线上集群, 1:是, 0:否, 线上集群会开启流量抓取',
`transaction_enabled` int(4) NOT NULL DEFAULT '0' COMMENT '0:不支持事务,1:支持事务',
`trace_enabled` int(4) NOT NULL DEFAULT '0' COMMENT '0:不支持trace,1:支持trace',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='集群表';
-- ----------------------------
-- Table structure for `common_config`
-- ----------------------------
DROP TABLE IF EXISTS `common_config`;
CREATE TABLE `common_config` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`key` varchar(64) DEFAULT NULL COMMENT '配置key',
`value` varchar(20000) DEFAULT '' COMMENT '配置值',
`comment` varchar(256) DEFAULT '' COMMENT '备注',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- ----------------------------
-- Table structure for `consumer`
-- ----------------------------
DROP TABLE IF EXISTS `consumer`;
CREATE TABLE `consumer` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`tid` int(11) NOT NULL COMMENT 'topic id',
`name` varchar(64) NOT NULL COMMENT 'consumer名',
`consume_way` int(4) NOT NULL DEFAULT '0' COMMENT '0:集群消费,1:广播消费',
`create_date` date NOT NULL,
`update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
`trace_enabled` int(4) NOT NULL DEFAULT '0' COMMENT '0:不开启trace,1:开启trace',
`info` varchar(360) DEFAULT NULL COMMENT '消费者描述',
PRIMARY KEY (`id`),
UNIQUE KEY `name` (`name`),
KEY `tid` (`tid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='消费者表';
-- ----------------------------
-- Table structure for `consumer_block`
-- ----------------------------
DROP TABLE IF EXISTS `consumer_block`;
CREATE TABLE `consumer_block` (
`csid` int(11) DEFAULT NULL COMMENT 'consumer_stat id',
`instance` varchar(255) DEFAULT NULL COMMENT 'consumer instance_id',
`updatetime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`broker` varchar(255) DEFAULT NULL COMMENT 'broker',
`qid` int(11) DEFAULT NULL COMMENT 'qid',
`block_time` bigint(20) DEFAULT NULL COMMENT '毫秒=当前时间-最新消费时间',
`offset_moved_times` int(11) DEFAULT '0' COMMENT 'offset moved times',
`offset_moved_time` bigint(20) DEFAULT NULL COMMENT 'offset moved msg store time',
UNIQUE KEY `csid` (`csid`,`broker`,`qid`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- ----------------------------
-- Table structure for `consumer_stat`
-- ----------------------------
DROP TABLE IF EXISTS `consumer_stat`;
CREATE TABLE `consumer_stat` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`consumer_group` varchar(255) DEFAULT NULL COMMENT 'consumer group',
`topic` varchar(255) DEFAULT NULL COMMENT 'host',
`updatetime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`undone_msg_count` bigint(20) DEFAULT NULL COMMENT '未消费的消息量',
`undone_1q_msg_count`bigint(20) DEFAULT NULL COMMENT '单队列未消费的最大消息量',
`undone_delay` bigint(20) DEFAULT NULL COMMENT '毫秒=broker最新消息存储时间-最新消费时间',
`sbscription` varchar(255) DEFAULT NULL COMMENT '订阅关系,如果一个group订阅不同的topic,在这里会有体现',
PRIMARY KEY (`id`),
UNIQUE KEY `consumer_group` (`consumer_group`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- ----------------------------
-- Table structure for `consumer_traffic`
-- ----------------------------
DROP TABLE IF EXISTS `consumer_traffic`;
CREATE TABLE `consumer_traffic` (
`consumer_id` int(11) NOT NULL DEFAULT '0' COMMENT 'consumer id',
`create_date` date NOT NULL COMMENT '数据收集天',
`create_time` char(4) NOT NULL COMMENT '数据收集小时分钟,格式:HHMM',
`count` bigint(20) DEFAULT NULL COMMENT 'consumer pull times',
`size` bigint(20) DEFAULT NULL COMMENT 'consumer pull size',
PRIMARY KEY (`consumer_id`,`create_date`,`create_time`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='消费者流量表';
-- ----------------------------
-- Table structure for `feedback`
-- ----------------------------
DROP TABLE IF EXISTS `feedback`;
CREATE TABLE `feedback` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`uid` int(11) NOT NULL COMMENT '用户id',
`content` text NOT NULL COMMENT '反馈内容',
`create_date` datetime NOT NULL COMMENT '创建时间',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='反馈表';
-- ----------------------------
-- Table structure for `need_warn_config`
-- ----------------------------
DROP TABLE IF EXISTS `need_warn_config`;
CREATE TABLE `need_warn_config` (
`oKey` varchar(255) NOT NULL COMMENT '报警频率的key(type_topic_group)',
`times` int(11) NOT NULL COMMENT '次数',
`update_time` bigint(13) NOT NULL COMMENT '计时起始时间时间',
UNIQUE KEY `key` (`oKey`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='报警频率表';
-- ----------------------------
-- Table structure for `notice`
-- ----------------------------
DROP TABLE IF EXISTS `notice`;
CREATE TABLE `notice` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`content` varchar(512) NOT NULL COMMENT '通知内容',
`status` tinyint(4) NOT NULL COMMENT '0:无效,1:有效',
`create_date` date NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='通知表';
-- ----------------------------
-- Table structure for `producer_stat`
-- ----------------------------
DROP TABLE IF EXISTS `producer_stat`;
CREATE TABLE `producer_stat` (
`total_id` int(11) NOT NULL COMMENT 'producer_total_stat id',
`broker` varchar(20) NOT NULL COMMENT 'broker',
`max` int(11) NOT NULL COMMENT '最大耗时',
`avg` double NOT NULL COMMENT '平均耗时',
`count` int(11) NOT NULL COMMENT '调用次数',
`exception` text COMMENT '异常记录',
KEY `total_id` (`total_id`,`broker`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='生产者统计';
-- ----------------------------
-- Table structure for `producer_total_stat`
-- ----------------------------
DROP TABLE IF EXISTS `producer_total_stat`;
CREATE TABLE `producer_total_stat` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`producer` varchar(255) NOT NULL COMMENT 'producer',
`client` varchar(100) NOT NULL COMMENT 'client',
`percent90` int(11) NOT NULL COMMENT '耗时百分位90',
`percent99` int(11) NOT NULL COMMENT '耗时百分位99',
`avg` double NOT NULL COMMENT '平均耗时',
`count` int(11) NOT NULL COMMENT '调用次数',
`create_date` int(11) NOT NULL COMMENT '创建日期',
`create_time` char(4) NOT NULL COMMENT '创建分钟,格式:HHMM',
`stat_time` int(11) NOT NULL COMMENT '统计时间',
`exception` text COMMENT '异常记录',
PRIMARY KEY (`id`),
UNIQUE KEY `producer` (`producer`,`stat_time`,`client`),
KEY `create_date` (`create_date`,`producer`),
KEY `date_client` (`create_date`,`client`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='生产者总体统计';
-- ----------------------------
-- Table structure for `server`
-- ----------------------------
DROP TABLE IF EXISTS `server`;
CREATE TABLE `server` (
`ip` varchar(16) NOT NULL COMMENT 'ip',
`machine_type` int(4) DEFAULT NULL COMMENT '机器类型:0-未知,1-物理机,2-虚拟机,3-docker',
`host` varchar(255) DEFAULT NULL COMMENT 'host',
`nmon` varchar(255) DEFAULT NULL COMMENT 'nmon version',
`cpus` tinyint(4) DEFAULT NULL COMMENT 'logic cpu num',
`cpu_model` varchar(255) DEFAULT NULL COMMENT 'cpu 型号',
`dist` varchar(255) DEFAULT NULL COMMENT '发行版信息',
`kernel` varchar(255) DEFAULT NULL COMMENT '内核信息',
`ulimit` varchar(255) DEFAULT NULL COMMENT 'ulimit -n,ulimit -u',
`updatetime` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`room` varchar(255) DEFAULT NULL COMMENT '机房',
PRIMARY KEY (`ip`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- ----------------------------
-- Table structure for `server_stat`
-- ----------------------------
DROP TABLE IF EXISTS `server_stat`;
CREATE TABLE `server_stat` (
`ip` varchar(16) NOT NULL COMMENT 'ip',
`cdate` date NOT NULL COMMENT '数据收集天',
`ctime` char(4) NOT NULL COMMENT '数据收集小时分钟',
`cuser` float DEFAULT NULL COMMENT '用户态占比',
`csys` float DEFAULT NULL COMMENT '内核态占比',
`cwio` float DEFAULT NULL COMMENT 'wio占比',
`c_ext` text COMMENT '子cpu占比',
`cload1` float DEFAULT NULL COMMENT '1分钟load',
`cload5` float DEFAULT NULL COMMENT '5分钟load',
`cload15` float DEFAULT NULL COMMENT '15分钟load',
`mtotal` float DEFAULT NULL COMMENT '总内存,单位M',
`mfree` float DEFAULT NULL COMMENT '空闲内存',
`mcache` float DEFAULT NULL COMMENT 'cache',
`mbuffer` float DEFAULT NULL COMMENT 'buffer',
`mswap` float DEFAULT NULL COMMENT 'cache',
`mswap_free` float DEFAULT NULL COMMENT 'cache',
`nin` float DEFAULT NULL COMMENT '网络入流量 单位K/s',
`nout` float DEFAULT NULL COMMENT '网络出流量 单位k/s',
`nin_ext` text COMMENT '各网卡入流量详情',
`nout_ext` text COMMENT '各网卡出流量详情',
`tuse` int(11) DEFAULT NULL COMMENT 'tcp estab连接数',
`torphan` int(11) DEFAULT NULL COMMENT 'tcp orphan连接数',
`twait` int(11) DEFAULT NULL COMMENT 'tcp time wait连接数',
`dread` float DEFAULT NULL COMMENT '磁盘读速率 单位K/s',
`dwrite` float DEFAULT NULL COMMENT '磁盘写速率 单位K/s',
`diops` float DEFAULT NULL COMMENT '磁盘io速率 交互次数/s',
`dbusy` float DEFAULT NULL COMMENT '磁盘io带宽使用百分比',
`d_ext` text COMMENT '磁盘各分区占比',
`dspace` text COMMENT '磁盘各分区空间使用率',
PRIMARY KEY (`ip`,`cdate`,`ctime`),
KEY `cdate` (`cdate`,`ctime`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- ----------------------------
-- Table structure for `shedlock`
-- ----------------------------
DROP TABLE IF EXISTS `shedlock`;
CREATE TABLE `shedlock` (
`name` varchar(64) NOT NULL DEFAULT '',
`lock_until` timestamp(3) NULL DEFAULT NULL,
`locked_at` timestamp(3) NULL DEFAULT NULL,
`locked_by` varchar(255) DEFAULT NULL,
PRIMARY KEY (`name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- ----------------------------
-- Table structure for `topic`
-- ----------------------------
DROP TABLE IF EXISTS `topic`;
CREATE TABLE `topic` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`cluster_id` int(11) NOT NULL COMMENT 'cluster id',
`name` varchar(64) NOT NULL COMMENT 'topic名',
`queue_num` int(11) NOT NULL COMMENT '队列长度',
`ordered` int(4) NOT NULL DEFAULT '0' COMMENT '0:无序,1:有序',
`count` int(11) DEFAULT NULL COMMENT 'topic put times',
`info` varchar(360) DEFAULT NULL COMMENT 'topic描述',
`trace_enabled` int(4) NOT NULL DEFAULT '0' COMMENT '0:不开启trace,1:开启trace',
`delay_enabled` int(4) NOT NULL DEFAULT '0' COMMENT '0:不发送延迟消息,1:发送延迟消息。注:此字段不强制该topic的消息类型',
`create_date` date NOT NULL,
`update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
`serializer` int(4) NOT NULL DEFAULT '0' COMMENT '序列化器 0:Protobuf,1:String',
`traffic_warn_enabled` int(4) NOT NULL DEFAULT '0' COMMENT '0:不开启流量预警,1:开启流量预警',
PRIMARY KEY (`id`),
UNIQUE KEY `name` (`name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='topic表';
-- ----------------------------
-- Table structure for `topic_traffic`
-- ----------------------------
DROP TABLE IF EXISTS `topic_traffic`;
CREATE TABLE `topic_traffic` (
`tid` int(11) NOT NULL COMMENT 'topic id',
`create_date` date NOT NULL COMMENT '数据收集天',
`create_time` char(4) NOT NULL COMMENT '数据收集小时分钟,格式:HHMM',
`count` bigint(20) DEFAULT NULL COMMENT 'topic put times',
`size` bigint(20) DEFAULT NULL COMMENT 'topic put size',
PRIMARY KEY (`tid`,`create_date`,`create_time`),
KEY `time` (`create_date`,`create_time`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='topic流量表';
-- ----------------------------
-- Table structure for `user`
-- ----------------------------
DROP TABLE IF EXISTS `user`;
CREATE TABLE `user` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(64) DEFAULT NULL COMMENT '用户名',
`email` varchar(64) NOT NULL COMMENT '邮箱',
`mobile` varchar(16) DEFAULT NULL COMMENT '手机',
`type` int(4) NOT NULL DEFAULT '0' COMMENT '0:普通用户,1:管理员',
`create_date` date NOT NULL,
`update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
`receive_notice` int(4) NOT NULL DEFAULT '0' COMMENT '是否接收各种通知,0:不接收,1:接收',
`password` varchar(256) COMMENT '登录方式采用用户名密码验证时使用',
PRIMARY KEY (`id`),
UNIQUE KEY `email` (`email`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='用户表';
-- ----------------------------
-- Table structure for `user_consumer`
-- ----------------------------
DROP TABLE IF EXISTS `user_consumer`;
CREATE TABLE `user_consumer` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`uid` int(11) NOT NULL COMMENT '用户id',
`tid` int(11) NOT NULL COMMENT 'topic id',
`consumer_id` int(11) DEFAULT NULL COMMENT 'consumer id',
PRIMARY KEY (`id`),
KEY `t_c` (`tid`,`consumer_id`),
KEY `u_t` (`uid`,`tid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='用户与消费者关系表';
-- ----------------------------
-- Table structure for `user_message`
-- ----------------------------
DROP TABLE IF EXISTS `user_message`;
CREATE TABLE `user_message` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`uid` int(11) NOT NULL COMMENT '用户id',
`message` varchar(512) NOT NULL COMMENT '消息内容',
`status` tinyint(4) NOT NULL COMMENT '0:未读,1:已读',
`create_date` datetime NOT NULL,
`update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
PRIMARY KEY (`id`),
KEY `uid` (`uid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='用户消息表';
-- ----------------------------
-- Table structure for `user_producer`
-- ----------------------------
DROP TABLE IF EXISTS `user_producer`;
CREATE TABLE `user_producer` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`uid` int(11) NOT NULL COMMENT '用户id',
`tid` int(11) NOT NULL COMMENT 'topic id',
`producer` varchar(64) NOT NULL COMMENT 'producer名',
PRIMARY KEY (`id`),
KEY `t_p` (`tid`,`producer`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='用户与生产者关系表';
-- ----------------------------
-- Table structure for `warn_config`
-- ----------------------------
DROP TABLE IF EXISTS `warn_config`;
CREATE TABLE `warn_config` (
`consumer` varchar(64) DEFAULT '' COMMENT 'consumer名,为空时代表默认(仅一条默认记录)',
`accumulate_time` int(11) DEFAULT '300000' COMMENT '堆积时间',
`accumulate_count` int(11) DEFAULT '10000' COMMENT '堆积数量',
`block_time` int(11) DEFAULT '10000' COMMENT '阻塞时间',
`consumer_fail_count` int(11) DEFAULT '10' COMMENT '消费失败数量',
`warn_unit_time` int(4) DEFAULT '1' COMMENT '报警频率的单位时间,单位小时',
`warn_unit_count` int(4) DEFAULT '2' COMMENT '报警频率在单位时间的次数',
`ignore_warn` int(4) DEFAULT '0' COMMENT '0:接收所有报警,1:不接收所有报警,此字段优先级最高',
unique key (`consumer`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='报警阈值配置表';
-- ----------------------------
-- Table structure for `name_server`
-- ----------------------------
DROP TABLE IF EXISTS `name_server`;
CREATE TABLE `name_server` (
`cid` int(11) NOT NULL COMMENT '集群id',
`addr` varchar(255) NOT NULL COMMENT 'name server 地址',
`create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`check_status` tinyint(4) DEFAULT 0 COMMENT '检测结果:0:未知,1:正常,2:异常',
`check_time` datetime COMMENT '检测时间',
`base_dir` varchar(360) DEFAULT '/opt/mqcloud/ns' COMMENT '安装路径',
UNIQUE KEY `cid` (`cid`,`addr`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='name server表';
-- ----------------------------
-- Table structure for `server_warn_config`
-- ----------------------------
DROP TABLE IF EXISTS `server_warn_config`;
CREATE TABLE `server_warn_config` (
`ip` varchar(15) NOT NULL COMMENT 'ip',
`memory_usage_rate` int(4) NOT NULL DEFAULT '0' COMMENT '内存使用率',
`load1` int(4) NOT NULL DEFAULT '0' COMMENT '一分钟load',
`connect` int(4) NOT NULL DEFAULT '0' COMMENT 'tcp连接数',
`wait` int(4) NOT NULL DEFAULT '0' COMMENT 'tcp等待数',
`iops` int(4) NOT NULL DEFAULT '0' COMMENT '磁盘io速率 交互次数/s',
`iobusy` int(4) NOT NULL DEFAULT '0' COMMENT '磁盘io带宽使用百分比',
`cpu_usage_rate` int(4) NOT NULL DEFAULT '0' COMMENT 'cpu使用率',
`net_in` int(4) NOT NULL DEFAULT '0' COMMENT '入网流量',
`net_out` int(4) NOT NULL DEFAULT '0' COMMENT '出网流量',
`io_usage_rate` int(4) NOT NULL DEFAULT '0' COMMENT '磁盘使用率',
UNIQUE KEY `ip` (`ip`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='服务器预警配置表';
-- ----------------------------
-- Table structure for `broker`
-- ----------------------------
DROP TABLE IF EXISTS `broker`;
CREATE TABLE `broker` (
`cid` int(11) NOT NULL COMMENT '集群id',
`addr` varchar(255) NOT NULL COMMENT 'broker 地址',
`broker_name` varchar(64) NOT NULL COMMENT 'broker名字',
`broker_id` int(4) NOT NULL COMMENT 'broker ID,0-master,1-slave',
`create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`check_status` tinyint(4) DEFAULT 0 COMMENT '检测结果:0:未知,1:正常,2:异常',
`check_time` datetime COMMENT '检测时间',
`base_dir` varchar(360) DEFAULT NULL COMMENT '安装路径',
UNIQUE KEY `cid` (`cid`,`addr`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='broker表';
-- ----------------------------
-- Table structure for `consumer_client_stat`
-- ----------------------------
DROP TABLE IF EXISTS `consumer_client_stat`;
CREATE TABLE `consumer_client_stat` (
`consumer` varchar(255) NOT NULL COMMENT 'consumer',
`client` varchar(20) NOT NULL COMMENT 'client',
`create_date` date NOT NULL COMMENT '创建日期',
KEY `cck` (`create_date`,`client`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='消费者客户端统计表';
-- ----------------------------
-- Table structure for `audit_batch_associate`
-- ----------------------------
DROP TABLE IF EXISTS `audit_batch_associate`;
CREATE TABLE `audit_batch_associate` (
`uids` text NOT NULL COMMENT '关联的用户id',
`aid` int(11) NOT NULL COMMENT '审核id',
`producer_ids` text NULL COMMENT '生产者id',
`consumer_ids` text NULL COMMENT '消费者id',
PRIMARY KEY (`aid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='审核批量关联';
-- ----------------------------
-- Table structure for `broker_store_stat`
-- ----------------------------
DROP TABLE IF EXISTS `broker_store_stat`;
CREATE TABLE `broker_store_stat` (
`cluster_id` int(11) NOT NULL COMMENT 'cluster_id',
`broker_ip` varchar(255) NOT NULL COMMENT 'broker ip',
`percent90` int(11) NOT NULL COMMENT '耗时百分位90',
`percent99` int(11) NOT NULL COMMENT '耗时百分位99',
`avg` double NOT NULL COMMENT '平均耗时',
`max` int(11) NOT NULL COMMENT '最大耗时',
`count` bigint(20) NOT NULL COMMENT '调用次数',
`create_date` int(11) NOT NULL COMMENT '创建日期',
`create_time` char(4) NOT NULL COMMENT '创建分钟,格式:HHMM',
`stat_time` int(11) NOT NULL COMMENT '统计时间',
PRIMARY KEY (`create_date`,`broker_ip`,`create_time`, `cluster_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='broker存储统计';
-- ----------------------------
-- user init
-- ----------------------------
INSERT INTO `user` VALUES ('1', 'admin', 'admin@admin.com', '18688888888', '1', '2018-10-01', '2018-10-01 09:49:00', '1', '21232f297a57a5a743894a0e4a801fc3');
-- ----------------------------
-- common_config init
-- ----------------------------
INSERT INTO `common_config` VALUES ('1', 'domain', '127.0.0.1:8080', 'mqcloud的域名');
INSERT INTO `common_config` VALUES ('5', 'serverUser', 'mqcloud', '服务器 ssh 用户');
INSERT INTO `common_config` VALUES ('6', 'serverPassword', '9j7t4SDJOIusddca+Mzd6Q==', '服务器 ssh 密码');
INSERT INTO `common_config` VALUES ('7', 'serverPort', '22', '服务器 ssh 端口');
INSERT INTO `common_config` VALUES ('8', 'serverConnectTimeout', '6000', '服务器 ssh 链接建立超时时间');
INSERT INTO `common_config` VALUES ('9', 'serverOPTimeout', '12000', '服务器 ssh 操作超时时间');
INSERT INTO `common_config` VALUES ('10', 'ciperKey', 'DJs32jslkdghDSDf', '密码助手的key,长度需为8的倍数');
INSERT INTO `common_config` VALUES ('12', 'operatorContact', '[{\"name\":\"admin\",\"phone\":\"010-1234\",\"mobile\":\"18688888888\",\"qq\":\"88888888\",\"email\":\"admin@admin.com\"}]', '运维人员json');
INSERT INTO `common_config`(`key`, `value`, `comment`) VALUES ('mailHost', 'smtp.xx.com', '邮件服务器域名');
INSERT INTO `common_config`(`key`, `value`, `comment`) VALUES ('mailUsername', 'xxx@xx.com', '邮件服务器用户');
INSERT INTO `common_config`(`key`, `value`, `comment`) VALUES ('mailPassword', '密码或授权码', '邮件服务器用户密码');
INSERT INTO `common_config`(`key`, `value`, `comment`) VALUES ('mailPort', '25', '邮件服务器端口');
INSERT INTO `common_config`(`key`, `value`, `comment`) VALUES ('mailProtocol', 'smtp', '邮件服务器通信协议');
INSERT INTO `common_config`(`key`, `value`, `comment`) VALUES ('mailTimeout', '10000', '邮件服务器超时时间');
INSERT INTO `common_config`(`key`, `value`, `comment`) VALUES ('isOpenRegister', '1', '是否开启注册功能:0-不开启,1-开启');
INSERT INTO `common_config`(`key`, `value`, `comment`) VALUES ('rocketmqFilePath', 'classpath:static/software/rocketmq.zip', 'rocketmq安装文件路径,支持以下三种资源加载方式,例如 1:classpath:static/software/rocketmq.zip 2:file:///tmp/rocketmq.zip 3:http://127.0.0.1:8080/software/rocketmq.zip');
INSERT INTO `common_config`(`key`, `comment`) VALUES ('privateKey', '私钥');
INSERT INTO `common_config`(`key`, `comment`) VALUES ('adminAccessKey', '管理员访问名(broker&nameserver使用)');
INSERT INTO `common_config`(`key`, `comment`) VALUES ('adminSecretKey', '管理员访问私钥(broker&nameserver使用)');
INSERT INTO `common_config`(`key`, `value`, `comment`) VALUES ('machineRoom', '["默认"]', '机房列表');
INSERT INTO `common_config`(`key`, `value`, `comment`) VALUES ('machineRoomColor', '["#95a5a6"]', '机房节点颜色');
INSERT INTO `common_config`(`key`, `value`, `comment`) VALUES ('queryMessageFromSlave', 'true', '是否从slave查询消息');
INSERT INTO `common_config`(`key`, `value`, `comment`) VALUES ('consumeFallBehindSize', '1073741824', '消费落后多少进行预警,单位byte');
INSERT INTO `common_config`(`key`, `value`, `comment`) VALUES ('messageTypeLocation', 'classpath*:msg-type/*.class', '消息序列化方式为protostuf并且发送为自定义类型时,需要配置消息类型的class路径,例如 1:classpath*:msg-type/*.class 2:jar:file:///tmp/msgType.jar!/**/*.class 3:jar:http://127.0.0.1:8080/msgType.jar!/**/*.class');
INSERT INTO `common_config`(`key`, `value`, `comment`) VALUES ('slaveFallBehindSize', '10485760', 'slave的commitlog落后master多少进行预警,单位byte');
-- ----------------------------
-- warn_config init
-- ----------------------------
INSERT INTO `warn_config`(accumulate_time,accumulate_count,block_time,consumer_fail_count,warn_unit_time,warn_unit_count,ignore_warn) VALUES (300000, 10000, 10000, 10, 1, 1, 0);
-- ----------------------------
-- notice init
-- ----------------------------
INSERT INTO `notice` (`content`, `status`, `create_date`) VALUES ('欢迎您使用MQCloud,为了更好为您的服务,请花一分钟时间看下快速指南,如果有任何问题,欢迎联系我们^_^', 1, now());
-- ----------------------------
-- user message init
-- ----------------------------
INSERT INTO `user_message` (`uid`, `message`, `status`, `create_date`) VALUES (1, 'Hello!Welcome to MQCloud!', 0, now());
-- ----------------------------
-- Table structure for `cluster_config`
-- ----------------------------
DROP TABLE IF EXISTS `cluster_config`;
CREATE TABLE `cluster_config` (
`cid` int(11) NOT NULL COMMENT '集群id',
`bid` int(11) NOT NULL COMMENT 'broker config id',
`online_value` varchar(256) COMMENT '线上值',
UNIQUE KEY `cid_key` (`cid`,`bid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- ----------------------------
-- Table structure for `broker_config_group`
-- ----------------------------
DROP TABLE IF EXISTS `broker_config_group`;
CREATE TABLE `broker_config_group` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`group` varchar(255) NOT NULL COMMENT '配置组',
`order` int(11) NOT NULL COMMENT '序号小排前',
PRIMARY KEY (`id`),
UNIQUE KEY `group_key` (`group`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- ----------------------------
-- Table structure for `broker_config`
-- ----------------------------
DROP TABLE IF EXISTS `broker_config`;
CREATE TABLE `broker_config` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`gid` int(11) NOT NULL COMMENT '组id',
`key` varchar(255) NOT NULL COMMENT '配置key',
`value` varchar(256) COMMENT '配置值',
`desc` varchar(256) COMMENT '描述',
`tip` varchar(256) COMMENT '提示',
`order` int(11) NOT NULL COMMENT '序号小排前',
`dynamic_modify` tinyint(4) NOT NULL COMMENT '0:修改后需要重启,1:修改后实时生效',
`option` varchar(256) COMMENT '选项',
`required` tinyint(4) DEFAULT 0 COMMENT '0:可选配置,1:必选配置',
PRIMARY KEY (`id`),
UNIQUE KEY `bkey` (`key`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- ----------------------------
-- Table structure for `audit_consumer_config`
-- ----------------------------
DROP TABLE IF EXISTS `audit_consumer_config`;
CREATE TABLE `audit_consumer_config` (
`aid` int(11) NOT NULL COMMENT '审核id',
`consumer_id` int(11) DEFAULT NULL COMMENT 'consumer id',
`permits_per_second` float DEFAULT NULL COMMENT 'qps',
`enable_rate_limit` tinyint(4) DEFAULT NULL COMMENT '0:不限速,1:限速',
`pause` tinyint(4) DEFAULT NULL COMMENT '0:不暂停,1:暂停',
`pause_client_id` varchar(255) DEFAULT NULL COMMENT '暂停的客户端Id'
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='审核消费者配置相关表';
-- ----------------------------
-- Table structure for `consumer_config`
-- ----------------------------
DROP TABLE IF EXISTS `consumer_config`;
CREATE TABLE `consumer_config` (
`consumer` varchar(64) NOT NULL COMMENT 'consumer名',
`retry_message_reset_to` bigint(20) DEFAULT NULL COMMENT '重置至时间戳,小于此时间的都将不再消息',
`permits_per_second` float DEFAULT NULL COMMENT 'qps',
`enable_rate_limit` tinyint(4) DEFAULT NULL COMMENT '0:不限速,1:限速',
`pause` tinyint(4) DEFAULT NULL COMMENT '0:不暂停,1:暂停',
`pause_client_id` varchar(255) DEFAULT NULL COMMENT '暂停的客户端Id',
`update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
UNIQUE KEY `consumer` (`consumer`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='客户端配置表';
-- ----------------------------
-- Table structure for `topic_traffic_stat`
-- ----------------------------
DROP TABLE IF EXISTS `topic_traffic_stat`;
CREATE TABLE `topic_traffic_stat` (
`tid` int(11) NOT NULL COMMENT 'topic id',
`avg_max` bigint(20) NOT NULL COMMENT '指定天数内,每天流量最大值的平均值',
`max_max` bigint(20) NOT NULL COMMENT '指定天数内,去除异常点后流量的最大值',
`days` int(4) NOT NULL COMMENT '指定统计流量的天数',
`update_date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
PRIMARY KEY (`tid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='topic流量统计表';
-- ----------------------------
-- `broker_config_group` record
-- ----------------------------
insert into broker_config_group(`id`, `group`, `order`) values(1, '常见配置', 1);
insert into broker_config_group(`id`, `group`, `order`) values(2, '发现机制', 2);
insert into broker_config_group(`id`, `group`, `order`) values(3, 'topic&订阅', 3);
insert into broker_config_group(`id`, `group`, `order`) values(4, '写入限流机制', 4);
insert into broker_config_group(`id`, `group`, `order`) values(5, '请求处理线程池', 5);
insert into broker_config_group(`id`, `group`, `order`) values(6, '内存预热', 6);
insert into broker_config_group(`id`, `group`, `order`) values(7, 'CommitLog相关', 7);
insert into broker_config_group(`id`, `group`, `order`) values(8, 'ConsumeQueue相关', 8);
insert into broker_config_group(`id`, `group`, `order`) values(9, '堆外内存相关', 9);
insert into broker_config_group(`id`, `group`, `order`) values(10, 'HA机制', 10);
insert into broker_config_group(`id`, `group`, `order`) values(11, '数据文件保留机制', 11);
insert into broker_config_group(`id`, `group`, `order`) values(12, '消息相关', 12);
insert into broker_config_group(`id`, `group`, `order`) values(13, '消费优化', 13);
insert into broker_config_group(`id`, `group`, `order`) values(14, '拉取消息', 14);
insert into broker_config_group(`id`, `group`, `order`) values(15, '快速失败机制', 15);
insert into broker_config_group(`id`, `group`, `order`) values(16, 'broker保护机制', 16);
insert into broker_config_group(`id`, `group`, `order`) values(17, '注册相关', 17);
insert into broker_config_group(`id`, `group`, `order`) values(18, '事务相关', 18);
insert into broker_config_group(`id`, `group`, `order`) values(19, 'salve相关', 19);
insert into broker_config_group(`id`, `group`, `order`) values(20, 'filter相关', 20);
insert into broker_config_group(`id`, `group`, `order`) values(21, 'netty server相关', 21);
insert into broker_config_group(`id`, `group`, `order`) values(22, 'netty client相关', 22);
insert into broker_config_group(`id`, `group`, `order`) values(23, 'rpc消息', 23);
insert into broker_config_group(`id`, `group`, `order`) values(24, '其他配置', 24);
-- ----------------------------
-- `broker_config` record
-- ----------------------------
insert into broker_config(`gid`, `key`, `value`, `desc`, `tip`, `order`, `dynamic_modify`, `option`, `required`) values(1, 'brokerName', null, 'broker名', null, 1, 0, null, 1);
insert into broker_config(`gid`, `key`, `value`, `desc`, `tip`, `order`, `dynamic_modify`, `option`, `required`) values(1, 'rocketmqHome', null, 'broker安装目录', '启动脚本中已经设置,无需再设置', 2, 0, null, 0);
insert into broker_config(`gid`, `key`, `value`, `desc`, `tip`, `order`, `dynamic_modify`, `option`, `required`) values(1, 'brokerRole', 'ASYNC_MASTER', 'broker角色', null, 3, 0, 'ASYNC_MASTER:异步复制master;SYNC_MASTER:同步双写master;SLAVE:slave;', 1);
insert into broker_config(`gid`, `key`, `value`, `desc`, `tip`, `order`, `dynamic_modify`, `option`, `required`) values(1, 'flushDiskType', 'ASYNC_FLUSH', '刷盘机制', null, 4, 0, 'ASYNC_FLUSH:异步刷盘;SYNC_FLUSH:同步刷盘;', 1);
insert into broker_config(`gid`, `key`, `value`, `desc`, `tip`, `order`, `dynamic_modify`, `option`, `required`) values(1, 'brokerIP1', null, 'broker的ip', '服务器ip,尤其对于多网卡情况', 5, 0, null, 1);
insert into broker_config(`gid`, `key`, `value`, `desc`, `tip`, `order`, `dynamic_modify`, `option`, `required`) values(1, 'brokerIP2', null, 'master HA ip', '与brokerIP1一致', 6, 0, null, 1);
insert into broker_config(`gid`, `key`, `value`, `desc`, `tip`, `order`, `dynamic_modify`, `option`, `required`) values(1, 'listenPort', '10911', 'broker监听端口', null, 7, 0, null, 1);
insert into broker_config(`gid`, `key`, `value`, `desc`, `tip`, `order`, `dynamic_modify`, `option`, `required`) values(1, 'brokerClusterName', null, '集群名', null, 8, 0, null, 1);
insert into broker_config(`gid`, `key`, `value`, `desc`, `tip`, `order`, `dynamic_modify`, `option`, `required`) values(1, 'brokerId', '0', '0:master,非0:slave', null, 9, 0, null, 1);
insert into broker_config(`gid`, `key`, `value`, `desc`, `tip`, `order`, `dynamic_modify`, `option`, `required`) values(1, 'brokerPermission', '6', 'broker权限', 'broker下线可以设置为只读', 10, 1, '2:只写;4:只读;6:读写', 0);
insert into broker_config(`gid`, `key`, `value`, `desc`, `tip`, `order`, `dynamic_modify`, `option`, `required`) values(1, 'storePathRootDir', null, '数据文件存储根目录', '务必设置', 11, 0, null, 1);
insert into broker_config(`gid`, `key`, `value`, `desc`, `tip`, `order`, `dynamic_modify`, `option`, `required`) values(1, 'storePathCommitLog', null, 'CommitLog文件存储根目录', '务必设置', 12, 0, null, 1);
insert into broker_config(`gid`, `key`, `value`, `desc`, `tip`, `order`, `dynamic_modify`, `option`, `required`) values(2, 'namesrvAddr', null, 'namesrv地址', '若采用域名寻址模式无需设置', 1, 0, null, 0);
insert into broker_config(`gid`, `key`, `value`, `desc`, `tip`, `order`, `dynamic_modify`, `option`, `required`) values(2, 'fetchNamesrvAddrByAddressServer', 'true', '域名方式获取NameServer地址', '若配置namesrvAddr无需设置此项', 2, 0, 'true:是;false:否;', 1);
insert into broker_config(`gid`, `key`, `value`, `desc`, `tip`, `order`, `dynamic_modify`, `option`, `required`) values(2, 'rmqAddressServerDomain', null, 'NameServer地址域名', null, 3, 0, null, 1);
insert into broker_config(`gid`, `key`, `value`, `desc`, `tip`, `order`, `dynamic_modify`, `option`, `required`) values(2, 'rmqAddressServerSubGroup', null, 'NameServer地址域名子路径', null, 4, 0, null, 1);
insert into broker_config(`gid`, `key`, `value`, `desc`, `tip`, `order`, `dynamic_modify`, `option`, `required`) values(3, 'autoCreateTopicEnable', 'true', '发送消息时没有topic自动创建', '线上建议设置为false', 1, 0, 'true:是;false:否;', 0);
insert into broker_config(`gid`, `key`, `value`, `desc`, `tip`, `order`, `dynamic_modify`, `option`, `required`) values(3, 'autoCreateSubscriptionGroup', 'true', '自动创建订阅组', '线上建议设置为false', 2, 1, 'true:是;false:否;', 0);
insert into broker_config(`gid`, `key`, `value`, `desc`, `tip`, `order`, `dynamic_modify`, `option`, `required`) values(3, 'defaultTopicQueueNums', '8', 'autoCreateTopicEnable为true时,创建topic的队列数', '无需修改', 3, 0, null, 0);
insert into broker_config(`gid`, `key`, `value`, `desc`, `tip`, `order`, `dynamic_modify`, `option`, `required`) values(3, 'clusterTopicEnable', 'true', '自动创建以cluster为名字的topic', null, 4, 0, 'true:是;false:否;', 0);
insert into broker_config(`gid`, `key`, `value`, `desc`, `tip`, `order`, `dynamic_modify`, `option`, `required`) values(3, 'brokerTopicEnable', 'true', '自动创建以broker为名字的topic', null, 5, 0, 'true:是;false:否;', 0);
insert into broker_config(`gid`, `key`, `value`, `desc`, `tip`, `order`, `dynamic_modify`, `option`, `required`) values(3, 'traceTopicEnable', 'false', '是否启用trace topic', null, 6, 0, 'true:是;false:否;', 0);
insert into broker_config(`gid`, `key`, `value`, `desc`, `tip`, `order`, `dynamic_modify`, `option`, `required`) values(3, 'msgTraceTopicName', 'RMQ_SYS_TRACE_TOPIC', '默认的trace topic名', null, 7, 0, null, 0);
insert into broker_config(`gid`, `key`, `value`, `desc`, `tip`, `order`, `dynamic_modify`, `option`, `required`) values(4, 'useReentrantLockWhenPutMessage', 'false', '写消息是否使用重入锁', '若不使用建议配合transientStorePool使用;若使用要加大sendMessageThreadPoolNums', 1, 0, 'true:是;false:否;', 1);
insert into broker_config(`gid`, `key`, `value`, `desc`, `tip`, `order`, `dynamic_modify`, `option`, `required`) values(4, 'sendMessageThreadPoolNums', '1', '处理发消息的线程池大小', '默认使用spin锁', 2, 0, null, 1);
insert into broker_config(`gid`, `key`, `value`, `desc`, `tip`, `order`, `dynamic_modify`, `option`, `required`) values(4, 'waitTimeMillsInSendQueue', '200', '消息发送请求超过阈值没有处理则返回失败', '若出现broker busy建议调大', 3, 1, null, 1);
insert into broker_config(`gid`, `key`, `value`, `desc`, `tip`, `order`, `dynamic_modify`, `option`, `required`) values(5, 'sendThreadPoolQueueCapacity', '10000', '处理发消息的线程池队列大小', null, 2, 0, null, 0);
insert into broker_config(`gid`, `key`, `value`, `desc`, `tip`, `order`, `dynamic_modify`, `option`, `required`) values(5, 'pullMessageThreadPoolNums', '16+核数*2', '处理拉消息的线程池大小', null, 3, 0, null, 0);
insert into broker_config(`gid`, `key`, `value`, `desc`, `tip`, `order`, `dynamic_modify`, `option`, `required`) values(5, 'pullThreadPoolQueueCapacity', '100000', '处理拉消息的线程池队列大小', null, 4, 0, null, 0);
insert into broker_config(`gid`, `key`, `value`, `desc`, `tip`, `order`, `dynamic_modify`, `option`, `required`) values(5, 'queryMessageThreadPoolNums', '8+核数', '处理消息查询的线程池大小', null, 5, 0, null, 0);
insert into broker_config(`gid`, `key`, `value`, `desc`, `tip`, `order`, `dynamic_modify`, `option`, `required`) values(5, 'queryThreadPoolQueueCapacity', '20000', '处理消息查询的线程池队列大小', null, 6, 0, null, 0);
insert into broker_config(`gid`, `key`, `value`, `desc`, `tip`, `order`, `dynamic_modify`, `option`, `required`) values(5, 'adminBrokerThreadPoolNums', '16', '处理admin请求的线程池大小', null, 7, 0, null, 0);
insert into broker_config(`gid`, `key`, `value`, `desc`, `tip`, `order`, `dynamic_modify`, `option`, `required`) values(5, 'clientManageThreadPoolNums', '32', '处理客户端(解注册等)的线程池大小', null, 8, 0, null, 0);
insert into broker_config(`gid`, `key`, `value`, `desc`, `tip`, `order`, `dynamic_modify`, `option`, `required`) values(5, 'clientManagerThreadPoolQueueCapacity', '1000000', '处理客户端(解注册等)的线程池队列大小', null, 9, 0, null, 0);
insert into broker_config(`gid`, `key`, `value`, `desc`, `tip`, `order`, `dynamic_modify`, `option`, `required`) values(5, 'consumerManageThreadPoolNums', '32', '处理消费者请求的线程池大小', null, 10, 0, null, 0);
insert into broker_config(`gid`, `key`, `value`, `desc`, `tip`, `order`, `dynamic_modify`, `option`, `required`) values(5, 'consumerManagerThreadPoolQueueCapacity', '1000000', '处理消费者请求的线程池队列大小', null, 11, 0, null, 0);
insert into broker_config(`gid`, `key`, `value`, `desc`, `tip`, `order`, `dynamic_modify`, `option`, `required`) values(5, 'heartbeatThreadPoolNums', 'min(32, 核数)', '处理客户端心跳的线程池大小', null, 12, 0, null, 0);
insert into broker_config(`gid`, `key`, `value`, `desc`, `tip`, `order`, `dynamic_modify`, `option`, `required`) values(5, 'heartbeatThreadPoolQueueCapacity', '50000', '处理客户端心跳的线程池队列大小', null, 13, 0, null, 0);
insert into broker_config(`gid`, `key`, `value`, `desc`, `tip`, `order`, `dynamic_modify`, `option`, `required`) values(5, 'endTransactionThreadPoolNums', '8+核数*2', '处理结束事务请求的线程池大小', null, 14, 0, null, 0);
insert into broker_config(`gid`, `key`, `value`, `desc`, `tip`, `order`, `dynamic_modify`, `option`, `required`) values(5, 'endTransactionPoolQueueCapacity', '100000', '处理结束事务请求的线程池队列大小', null, 15, 0, null, 0);
insert into broker_config(`gid`, `key`, `value`, `desc`, `tip`, `order`, `dynamic_modify`, `option`, `required`) values(6, 'warmMapedFileEnable', 'false', 'mmap时进行是否进行内存预热,避免缺页异常', null, 1, 1, 'true:是;false:否;', 0);
insert into broker_config(`gid`, `key`, `value`, `desc`, `tip`, `order`, `dynamic_modify`, `option`, `required`) values(6, 'flushLeastPagesWhenWarmMapedFile', '4096', '预热时同时刷多少页内存(同步刷盘时)', null, 2, 1, null, 0);
insert into broker_config(`gid`, `key`, `value`, `desc`, `tip`, `order`, `dynamic_modify`, `option`, `required`) values(7, 'mappedFileSizeCommitLog', '1073741824', 'CommitLog文件大小', '默认大小1G,如非必要请勿修改', 1, 0, null, 0);
insert into broker_config(`gid`, `key`, `value`, `desc`, `tip`, `order`, `dynamic_modify`, `option`, `required`) values(7, 'flushIntervalCommitLog', '500', '异步刷盘时间间隔', '单位ms', 2, 1, null, 0);
insert into broker_config(`gid`, `key`, `value`, `desc`, `tip`, `order`, `dynamic_modify`, `option`, `required`) values(7, 'flushCommitLogTimed', 'false', '是否定时刷CommitLog,若否会实时刷', null, 3, 1, 'true:是;false:否;', 0);
insert into broker_config(`gid`, `key`, `value`, `desc`, `tip`, `order`, `dynamic_modify`, `option`, `required`) values(7, 'flushCommitLogLeastPages', '4', '最少凑够多少页内存才刷CommitLog', null, 4, 1, null, 0);
insert into broker_config(`gid`, `key`, `value`, `desc`, `tip`, `order`, `dynamic_modify`, `option`, `required`) values(7, 'flushCommitLogThoroughInterval', '10000', '两次刷CommitLog最大间隔,若超过,不校验页数直接刷', '单位ms,默认10秒', 5, 1, null, 0);
insert into broker_config(`gid`, `key`, `value`, `desc`, `tip`, `order`, `dynamic_modify`, `option`, `required`) values(7, 'syncFlushTimeout', '5000', '同步刷CommitLog超时时间', '单位ms,默认5秒', 6, 1, null, 0);
insert into broker_config(`gid`, `key`, `value`, `desc`, `tip`, `order`, `dynamic_modify`, `option`, `required`) values(8, 'mappedFileSizeConsumeQueue', '6000000', 'ConsumeQueue文件存储的条目', '默认为30万,如非必要请勿修改', 1, 0, null, 0);
insert into broker_config(`gid`, `key`, `value`, `desc`, `tip`, `order`, `dynamic_modify`, `option`, `required`) values(8, 'flushIntervalConsumeQueue', '1000', '异步刷ConsumeQueue时间间隔', '单位ms,默认1秒', 2, 1, null, 0);
insert into broker_config(`gid`, `key`, `value`, `desc`, `tip`, `order`, `dynamic_modify`, `option`, `required`) values(8, 'flushConsumeQueueLeastPages', '2', '最少凑够多少页内存才刷ConsumeQueue', null, 3, 1, null, 0);
insert into broker_config(`gid`, `key`, `value`, `desc`, `tip`, `order`, `dynamic_modify`, `option`, `required`) values(8, 'flushConsumeQueueThoroughInterval', '60000', '两次刷ConsumeQueue最大间隔,若超过,不校验页数直接刷', '单位ms,默认1分钟', 4, 1, null, 0);
insert into broker_config(`gid`, `key`, `value`, `desc`, `tip`, `order`, `dynamic_modify`, `option`, `required`) values(9, 'transientStorePoolEnable', 'false', '是否启动堆外内存池加速写', null, 1, 0, 'true:是;false:否;', 0);
insert into broker_config(`gid`, `key`, `value`, `desc`, `tip`, `order`, `dynamic_modify`, `option`, `required`) values(9, 'transientStorePoolSize', '5', '堆外内存池大小', null, 2, 0, null, 0);
insert into broker_config(`gid`, `key`, `value`, `desc`, `tip`, `order`, `dynamic_modify`, `option`, `required`) values(9, 'fastFailIfNoBufferInStorePool', 'false', '是否启用快速失败', null, 3, 0, 'true:是;false:否;', 0);
insert into broker_config(`gid`, `key`, `value`, `desc`, `tip`, `order`, `dynamic_modify`, `option`, `required`) values(9, 'commitIntervalCommitLog', '200', '异步刷堆外内存时间间隔', '单位ms', 4, 1, null, 0);
insert into broker_config(`gid`, `key`, `value`, `desc`, `tip`, `order`, `dynamic_modify`, `option`, `required`) values(9, 'commitCommitLogLeastPages', '4', '最少凑够多少页内存才刷堆外内存', null, 5, 1, null, 0);
insert into broker_config(`gid`, `key`, `value`, `desc`, `tip`, `order`, `dynamic_modify`, `option`, `required`) values(9, 'commitCommitLogThoroughInterval', '200', '两次刷堆外内存最大间隔,若超过,不校验页数直接刷', '单位ms', 6, 1, null, 0);
insert into broker_config(`gid`, `key`, `value`, `desc`, `tip`, `order`, `dynamic_modify`, `option`, `required`) values(10, 'haListenPort', '10912', 'master监听的HA端口', null, 1, 0, null, 0);
insert into broker_config(`gid`, `key`, `value`, `desc`, `tip`, `order`, `dynamic_modify`, `option`, `required`) values(10, 'haHousekeepingInterval', '20000', 'master与slave链接超时间隔', '单位ms,默认20秒', 2, 1, null, 0);
insert into broker_config(`gid`, `key`, `value`, `desc`, `tip`, `order`, `dynamic_modify`, `option`, `required`) values(10, 'haTransferBatchSize', '32768', 'master批量传输给slave数据大小', '单位字节,默认32K', 3, 1, null, 0);
insert into broker_config(`gid`, `key`, `value`, `desc`, `tip`, `order`, `dynamic_modify`, `option`, `required`) values(10, 'haSlaveFallbehindMax', '268435456', '同步双写master,判断slave落后大于多少为不可用', '单位字节,默认256M', 4, 1, null, 0);
insert into broker_config(`gid`, `key`, `value`, `desc`, `tip`, `order`, `dynamic_modify`, `option`, `required`) values(11, 'fileReservedTime', '72', 'CommitLog保留的时间', '单位小时,默认3天', 1, 1, null, 0);
insert into broker_config(`gid`, `key`, `value`, `desc`, `tip`, `order`, `dynamic_modify`, `option`, `required`) values(11, 'deleteWhen', '04', 'CommitLog删除时间点,多个用;分隔', null, 2, 1, null, 0);
insert into broker_config(`gid`, `key`, `value`, `desc`, `tip`, `order`, `dynamic_modify`, `option`, `required`) values(11, 'destroyMapedFileIntervalForcibly', '120000', '删除文件时,若文件被占用,等待多久后强制删除', '单位ms,默认2分钟', 3, 1, null, 0);
insert into broker_config(`gid`, `key`, `value`, `desc`, `tip`, `order`, `dynamic_modify`, `option`, `required`) values(11, 'cleanFileForciblyEnable', 'true', '磁盘超过阈值、且无过期文件情况下, 是否强制删除文件', null, 4, 1, 'true:是;false:否;', 0);
insert into broker_config(`gid`, `key`, `value`, `desc`, `tip`, `order`, `dynamic_modify`, `option`, `required`) values(11, 'diskMaxUsedSpaceRatio', '75', '磁盘最大使用阈值', null, 5, 1, null, 0);
insert into broker_config(`gid`, `key`, `value`, `desc`, `tip`, `order`, `dynamic_modify`, `option`, `required`) values(11, 'deleteCommitLogFilesInterval', '100', '删除CommitLog间隔,中间将sleep', '单位ms', 6, 1, null, 0);
insert into broker_config(`gid`, `key`, `value`, `desc`, `tip`, `order`, `dynamic_modify`, `option`, `required`) values(11, 'deleteConsumeQueueFilesInterval', '100', '删除ConsumeQueue间隔,中间将sleep', '单位ms', 7, 1, null, 0);
insert into broker_config(`gid`, `key`, `value`, `desc`, `tip`, `order`, `dynamic_modify`, `option`, `required`) values(11, 'redeleteHangedFileInterval', '120000', '重新删除已经执行过删除却未删掉的文件间隔', '单位ms,默认2分钟', 8, 1, null, 0);
insert into broker_config(`gid`, `key`, `value`, `desc`, `tip`, `order`, `dynamic_modify`, `option`, `required`) values(12, 'maxMessageSize', '4194304', '单条消息最大大小', '单位字节,默认4M', 1, 0, null, 0);
insert into broker_config(`gid`, `key`, `value`, `desc`, `tip`, `order`, `dynamic_modify`, `option`, `required`) values(12, 'messageIndexEnable', 'true', '消息是否开启索引', null, 2, 0, 'true:是;false:否;', 0);
insert into broker_config(`gid`, `key`, `value`, `desc`, `tip`, `order`, `dynamic_modify`, `option`, `required`) values(12, 'messageIndexSafe', 'false', '消息索引恢复时是否安全校验', null, 3, 0, 'true:是;false:否;', 0);
insert into broker_config(`gid`, `key`, `value`, `desc`, `tip`, `order`, `dynamic_modify`, `option`, `required`) values(12, 'maxHashSlotNum', '5000000', '单个消息文件hash槽个数', '默认5百万', 4, 0, null, 0);
insert into broker_config(`gid`, `key`, `value`, `desc`, `tip`, `order`, `dynamic_modify`, `option`, `required`) values(12, 'maxIndexNum', '20000000', '单个消息文件hash槽个数', '默认2千万', 5, 0, null, 0);
insert into broker_config(`gid`, `key`, `value`, `desc`, `tip`, `order`, `dynamic_modify`, `option`, `required`) values(12, 'messageDelayLevel', '1s 5s 10s 30s 1m 2m 3m 4m 5m 6m 7m 8m 9m 10m 20m 30m 1h 2h', '延迟消息队列', null, 6, 0, null, 0);
insert into broker_config(`gid`, `key`, `value`, `desc`, `tip`, `order`, `dynamic_modify`, `option`, `required`) values(13, 'slaveReadEnable', 'false', '拉取消息在硬盘时是否可以从slave拉取', '设置为true分担master压力', 1, 1, 'true:是;false:否;', 0);
insert into broker_config(`gid`, `key`, `value`, `desc`, `tip`, `order`, `dynamic_modify`, `option`, `required`) values(13, 'longPollingEnable', 'true', '针对消费拉消息是否开启长轮询', null, 2, 1, 'true:是;false:否;', 0);
insert into broker_config(`gid`, `key`, `value`, `desc`, `tip`, `order`, `dynamic_modify`, `option`, `required`) values(13, 'shortPollingTimeMills', '1000', '针对消费拉消息短轮询时间', '单位ms,默认1秒', 3, 1, null, 0);
insert into broker_config(`gid`, `key`, `value`, `desc`, `tip`, `order`, `dynamic_modify`, `option`, `required`) values(13, 'notifyConsumerIdsChangedEnable', 'true', '消费者上下线时是否通知客户端,以便再平衡', null, 4, 1, 'true:是;false:否;', 0);
insert into broker_config(`gid`, `key`, `value`, `desc`, `tip`, `order`, `dynamic_modify`, `option`, `required`) values(13, 'transferMsgByHeap', 'true', '传输数据时是否使用零拷贝', '若消息量不大,基本都在pagecache,建议为false.否则消息在硬盘使用零拷贝会卡netty线程', 5, 1, 'true:是;false:否;', 0);
insert into broker_config(`gid`, `key`, `value`, `desc`, `tip`, `order`, `dynamic_modify`, `option`, `required`) values(14, 'accessMessageInMemoryMaxRatio', '40', '判断消息是否在内存的依据,此值仅为预估值,不准确', null, 1, 1, null, 0);
insert into broker_config(`gid`, `key`, `value`, `desc`, `tip`, `order`, `dynamic_modify`, `option`, `required`) values(14, 'maxTransferBytesOnMessageInMemory', '262144', '单次拉取内存消息传输的最大字节', '单位字节,默认256K', 2, 1, null, 0);
insert into broker_config(`gid`, `key`, `value`, `desc`, `tip`, `order`, `dynamic_modify`, `option`, `required`) values(14, 'maxTransferCountOnMessageInMemory', '32', '单次拉取内存消息传输的最大数量', null, 3, 1, null, 0);
insert into broker_config(`gid`, `key`, `value`, `desc`, `tip`, `order`, `dynamic_modify`, `option`, `required`) values(14, 'maxTransferBytesOnMessageInDisk', '65536', '单次拉取硬盘消息传输的最大字节', '单位字节,默认64K', 4, 1, null, 0);
insert into broker_config(`gid`, `key`, `value`, `desc`, `tip`, `order`, `dynamic_modify`, `option`, `required`) values(14, 'maxTransferCountOnMessageInDisk', '8', '单次拉取硬盘消息传输的最大数量', null, 5, 1, null, 0);
insert into broker_config(`gid`, `key`, `value`, `desc`, `tip`, `order`, `dynamic_modify`, `option`, `required`) values(14, 'maxMsgsNumBatch', '64', '按照key查询一次返回多少条消息(主要用于admin工具查询)', null, 6, 1, null, 0);
insert into broker_config(`gid`, `key`, `value`, `desc`, `tip`, `order`, `dynamic_modify`, `option`, `required`) values(14, 'defaultQueryMaxNum', '32', '按照msgId查询一次返回多少条消息(主要用于admin工具查询)', null, 7, 1, null, 0);
insert into broker_config(`gid`, `key`, `value`, `desc`, `tip`, `order`, `dynamic_modify`, `option`, `required`) values(15, 'osPageCacheBusyTimeOutMills', '1000', '消息存储超过此时间,则将丢弃所有的写入请求', '单位ms,默认1秒', 1, 1, null, 0);
insert into broker_config(`gid`, `key`, `value`, `desc`, `tip`, `order`, `dynamic_modify`, `option`, `required`) values(15, 'brokerFastFailureEnable', 'true', '是否启用快速失败机制', null, 2, 1, 'true:是;false:否;', 0);
insert into broker_config(`gid`, `key`, `value`, `desc`, `tip`, `order`, `dynamic_modify`, `option`, `required`) values(15, 'waitTimeMillsInPullQueue', '5000', '消息拉取请求超过阈值没有处理则返回失败', '单位ms,默认5秒', 4, 1, null, 0);
insert into broker_config(`gid`, `key`, `value`, `desc`, `tip`, `order`, `dynamic_modify`, `option`, `required`) values(15, 'waitTimeMillsInHeartbeatQueue', '31000', 'client心跳请求超过阈值没有处理则返回失败', '单位ms,默认31秒', 5, 1, null, 0);
insert into broker_config(`gid`, `key`, `value`, `desc`, `tip`, `order`, `dynamic_modify`, `option`, `required`) values(15, 'waitTimeMillsInTransactionQueue', '3000', '事务结束请求超过阈值没有处理则返回失败', '单位ms,默认3秒', 6, 1, null, 0);
insert into broker_config(`gid`, `key`, `value`, `desc`, `tip`, `order`, `dynamic_modify`, `option`, `required`) values(16, 'startAcceptSendRequestTimeStamp', '0', 'broker启动多久后可以接受请求', '单位ms,默认0ms', 1, 1, null, 0);
insert into broker_config(`gid`, `key`, `value`, `desc`, `tip`, `order`, `dynamic_modify`, `option`, `required`) values(16, 'disableConsumeIfConsumerReadSlowly', 'false', '是否禁用消费慢的消费者', '启用slaveReadEnable代替此功能', 2, 1, 'true:是;false:否;', 0);
insert into broker_config(`gid`, `key`, `value`, `desc`, `tip`, `order`, `dynamic_modify`, `option`, `required`) values(16, 'consumerFallbehindThreshold', '17179869184', '消费者拉取消息大小超过此值认为消费慢', '单位字节,默认16G', 3, 1, null, 0);
insert into broker_config(`gid`, `key`, `value`, `desc`, `tip`, `order`, `dynamic_modify`, `option`, `required`) values(16, 'diskFallRecorded', 'true', '记录消费者拉取消息大小', '不启用disableConsumeIfConsumerReadSlowly可以选否', 4, 1, 'true:是;false:否;', 0);
insert into broker_config(`gid`, `key`, `value`, `desc`, `tip`, `order`, `dynamic_modify`, `option`, `required`) values(17, 'compressedRegister', 'false', '向NameServer注册时数据是否压缩', 'topic过多可以开启', 1, 1, 'true:是;false:否;', 0);
insert into broker_config(`gid`, `key`, `value`, `desc`, `tip`, `order`, `dynamic_modify`, `option`, `required`) values(17, 'forceRegister', 'true', '向NameServer注册时是否强制每次发送数据', 'topic过多可以关闭', 2, 1, 'true:是;false:否;', 0);
insert into broker_config(`gid`, `key`, `value`, `desc`, `tip`, `order`, `dynamic_modify`, `option`, `required`) values(17, 'registerNameServerPeriod', '30000', '向NameServer注册周期', '单位ms,默认30秒', 3, 0, null, 0);
insert into broker_config(`gid`, `key`, `value`, `desc`, `tip`, `order`, `dynamic_modify`, `option`, `required`) values(17, 'registerBrokerTimeoutMills', '6000', '向NameServer注册时超时时间', '单位ms,默认6秒', 4, 1, null, 0);
insert into broker_config(`gid`, `key`, `value`, `desc`, `tip`, `order`, `dynamic_modify`, `option`, `required`) values(18, 'rejectTransactionMessage', 'false', '是否拒绝发送事务消息', '非事务集群设置为true', 1, 1, 'true:是;false:否;', 0);
insert into broker_config(`gid`, `key`, `value`, `desc`, `tip`, `order`, `dynamic_modify`, `option`, `required`) values(18, 'transactionTimeOut', '6000', '事务消息超过多久后首次检查', '单位ms,默认6秒', 2, 1, null, 0);
insert into broker_config(`gid`, `key`, `value`, `desc`, `tip`, `order`, `dynamic_modify`, `option`, `required`) values(18, 'transactionCheckMax', '15', '事务消息最大检查次数', null, 3, 1, null, 0);
insert into broker_config(`gid`, `key`, `value`, `desc`, `tip`, `order`, `dynamic_modify`, `option`, `required`) values(18, 'transactionCheckInterval', '60000', '事务消息检查间隔', '单位ms,默认60秒', 4, 1, null, 0);
insert into broker_config(`gid`, `key`, `value`, `desc`, `tip`, `order`, `dynamic_modify`, `option`, `required`) values(19, 'haSendHeartbeatInterval', '5000', 'slave与master心跳间隔', '单位ms,默认5秒', 1, 1, null, 0);
insert into broker_config(`gid`, `key`, `value`, `desc`, `tip`, `order`, `dynamic_modify`, `option`, `required`) values(19, 'haMasterAddress', null, 'slave的HA master', '无需设置,向NameServer注册会返回master地址作为HA地址', 2, 0, null, 0);
insert into broker_config(`gid`, `key`, `value`, `desc`, `tip`, `order`, `dynamic_modify`, `option`, `required`) values(19, 'offsetCheckInSlave', 'false', '消费者从slave拉取消息offset不正确时,slave是否检查更正', null, 2, 1, 'true:是;false:否;', 0);
insert into broker_config(`gid`, `key`, `value`, `desc`, `tip`, `order`, `dynamic_modify`, `option`, `required`) values(20, 'filterServerNums', '0', '过滤服务数', null, 1, 1, null, 0);
insert into broker_config(`gid`, `key`, `value`, `desc`, `tip`, `order`, `dynamic_modify`, `option`, `required`) values(20, 'enableCalcFilterBitMap', 'false', '是否启用BitMap过滤计算', null, 2, 0, 'true:是;false:否;', 0);
insert into broker_config(`gid`, `key`, `value`, `desc`, `tip`, `order`, `dynamic_modify`, `option`, `required`) values(20, 'bitMapLengthConsumeQueueExt', '112', 'BitMap大小', null, 3, 0, null, 0);
insert into broker_config(`gid`, `key`, `value`, `desc`, `tip`, `order`, `dynamic_modify`, `option`, `required`) values(20, 'expectConsumerNumUseFilter', '32', '预估的订阅同一topic的消费者数', null, 4, 0, null, 0);
insert into broker_config(`gid`, `key`, `value`, `desc`, `tip`, `order`, `dynamic_modify`, `option`, `required`) values(20, 'maxErrorRateOfBloomFilter', '20', 'bloom filter错误率', '单位%,默认20%', 5, 0, null, 0);
insert into broker_config(`gid`, `key`, `value`, `desc`, `tip`, `order`, `dynamic_modify`, `option`, `required`) values(20, 'filterDataCleanTimeSpan', '86400000', '清理n小时之前的filter数据', '单位ms,默认24小时', 6, 0, null, 0);
insert into broker_config(`gid`, `key`, `value`, `desc`, `tip`, `order`, `dynamic_modify`, `option`, `required`) values(20, 'enableConsumeQueueExt', 'false', '是否生成额外的consume queue文件', null, 7, 0, 'true:是;false:否;', 0);
insert into broker_config(`gid`, `key`, `value`, `desc`, `tip`, `order`, `dynamic_modify`, `option`, `required`) values(20, 'mappedFileSizeConsumeQueueExt', '50331648', '额外的consume queue文件大小', '单位字节,默认48M', 8, 0, null, 0);
insert into broker_config(`gid`, `key`, `value`, `desc`, `tip`, `order`, `dynamic_modify`, `option`, `required`) values(20, 'filterSupportRetry', 'false', '是否支持过滤retry消费者', null, 9, 1, 'true:是;false:否;', 0);
insert into broker_config(`gid`, `key`, `value`, `desc`, `tip`, `order`, `dynamic_modify`, `option`, `required`) values(20, 'enablePropertyFilter', 'false', '是否支持过滤SQL92', null, 10, 1, 'true:是;false:否;', 0);
insert into broker_config(`gid`, `key`, `value`, `desc`, `tip`, `order`, `dynamic_modify`, `option`, `required`) values(21, 'serverWorkerThreads', '8', 'worker线程', null, 1, 0, null, 0);
insert into broker_config(`gid`, `key`, `value`, `desc`, `tip`, `order`, `dynamic_modify`, `option`, `required`) values(21, 'serverCallbackExecutorThreads', '0', '默认公共线程', null, 2, 0, null, 0);
insert into broker_config(`gid`, `key`, `value`, `desc`, `tip`, `order`, `dynamic_modify`, `option`, `required`) values(21, 'serverSelectorThreads', '3', 'selector线程', null, 3, 0, null, 0);
insert into broker_config(`gid`, `key`, `value`, `desc`, `tip`, `order`, `dynamic_modify`, `option`, `required`) values(21, 'serverOnewaySemaphoreValue', '256', 'oneway信号量', null, 4, 0, null, 0);
insert into broker_config(`gid`, `key`, `value`, `desc`, `tip`, `order`, `dynamic_modify`, `option`, `required`) values(21, 'serverAsyncSemaphoreValue', '64', 'aysnc信号量', null, 5, 0, null, 0);
insert into broker_config(`gid`, `key`, `value`, `desc`, `tip`, `order`, `dynamic_modify`, `option`, `required`) values(21, 'serverChannelMaxIdleTimeSeconds', '120', 'idle最大时间', null, 6, 0, null, 0);
insert into broker_config(`gid`, `key`, `value`, `desc`, `tip`, `order`, `dynamic_modify`, `option`, `required`) values(21, 'serverSocketSndBufSize', '131072', 'SO_SNDBUF', null, 7, 0, null, 0);
insert into broker_config(`gid`, `key`, `value`, `desc`, `tip`, `order`, `dynamic_modify`, `option`, `required`) values(21, 'serverSocketRcvBufSize', '131072', 'SO_RCVBUF', null, 8, 0, null, 0);
insert into broker_config(`gid`, `key`, `value`, `desc`, `tip`, `order`, `dynamic_modify`, `option`, `required`) values(21, 'serverPooledByteBufAllocatorEnable', 'true', '是否开启bytebuffer池', null, 9, 0, 'true:是;false:否;', 0);
insert into broker_config(`gid`, `key`, `value`, `desc`, `tip`, `order`, `dynamic_modify`, `option`, `required`) values(21, 'useEpollNativeSelector', 'false', '是否使用epoll', null, 10, 0, 'true:是;false:否;', 0);
insert into broker_config(`gid`, `key`, `value`, `desc`, `tip`, `order`, `dynamic_modify`, `option`, `required`) values(22, 'clientWorkerThreads', '4', 'worker线程', null, 1, 0, null, 0);
insert into broker_config(`gid`, `key`, `value`, `desc`, `tip`, `order`, `dynamic_modify`, `option`, `required`) values(22, 'clientCallbackExecutorThreads', '核数', '默认公共线程', null, 2, 0, null, 0);
insert into broker_config(`gid`, `key`, `value`, `desc`, `tip`, `order`, `dynamic_modify`, `option`, `required`) values(22, 'clientOnewaySemaphoreValue', '65535', 'oneway信号量', null, 3, 0, null, 0);
insert into broker_config(`gid`, `key`, `value`, `desc`, `tip`, `order`, `dynamic_modify`, `option`, `required`) values(22, 'clientAsyncSemaphoreValue', '65535', 'aysnc信号量', null, 4, 0, null, 0);
insert into broker_config(`gid`, `key`, `value`, `desc`, `tip`, `order`, `dynamic_modify`, `option`, `required`) values(22, 'channelNotActiveInterval', '60000', '此项作废', null, 5, 0, null, 0);
insert into broker_config(`gid`, `key`, `value`, `desc`, `tip`, `order`, `dynamic_modify`, `option`, `required`) values(22, 'clientChannelMaxIdleTimeSeconds', '120', '链接最大idle时间', null, 6, 0, null, 0);
insert into broker_config(`gid`, `key`, `value`, `desc`, `tip`, `order`, `dynamic_modify`, `option`, `required`) values(22, 'connectTimeoutMillis', '3000', '连接超时时间', null, 7, 0, null, 0);
insert into broker_config(`gid`, `key`, `value`, `desc`, `tip`, `order`, `dynamic_modify`, `option`, `required`) values(22, 'clientSocketSndBufSize', '131072', 'SO_SNDBUF', null, 8, 0, null, 0);
insert into broker_config(`gid`, `key`, `value`, `desc`, `tip`, `order`, `dynamic_modify`, `option`, `required`) values(22, 'clientSocketRcvBufSize', '131072', 'SO_RCVBUF', null, 9, 0, null, 0);
insert into broker_config(`gid`, `key`, `value`, `desc`, `tip`, `order`, `dynamic_modify`, `option`, `required`) values(22, 'clientPooledByteBufAllocatorEnable', 'false', '是否开启bytebuffer池', null, 10, 0, 'true:是;false:否;', 0);
insert into broker_config(`gid`, `key`, `value`, `desc`, `tip`, `order`, `dynamic_modify`, `option`, `required`) values(22, 'clientCloseSocketIfTimeout', 'false', '超时是否关闭连接', null, 11, 0, 'true:是;false:否;', 0);
insert into broker_config(`gid`, `key`, `value`, `desc`, `tip`, `order`, `dynamic_modify`, `option`, `required`) values(22, 'useTLS', 'false', '是否使用ssl', null, 12, 0, 'true:是;false:否;', 0);
insert into broker_config(`gid`, `key`, `value`, `desc`, `tip`, `order`, `dynamic_modify`, `option`, `required`) values(23, 'storeReplyMessageEnable', 'true', '是否启用rpc消息', null, 1, 1, 'true:是;false:否;', 0);
insert into broker_config(`gid`, `key`, `value`, `desc`, `tip`, `order`, `dynamic_modify`, `option`, `required`) values(23, 'processReplyMessageThreadPoolNums', '16+核数*2', '处理rpc消息线程池大小', null, 2, 0, null, 0);
insert into broker_config(`gid`, `key`, `value`, `desc`, `tip`, `order`, `dynamic_modify`, `option`, `required`) values(23, 'replyThreadPoolQueueCapacity', '10000', '处理rpc消息的线程池队列大小', null, 3, 0, null, 0);
insert into broker_config(`gid`, `key`, `value`, `desc`, `tip`, `order`, `dynamic_modify`, `option`, `required`) values(24, 'traceOn', 'true', '是否启用trace', null, 1, 1, 'true:是;false:否;', 0);
insert into broker_config(`gid`, `key`, `value`, `desc`, `tip`, `order`, `dynamic_modify`, `option`, `required`) values(24, 'aclEnable', 'false', '是否启用权限校验,若启用需要配置权限文件', null, 2, 0, 'true:是;false:否;', 0);
insert into broker_config(`gid`, `key`, `value`, `desc`, `tip`, `order`, `dynamic_modify`, `option`, `required`) values(24, 'messageStorePlugIn', null, '消息存储插件', null, 3, 0, null, 0);
insert into broker_config(`gid`, `key`, `value`, `desc`, `tip`, `order`, `dynamic_modify`, `option`, `required`) values(24, 'checkCRCOnRecover', 'true', 'load完消息校验消息是否用CRC32', null, 4, 1, null, 0);
insert into broker_config(`gid`, `key`, `value`, `desc`, `tip`, `order`, `dynamic_modify`, `option`, `required`) values(24, 'debugLockEnable', 'false', 'commitlog写入超过1秒打印堆栈', null, 5, 1, null, 0);
insert into broker_config(`gid`, `key`, `value`, `desc`, `tip`, `order`, `dynamic_modify`, `option`, `required`) values(24, 'cleanResourceInterval', '10000', 'CommitLog&ConsumeQueue清除任务执行间隔', '单位ms,默认10秒', 6, 0, null, 0);
insert into broker_config(`gid`, `key`, `value`, `desc`, `tip`, `order`, `dynamic_modify`, `option`, `required`) values(24, 'flushConsumerOffsetInterval', '5000', 'consumerOffset.json持久化间隔', '单位ms,默认5秒', 7, 0, null, 0);
insert into broker_config(`gid`, `key`, `value`, `desc`, `tip`, `order`, `dynamic_modify`, `option`, `required`) values(24, 'flushConsumerOffsetHistoryInterval', '60000', '此项作废,以flushConsumerOffsetInterval为准', null, 8, 0, null, 0);
insert into broker_config(`gid`, `key`, `value`, `desc`, `tip`, `order`, `dynamic_modify`, `option`, `required`) values(24, 'flushDelayOffsetInterval', '10000', 'delayOffset.json持久化间隔', '单位ms,默认10秒', 9, 0, null, 0);
insert into broker_config(`gid`, `key`, `value`, `desc`, `tip`, `order`, `dynamic_modify`, `option`, `required`) values(24, 'abortFile', null, '自动以storePathRootDir拼装', '无需设置', 10, 0, null, 0);
insert into broker_config(`gid`, `key`, `value`, `desc`, `tip`, `order`, `dynamic_modify`, `option`, `required`) values(24, 'storePathIndex', null, '自动以storePathRootDir拼装', '无需设置', 11, 0, null, 0);
insert into broker_config(`gid`, `key`, `value`, `desc`, `tip`, `order`, `dynamic_modify`, `option`, `required`) values(24, 'storeCheckpoint', null, '自动以storePathRootDir拼装', '无需设置', 12, 0, null, 0);
insert into broker_config(`gid`, `key`, `value`, `desc`, `tip`, `order`, `dynamic_modify`, `option`, `required`) values(24, 'highSpeedMode', 'false', '此项作废', null, 14, 0, null, 0);
insert into broker_config(`gid`, `key`, `value`, `desc`, `tip`, `order`, `dynamic_modify`, `option`, `required`) values(24, 'commercialEnable', 'true', '此项作废', null, 15, 0, null, 0);
insert into broker_config(`gid`, `key`, `value`, `desc`, `tip`, `order`, `dynamic_modify`, `option`, `required`) values(24, 'commercialTimerCount', '1', '此项作废', null, 16, 0, null, 0);
insert into broker_config(`gid`, `key`, `value`, `desc`, `tip`, `order`, `dynamic_modify`, `option`, `required`) values(24, 'commercialTransCount', '1', '此项作废', null, 17, 0, null, 0);
insert into broker_config(`gid`, `key`, `value`, `desc`, `tip`, `order`, `dynamic_modify`, `option`, `required`) values(24, 'commercialBigCount', '1', '此项作废', null, 18, 0, null, 0);
insert into broker_config(`gid`, `key`, `value`, `desc`, `tip`, `order`, `dynamic_modify`, `option`, `required`) values(24, 'commercialBaseCount', '1', '此项作废', null, 19, 0, null, 0);
insert into broker_config(`gid`, `key`, `value`, `desc`, `tip`, `order`, `dynamic_modify`, `option`, `required`) values(24, 'putMsgIndexHightWater', '600000', '此项作废', null, 20, 0, null, 0);
insert into broker_config(`gid`, `key`, `value`, `desc`, `tip`, `order`, `dynamic_modify`, `option`, `required`) values(24, 'maxDelayTime', '40', '此项作废', null, 21, 0, null, 0);
insert into broker_config(`gid`, `key`, `value`, `desc`, `tip`, `order`, `dynamic_modify`, `option`, `required`) values(24, 'regionId', 'DefaultRegion', 'broker区域,trace使用', null, 22, 0, null, 0);
insert into broker_config(`gid`, `key`, `value`, `desc`, `tip`, `order`, `dynamic_modify`, `option`, `required`) values(24, 'duplicationEnable', 'false', '是否支持重写consume queue', null, 23, 0, null, 0);
insert into broker_config(`gid`, `key`, `value`, `desc`, `tip`, `order`, `dynamic_modify`, `option`, `required`) values(24, 'enableDLegerCommitLog', 'false', '是否支持DLeger', null, 24, 0, null, 0);
insert into broker_config(`gid`, `key`, `value`, `desc`, `tip`, `order`, `dynamic_modify`, `option`, `required`) values(24, 'dLegerGroup', null, 'DLeger相关配置', null, 25, 0, null, 0);
insert into broker_config(`gid`, `key`, `value`, `desc`, `tip`, `order`, `dynamic_modify`, `option`, `required`) values(24, 'dLegerPeers', null, 'DLeger相关配置', null, 26, 0, null, 0);
insert into broker_config(`gid`, `key`, `value`, `desc`, `tip`, `order`, `dynamic_modify`, `option`, `required`) values(24, 'dLegerSelfId', null, 'DLeger相关配置', null, 27, 0, null, 0);
-- ----------------------------
-- Table structure for `topic_traffic_warn_config`
-- ----------------------------
DROP TABLE IF EXISTS `topic_traffic_warn_config`;
CREATE TABLE `topic_traffic_warn_config` (
`avg_multiplier` float(11,3) DEFAULT '5.000' COMMENT '平均流量值的乘数阈值;流量统计时,大于该值乘以平均流量值认定为异常值而被剔除',
`avg_max_percentage_increase` float(11,3) DEFAULT '200.000' COMMENT '30天内每天流量最大值的平均值的百分比阈值;某时刻流量值大于最大值的平均值的增长阈值,则预警',
`max_max_percentage_increase` float(11,3) DEFAULT '30.000' COMMENT '30天内流量最大值的增幅百分比阈值;某时刻流量值若大于最大值的该增幅阈值,则预警',
`alarm_receiver` int(4) DEFAULT '0' COMMENT '告警接收人,0:生产者消费者及管理员,1:生产者和管理员,2:消费者和管理员,3:仅管理员,4:不告警',
`topic` varchar(64) DEFAULT '' COMMENT 'topic名称,为空代表默认配置,只有一条默认配置',
UNIQUE KEY `topic` (`topic`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='topic流量预警阈值配置';
-- ----------------------------
-- topic_traffic_warn_config init
-- ----------------------------
INSERT INTO `topic_traffic_warn_config`(avg_multiplier,avg_max_percentage_increase,max_max_percentage_increase,alarm_receiver) VALUES (5, 200, 30, 0);
-- ----------------------------
-- Table structure for `audit_topic_traffic_warn`
-- ----------------------------
CREATE TABLE `audit_topic_traffic_warn` (
`aid` int(11) NOT NULL COMMENT '审核id',
`tid` int(11) NOT NULL COMMENT 'topic id',
`traffic_warn_enabled` int(11) NOT NULL COMMENT '0:不开启topic流量预警,1:开启topic流量预警'
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='审核topic trafficWarn相关表'; | the_stack |
-- Copyright 2018 Tanel Poder. All rights reserved. More info at http://tanelpoder.com
-- Licensed under the Apache License, Version 2.0. See LICENSE.txt for terms & conditions.
------------------------------------------------------------------------------------------------------------------------
--
-- File name: exadisktopo.sql (v1.0)
--
-- Purpose: Report Exadata disk topology from ASM Diskgroup all the way to cell LUNs and Physical disks
-- (from top of the stack downwards)
--
-- Author: Tanel Poder (tanel@tanelpoder.com)
--
-- Copyright: (c) http://blog.tanelpoder.com - All rights reserved.
--
-- Disclaimer: This script is provided "as is", no warranties nor guarantees are
-- made. Use at your own risk :)
--
-- Usage: @exadisktopo.sql
--
------------------------------------------------------------------------------------------------------------------------
COL cellname HEAD CELLNAME FOR A20
COL celldisk_name HEAD CELLDISK FOR A30
COL physdisk_name HEAD PHYSDISK FOR A30
COL griddisk_name HEAD GRIDDISK FOR A30
COL asmdisk_name HEAD ASMDISK FOR A30
BREAK ON asm_diskgroup SKIP 1 ON asm_disk
PROMPT Showing Exadata disk topology from V$ASM_DISK and V$CELL_CONFIG....
WITH
pd AS (
SELECT /*+ MATERIALIZE */
c.cellname
, CAST(EXTRACTVALUE(VALUE(v), '/physicaldisk/name/text()') AS VARCHAR2(100)) name
, CAST(EXTRACTVALUE(VALUE(v), '/physicaldisk/diskType/text()') AS VARCHAR2(100)) diskType
, CAST(EXTRACTVALUE(VALUE(v), '/physicaldisk/luns/text()') AS VARCHAR2(100)) luns
, CAST(EXTRACTVALUE(VALUE(v), '/physicaldisk/makeModel/text()') AS VARCHAR2(100)) makeModel
, CAST(EXTRACTVALUE(VALUE(v), '/physicaldisk/physicalFirmware/text()') AS VARCHAR2(100)) physicalFirmware
, CAST(EXTRACTVALUE(VALUE(v), '/physicaldisk/physicalInsertTime/text()') AS VARCHAR2(100)) physicalInsertTime
, CAST(EXTRACTVALUE(VALUE(v), '/physicaldisk/physicalSerial/text()') AS VARCHAR2(100)) physicalSerial
, CAST(EXTRACTVALUE(VALUE(v), '/physicaldisk/physicalSize/text()') AS VARCHAR2(100)) physicalSize
, CAST(EXTRACTVALUE(VALUE(v), '/physicaldisk/slotNumber/text()') AS VARCHAR2(100)) slotNumber
, CAST(EXTRACTVALUE(VALUE(v), '/physicaldisk/status/text()') AS VARCHAR2(100)) status
, CAST(EXTRACTVALUE(VALUE(v), '/physicaldisk/id/text()') AS VARCHAR2(100)) id
, CAST(EXTRACTVALUE(VALUE(v), '/physicaldisk/key_500/text()') AS VARCHAR2(100)) key_500
, CAST(EXTRACTVALUE(VALUE(v), '/physicaldisk/predfailStatus/text()') AS VARCHAR2(100)) predfailStatus
, CAST(EXTRACTVALUE(VALUE(v), '/physicaldisk/poorPerfStatus/text()') AS VARCHAR2(100)) poorPerfStatus
, CAST(EXTRACTVALUE(VALUE(v), '/physicaldisk/wtCachingStatus/text()') AS VARCHAR2(100)) wtCachingStatus
, CAST(EXTRACTVALUE(VALUE(v), '/physicaldisk/peerFailStatus/text()') AS VARCHAR2(100)) peerFailStatus
, CAST(EXTRACTVALUE(VALUE(v), '/physicaldisk/criticalStatus/text()') AS VARCHAR2(100)) criticalStatus
, CAST(EXTRACTVALUE(VALUE(v), '/physicaldisk/errCmdTimeoutCount/text()') AS VARCHAR2(100)) errCmdTimeoutCount
, CAST(EXTRACTVALUE(VALUE(v), '/physicaldisk/errHardReadCount/text()') AS VARCHAR2(100)) errHardReadCount
, CAST(EXTRACTVALUE(VALUE(v), '/physicaldisk/errHardWriteCount/text()') AS VARCHAR2(100)) errHardWriteCount
, CAST(EXTRACTVALUE(VALUE(v), '/physicaldisk/errMediaCount/text()') AS VARCHAR2(100)) errMediaCount
, CAST(EXTRACTVALUE(VALUE(v), '/physicaldisk/errOtherCount/text()') AS VARCHAR2(100)) errOtherCount
, CAST(EXTRACTVALUE(VALUE(v), '/physicaldisk/errSeekCount/text()') AS VARCHAR2(100)) errSeekCount
, CAST(EXTRACTVALUE(VALUE(v), '/physicaldisk/sectorRemapCount/text()') AS VARCHAR2(100)) sectorRemapCount
FROM
v$cell_config c
, TABLE(XMLSEQUENCE(EXTRACT(XMLTYPE(c.confval), '/cli-output/physicaldisk'))) v -- gv$ isn't needed, all cells should be visible in all instances
WHERE
c.conftype = 'PHYSICALDISKS'
),
cd AS (
SELECT /*+ MATERIALIZE */
c.cellname
, CAST(EXTRACTVALUE(VALUE(v), '/celldisk/name/text()') AS VARCHAR2(100)) name
, CAST(EXTRACTVALUE(VALUE(v), '/celldisk/comment /text()') AS VARCHAR2(100)) disk_comment
, CAST(EXTRACTVALUE(VALUE(v), '/celldisk/creationTime /text()') AS VARCHAR2(100)) creationTime
, CAST(EXTRACTVALUE(VALUE(v), '/celldisk/deviceName /text()') AS VARCHAR2(100)) deviceName
, CAST(EXTRACTVALUE(VALUE(v), '/celldisk/devicePartition/text()') AS VARCHAR2(100)) devicePartition
, CAST(EXTRACTVALUE(VALUE(v), '/celldisk/diskType /text()') AS VARCHAR2(100)) diskType
, CAST(EXTRACTVALUE(VALUE(v), '/celldisk/errorCount /text()') AS VARCHAR2(100)) errorCount
, CAST(EXTRACTVALUE(VALUE(v), '/celldisk/freeSpace /text()') AS VARCHAR2(100)) freeSpace
, CAST(EXTRACTVALUE(VALUE(v), '/celldisk/id /text()') AS VARCHAR2(100)) id
, CAST(EXTRACTVALUE(VALUE(v), '/celldisk/interleaving /text()') AS VARCHAR2(100)) interleaving
, CAST(EXTRACTVALUE(VALUE(v), '/celldisk/lun /text()') AS VARCHAR2(100)) lun
, CAST(EXTRACTVALUE(VALUE(v), '/celldisk/physicalDisk /text()') AS VARCHAR2(100)) physicalDisk
, CAST(EXTRACTVALUE(VALUE(v), '/celldisk/size /text()') AS VARCHAR2(100)) disk_size
, CAST(EXTRACTVALUE(VALUE(v), '/celldisk/status /text()') AS VARCHAR2(100)) status
FROM
v$cell_config c
, TABLE(XMLSEQUENCE(EXTRACT(XMLTYPE(c.confval), '/cli-output/celldisk'))) v -- gv$ isn't needed, all cells should be visible in all instances
WHERE
c.conftype = 'CELLDISKS'
),
gd AS (
SELECT /*+ MATERIALIZE */
c.cellname
, CAST(EXTRACTVALUE(VALUE(v), '/griddisk/name/text()') AS VARCHAR2(100)) name
, CAST(EXTRACTVALUE(VALUE(v), '/griddisk/asmDiskgroupName/text()') AS VARCHAR2(100)) asmDiskgroupName
, CAST(EXTRACTVALUE(VALUE(v), '/griddisk/asmDiskName /text()') AS VARCHAR2(100)) asmDiskName
, CAST(EXTRACTVALUE(VALUE(v), '/griddisk/asmFailGroupName/text()') AS VARCHAR2(100)) asmFailGroupName
, CAST(EXTRACTVALUE(VALUE(v), '/griddisk/availableTo /text()') AS VARCHAR2(100)) availableTo
, CAST(EXTRACTVALUE(VALUE(v), '/griddisk/cachingPolicy /text()') AS VARCHAR2(100)) cachingPolicy
, CAST(EXTRACTVALUE(VALUE(v), '/griddisk/cellDisk /text()') AS VARCHAR2(100)) cellDisk
, CAST(EXTRACTVALUE(VALUE(v), '/griddisk/comment /text()') AS VARCHAR2(100)) disk_comment
, CAST(EXTRACTVALUE(VALUE(v), '/griddisk/creationTime /text()') AS VARCHAR2(100)) creationTime
, CAST(EXTRACTVALUE(VALUE(v), '/griddisk/diskType /text()') AS VARCHAR2(100)) diskType
, CAST(EXTRACTVALUE(VALUE(v), '/griddisk/errorCount /text()') AS VARCHAR2(100)) errorCount
, CAST(EXTRACTVALUE(VALUE(v), '/griddisk/id /text()') AS VARCHAR2(100)) id
, CAST(EXTRACTVALUE(VALUE(v), '/griddisk/offset /text()') AS VARCHAR2(100)) offset
, CAST(EXTRACTVALUE(VALUE(v), '/griddisk/size /text()') AS VARCHAR2(100)) disk_size
, CAST(EXTRACTVALUE(VALUE(v), '/griddisk/status /text()') AS VARCHAR2(100)) status
FROM
v$cell_config c
, TABLE(XMLSEQUENCE(EXTRACT(XMLTYPE(c.confval), '/cli-output/griddisk'))) v -- gv$ isn't needed, all cells should be visible in all instances
WHERE
c.conftype = 'GRIDDISKS'
),
lun AS (
SELECT /*+ MATERIALIZE */
c.cellname
, CAST(EXTRACTVALUE(VALUE(v), '/lun/cellDisk /text()') AS VARCHAR2(100)) cellDisk
, CAST(EXTRACTVALUE(VALUE(v), '/lun/deviceName /text()') AS VARCHAR2(100)) deviceName
, CAST(EXTRACTVALUE(VALUE(v), '/lun/diskType /text()') AS VARCHAR2(100)) diskType
, CAST(EXTRACTVALUE(VALUE(v), '/lun/id /text()') AS VARCHAR2(100)) id
, CAST(EXTRACTVALUE(VALUE(v), '/lun/isSystemLun /text()') AS VARCHAR2(100)) isSystemLun
, CAST(EXTRACTVALUE(VALUE(v), '/lun/lunAutoCreate /text()') AS VARCHAR2(100)) lunAutoCreate
, CAST(EXTRACTVALUE(VALUE(v), '/lun/lunSize /text()') AS VARCHAR2(100)) lunSize
, CAST(EXTRACTVALUE(VALUE(v), '/lun/physicalDrives /text()') AS VARCHAR2(100)) physicalDrives
, CAST(EXTRACTVALUE(VALUE(v), '/lun/raidLevel /text()') AS VARCHAR2(100)) raidLevel
, CAST(EXTRACTVALUE(VALUE(v), '/lun/lunWriteCacheMode/text()') AS VARCHAR2(100)) lunWriteCacheMode
, CAST(EXTRACTVALUE(VALUE(v), '/lun/status /text()') AS VARCHAR2(100)) status
FROM
v$cell_config c
, TABLE(XMLSEQUENCE(EXTRACT(XMLTYPE(c.confval), '/cli-output/lun'))) v -- gv$ isn't needed, all cells should be visible in all instances
WHERE
c.conftype = 'LUNS'
)
, ad AS (SELECT /*+ MATERIALIZE */ * FROM v$asm_disk)
, adg AS (SELECT /*+ MATERIALIZE */ * FROM v$asm_diskgroup)
SELECT
adg.name asm_diskgroup
, ad.name asm_disk
, gd.name griddisk_name
, cd.name celldisk_name
, pd.cellname
, SUBSTR(cd.devicepartition,1,20) cd_devicepart
, pd.name physdisk_name
, SUBSTR(pd.status,1,20) physdisk_status
, lun.lunWriteCacheMode
-- , SUBSTR(cd.devicename,1,20) cd_devicename
-- , SUBSTR(lun.devicename,1,20) lun_devicename
-- disktype
FROM
gd
, cd
, pd
, lun
, ad
, adg
WHERE
ad.group_number = adg.group_number (+)
AND gd.asmdiskname = ad.name (+)
AND cd.name = gd.cellDisk (+)
AND pd.id = cd.physicalDisk (+)
AND cd.name = lun.celldisk (+)
--GROUP BY
-- cellname
-- , disktype
-- , status
ORDER BY
-- disktype
asm_diskgroup
, asm_disk
, griddisk_name
, celldisk_name
, physdisk_name
, cellname
/ | the_stack |
-- alter table sites rename id to site_id;
-- alter table sites add column first_hit_at timestamp;
-- alter table sites drop constraint sites_parent_check;
create table sites2 (
site_id integer primary key autoincrement,
parent integer null,
code varchar not null check(length(code) >= 2 and length(code) <= 50),
link_domain varchar not null default '' check(link_domain = '' or (length(link_domain) >= 4 and length(link_domain) <= 255)),
cname varchar null check(cname is null or (length(cname) >= 4 and length(cname) <= 255)),
cname_setup_at timestamp default null check(cname_setup_at = strftime('%Y-%m-%d %H:%M:%S', cname_setup_at)),
plan varchar not null check(plan in ('personal', 'personalplus', 'business', 'businessplus', 'child', 'custom')),
stripe varchar null,
billing_amount varchar,
settings varchar not null,
received_data integer not null default 0,
state varchar not null default 'a' check(state in ('a', 'd')),
created_at timestamp not null check(created_at = strftime('%Y-%m-%d %H:%M:%S', created_at)),
updated_at timestamp check(updated_at = strftime('%Y-%m-%d %H:%M:%S', updated_at)),
first_hit_at timestamp not null check(first_hit_at = strftime('%Y-%m-%d %H:%M:%S', first_hit_at))
);
insert into sites2
select id, parent, code, link_domain, cname, cname_setup_at, plan, stripe, billing_amount,
settings, received_data, state, created_at, updated_at, created_at from sites;
drop table sites;
alter table sites2 rename to sites;
create unique index "sites#code" on sites(lower(code));
create index "sites#parent" on sites(parent) where state='a';
create unique index if not exists "sites#cname" on sites(lower(cname));
-- alter table users rename id to user_id;
-- alter table users rename site to site_id;
-- alter table users drop constraint users_site_id_check;
create table users2 (
user_id integer primary key autoincrement,
site_id integer not null,
email varchar not null check(length(email) > 5 and length(email) <= 255),
email_verified integer not null default 0,
password blob default null,
totp_enabled integer not null default 0,
totp_secret blob,
role varchar not null default '' check(role in ('', 'a')),
login_at timestamp null check(login_at = strftime('%Y-%m-%d %H:%M:%S', login_at)),
login_request varchar null,
login_token varchar null,
csrf_token varchar null,
email_token varchar null,
seen_updates_at timestamp not null default current_timestamp check(seen_updates_at = strftime('%Y-%m-%d %H:%M:%S', seen_updates_at)),
reset_at timestamp null,
created_at timestamp not null check(created_at = strftime('%Y-%m-%d %H:%M:%S', created_at)),
updated_at timestamp check(updated_at = strftime('%Y-%m-%d %H:%M:%S', updated_at)),
foreign key (site_id) references sites(site_id) on delete restrict on update restrict
);
insert into users2
select id, site, email, email_verified, password, totp_enabled, totp_secret, role, login_at, login_request,
login_token, csrf_token, email_token, seen_updates_at, reset_at, created_at, updated_at from users;
drop table users;
alter table users2 rename to users;
create index "users#site_id" on users(site_id);
create unique index "users#site_id#email" on users(site_id, lower(email));
-- alter table hits rename id to hit_id;
-- alter table hits rename site to site_id;
-- alter table hits drop column session;
-- alter table hits rename session2 to session;
-- alter table hits drop column path;
-- alter table hits drop column title;
-- alter table hits drop column event;
-- alter table hits drop column browser;
-- alter table hits add check(path_id > 0);
-- alter table hits add check(user_agent_id > 0);
create table hits2 (
hit_id integer primary key autoincrement,
site_id integer not null check(site_id > 0),
path_id integer not null check(path_id > 0),
user_agent_id integer not null check(user_agent_id > 0),
session blob default null,
bot integer default 0,
ref varchar not null,
ref_scheme varchar null check(ref_scheme in ('h', 'g', 'o', 'c')),
size varchar not null default '',
location varchar not null default '',
first_visit integer default 0,
created_at timestamp not null check(created_at = strftime('%Y-%m-%d %H:%M:%S', created_at))
);
insert into hits2
select id, site, path_id, user_agent_id, session2, bot, ref, ref_scheme, size, location, first_visit, created_at from hits;
drop table hits;
alter table hits2 rename to hits;
create index "hits#site_id#created_at" on hits(site_id, created_at);
-- alter table hit_counts rename site to site_id;
-- alter table hit_counts drop column path;
-- alter table hit_counts drop column title;
-- alter table hit_counts drop column event;
-- alter table hit_counts add foreign key (site_id) references sites(site_id) on delete restrict on update restrict;
drop table hit_counts;
create table hit_counts (
site_id integer not null,
path_id integer not null,
hour timestamp not null check(hour = strftime('%Y-%m-%d %H:%M:%S', hour)),
total integer not null,
total_unique integer not null,
foreign key (site_id) references sites(site_id) on delete restrict on update restrict,
constraint "hit_counts#site_id#path_id#hour" unique(site_id, path_id, hour) on conflict replace
);
create index "hit_counts#site_id#hour" on hit_counts(site_id, hour);
-- alter table ref_counts rename site to site_id;
-- alter table ref_counts drop column path;
-- alter table ref_counts add foreign key (site_id) references sites(site_id) on delete restrict on update restrict;
drop table ref_counts;
create table ref_counts (
site_id integer not null,
path_id integer not null,
ref varchar not null,
ref_scheme varchar null,
hour timestamp not null check(hour=strftime('%Y-%m-%d %H:%M:%S', hour)),
total integer not null,
total_unique integer not null,
foreign key (site_id) references sites(site_id) on delete restrict on update restrict,
constraint "ref_counts#site_id#path_id#ref#hour" unique(site_id, path_id, ref, hour) on conflict replace
);
create index "ref_counts#site_id#hour" on ref_counts(site_id, hour);
-- alter table hit_stats rename site to site_id;
-- alter table hit_stats drop column path;
-- alter table hit_stats drop column title;
-- alter table hit_stats drop constraint hit_stats_site_id_check;
drop table hit_stats;
create table hit_stats (
site_id integer not null,
path_id integer not null,
day date not null check(day = strftime('%Y-%m-%d', day)),
stats varchar not null,
stats_unique varchar not null,
foreign key (site_id) references sites(site_id) on delete restrict on update restrict,
constraint "hit_stats#site_id#path_id#day" unique(site_id, path_id, day) on conflict replace
);
create index "hit_stats#site_id#day" on hit_stats(site_id, day);
-- alter table browser_stats rename site to site_id;
-- alter table browser_stats drop column browser;
-- alter table browser_stats drop column version;
drop table browser_stats;
create table browser_stats (
site_id integer not null,
path_id integer not null,
browser_id integer not null,
day date not null check(day=strftime('%Y-%m-%d', day)),
count integer not null,
count_unique integer not null,
foreign key (site_id) references sites(site_id) on delete restrict on update restrict,
foreign key (browser_id) references browsers(browser_id) on delete restrict on update restrict
constraint "browser_stats#site_id#path_id#day#browser_id" unique(site_id, path_id, day, browser_id) on conflict replace
);
create index "browser_stats#site_id#browser_id#day" on browser_stats(site_id, browser_id, day);
-- alter table system_stats rename site to site_id;
-- alter table system_stats drop column system;
-- alter table system_stats drop column version;
drop table system_stats;
create table system_stats (
site_id integer not null,
path_id integer not null,
system_id integer not null,
day date not null check(day=strftime('%Y-%m-%d', day)),
count integer not null,
count_unique integer not null,
foreign key (site_id) references sites(site_id) on delete restrict on update restrict,
foreign key (system_id) references systems(system_id) on delete restrict on update restrict
constraint "system_stats#site_id#path_id#day#system_id" unique(site_id, path_id, day, system_id) on conflict replace
);
create index "system_stats#site_id#system_id#day" on system_stats(site_id, system_id, day);
-- alter table location_stats rename site to site_id;
drop table location_stats;
create table location_stats (
site_id integer not null,
path_id integer not null,
day date not null check(day = strftime('%Y-%m-%d', day)),
location varchar not null,
count integer not null,
count_unique integer not null,
foreign key (site_id) references sites(site_id) on delete restrict on update restrict,
constraint "location_stats#site_id#path_id#day#location" unique(site_id, path_id, day, location) on conflict replace
);
create index "location_stats#site_id#day" on location_stats(site_id, day);
-- alter table size_stats rename site to site_id;
drop table size_stats;
create table size_stats (
site_id integer not null,
path_id integer not null,
day date not null check(day = strftime('%Y-%m-%d', day)),
width integer not null,
count integer not null,
count_unique integer not null,
foreign key (site_id) references sites(site_id) on delete restrict on update restrict,
constraint "size_stats#site_id#path_id#day#width" unique(site_id, path_id, day, width) on conflict replace
);
create index "size_stats#site_id#day" on size_stats(site_id, day);
-- Need to rename to FK on the following tables.
create table api_tokens2 (
api_token_id integer primary key autoincrement,
site_id integer not null,
user_id integer not null,
name varchar not null,
token varchar not null check(length(token) > 10),
permissions varchar not null,
created_at timestamp not null check(created_at = strftime('%Y-%m-%d %H:%M:%S', created_at)),
foreign key (site_id) references sites(site_id) on delete restrict on update restrict,
foreign key (user_id) references users(user_id) on delete restrict on update restrict
);
insert into api_tokens2
select api_token_id, site_id, user_id, name, token, permissions, created_at from api_tokens;
drop table api_tokens;
alter table api_tokens2 rename to api_tokens;
create unique index "api_tokens#site_id#token" on api_tokens(site_id, token);
CREATE TABLE exports2 (
export_id integer primary key autoincrement,
site_id integer not null,
start_from_hit_id integer not null,
path varchar not null,
created_at timestamp not null check(created_at = strftime('%Y-%m-%d %H:%M:%S', created_at)),
finished_at timestamp check(finished_at is null or finished_at = strftime('%Y-%m-%d %H:%M:%S', finished_at)),
last_hit_id integer,
num_rows integer,
size varchar,
hash varchar,
error varchar,
foreign key (site_id) references sites(site_id) on delete restrict on update restrict
);
insert into exports2
select export_id, site_id, start_from_hit_id, path, created_at, finished_at, last_hit_id, num_rows, size, hash, error from exports;
drop table exports;
alter table exports2 rename to exports;
create index "exports#site_id#created_at" on exports(site_id, created_at);
CREATE TABLE paths2 (
path_id integer primary key autoincrement,
site_id integer not null,
path varchar not null,
title varchar not null default '',
event int default 0,
foreign key (site_id) references sites(site_id) on delete restrict on update restrict
);
insert into paths2
select path_id, site_id, path, title, event from paths;
drop table paths;
alter table paths2 rename to paths;
create unique index "paths#site_id#path" on paths(site_id, lower(path));
create index "paths#path#title" on paths(lower(path), lower(title)); | the_stack |
SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;
-- ----------------------------
-- Table structure for attr
-- ----------------------------
DROP TABLE IF EXISTS `attr`;
CREATE TABLE `attr` (
`attr_id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '属性id',
`attr_name` char(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '属性名',
`search_type` tinyint(4) NULL DEFAULT NULL COMMENT '是否需要检索[0-不需要,1-需要]',
`icon` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '属性图标',
`value_select` char(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '可选值列表[用逗号分隔]',
`attr_type` tinyint(4) NULL DEFAULT NULL COMMENT '属性类型[0-销售属性,1-基本属性,2-既是销售属性又是基本属性]',
`enable` bigint(20) NULL DEFAULT NULL COMMENT '启用状态[0 - 禁用,1 - 启用]',
`category_id` bigint(20) NULL DEFAULT NULL COMMENT '所属分类',
`show_desc` tinyint(4) NULL DEFAULT NULL COMMENT '快速展示【是否展示在介绍上;0-否 1-是】,在sku中仍然可以调整',
`value_type` tinyint(4) NULL DEFAULT NULL COMMENT '值类型(1-允许多个,2-只能一个值)',
PRIMARY KEY (`attr_id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 24 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '商品属性' ROW_FORMAT = Dynamic;
-- ----------------------------
-- Table structure for attr_attr_group_relation
-- ----------------------------
DROP TABLE IF EXISTS `attr_attr_group_relation`;
CREATE TABLE `attr_attr_group_relation` (
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'id',
`attr_id` bigint(20) NULL DEFAULT NULL COMMENT '属性id',
`attr_group_id` bigint(20) NULL DEFAULT NULL COMMENT '属性分组id',
`attr_sort` int(11) NULL DEFAULT NULL COMMENT '属性组内排序',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 32 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '属性&属性分组关联' ROW_FORMAT = Dynamic;
-- ----------------------------
-- Table structure for attr_group
-- ----------------------------
DROP TABLE IF EXISTS `attr_group`;
CREATE TABLE `attr_group` (
`attr_group_id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '分组id',
`attr_group_name` char(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '组名',
`sort` int(11) NULL DEFAULT NULL COMMENT '排序',
`description` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '描述',
`icon` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '组图标',
`category_id` bigint(20) NULL DEFAULT NULL COMMENT '所属分类id',
PRIMARY KEY (`attr_group_id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 21 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '属性分组' ROW_FORMAT = Dynamic;
-- ----------------------------
-- Table structure for brand
-- ----------------------------
DROP TABLE IF EXISTS `brand`;
CREATE TABLE `brand` (
`brand_id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '品牌id',
`name` char(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '品牌名',
`logo` varchar(2000) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '品牌logo地址',
`descript` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '介绍',
`show_status` tinyint(4) NULL DEFAULT NULL COMMENT '显示状态[0-不显示;1-显示]',
`first_letter` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '检索首字母',
`sort` int(11) NULL DEFAULT NULL COMMENT '排序',
PRIMARY KEY (`brand_id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 9 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '品牌' ROW_FORMAT = Dynamic;
-- ----------------------------
-- Table structure for category
-- ----------------------------
DROP TABLE IF EXISTS `category`;
CREATE TABLE `category` (
`category_id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '分类id',
`name` char(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '分类名称',
`parent_cid` bigint(20) NULL DEFAULT NULL COMMENT '父分类id',
`category_level` int(11) NULL DEFAULT NULL COMMENT '层级',
`show_status` tinyint(4) NULL DEFAULT NULL COMMENT '是否显示[0-不显示,1显示]',
`sort` int(11) NULL DEFAULT NULL COMMENT '排序',
`icon` char(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '图标地址',
`product_unit` char(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '计量单位',
`product_count` int(11) NULL DEFAULT NULL COMMENT '商品数量',
PRIMARY KEY (`category_id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1430 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '商品三级分类' ROW_FORMAT = Dynamic;
-- ----------------------------
-- Table structure for category_brand_relation
-- ----------------------------
DROP TABLE IF EXISTS `category_brand_relation`;
CREATE TABLE `category_brand_relation` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`brand_id` bigint(20) NULL DEFAULT NULL COMMENT '品牌id',
`category_id` bigint(20) NULL DEFAULT NULL COMMENT '分类id',
`brand_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '品牌名称',
`category_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '分类名称',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 24 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '品牌分类关联' ROW_FORMAT = Dynamic;
-- ----------------------------
-- Table structure for comment_reply
-- ----------------------------
DROP TABLE IF EXISTS `comment_reply`;
CREATE TABLE `comment_reply` (
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'id',
`comment_id` bigint(20) NULL DEFAULT NULL COMMENT '评论id',
`reply_id` bigint(20) NULL DEFAULT NULL COMMENT '回复id',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '商品评价回复关系' ROW_FORMAT = Dynamic;
-- ----------------------------
-- Table structure for product_attr_value
-- ----------------------------
DROP TABLE IF EXISTS `product_attr_value`;
CREATE TABLE `product_attr_value` (
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'id',
`spu_id` bigint(20) NULL DEFAULT NULL COMMENT '商品id',
`attr_id` bigint(20) NULL DEFAULT NULL COMMENT '属性id',
`attr_name` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '属性名',
`attr_value` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '属性值',
`attr_sort` int(11) NULL DEFAULT NULL COMMENT '顺序',
`quick_show` tinyint(4) NULL DEFAULT NULL COMMENT '快速展示【是否展示在介绍上;0-否 1-是】',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 80 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = 'spu属性值' ROW_FORMAT = Dynamic;
-- ----------------------------
-- Table structure for sku_images
-- ----------------------------
DROP TABLE IF EXISTS `sku_images`;
CREATE TABLE `sku_images` (
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'id',
`sku_id` bigint(20) NULL DEFAULT NULL COMMENT 'sku_id',
`img_url` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '图片地址',
`img_sort` int(11) NULL DEFAULT NULL COMMENT '排序',
`default_img` int(11) NULL DEFAULT NULL COMMENT '默认图[0 - 不是默认图,1 - 是默认图]',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 15 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = 'sku图片' ROW_FORMAT = Dynamic;
-- ----------------------------
-- Table structure for sku_info
-- ----------------------------
DROP TABLE IF EXISTS `sku_info`;
CREATE TABLE `sku_info` (
`sku_id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'skuId',
`spu_id` bigint(20) NULL DEFAULT NULL COMMENT 'spuId',
`sku_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT 'sku名称',
`sku_desc` varchar(2000) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT 'sku介绍描述',
`category_id` bigint(20) NULL DEFAULT NULL COMMENT '所属分类id',
`brand_id` bigint(20) NULL DEFAULT NULL COMMENT '品牌id',
`sku_default_img` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '默认图片',
`sku_title` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '标题',
`sku_subtitle` varchar(2000) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '副标题',
`price` decimal(18, 4) NULL DEFAULT NULL COMMENT '价格',
`sale_count` bigint(20) NULL DEFAULT NULL COMMENT '销量',
PRIMARY KEY (`sku_id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 43 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = 'sku信息' ROW_FORMAT = Dynamic;
-- ----------------------------
-- Table structure for sku_sale_attr_value
-- ----------------------------
DROP TABLE IF EXISTS `sku_sale_attr_value`;
CREATE TABLE `sku_sale_attr_value` (
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'id',
`sku_id` bigint(20) NULL DEFAULT NULL COMMENT 'sku_id',
`attr_id` bigint(20) NULL DEFAULT NULL COMMENT 'attr_id',
`attr_name` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '销售属性名',
`attr_value` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '销售属性值',
`attr_sort` int(11) NULL DEFAULT NULL COMMENT '顺序',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 85 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = 'sku销售属性&值' ROW_FORMAT = Dynamic;
-- ----------------------------
-- Table structure for spu_comment
-- ----------------------------
DROP TABLE IF EXISTS `spu_comment`;
CREATE TABLE `spu_comment` (
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'id',
`sku_id` bigint(20) NULL DEFAULT NULL COMMENT 'sku_id',
`spu_id` bigint(20) NULL DEFAULT NULL COMMENT 'spu_id',
`spu_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '商品名字',
`member_nick_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '会员昵称',
`star` tinyint(1) NULL DEFAULT NULL COMMENT '星级',
`member_ip` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '会员ip',
`create_time` datetime(0) NULL DEFAULT NULL COMMENT '创建时间',
`show_status` tinyint(1) NULL DEFAULT NULL COMMENT '显示状态[0-不显示,1-显示]',
`spu_attributes` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '购买时属性组合',
`likes_count` int(11) NULL DEFAULT NULL COMMENT '点赞数',
`reply_count` int(11) NULL DEFAULT NULL COMMENT '回复数',
`resources` varchar(1000) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '评论图片/视频[json数据;[{type:文件类型,url:资源路径}]]',
`content` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '内容',
`member_icon` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '用户头像',
`comment_type` tinyint(4) NULL DEFAULT NULL COMMENT '评论类型[0 - 对商品的直接评论,1 - 对评论的回复]',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '商品评价' ROW_FORMAT = Dynamic;
-- ----------------------------
-- Table structure for spu_images
-- ----------------------------
DROP TABLE IF EXISTS `spu_images`;
CREATE TABLE `spu_images` (
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'id',
`spu_id` bigint(20) NULL DEFAULT NULL COMMENT 'spu_id',
`img_name` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '图片名',
`img_url` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '图片地址',
`img_sort` int(11) NULL DEFAULT NULL COMMENT '顺序',
`default_img` tinyint(4) NULL DEFAULT NULL COMMENT '是否默认图',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 49 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = 'spu图片' ROW_FORMAT = Dynamic;
-- ----------------------------
-- Table structure for spu_info
-- ----------------------------
DROP TABLE IF EXISTS `spu_info`;
CREATE TABLE `spu_info` (
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '商品id',
`spu_name` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '商品名称',
`spu_description` varchar(1000) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '商品描述',
`category_id` bigint(20) NULL DEFAULT NULL COMMENT '所属分类id',
`brand_id` bigint(20) NULL DEFAULT NULL COMMENT '品牌id',
`weight` decimal(18, 4) NULL DEFAULT NULL,
`publish_status` tinyint(4) NULL DEFAULT NULL COMMENT '上架状态[0 - 下架,1 - 上架]',
`create_time` datetime(0) NULL DEFAULT NULL COMMENT '创建时间',
`update_time` datetime(0) NULL DEFAULT NULL COMMENT '更新时间',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 38 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = 'spu信息' ROW_FORMAT = Dynamic;
-- ----------------------------
-- Table structure for spu_info_desc
-- ----------------------------
DROP TABLE IF EXISTS `spu_info_desc`;
CREATE TABLE `spu_info_desc` (
`spu_id` bigint(20) NOT NULL COMMENT '商品id',
`description` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '商品介绍',
PRIMARY KEY (`spu_id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = 'spu信息介绍' ROW_FORMAT = Dynamic;
-- ----------------------------
-- Table structure for undo_log
-- ----------------------------
DROP TABLE IF EXISTS `undo_log`;
CREATE TABLE `undo_log` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`branch_id` bigint(20) NOT NULL,
`xid` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
`context` varchar(128) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
`rollback_info` longblob NOT NULL,
`log_status` int(11) NOT NULL,
`log_created` datetime(0) NOT NULL,
`log_modified` datetime(0) NOT NULL,
`ext` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
PRIMARY KEY (`id`) USING BTREE,
UNIQUE INDEX `ux_undo_log`(`xid`, `branch_id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;
SET FOREIGN_KEY_CHECKS = 1; | the_stack |
-- 1 "sql/babelfishpg_common.in"
-- 1 "<built-in>"
-- 1 "<command-line>"
-- 1 "sql/babelfishpg_common.in"
CREATE SCHEMA sys;
GRANT USAGE ON SCHEMA sys TO PUBLIC;
SELECT set_config('search_path', 'sys, '||current_setting('search_path'), false);
-- 1 "sql/money/fixeddecimal--1.1.0_base_parallel.sql" 1
------------------
-- FIXEDDECIMAL --
------------------
CREATE TYPE sys.FIXEDDECIMAL;
CREATE FUNCTION sys.fixeddecimalin(cstring, oid, int4)
RETURNS FIXEDDECIMAL
AS 'babelfishpg_money', 'fixeddecimalin'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE FUNCTION sys.fixeddecimalout(fixeddecimal)
RETURNS cstring
AS 'babelfishpg_money', 'fixeddecimalout'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE FUNCTION sys.fixeddecimalrecv(internal)
RETURNS FIXEDDECIMAL
AS 'babelfishpg_money', 'fixeddecimalrecv'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE FUNCTION sys.fixeddecimalsend(FIXEDDECIMAL)
RETURNS bytea
AS 'babelfishpg_money', 'fixeddecimalsend'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE FUNCTION sys.fixeddecimaltypmodin(_cstring)
RETURNS INT4
AS 'babelfishpg_money', 'fixeddecimaltypmodin'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE FUNCTION sys.fixeddecimaltypmodout(INT4)
RETURNS cstring
AS 'babelfishpg_money', 'fixeddecimaltypmodout'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE TYPE sys.FIXEDDECIMAL (
INPUT = fixeddecimalin,
OUTPUT = fixeddecimalout,
RECEIVE = fixeddecimalrecv,
SEND = fixeddecimalsend,
TYPMOD_IN = fixeddecimaltypmodin,
TYPMOD_OUT = fixeddecimaltypmodout,
INTERNALLENGTH = 8,
ALIGNMENT = 'double',
STORAGE = plain,
CATEGORY = 'N',
PREFERRED = false,
COLLATABLE = false,
PASSEDBYVALUE -- But not always.. XXX fix that.
);
-- FIXEDDECIMAL, NUMERIC
CREATE FUNCTION sys.fixeddecimaleq(FIXEDDECIMAL, FIXEDDECIMAL)
RETURNS bool
AS 'babelfishpg_money', 'fixeddecimaleq'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE FUNCTION sys.fixeddecimalne(FIXEDDECIMAL, FIXEDDECIMAL)
RETURNS bool
AS 'babelfishpg_money', 'fixeddecimalne'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE FUNCTION sys.fixeddecimallt(FIXEDDECIMAL, FIXEDDECIMAL)
RETURNS bool
AS 'babelfishpg_money', 'fixeddecimallt'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE FUNCTION sys.fixeddecimalle(FIXEDDECIMAL, FIXEDDECIMAL)
RETURNS bool
AS 'babelfishpg_money', 'fixeddecimalle'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE FUNCTION sys.fixeddecimalgt(FIXEDDECIMAL, FIXEDDECIMAL)
RETURNS bool
AS 'babelfishpg_money', 'fixeddecimalgt'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE FUNCTION sys.fixeddecimalge(FIXEDDECIMAL, FIXEDDECIMAL)
RETURNS bool
AS 'babelfishpg_money', 'fixeddecimalge'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE FUNCTION sys.fixeddecimalum(FIXEDDECIMAL)
RETURNS sys.MONEY
AS 'babelfishpg_money', 'fixeddecimalum'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE FUNCTION sys.fixeddecimalpl(FIXEDDECIMAL, FIXEDDECIMAL)
RETURNS sys.MONEY
AS 'babelfishpg_money', 'fixeddecimalpl'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE FUNCTION sys.fixeddecimalmi(FIXEDDECIMAL, FIXEDDECIMAL)
RETURNS sys.MONEY
AS 'babelfishpg_money', 'fixeddecimalmi'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE FUNCTION sys.fixeddecimalmul(FIXEDDECIMAL, FIXEDDECIMAL)
RETURNS sys.MONEY
AS 'babelfishpg_money', 'fixeddecimalmul'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE FUNCTION sys.fixeddecimaldiv(FIXEDDECIMAL, FIXEDDECIMAL)
RETURNS sys.MONEY
AS 'babelfishpg_money', 'fixeddecimaldiv'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE FUNCTION sys.abs(FIXEDDECIMAL)
RETURNS sys.MONEY
AS 'babelfishpg_money', 'fixeddecimalabs'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE FUNCTION sys.fixeddecimallarger(FIXEDDECIMAL, FIXEDDECIMAL)
RETURNS FIXEDDECIMAL
AS 'babelfishpg_money', 'fixeddecimallarger'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE FUNCTION sys.fixeddecimalsmaller(FIXEDDECIMAL, FIXEDDECIMAL)
RETURNS FIXEDDECIMAL
AS 'babelfishpg_money', 'fixeddecimalsmaller'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE FUNCTION sys.fixeddecimal_cmp(FIXEDDECIMAL, FIXEDDECIMAL)
RETURNS INT4
AS 'babelfishpg_money', 'fixeddecimal_cmp'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE FUNCTION sys.fixeddecimal_hash(FIXEDDECIMAL)
RETURNS INT4
AS 'babelfishpg_money', 'fixeddecimal_hash'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
--
-- Operators.
--
-- FIXEDDECIMAL op FIXEDDECIMAL
CREATE OPERATOR sys.= (
LEFTARG = FIXEDDECIMAL,
RIGHTARG = FIXEDDECIMAL,
COMMUTATOR = =,
NEGATOR = <>,
PROCEDURE = fixeddecimaleq,
RESTRICT = eqsel,
JOIN = eqjoinsel,
MERGES
);
CREATE OPERATOR sys.<> (
LEFTARG = FIXEDDECIMAL,
RIGHTARG = FIXEDDECIMAL,
NEGATOR = =,
COMMUTATOR = <>,
PROCEDURE = fixeddecimalne,
RESTRICT = neqsel,
JOIN = neqjoinsel
);
CREATE OPERATOR sys.< (
LEFTARG = FIXEDDECIMAL,
RIGHTARG = FIXEDDECIMAL,
NEGATOR = >=,
COMMUTATOR = >,
PROCEDURE = fixeddecimallt,
RESTRICT = scalarltsel,
JOIN = scalarltjoinsel
);
CREATE OPERATOR sys.<= (
LEFTARG = FIXEDDECIMAL,
RIGHTARG = FIXEDDECIMAL,
NEGATOR = >,
COMMUTATOR = >=,
PROCEDURE = fixeddecimalle,
RESTRICT = scalarltsel,
JOIN = scalarltjoinsel
);
CREATE OPERATOR sys.>= (
LEFTARG = FIXEDDECIMAL,
RIGHTARG = FIXEDDECIMAL,
NEGATOR = <,
COMMUTATOR = <=,
PROCEDURE = fixeddecimalge,
RESTRICT = scalargtsel,
JOIN = scalargtjoinsel
);
CREATE OPERATOR sys.> (
LEFTARG = FIXEDDECIMAL,
RIGHTARG = FIXEDDECIMAL,
NEGATOR = <=,
COMMUTATOR = <,
PROCEDURE = fixeddecimalgt,
RESTRICT = scalargtsel,
JOIN = scalargtjoinsel
);
CREATE OPERATOR sys.+ (
LEFTARG = FIXEDDECIMAL,
RIGHTARG = FIXEDDECIMAL,
COMMUTATOR = +,
PROCEDURE = fixeddecimalpl
);
CREATE OPERATOR sys.- (
LEFTARG = FIXEDDECIMAL,
RIGHTARG = FIXEDDECIMAL,
PROCEDURE = fixeddecimalmi
);
CREATE OPERATOR sys.- (
RIGHTARG = FIXEDDECIMAL,
PROCEDURE = fixeddecimalum
);
CREATE OPERATOR sys.* (
LEFTARG = FIXEDDECIMAL,
RIGHTARG = FIXEDDECIMAL,
COMMUTATOR = *,
PROCEDURE = fixeddecimalmul
);
CREATE OPERATOR sys./ (
LEFTARG = FIXEDDECIMAL,
RIGHTARG = FIXEDDECIMAL,
PROCEDURE = fixeddecimaldiv
);
CREATE OPERATOR CLASS sys.fixeddecimal_ops
DEFAULT FOR TYPE FIXEDDECIMAL USING btree AS
OPERATOR 1 < (FIXEDDECIMAL, FIXEDDECIMAL),
OPERATOR 2 <= (FIXEDDECIMAL, FIXEDDECIMAL),
OPERATOR 3 = (FIXEDDECIMAL, FIXEDDECIMAL),
OPERATOR 4 >= (FIXEDDECIMAL, FIXEDDECIMAL),
OPERATOR 5 > (FIXEDDECIMAL, FIXEDDECIMAL),
FUNCTION 1 fixeddecimal_cmp(FIXEDDECIMAL, FIXEDDECIMAL);
CREATE OPERATOR CLASS sys.fixeddecimal_ops
DEFAULT FOR TYPE FIXEDDECIMAL USING hash AS
OPERATOR 1 = (FIXEDDECIMAL, FIXEDDECIMAL),
FUNCTION 1 fixeddecimal_hash(FIXEDDECIMAL);
-- FIXEDDECIMAL, NUMERIC
CREATE FUNCTION sys.fixeddecimal_numeric_cmp(FIXEDDECIMAL, NUMERIC)
RETURNS INT4
AS 'babelfishpg_money', 'fixeddecimal_numeric_cmp'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE FUNCTION sys.numeric_fixeddecimal_cmp(NUMERIC, FIXEDDECIMAL)
RETURNS INT4
AS 'babelfishpg_money', 'numeric_fixeddecimal_cmp'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE FUNCTION sys.fixeddecimal_numeric_eq(FIXEDDECIMAL, NUMERIC)
RETURNS bool
AS 'babelfishpg_money', 'fixeddecimal_numeric_eq'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE FUNCTION sys.fixeddecimal_numeric_ne(FIXEDDECIMAL, NUMERIC)
RETURNS bool
AS 'babelfishpg_money', 'fixeddecimal_numeric_ne'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE FUNCTION sys.fixeddecimal_numeric_lt(FIXEDDECIMAL, NUMERIC)
RETURNS bool
AS 'babelfishpg_money', 'fixeddecimal_numeric_lt'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE FUNCTION sys.fixeddecimal_numeric_le(FIXEDDECIMAL, NUMERIC)
RETURNS bool
AS 'babelfishpg_money', 'fixeddecimal_numeric_le'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE FUNCTION sys.fixeddecimal_numeric_gt(FIXEDDECIMAL, NUMERIC)
RETURNS bool
AS 'babelfishpg_money', 'fixeddecimal_numeric_gt'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE FUNCTION sys.fixeddecimal_numeric_ge(FIXEDDECIMAL, NUMERIC)
RETURNS bool
AS 'babelfishpg_money', 'fixeddecimal_numeric_ge'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE OPERATOR sys.= (
LEFTARG = FIXEDDECIMAL,
RIGHTARG = NUMERIC,
COMMUTATOR = =,
NEGATOR = <>,
PROCEDURE = fixeddecimal_numeric_eq,
RESTRICT = eqsel,
JOIN = eqjoinsel,
MERGES
);
CREATE OPERATOR sys.<> (
LEFTARG = FIXEDDECIMAL,
RIGHTARG = NUMERIC,
NEGATOR = =,
COMMUTATOR = <>,
PROCEDURE = fixeddecimal_numeric_ne,
RESTRICT = neqsel,
JOIN = neqjoinsel
);
CREATE OPERATOR sys.< (
LEFTARG = FIXEDDECIMAL,
RIGHTARG = NUMERIC,
NEGATOR = >=,
COMMUTATOR = >,
PROCEDURE = fixeddecimal_numeric_lt,
RESTRICT = scalarltsel,
JOIN = scalarltjoinsel
);
CREATE OPERATOR sys.<= (
LEFTARG = FIXEDDECIMAL,
RIGHTARG = NUMERIC,
NEGATOR = >,
COMMUTATOR = >=,
PROCEDURE = fixeddecimal_numeric_le,
RESTRICT = scalarltsel,
JOIN = scalarltjoinsel
);
CREATE OPERATOR sys.>= (
LEFTARG = FIXEDDECIMAL,
RIGHTARG = NUMERIC,
NEGATOR = <,
COMMUTATOR = <=,
PROCEDURE = fixeddecimal_numeric_ge,
RESTRICT = scalargtsel,
JOIN = scalargtjoinsel
);
CREATE OPERATOR sys.> (
LEFTARG = FIXEDDECIMAL,
RIGHTARG = NUMERIC,
NEGATOR = <=,
COMMUTATOR = <,
PROCEDURE = fixeddecimal_numeric_gt,
RESTRICT = scalargtsel,
JOIN = scalargtjoinsel
);
CREATE OPERATOR CLASS sys.fixeddecimal_numeric_ops
FOR TYPE FIXEDDECIMAL USING btree AS
OPERATOR 1 < (FIXEDDECIMAL, NUMERIC),
OPERATOR 2 <= (FIXEDDECIMAL, NUMERIC),
OPERATOR 3 = (FIXEDDECIMAL, NUMERIC),
OPERATOR 4 >= (FIXEDDECIMAL, NUMERIC),
OPERATOR 5 > (FIXEDDECIMAL, NUMERIC),
FUNCTION 1 fixeddecimal_numeric_cmp(FIXEDDECIMAL, NUMERIC);
CREATE OPERATOR CLASS sys.fixeddecimal_numeric_ops
FOR TYPE FIXEDDECIMAL USING hash AS
OPERATOR 1 = (FIXEDDECIMAL, NUMERIC),
FUNCTION 1 fixeddecimal_hash(FIXEDDECIMAL);
-- NUMERIC, FIXEDDECIMAL
CREATE FUNCTION sys.numeric_fixeddecimal_eq(NUMERIC, FIXEDDECIMAL)
RETURNS bool
AS 'babelfishpg_money', 'numeric_fixeddecimal_eq'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE FUNCTION sys.numeric_fixeddecimal_ne(NUMERIC, FIXEDDECIMAL)
RETURNS bool
AS 'babelfishpg_money', 'numeric_fixeddecimal_ne'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE FUNCTION sys.numeric_fixeddecimal_lt(NUMERIC, FIXEDDECIMAL)
RETURNS bool
AS 'babelfishpg_money', 'numeric_fixeddecimal_lt'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE FUNCTION sys.numeric_fixeddecimal_le(NUMERIC, FIXEDDECIMAL)
RETURNS bool
AS 'babelfishpg_money', 'numeric_fixeddecimal_le'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE FUNCTION sys.numeric_fixeddecimal_gt(NUMERIC, FIXEDDECIMAL)
RETURNS bool
AS 'babelfishpg_money', 'numeric_fixeddecimal_gt'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE FUNCTION sys.numeric_fixeddecimal_ge(NUMERIC, FIXEDDECIMAL)
RETURNS bool
AS 'babelfishpg_money', 'numeric_fixeddecimal_ge'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE OPERATOR sys.= (
LEFTARG = NUMERIC,
RIGHTARG = FIXEDDECIMAL,
COMMUTATOR = =,
NEGATOR = <>,
PROCEDURE = numeric_fixeddecimal_eq,
RESTRICT = eqsel,
JOIN = eqjoinsel,
MERGES
);
CREATE OPERATOR sys.<> (
LEFTARG = NUMERIC,
RIGHTARG = FIXEDDECIMAL,
NEGATOR = =,
COMMUTATOR = <>,
PROCEDURE = numeric_fixeddecimal_ne,
RESTRICT = neqsel,
JOIN = neqjoinsel
);
CREATE OPERATOR sys.< (
LEFTARG = NUMERIC,
RIGHTARG = FIXEDDECIMAL,
NEGATOR = >=,
COMMUTATOR = >,
PROCEDURE = numeric_fixeddecimal_lt,
RESTRICT = scalarltsel,
JOIN = scalarltjoinsel
);
CREATE OPERATOR sys.<= (
LEFTARG = NUMERIC,
RIGHTARG = FIXEDDECIMAL,
NEGATOR = >,
COMMUTATOR = >=,
PROCEDURE = numeric_fixeddecimal_le,
RESTRICT = scalarltsel,
JOIN = scalarltjoinsel
);
CREATE OPERATOR >= (
LEFTARG = NUMERIC,
RIGHTARG = FIXEDDECIMAL,
NEGATOR = <,
COMMUTATOR = <=,
PROCEDURE = numeric_fixeddecimal_ge,
RESTRICT = scalargtsel,
JOIN = scalargtjoinsel
);
CREATE OPERATOR sys.> (
LEFTARG = NUMERIC,
RIGHTARG = FIXEDDECIMAL,
NEGATOR = <=,
COMMUTATOR = <,
PROCEDURE = numeric_fixeddecimal_gt,
RESTRICT = scalargtsel,
JOIN = scalargtjoinsel
);
CREATE OPERATOR CLASS sys.numeric_fixeddecimal_ops
FOR TYPE FIXEDDECIMAL USING btree AS
OPERATOR 1 < (NUMERIC, FIXEDDECIMAL) FOR SEARCH,
OPERATOR 2 <= (NUMERIC, FIXEDDECIMAL) FOR SEARCH,
OPERATOR 3 = (NUMERIC, FIXEDDECIMAL) FOR SEARCH,
OPERATOR 4 >= (NUMERIC, FIXEDDECIMAL) FOR SEARCH,
OPERATOR 5 > (NUMERIC, FIXEDDECIMAL) FOR SEARCH,
FUNCTION 1 numeric_fixeddecimal_cmp(NUMERIC, FIXEDDECIMAL);
CREATE OPERATOR CLASS sys.numeric_fixeddecimal_ops
FOR TYPE FIXEDDECIMAL USING hash AS
OPERATOR 1 = (NUMERIC, FIXEDDECIMAL),
FUNCTION 1 fixeddecimal_hash(FIXEDDECIMAL);
--
-- Cross type operators with int8
--
-- FIXEDDECIMAL, INT8
CREATE FUNCTION sys.fixeddecimal_int8_cmp(FIXEDDECIMAL, INT8)
RETURNS INT4
AS 'babelfishpg_money', 'fixeddecimal_int8_cmp'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE FUNCTION sys.fixeddecimal_int8_eq(FIXEDDECIMAL, INT8)
RETURNS bool
AS 'babelfishpg_money', 'fixeddecimal_int8_eq'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE FUNCTION sys.fixeddecimal_int8_ne(FIXEDDECIMAL, INT8)
RETURNS bool
AS 'babelfishpg_money', 'fixeddecimal_int8_ne'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE FUNCTION sys.fixeddecimal_int8_lt(FIXEDDECIMAL, INT8)
RETURNS bool
AS 'babelfishpg_money', 'fixeddecimal_int8_lt'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE FUNCTION sys.fixeddecimal_int8_le(FIXEDDECIMAL, INT8)
RETURNS bool
AS 'babelfishpg_money', 'fixeddecimal_int8_le'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE FUNCTION sys.fixeddecimal_int8_gt(FIXEDDECIMAL, INT8)
RETURNS bool
AS 'babelfishpg_money', 'fixeddecimal_int8_gt'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE FUNCTION sys.fixeddecimal_int8_ge(FIXEDDECIMAL, INT8)
RETURNS bool
AS 'babelfishpg_money', 'fixeddecimal_int8_ge'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE FUNCTION sys.fixeddecimalint8pl(FIXEDDECIMAL, INT8)
RETURNS sys.MONEY
AS 'babelfishpg_money', 'fixeddecimalint8pl'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE FUNCTION sys.fixeddecimalint8mi(FIXEDDECIMAL, INT8)
RETURNS sys.MONEY
AS 'babelfishpg_money', 'fixeddecimalint8mi'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE FUNCTION sys.fixeddecimalint8mul(FIXEDDECIMAL, INT8)
RETURNS sys.MONEY
AS 'babelfishpg_money', 'fixeddecimalint8mul'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE FUNCTION sys.fixeddecimalint8div(FIXEDDECIMAL, INT8)
RETURNS sys.MONEY
AS 'babelfishpg_money', 'fixeddecimalint8div'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE OPERATOR sys.= (
LEFTARG = FIXEDDECIMAL,
RIGHTARG = INT8,
COMMUTATOR = =,
NEGATOR = <>,
PROCEDURE = fixeddecimal_int8_eq,
RESTRICT = eqsel,
JOIN = eqjoinsel,
MERGES
);
CREATE OPERATOR sys.<> (
LEFTARG = FIXEDDECIMAL,
RIGHTARG = INT8,
NEGATOR = =,
COMMUTATOR = <>,
PROCEDURE = fixeddecimal_int8_ne,
RESTRICT = neqsel,
JOIN = neqjoinsel
);
CREATE OPERATOR sys.< (
LEFTARG = FIXEDDECIMAL,
RIGHTARG = INT8,
NEGATOR = >=,
COMMUTATOR = >,
PROCEDURE = fixeddecimal_int8_lt,
RESTRICT = scalarltsel,
JOIN = scalarltjoinsel
);
CREATE OPERATOR sys.<= (
LEFTARG = FIXEDDECIMAL,
RIGHTARG = INT8,
NEGATOR = >,
COMMUTATOR = >=,
PROCEDURE = fixeddecimal_int8_le,
RESTRICT = scalarltsel,
JOIN = scalarltjoinsel
);
CREATE OPERATOR sys.>= (
LEFTARG = FIXEDDECIMAL,
RIGHTARG = INT8,
NEGATOR = <,
COMMUTATOR = <=,
PROCEDURE = fixeddecimal_int8_ge,
RESTRICT = scalargtsel,
JOIN = scalargtjoinsel
);
CREATE OPERATOR sys.> (
LEFTARG = FIXEDDECIMAL,
RIGHTARG = INT8,
NEGATOR = <=,
COMMUTATOR = <,
PROCEDURE = fixeddecimal_int8_gt,
RESTRICT = scalargtsel,
JOIN = scalargtjoinsel
);
CREATE OPERATOR sys.+ (
LEFTARG = FIXEDDECIMAL,
RIGHTARG = INT8,
COMMUTATOR = +,
PROCEDURE = fixeddecimalint8pl
);
CREATE OPERATOR sys.- (
LEFTARG = FIXEDDECIMAL,
RIGHTARG = INT8,
PROCEDURE = fixeddecimalint8mi
);
CREATE OPERATOR sys.* (
LEFTARG = FIXEDDECIMAL,
RIGHTARG = INT8,
COMMUTATOR = *,
PROCEDURE = fixeddecimalint8mul
);
CREATE OPERATOR sys./ (
LEFTARG = FIXEDDECIMAL,
RIGHTARG = INT8,
PROCEDURE = fixeddecimalint8div
);
CREATE OPERATOR CLASS sys.fixeddecimal_int8_ops
FOR TYPE FIXEDDECIMAL USING btree AS
OPERATOR 1 < (FIXEDDECIMAL, INT8),
OPERATOR 2 <= (FIXEDDECIMAL, INT8),
OPERATOR 3 = (FIXEDDECIMAL, INT8),
OPERATOR 4 >= (FIXEDDECIMAL, INT8),
OPERATOR 5 > (FIXEDDECIMAL, INT8),
FUNCTION 1 fixeddecimal_int8_cmp(FIXEDDECIMAL, INT8);
CREATE OPERATOR CLASS sys.fixeddecimal_int8_ops
FOR TYPE FIXEDDECIMAL USING hash AS
OPERATOR 1 = (FIXEDDECIMAL, INT8),
FUNCTION 1 fixeddecimal_hash(FIXEDDECIMAL);
-- INT8, FIXEDDECIMAL
CREATE FUNCTION sys.int8_fixeddecimal_cmp(INT8, FIXEDDECIMAL)
RETURNS INT4
AS 'babelfishpg_money', 'int8_fixeddecimal_cmp'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE FUNCTION sys.int8_fixeddecimal_eq(INT8, FIXEDDECIMAL)
RETURNS bool
AS 'babelfishpg_money', 'int8_fixeddecimal_eq'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE FUNCTION sys.int8_fixeddecimal_ne(INT8, FIXEDDECIMAL)
RETURNS bool
AS 'babelfishpg_money', 'int8_fixeddecimal_ne'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE FUNCTION sys.int8_fixeddecimal_lt(INT8, FIXEDDECIMAL)
RETURNS bool
AS 'babelfishpg_money', 'int8_fixeddecimal_lt'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE FUNCTION sys.int8_fixeddecimal_le(INT8, FIXEDDECIMAL)
RETURNS bool
AS 'babelfishpg_money', 'int8_fixeddecimal_le'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE FUNCTION sys.int8_fixeddecimal_gt(INT8, FIXEDDECIMAL)
RETURNS bool
AS 'babelfishpg_money', 'int8_fixeddecimal_gt'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE FUNCTION sys.int8_fixeddecimal_ge(INT8, FIXEDDECIMAL)
RETURNS bool
AS 'babelfishpg_money', 'int8_fixeddecimal_ge'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE FUNCTION sys.int8fixeddecimalpl(INT8, FIXEDDECIMAL)
RETURNS sys.MONEY
AS 'babelfishpg_money', 'int8fixeddecimalpl'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE FUNCTION sys.int8fixeddecimalmi(INT8, FIXEDDECIMAL)
RETURNS sys.MONEY
AS 'babelfishpg_money', 'int8fixeddecimalmi'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE FUNCTION sys.int8fixeddecimalmul(INT8, FIXEDDECIMAL)
RETURNS sys.MONEY
AS 'babelfishpg_money', 'int8fixeddecimalmul'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE FUNCTION sys.int8fixeddecimaldiv(INT8, FIXEDDECIMAL)
RETURNS DOUBLE PRECISION
AS 'babelfishpg_money', 'int8fixeddecimaldiv'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE OPERATOR sys.= (
LEFTARG = INT8,
RIGHTARG = FIXEDDECIMAL,
COMMUTATOR = =,
NEGATOR = <>,
PROCEDURE = int8_fixeddecimal_eq,
RESTRICT = eqsel,
JOIN = eqjoinsel,
MERGES
);
CREATE OPERATOR sys.<> (
LEFTARG = INT8,
RIGHTARG = FIXEDDECIMAL,
NEGATOR = =,
COMMUTATOR = <>,
PROCEDURE = int8_fixeddecimal_ne,
RESTRICT = neqsel,
JOIN = neqjoinsel
);
CREATE OPERATOR sys.< (
LEFTARG = INT8,
RIGHTARG = FIXEDDECIMAL,
NEGATOR = >=,
COMMUTATOR = >,
PROCEDURE = int8_fixeddecimal_lt,
RESTRICT = scalarltsel,
JOIN = scalarltjoinsel
);
CREATE OPERATOR sys.<= (
LEFTARG = INT8,
RIGHTARG = FIXEDDECIMAL,
NEGATOR = >,
COMMUTATOR = >=,
PROCEDURE = int8_fixeddecimal_le,
RESTRICT = scalarltsel,
JOIN = scalarltjoinsel
);
CREATE OPERATOR sys.>= (
LEFTARG = INT8,
RIGHTARG = FIXEDDECIMAL,
NEGATOR = <,
COMMUTATOR = <=,
PROCEDURE = int8_fixeddecimal_ge,
RESTRICT = scalargtsel,
JOIN = scalargtjoinsel
);
CREATE OPERATOR sys.> (
LEFTARG = INT8,
RIGHTARG = FIXEDDECIMAL,
NEGATOR = <=,
COMMUTATOR = <,
PROCEDURE = int8_fixeddecimal_gt,
RESTRICT = scalargtsel,
JOIN = scalargtjoinsel
);
CREATE OPERATOR sys.+ (
LEFTARG = INT8,
RIGHTARG = FIXEDDECIMAL,
COMMUTATOR = +,
PROCEDURE = int8fixeddecimalpl
);
CREATE OPERATOR sys.- (
LEFTARG = INT8,
RIGHTARG = FIXEDDECIMAL,
PROCEDURE = int8fixeddecimalmi
);
CREATE OPERATOR sys.* (
LEFTARG = INT8,
RIGHTARG = FIXEDDECIMAL,
COMMUTATOR = *,
PROCEDURE = int8fixeddecimalmul
);
CREATE OPERATOR sys./ (
LEFTARG = INT8,
RIGHTARG = FIXEDDECIMAL,
PROCEDURE = int8fixeddecimaldiv
);
CREATE OPERATOR CLASS sys.int8_fixeddecimal_ops
FOR TYPE FIXEDDECIMAL USING btree AS
OPERATOR 1 < (INT8, FIXEDDECIMAL),
OPERATOR 2 <= (INT8, FIXEDDECIMAL),
OPERATOR 3 = (INT8, FIXEDDECIMAL),
OPERATOR 4 >= (INT8, FIXEDDECIMAL),
OPERATOR 5 > (INT8, FIXEDDECIMAL),
FUNCTION 1 int8_fixeddecimal_cmp(INT8, FIXEDDECIMAL);
CREATE OPERATOR CLASS sys.int8_fixeddecimal_ops
FOR TYPE FIXEDDECIMAL USING hash AS
OPERATOR 1 = (INT8, FIXEDDECIMAL),
FUNCTION 1 fixeddecimal_hash(FIXEDDECIMAL);
--
-- Cross type operators with int4
--
-- FIXEDDECIMAL, INT4
CREATE FUNCTION sys.fixeddecimal_int4_cmp(FIXEDDECIMAL, INT4)
RETURNS INT4
AS 'babelfishpg_money', 'fixeddecimal_int4_cmp'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE FUNCTION sys.fixeddecimal_int4_eq(FIXEDDECIMAL, INT4)
RETURNS bool
AS 'babelfishpg_money', 'fixeddecimal_int4_eq'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE FUNCTION sys.fixeddecimal_int4_ne(FIXEDDECIMAL, INT4)
RETURNS bool
AS 'babelfishpg_money', 'fixeddecimal_int4_ne'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE FUNCTION sys.fixeddecimal_int4_lt(FIXEDDECIMAL, INT4)
RETURNS bool
AS 'babelfishpg_money', 'fixeddecimal_int4_lt'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE FUNCTION sys.fixeddecimal_int4_le(FIXEDDECIMAL, INT4)
RETURNS bool
AS 'babelfishpg_money', 'fixeddecimal_int4_le'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE FUNCTION sys.fixeddecimal_int4_gt(FIXEDDECIMAL, INT4)
RETURNS bool
AS 'babelfishpg_money', 'fixeddecimal_int4_gt'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE FUNCTION sys.fixeddecimal_int4_ge(FIXEDDECIMAL, INT4)
RETURNS bool
AS 'babelfishpg_money', 'fixeddecimal_int4_ge'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE FUNCTION sys.fixeddecimalint4pl(FIXEDDECIMAL, INT4)
RETURNS sys.MONEY
AS 'babelfishpg_money', 'fixeddecimalint4pl'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE FUNCTION sys.fixeddecimalint4mi(FIXEDDECIMAL, INT4)
RETURNS sys.MONEY
AS 'babelfishpg_money', 'fixeddecimalint4mi'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE FUNCTION sys.fixeddecimalint4mul(FIXEDDECIMAL, INT4)
RETURNS sys.MONEY
AS 'babelfishpg_money', 'fixeddecimalint4mul'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE FUNCTION sys.fixeddecimalint4div(FIXEDDECIMAL, INT4)
RETURNS sys.MONEY
AS 'babelfishpg_money', 'fixeddecimalint4div'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE OPERATOR sys.= (
LEFTARG = FIXEDDECIMAL,
RIGHTARG = INT4,
COMMUTATOR = =,
NEGATOR = <>,
PROCEDURE = fixeddecimal_int4_eq,
RESTRICT = eqsel,
JOIN = eqjoinsel,
MERGES
);
CREATE OPERATOR sys.<> (
LEFTARG = FIXEDDECIMAL,
RIGHTARG = INT4,
NEGATOR = =,
COMMUTATOR = <>,
PROCEDURE = fixeddecimal_int4_ne,
RESTRICT = neqsel,
JOIN = neqjoinsel
);
CREATE OPERATOR sys.< (
LEFTARG = FIXEDDECIMAL,
RIGHTARG = INT4,
NEGATOR = >=,
COMMUTATOR = >,
PROCEDURE = fixeddecimal_int4_lt,
RESTRICT = scalarltsel,
JOIN = scalarltjoinsel
);
CREATE OPERATOR sys.<= (
LEFTARG = FIXEDDECIMAL,
RIGHTARG = INT4,
NEGATOR = >,
COMMUTATOR = >=,
PROCEDURE = fixeddecimal_int4_le,
RESTRICT = scalarltsel,
JOIN = scalarltjoinsel
);
CREATE OPERATOR sys.>= (
LEFTARG = FIXEDDECIMAL,
RIGHTARG = INT4,
NEGATOR = <,
COMMUTATOR = <=,
PROCEDURE = fixeddecimal_int4_ge,
RESTRICT = scalargtsel,
JOIN = scalargtjoinsel
);
CREATE OPERATOR sys.> (
LEFTARG = FIXEDDECIMAL,
RIGHTARG = INT4,
NEGATOR = <=,
COMMUTATOR = <,
PROCEDURE = fixeddecimal_int4_gt,
RESTRICT = scalargtsel,
JOIN = scalargtjoinsel
);
CREATE OPERATOR sys.+ (
LEFTARG = FIXEDDECIMAL,
RIGHTARG = INT4,
COMMUTATOR = +,
PROCEDURE = fixeddecimalint4pl
);
CREATE OPERATOR sys.- (
LEFTARG = FIXEDDECIMAL,
RIGHTARG = INT4,
PROCEDURE = fixeddecimalint4mi
);
CREATE OPERATOR sys.* (
LEFTARG = FIXEDDECIMAL,
RIGHTARG = INT4,
COMMUTATOR = *,
PROCEDURE = fixeddecimalint4mul
);
CREATE OPERATOR sys./ (
LEFTARG = FIXEDDECIMAL,
RIGHTARG = INT4,
PROCEDURE = fixeddecimalint4div
);
CREATE OPERATOR CLASS sys.fixeddecimal_int4_ops
FOR TYPE FIXEDDECIMAL USING btree AS
OPERATOR 1 < (FIXEDDECIMAL, INT4),
OPERATOR 2 <= (FIXEDDECIMAL, INT4),
OPERATOR 3 = (FIXEDDECIMAL, INT4),
OPERATOR 4 >= (FIXEDDECIMAL, INT4),
OPERATOR 5 > (FIXEDDECIMAL, INT4),
FUNCTION 1 fixeddecimal_int4_cmp(FIXEDDECIMAL, INT4);
CREATE OPERATOR CLASS sys.fixeddecimal_int4_ops
FOR TYPE FIXEDDECIMAL USING hash AS
OPERATOR 1 = (FIXEDDECIMAL, INT4),
FUNCTION 1 fixeddecimal_hash(FIXEDDECIMAL);
-- INT4, FIXEDDECIMAL
CREATE FUNCTION sys.int4_fixeddecimal_cmp(INT4, FIXEDDECIMAL)
RETURNS INT4
AS 'babelfishpg_money', 'int4_fixeddecimal_cmp'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE FUNCTION sys.int4_fixeddecimal_eq(INT4, FIXEDDECIMAL)
RETURNS bool
AS 'babelfishpg_money', 'int4_fixeddecimal_eq'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE FUNCTION sys.int4_fixeddecimal_ne(INT4, FIXEDDECIMAL)
RETURNS bool
AS 'babelfishpg_money', 'int4_fixeddecimal_ne'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE FUNCTION sys.int4_fixeddecimal_lt(INT4, FIXEDDECIMAL)
RETURNS bool
AS 'babelfishpg_money', 'int4_fixeddecimal_lt'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE FUNCTION sys.int4_fixeddecimal_le(INT4, FIXEDDECIMAL)
RETURNS bool
AS 'babelfishpg_money', 'int4_fixeddecimal_le'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE FUNCTION sys.int4_fixeddecimal_gt(INT4, FIXEDDECIMAL)
RETURNS bool
AS 'babelfishpg_money', 'int4_fixeddecimal_gt'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE FUNCTION sys.int4_fixeddecimal_ge(INT4, FIXEDDECIMAL)
RETURNS bool
AS 'babelfishpg_money', 'int4_fixeddecimal_ge'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE FUNCTION sys.int4fixeddecimalpl(INT4, FIXEDDECIMAL)
RETURNS sys.MONEY
AS 'babelfishpg_money', 'int4fixeddecimalpl'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE FUNCTION sys.int4fixeddecimalmi(INT4, FIXEDDECIMAL)
RETURNS sys.MONEY
AS 'babelfishpg_money', 'int4fixeddecimalmi'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE FUNCTION sys.int4fixeddecimalmul(INT4, FIXEDDECIMAL)
RETURNS sys.MONEY
AS 'babelfishpg_money', 'int4fixeddecimalmul'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE FUNCTION sys.int4fixeddecimaldiv(INT4, FIXEDDECIMAL)
RETURNS DOUBLE PRECISION
AS 'babelfishpg_money', 'int4fixeddecimaldiv'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE OPERATOR sys.= (
LEFTARG = INT4,
RIGHTARG = FIXEDDECIMAL,
COMMUTATOR = =,
NEGATOR = <>,
PROCEDURE = int4_fixeddecimal_eq,
RESTRICT = eqsel,
JOIN = eqjoinsel,
MERGES
);
CREATE OPERATOR sys.<> (
LEFTARG = INT4,
RIGHTARG = FIXEDDECIMAL,
NEGATOR = =,
COMMUTATOR = <>,
PROCEDURE = int4_fixeddecimal_ne,
RESTRICT = neqsel,
JOIN = neqjoinsel
);
CREATE OPERATOR sys.< (
LEFTARG = INT4,
RIGHTARG = FIXEDDECIMAL,
NEGATOR = >=,
COMMUTATOR = >,
PROCEDURE = int4_fixeddecimal_lt,
RESTRICT = scalarltsel,
JOIN = scalarltjoinsel
);
CREATE OPERATOR sys.<= (
LEFTARG = INT4,
RIGHTARG = FIXEDDECIMAL,
NEGATOR = >,
COMMUTATOR = >=,
PROCEDURE = int4_fixeddecimal_le,
RESTRICT = scalarltsel,
JOIN = scalarltjoinsel
);
CREATE OPERATOR sys.>= (
LEFTARG = INT4,
RIGHTARG = FIXEDDECIMAL,
NEGATOR = <,
COMMUTATOR = <=,
PROCEDURE = int4_fixeddecimal_ge,
RESTRICT = scalargtsel,
JOIN = scalargtjoinsel
);
CREATE OPERATOR sys.> (
LEFTARG = INT4,
RIGHTARG = FIXEDDECIMAL,
NEGATOR = <=,
COMMUTATOR = <,
PROCEDURE = int4_fixeddecimal_gt,
RESTRICT = scalargtsel,
JOIN = scalargtjoinsel
);
CREATE OPERATOR sys.+ (
LEFTARG = INT4,
RIGHTARG = FIXEDDECIMAL,
COMMUTATOR = +,
PROCEDURE = int4fixeddecimalpl
);
CREATE OPERATOR sys.- (
LEFTARG = INT4,
RIGHTARG = FIXEDDECIMAL,
PROCEDURE = int4fixeddecimalmi
);
CREATE OPERATOR sys.* (
LEFTARG = INT4,
RIGHTARG = FIXEDDECIMAL,
COMMUTATOR = *,
PROCEDURE = int4fixeddecimalmul
);
CREATE OPERATOR sys./ (
LEFTARG = INT4,
RIGHTARG = FIXEDDECIMAL,
PROCEDURE = int4fixeddecimaldiv
);
CREATE OPERATOR CLASS sys.int4_fixeddecimal_ops
FOR TYPE FIXEDDECIMAL USING btree AS
OPERATOR 1 < (INT4, FIXEDDECIMAL),
OPERATOR 2 <= (INT4, FIXEDDECIMAL),
OPERATOR 3 = (INT4, FIXEDDECIMAL),
OPERATOR 4 >= (INT4, FIXEDDECIMAL),
OPERATOR 5 > (INT4, FIXEDDECIMAL),
FUNCTION 1 int4_fixeddecimal_cmp(INT4, FIXEDDECIMAL);
CREATE OPERATOR CLASS sys.int4_fixeddecimal_ops
FOR TYPE FIXEDDECIMAL USING hash AS
OPERATOR 1 = (INT4, FIXEDDECIMAL),
FUNCTION 1 fixeddecimal_hash(FIXEDDECIMAL);
--
-- Cross type operators with int2
--
-- FIXEDDECIMAL, INT2
CREATE FUNCTION sys.fixeddecimal_int2_cmp(FIXEDDECIMAL, INT2)
RETURNS INT4
AS 'babelfishpg_money', 'fixeddecimal_int2_cmp'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE FUNCTION sys.fixeddecimal_int2_eq(FIXEDDECIMAL, INT2)
RETURNS bool
AS 'babelfishpg_money', 'fixeddecimal_int2_eq'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE FUNCTION sys.fixeddecimal_int2_ne(FIXEDDECIMAL, INT2)
RETURNS bool
AS 'babelfishpg_money', 'fixeddecimal_int2_ne'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE FUNCTION sys.fixeddecimal_int2_lt(FIXEDDECIMAL, INT2)
RETURNS bool
AS 'babelfishpg_money', 'fixeddecimal_int2_lt'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE FUNCTION sys.fixeddecimal_int2_le(FIXEDDECIMAL, INT2)
RETURNS bool
AS 'babelfishpg_money', 'fixeddecimal_int2_le'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE FUNCTION sys.fixeddecimal_int2_gt(FIXEDDECIMAL, INT2)
RETURNS bool
AS 'babelfishpg_money', 'fixeddecimal_int2_gt'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE FUNCTION sys.fixeddecimal_int2_ge(FIXEDDECIMAL, INT2)
RETURNS bool
AS 'babelfishpg_money', 'fixeddecimal_int2_ge'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE FUNCTION sys.fixeddecimalint2pl(FIXEDDECIMAL, INT2)
RETURNS sys.MONEY
AS 'babelfishpg_money', 'fixeddecimalint2pl'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE FUNCTION sys.fixeddecimalint2mi(FIXEDDECIMAL, INT2)
RETURNS sys.MONEY
AS 'babelfishpg_money', 'fixeddecimalint2mi'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE FUNCTION sys.fixeddecimalint2mul(FIXEDDECIMAL, INT2)
RETURNS sys.MONEY
AS 'babelfishpg_money', 'fixeddecimalint2mul'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE FUNCTION sys.fixeddecimalint2div(FIXEDDECIMAL, INT2)
RETURNS sys.MONEY
AS 'babelfishpg_money', 'fixeddecimalint2div'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE OPERATOR sys.= (
LEFTARG = FIXEDDECIMAL,
RIGHTARG = INT2,
COMMUTATOR = =,
NEGATOR = <>,
PROCEDURE = fixeddecimal_int2_eq,
RESTRICT = eqsel,
JOIN = eqjoinsel,
MERGES
);
CREATE OPERATOR sys.<> (
LEFTARG = FIXEDDECIMAL,
RIGHTARG = INT2,
NEGATOR = =,
COMMUTATOR = <>,
PROCEDURE = fixeddecimal_int2_ne,
RESTRICT = neqsel,
JOIN = neqjoinsel
);
CREATE OPERATOR sys.< (
LEFTARG = FIXEDDECIMAL,
RIGHTARG = INT2,
NEGATOR = >=,
COMMUTATOR = >,
PROCEDURE = fixeddecimal_int2_lt,
RESTRICT = scalarltsel,
JOIN = scalarltjoinsel
);
CREATE OPERATOR sys.<= (
LEFTARG = FIXEDDECIMAL,
RIGHTARG = INT2,
NEGATOR = >,
COMMUTATOR = >=,
PROCEDURE = fixeddecimal_int2_le,
RESTRICT = scalarltsel,
JOIN = scalarltjoinsel
);
CREATE OPERATOR sys.>= (
LEFTARG = FIXEDDECIMAL,
RIGHTARG = INT2,
NEGATOR = <,
COMMUTATOR = <=,
PROCEDURE = fixeddecimal_int2_ge,
RESTRICT = scalargtsel,
JOIN = scalargtjoinsel
);
CREATE OPERATOR sys.> (
LEFTARG = FIXEDDECIMAL,
RIGHTARG = INT2,
NEGATOR = <=,
COMMUTATOR = <,
PROCEDURE = fixeddecimal_int2_gt,
RESTRICT = scalargtsel,
JOIN = scalargtjoinsel
);
CREATE OPERATOR sys.+ (
LEFTARG = FIXEDDECIMAL,
RIGHTARG = INT2,
COMMUTATOR = +,
PROCEDURE = fixeddecimalint2pl
);
CREATE OPERATOR sys.- (
LEFTARG = FIXEDDECIMAL,
RIGHTARG = INT2,
PROCEDURE = fixeddecimalint2mi
);
CREATE OPERATOR sys.* (
LEFTARG = FIXEDDECIMAL,
RIGHTARG = INT2,
COMMUTATOR = *,
PROCEDURE = fixeddecimalint2mul
);
CREATE OPERATOR sys./ (
LEFTARG = FIXEDDECIMAL,
RIGHTARG = INT2,
PROCEDURE = fixeddecimalint2div
);
CREATE OPERATOR CLASS sys.fixeddecimal_int2_ops
FOR TYPE FIXEDDECIMAL USING btree AS
OPERATOR 1 < (FIXEDDECIMAL, INT2),
OPERATOR 2 <= (FIXEDDECIMAL, INT2),
OPERATOR 3 = (FIXEDDECIMAL, INT2),
OPERATOR 4 >= (FIXEDDECIMAL, INT2),
OPERATOR 5 > (FIXEDDECIMAL, INT2),
FUNCTION 1 fixeddecimal_int2_cmp(FIXEDDECIMAL, INT2);
CREATE OPERATOR CLASS sys.fixeddecimal_int2_ops
FOR TYPE FIXEDDECIMAL USING hash AS
OPERATOR 1 = (FIXEDDECIMAL, INT2),
FUNCTION 1 fixeddecimal_hash(FIXEDDECIMAL);
-- INT2, FIXEDDECIMAL
CREATE FUNCTION sys.int2_fixeddecimal_cmp(INT2, FIXEDDECIMAL)
RETURNS INT4
AS 'babelfishpg_money', 'int2_fixeddecimal_cmp'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE FUNCTION sys.int2_fixeddecimal_eq(INT2, FIXEDDECIMAL)
RETURNS bool
AS 'babelfishpg_money', 'int2_fixeddecimal_eq'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE FUNCTION sys.int2_fixeddecimal_ne(INT2, FIXEDDECIMAL)
RETURNS bool
AS 'babelfishpg_money', 'int2_fixeddecimal_ne'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE FUNCTION sys.int2_fixeddecimal_lt(INT2, FIXEDDECIMAL)
RETURNS bool
AS 'babelfishpg_money', 'int2_fixeddecimal_lt'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE FUNCTION sys.int2_fixeddecimal_le(INT2, FIXEDDECIMAL)
RETURNS bool
AS 'babelfishpg_money', 'int2_fixeddecimal_le'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE FUNCTION sys.int2_fixeddecimal_gt(INT2, FIXEDDECIMAL)
RETURNS bool
AS 'babelfishpg_money', 'int2_fixeddecimal_gt'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE FUNCTION sys.int2_fixeddecimal_ge(INT2, FIXEDDECIMAL)
RETURNS bool
AS 'babelfishpg_money', 'int2_fixeddecimal_ge'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE FUNCTION sys.int2fixeddecimalpl(INT2, FIXEDDECIMAL)
RETURNS sys.MONEY
AS 'babelfishpg_money', 'int2fixeddecimalpl'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE FUNCTION sys.int2fixeddecimalmi(INT2, FIXEDDECIMAL)
RETURNS sys.MONEY
AS 'babelfishpg_money', 'int2fixeddecimalmi'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE FUNCTION sys.int2fixeddecimalmul(INT2, FIXEDDECIMAL)
RETURNS sys.MONEY
AS 'babelfishpg_money', 'int2fixeddecimalmul'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE FUNCTION sys.int2fixeddecimaldiv(INT2, FIXEDDECIMAL)
RETURNS DOUBLE PRECISION
AS 'babelfishpg_money', 'int2fixeddecimaldiv'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE OPERATOR sys.= (
LEFTARG = INT2,
RIGHTARG = FIXEDDECIMAL,
COMMUTATOR = =,
NEGATOR = <>,
PROCEDURE = int2_fixeddecimal_eq,
RESTRICT = eqsel,
JOIN = eqjoinsel,
MERGES
);
CREATE OPERATOR sys.<> (
LEFTARG = INT2,
RIGHTARG = FIXEDDECIMAL,
NEGATOR = =,
COMMUTATOR = <>,
PROCEDURE = int2_fixeddecimal_ne,
RESTRICT = neqsel,
JOIN = neqjoinsel
);
CREATE OPERATOR sys.< (
LEFTARG = INT2,
RIGHTARG = FIXEDDECIMAL,
NEGATOR = >=,
COMMUTATOR = >,
PROCEDURE = int2_fixeddecimal_lt,
RESTRICT = scalarltsel,
JOIN = scalarltjoinsel
);
CREATE OPERATOR sys.<= (
LEFTARG = INT2,
RIGHTARG = FIXEDDECIMAL,
NEGATOR = >,
COMMUTATOR = >=,
PROCEDURE = int2_fixeddecimal_le,
RESTRICT = scalarltsel,
JOIN = scalarltjoinsel
);
CREATE OPERATOR sys.>= (
LEFTARG = INT2,
RIGHTARG = FIXEDDECIMAL,
NEGATOR = <,
COMMUTATOR = <=,
PROCEDURE = int2_fixeddecimal_ge,
RESTRICT = scalargtsel,
JOIN = scalargtjoinsel
);
CREATE OPERATOR sys.> (
LEFTARG = INT2,
RIGHTARG = FIXEDDECIMAL,
NEGATOR = <=,
COMMUTATOR = <,
PROCEDURE = int2_fixeddecimal_gt,
RESTRICT = scalargtsel,
JOIN = scalargtjoinsel
);
CREATE OPERATOR sys.+ (
LEFTARG = INT2,
RIGHTARG = FIXEDDECIMAL,
COMMUTATOR = +,
PROCEDURE = int2fixeddecimalpl
);
CREATE OPERATOR sys.- (
LEFTARG = INT2,
RIGHTARG = FIXEDDECIMAL,
PROCEDURE = int2fixeddecimalmi
);
CREATE OPERATOR sys.* (
LEFTARG = INT2,
RIGHTARG = FIXEDDECIMAL,
COMMUTATOR = *,
PROCEDURE = int2fixeddecimalmul
);
CREATE OPERATOR sys./ (
LEFTARG = INT2,
RIGHTARG = FIXEDDECIMAL,
PROCEDURE = int2fixeddecimaldiv
);
CREATE OPERATOR CLASS sys.int2_fixeddecimal_ops
FOR TYPE FIXEDDECIMAL USING btree AS
OPERATOR 1 < (INT2, FIXEDDECIMAL),
OPERATOR 2 <= (INT2, FIXEDDECIMAL),
OPERATOR 3 = (INT2, FIXEDDECIMAL),
OPERATOR 4 >= (INT2, FIXEDDECIMAL),
OPERATOR 5 > (INT2, FIXEDDECIMAL),
FUNCTION 1 int2_fixeddecimal_cmp(INT2, FIXEDDECIMAL);
CREATE OPERATOR CLASS sys.int2_fixeddecimal_ops
FOR TYPE FIXEDDECIMAL USING hash AS
OPERATOR 1 = (INT2, FIXEDDECIMAL),
FUNCTION 1 fixeddecimal_hash(FIXEDDECIMAL);
--
-- Casts
--
CREATE FUNCTION sys.fixeddecimal(FIXEDDECIMAL, INT4)
RETURNS FIXEDDECIMAL
AS 'babelfishpg_money', 'fixeddecimal'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE FUNCTION sys.int8fixeddecimal(INT8)
RETURNS FIXEDDECIMAL
AS 'babelfishpg_money', 'int8fixeddecimal'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE FUNCTION sys.fixeddecimalint8(FIXEDDECIMAL)
RETURNS INT8
AS 'babelfishpg_money', 'fixeddecimalint8'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE FUNCTION sys.int4fixeddecimal(INT4)
RETURNS FIXEDDECIMAL
AS 'babelfishpg_money', 'int4fixeddecimal'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE FUNCTION sys.fixeddecimalint4(FIXEDDECIMAL)
RETURNS INT4
AS 'babelfishpg_money', 'fixeddecimalint4'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE FUNCTION sys.int2fixeddecimal(INT2)
RETURNS FIXEDDECIMAL
AS 'babelfishpg_money', 'int2fixeddecimal'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE FUNCTION sys.fixeddecimalint2(FIXEDDECIMAL)
RETURNS INT2
AS 'babelfishpg_money', 'fixeddecimalint2'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE FUNCTION sys.fixeddecimaltod(FIXEDDECIMAL)
RETURNS DOUBLE PRECISION
AS 'babelfishpg_money', 'fixeddecimaltod'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE FUNCTION sys.dtofixeddecimal(DOUBLE PRECISION)
RETURNS FIXEDDECIMAL
AS 'babelfishpg_money', 'dtofixeddecimal'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE FUNCTION sys.fixeddecimaltof(FIXEDDECIMAL)
RETURNS REAL
AS 'babelfishpg_money', 'fixeddecimaltof'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE FUNCTION sys.ftofixeddecimal(REAL)
RETURNS FIXEDDECIMAL
AS 'babelfishpg_money', 'ftofixeddecimal'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE FUNCTION sys.fixeddecimal_numeric(FIXEDDECIMAL)
RETURNS NUMERIC
AS 'babelfishpg_money', 'fixeddecimal_numeric'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE FUNCTION sys.numeric_fixeddecimal(NUMERIC)
RETURNS FIXEDDECIMAL
AS 'babelfishpg_money', 'numeric_fixeddecimal'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE CAST (FIXEDDECIMAL AS FIXEDDECIMAL)
WITH FUNCTION fixeddecimal (FIXEDDECIMAL, INT4) AS ASSIGNMENT;
CREATE CAST (INT8 AS FIXEDDECIMAL)
WITH FUNCTION int8fixeddecimal (INT8) AS IMPLICIT;
CREATE CAST (FIXEDDECIMAL AS INT8)
WITH FUNCTION fixeddecimalint8 (FIXEDDECIMAL) AS ASSIGNMENT;
CREATE CAST (INT4 AS FIXEDDECIMAL)
WITH FUNCTION int4fixeddecimal (INT4) AS IMPLICIT;
CREATE CAST (FIXEDDECIMAL AS INT4)
WITH FUNCTION fixeddecimalint4 (FIXEDDECIMAL) AS ASSIGNMENT;
CREATE CAST (INT2 AS FIXEDDECIMAL)
WITH FUNCTION int2fixeddecimal (INT2) AS IMPLICIT;
CREATE CAST (FIXEDDECIMAL AS INT2)
WITH FUNCTION fixeddecimalint2 (FIXEDDECIMAL) AS ASSIGNMENT;
CREATE CAST (FIXEDDECIMAL AS DOUBLE PRECISION)
WITH FUNCTION fixeddecimaltod (FIXEDDECIMAL) AS IMPLICIT;
CREATE CAST (DOUBLE PRECISION AS FIXEDDECIMAL)
WITH FUNCTION dtofixeddecimal (DOUBLE PRECISION) AS ASSIGNMENT; -- XXX? or Implicit?
CREATE CAST (FIXEDDECIMAL AS REAL)
WITH FUNCTION fixeddecimaltof (FIXEDDECIMAL) AS IMPLICIT;
CREATE CAST (REAL AS FIXEDDECIMAL)
WITH FUNCTION ftofixeddecimal (REAL) AS ASSIGNMENT; -- XXX or Implicit?
CREATE CAST (FIXEDDECIMAL AS NUMERIC)
WITH FUNCTION fixeddecimal_numeric (FIXEDDECIMAL) AS IMPLICIT;
CREATE CAST (NUMERIC AS FIXEDDECIMAL)
WITH FUNCTION numeric_fixeddecimal (NUMERIC) AS IMPLICIT;
CREATE DOMAIN sys.MONEY as sys.FIXEDDECIMAL CHECK (VALUE >= -922337203685477.5808 AND VALUE <= 922337203685477.5807);
CREATE DOMAIN sys.SMALLMONEY as sys.FIXEDDECIMAL CHECK (VALUE >= -214748.3648 AND VALUE <= 214748.3647);
-- 13 "sql/babelfishpg_common.in" 2
-- 1 "sql/money/fixeddecimal--parallelaggs.sql" 1
-- Aggregate Support
CREATE FUNCTION sys.fixeddecimalaggstatecombine(INTERNAL, INTERNAL)
RETURNS INTERNAL
AS 'babelfishpg_money', 'fixeddecimalaggstatecombine'
LANGUAGE C IMMUTABLE PARALLEL SAFE;
CREATE FUNCTION sys.fixeddecimalaggstateserialize(INTERNAL)
RETURNS BYTEA
AS 'babelfishpg_money', 'fixeddecimalaggstateserialize'
LANGUAGE C IMMUTABLE PARALLEL SAFE;
CREATE FUNCTION sys.fixeddecimalaggstatedeserialize(BYTEA, INTERNAL)
RETURNS INTERNAL
AS 'babelfishpg_money', 'fixeddecimalaggstatedeserialize'
LANGUAGE C IMMUTABLE PARALLEL SAFE;
CREATE FUNCTION sys.fixeddecimal_avg_accum(INTERNAL, FIXEDDECIMAL)
RETURNS INTERNAL
AS 'babelfishpg_money', 'fixeddecimal_avg_accum'
LANGUAGE C IMMUTABLE PARALLEL SAFE;
CREATE FUNCTION sys.fixeddecimal_sum(INTERNAL)
RETURNS sys.MONEY
AS 'babelfishpg_money', 'fixeddecimal_sum'
LANGUAGE C IMMUTABLE PARALLEL SAFE;
CREATE FUNCTION sys.fixeddecimal_avg(INTERNAL)
RETURNS sys.MONEY
AS 'babelfishpg_money', 'fixeddecimal_avg'
LANGUAGE C IMMUTABLE PARALLEL SAFE;
CREATE AGGREGATE sys.min(FIXEDDECIMAL) (
SFUNC = fixeddecimalsmaller,
STYPE = FIXEDDECIMAL,
SORTOP = <,
COMBINEFUNC = fixeddecimalsmaller,
PARALLEL = SAFE
);
CREATE AGGREGATE sys.max(FIXEDDECIMAL) (
SFUNC = fixeddecimallarger,
STYPE = FIXEDDECIMAL,
SORTOP = >,
COMBINEFUNC = fixeddecimallarger,
PARALLEL = SAFE
);
CREATE AGGREGATE sys.sum(FIXEDDECIMAL) (
SFUNC = fixeddecimal_avg_accum,
FINALFUNC = fixeddecimal_sum,
STYPE = INTERNAL,
COMBINEFUNC = fixeddecimalaggstatecombine,
SERIALFUNC = fixeddecimalaggstateserialize,
DESERIALFUNC = fixeddecimalaggstatedeserialize,
PARALLEL = SAFE
);
CREATE AGGREGATE sys.avg(FIXEDDECIMAL) (
SFUNC = fixeddecimal_avg_accum,
FINALFUNC = fixeddecimal_avg,
STYPE = INTERNAL,
COMBINEFUNC = fixeddecimalaggstatecombine,
SERIALFUNC = fixeddecimalaggstateserialize,
DESERIALFUNC = fixeddecimalaggstatedeserialize,
PARALLEL = SAFE
);
-- 14 "sql/babelfishpg_common.in" 2
-- 1 "sql/money/fixeddecimal--brin.sql" 1
CREATE OPERATOR CLASS sys.fixeddecimal_minmax_ops
DEFAULT FOR TYPE FIXEDDECIMAL USING brin AS
OPERATOR 1 < (FIXEDDECIMAL, FIXEDDECIMAL),
OPERATOR 2 <= (FIXEDDECIMAL, FIXEDDECIMAL),
OPERATOR 3 = (FIXEDDECIMAL, FIXEDDECIMAL),
OPERATOR 4 >= (FIXEDDECIMAL, FIXEDDECIMAL),
OPERATOR 5 > (FIXEDDECIMAL, FIXEDDECIMAL),
FUNCTION 1 brin_minmax_opcinfo(INTERNAL),
FUNCTION 2 brin_minmax_add_value(INTERNAL, INTERNAL, INTERNAL, INTERNAL),
FUNCTION 3 brin_minmax_consistent(INTERNAL, INTERNAL, INTERNAL),
FUNCTION 4 brin_minmax_union(INTERNAL, INTERNAL, INTERNAL);
-- 15 "sql/babelfishpg_common.in" 2
-- 1 "sql/bpchar.sql" 1
CREATE TYPE sys.BPCHAR;
-- Basic functions
CREATE OR REPLACE FUNCTION sys.bpcharin(cstring)
RETURNS sys.BPCHAR
AS 'babelfishpg_common', 'bpcharin'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE OR REPLACE FUNCTION sys.bpcharout(sys.BPCHAR)
RETURNS cstring
AS 'bpcharout'
LANGUAGE INTERNAL IMMUTABLE STRICT PARALLEL SAFE;
CREATE OR REPLACE FUNCTION sys.bpcharrecv(internal)
RETURNS sys.BPCHAR
AS 'babelfishpg_common', 'bpcharrecv'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE OR REPLACE FUNCTION sys.bpcharsend(sys.BPCHAR)
RETURNS bytea
AS 'bpcharsend'
LANGUAGE INTERNAL IMMUTABLE STRICT PARALLEL SAFE;
CREATE TYPE sys.BPCHAR (
INPUT = sys.bpcharin,
OUTPUT = sys.bpcharout,
RECEIVE = sys.bpcharrecv,
SEND = sys.bpcharsend,
TYPMOD_IN = bpchartypmodin,
TYPMOD_OUT = bpchartypmodout,
CATEGORY = 'S',
COLLATABLE = True,
LIKE = pg_catalog.BPCHAR
);
-- Basic operator functions
CREATE FUNCTION sys.bpchareq(sys.BPCHAR, sys.BPCHAR)
RETURNS bool
AS 'bpchareq'
LANGUAGE internal IMMUTABLE STRICT PARALLEL SAFE;
CREATE FUNCTION sys.bpcharne(sys.BPCHAR, sys.BPCHAR)
RETURNS bool
AS 'bpcharne'
LANGUAGE internal IMMUTABLE STRICT PARALLEL SAFE;
CREATE FUNCTION sys.bpcharlt(sys.BPCHAR, sys.BPCHAR)
RETURNS bool
AS 'bpcharlt'
LANGUAGE internal IMMUTABLE STRICT PARALLEL SAFE;
CREATE FUNCTION sys.bpcharle(sys.BPCHAR, sys.BPCHAR)
RETURNS bool
AS 'bpcharle'
LANGUAGE internal IMMUTABLE STRICT PARALLEL SAFE;
CREATE FUNCTION sys.bpchargt(sys.BPCHAR, sys.BPCHAR)
RETURNS bool
AS 'bpchargt'
LANGUAGE internal IMMUTABLE STRICT PARALLEL SAFE;
CREATE FUNCTION sys.bpcharge(sys.BPCHAR, sys.BPCHAR)
RETURNS bool
AS 'bpcharge'
LANGUAGE internal IMMUTABLE STRICT PARALLEL SAFE;
-- Basic operators
-- Note that if those operators are not in pg_catalog, we will see different behaviors depending on sql_dialect
CREATE OPERATOR pg_catalog.= (
LEFTARG = sys.BPCHAR,
RIGHTARG = sys.BPCHAR,
COMMUTATOR = OPERATOR(pg_catalog.=),
NEGATOR = OPERATOR(pg_catalog.<>),
PROCEDURE = sys.bpchareq,
RESTRICT = eqsel,
JOIN = eqjoinsel,
MERGES,
HASHES
);
CREATE OPERATOR pg_catalog.<> (
LEFTARG = sys.BPCHAR,
RIGHTARG = sys.BPCHAR,
NEGATOR = OPERATOR(pg_catalog.=),
COMMUTATOR = OPERATOR(pg_catalog.<>),
PROCEDURE = sys.bpcharne,
RESTRICT = neqsel,
JOIN = neqjoinsel
);
CREATE OPERATOR pg_catalog.< (
LEFTARG = sys.BPCHAR,
RIGHTARG = sys.BPCHAR,
NEGATOR = OPERATOR(pg_catalog.>=),
COMMUTATOR = OPERATOR(pg_catalog.>),
PROCEDURE = sys.bpcharlt,
RESTRICT = scalarltsel,
JOIN = scalarltjoinsel
);
CREATE OPERATOR pg_catalog.<= (
LEFTARG = sys.BPCHAR,
RIGHTARG = sys.BPCHAR,
NEGATOR = OPERATOR(pg_catalog.>),
COMMUTATOR = OPERATOR(pg_catalog.>=),
PROCEDURE = sys.bpcharle,
RESTRICT = scalarlesel,
JOIN = scalarlejoinsel
);
CREATE OPERATOR pg_catalog.> (
LEFTARG = sys.BPCHAR,
RIGHTARG = sys.BPCHAR,
NEGATOR = OPERATOR(pg_catalog.<=),
COMMUTATOR = OPERATOR(pg_catalog.<),
PROCEDURE = sys.bpchargt,
RESTRICT = scalargtsel,
JOIN = scalargtjoinsel
);
CREATE OPERATOR pg_catalog.>= (
LEFTARG = sys.BPCHAR,
RIGHTARG = sys.BPCHAR,
NEGATOR = OPERATOR(pg_catalog.<),
COMMUTATOR = OPERATOR(pg_catalog.<=),
PROCEDURE = sys.bpcharge,
RESTRICT = scalargesel,
JOIN = scalargejoinsel
);
-- Operator classes
CREATE FUNCTION sys.bpcharcmp(sys.BPCHAR, sys.BPCHAR)
RETURNS INT4
AS 'bpcharcmp'
LANGUAGE internal IMMUTABLE STRICT PARALLEL SAFE;
CREATE FUNCTION sys.hashbpchar(sys.BPCHAR)
RETURNS INT4
AS 'hashbpchar'
LANGUAGE internal IMMUTABLE STRICT PARALLEL SAFE;
CREATE OPERATOR CLASS bpchar_ops
DEFAULT FOR TYPE sys.BPCHAR USING btree AS
OPERATOR 1 pg_catalog.< (sys.BPCHAR, sys.BPCHAR),
OPERATOR 2 pg_catalog.<= (sys.BPCHAR, sys.BPCHAR),
OPERATOR 3 pg_catalog.= (sys.BPCHAR, sys.BPCHAR),
OPERATOR 4 pg_catalog.>= (sys.BPCHAR, sys.BPCHAR),
OPERATOR 5 pg_catalog.> (sys.BPCHAR, sys.BPCHAR),
FUNCTION 1 sys.bpcharcmp(sys.BPCHAR, sys.BPCHAR);
CREATE OPERATOR CLASS bpchar_ops
DEFAULT FOR TYPE sys.BPCHAR USING hash AS
OPERATOR 1 pg_catalog.= (sys.BPCHAR, sys.BPCHAR),
FUNCTION 1 sys.hashbpchar(sys.BPCHAR);
CREATE OR REPLACE FUNCTION sys.bpchar(sys.BPCHAR, integer, boolean)
RETURNS sys.BPCHAR
AS 'babelfishpg_common', 'bpchar'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
-- To sys.BPCHAR
CREATE CAST (sys.BPCHAR AS sys.BPCHAR)
WITH FUNCTION sys.BPCHAR (sys.BPCHAR, integer, boolean) AS IMPLICIT;
CREATE CAST (pg_catalog.VARCHAR as sys.BPCHAR)
WITHOUT FUNCTION AS IMPLICIT;
CREATE CAST (pg_catalog.TEXT as sys.BPCHAR)
WITHOUT FUNCTION AS IMPLICIT;
CREATE CAST (pg_catalog.BOOL as sys.BPCHAR)
WITH FUNCTION pg_catalog.text(pg_catalog.BOOL) AS ASSIGNMENT;
-- From sys.BPCHAR
CREATE CAST (sys.BPCHAR AS pg_catalog.BPCHAR)
WITHOUT FUNCTION AS IMPLICIT;
CREATE CAST (sys.BPCHAR as pg_catalog.VARCHAR)
WITHOUT FUNCTION AS IMPLICIT;
CREATE CAST (sys.BPCHAR as pg_catalog.TEXT)
WITHOUT FUNCTION AS IMPLICIT;
-- Operators between different types
CREATE FUNCTION sys.bpchareq(sys.BPCHAR, pg_catalog.TEXT)
RETURNS bool
AS 'bpchareq'
LANGUAGE internal IMMUTABLE STRICT PARALLEL SAFE;
CREATE FUNCTION sys.bpchareq(pg_catalog.TEXT, sys.BPCHAR)
RETURNS bool
AS 'bpchareq'
LANGUAGE internal IMMUTABLE STRICT PARALLEL SAFE;
CREATE FUNCTION sys.bpcharne(sys.BPCHAR, pg_catalog.TEXT)
RETURNS bool
AS 'bpcharne'
LANGUAGE internal IMMUTABLE STRICT PARALLEL SAFE;
CREATE FUNCTION sys.bpcharne(pg_catalog.TEXT, sys.BPCHAR)
RETURNS bool
AS 'bpcharne'
LANGUAGE internal IMMUTABLE STRICT PARALLEL SAFE;
CREATE OPERATOR pg_catalog.= (
LEFTARG = sys.BPCHAR,
RIGHTARG = pg_catalog.TEXT,
COMMUTATOR = OPERATOR(pg_catalog.=),
NEGATOR = OPERATOR(pg_catalog.<>),
PROCEDURE = sys.bpchareq,
RESTRICT = eqsel,
JOIN = eqjoinsel
);
CREATE OPERATOR pg_catalog.= (
LEFTARG = pg_catalog.TEXT,
RIGHTARG = sys.BPCHAR,
COMMUTATOR = OPERATOR(pg_catalog.=),
NEGATOR = OPERATOR(pg_catalog.<>),
PROCEDURE = sys.bpchareq,
RESTRICT = eqsel,
JOIN = eqjoinsel
);
CREATE OPERATOR pg_catalog.<> (
LEFTARG = sys.BPCHAR,
RIGHTARG = pg_catalog.TEXT,
NEGATOR = OPERATOR(pg_catalog.=),
COMMUTATOR = OPERATOR(pg_catalog.<>),
PROCEDURE = sys.bpcharne,
RESTRICT = neqsel,
JOIN = neqjoinsel
);
CREATE OPERATOR pg_catalog.<> (
LEFTARG = pg_catalog.TEXT,
RIGHTARG = sys.BPCHAR,
NEGATOR = OPERATOR(pg_catalog.=),
COMMUTATOR = OPERATOR(pg_catalog.<>),
PROCEDURE = sys.bpcharne,
RESTRICT = neqsel,
JOIN = neqjoinsel
);
SET enable_domain_typmod = TRUE;
CREATE DOMAIN sys.NCHAR AS sys.BPCHAR;
RESET enable_domain_typmod;
CREATE OR REPLACE FUNCTION sys.nchar(sys.nchar, integer, boolean)
RETURNS sys.nchar
AS 'babelfishpg_common', 'bpchar'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
SET client_min_messages = 'ERROR';
CREATE CAST (sys.nchar AS sys.nchar)
WITH FUNCTION sys.nchar (sys.nchar, integer, BOOLEAN) AS ASSIGNMENT;
SET client_min_messages = 'WARNING';
-- 16 "sql/babelfishpg_common.in" 2
-- 1 "sql/varchar.sql" 1
CREATE TYPE sys.VARCHAR;
-- Basic functions
CREATE OR REPLACE FUNCTION sys.varcharin(cstring)
RETURNS sys.VARCHAR
AS 'babelfishpg_common', 'varcharin'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE OR REPLACE FUNCTION sys.varcharout(sys.VARCHAR)
RETURNS cstring
AS 'varcharout'
LANGUAGE INTERNAL IMMUTABLE STRICT PARALLEL SAFE;
CREATE OR REPLACE FUNCTION sys.varcharrecv(internal)
RETURNS sys.VARCHAR
AS 'babelfishpg_common', 'varcharrecv'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE OR REPLACE FUNCTION sys.varcharsend(sys.VARCHAR)
RETURNS bytea
AS 'varcharsend'
LANGUAGE INTERNAL IMMUTABLE STRICT PARALLEL SAFE;
CREATE TYPE sys.VARCHAR (
INPUT = sys.varcharin,
OUTPUT = sys.varcharout,
RECEIVE = sys.varcharrecv,
SEND = sys.varcharsend,
TYPMOD_IN = varchartypmodin,
TYPMOD_OUT = varchartypmodout,
CATEGORY = 'S',
COLLATABLE = True,
LIKE = pg_catalog.VARCHAR
);
-- Basic operator functions
CREATE FUNCTION sys.varchareq(sys.VARCHAR, sys.VARCHAR)
RETURNS bool
AS 'babelfishpg_common', 'varchareq'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE FUNCTION sys.varcharne(sys.VARCHAR, sys.VARCHAR)
RETURNS bool
AS 'babelfishpg_common', 'varcharne'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE FUNCTION sys.varcharlt(sys.VARCHAR, sys.VARCHAR)
RETURNS bool
AS 'babelfishpg_common', 'varcharlt'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE FUNCTION sys.varcharle(sys.VARCHAR, sys.VARCHAR)
RETURNS bool
AS 'babelfishpg_common', 'varcharle'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE FUNCTION sys.varchargt(sys.VARCHAR, sys.VARCHAR)
RETURNS bool
AS 'babelfishpg_common', 'varchargt'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE FUNCTION sys.varcharge(sys.VARCHAR, sys.VARCHAR)
RETURNS bool
AS 'babelfishpg_common', 'varcharge'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
-- Basic operators
-- Note that if those operators are not in pg_catalog, we will see different behaviors depending on sql_dialect
CREATE OPERATOR pg_catalog.= (
LEFTARG = sys.VARCHAR,
RIGHTARG = sys.VARCHAR,
COMMUTATOR = OPERATOR(pg_catalog.=),
NEGATOR = OPERATOR(pg_catalog.<>),
PROCEDURE = sys.varchareq,
RESTRICT = eqsel,
JOIN = eqjoinsel,
MERGES,
HASHES
);
CREATE OPERATOR pg_catalog.<> (
LEFTARG = sys.VARCHAR,
RIGHTARG = sys.VARCHAR,
NEGATOR = OPERATOR(pg_catalog.=),
COMMUTATOR = OPERATOR(pg_catalog.<>),
PROCEDURE = sys.varcharne,
RESTRICT = neqsel,
JOIN = neqjoinsel
);
CREATE OPERATOR pg_catalog.< (
LEFTARG = sys.VARCHAR,
RIGHTARG = sys.VARCHAR,
NEGATOR = OPERATOR(pg_catalog.>=),
COMMUTATOR = OPERATOR(pg_catalog.>),
PROCEDURE = sys.varcharlt,
RESTRICT = scalarltsel,
JOIN = scalarltjoinsel
);
CREATE OPERATOR pg_catalog.<= (
LEFTARG = sys.VARCHAR,
RIGHTARG = sys.VARCHAR,
NEGATOR = OPERATOR(pg_catalog.>),
COMMUTATOR = OPERATOR(pg_catalog.>=),
PROCEDURE = sys.varcharle,
RESTRICT = scalarlesel,
JOIN = scalarlejoinsel
);
CREATE OPERATOR pg_catalog.> (
LEFTARG = sys.VARCHAR,
RIGHTARG = sys.VARCHAR,
NEGATOR = OPERATOR(pg_catalog.<=),
COMMUTATOR = OPERATOR(pg_catalog.<),
PROCEDURE = sys.varchargt,
RESTRICT = scalargtsel,
JOIN = scalargtjoinsel
);
CREATE OPERATOR pg_catalog.>= (
LEFTARG = sys.VARCHAR,
RIGHTARG = sys.VARCHAR,
NEGATOR = OPERATOR(pg_catalog.<),
COMMUTATOR = OPERATOR(pg_catalog.<=),
PROCEDURE = sys.varcharge,
RESTRICT = scalargesel,
JOIN = scalargejoinsel
);
-- Operator classes
CREATE FUNCTION sys.varcharcmp(sys.VARCHAR, sys.VARCHAR)
RETURNS INT4
AS 'babelfishpg_common', 'varcharcmp'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE FUNCTION sys.hashvarchar(sys.VARCHAR)
RETURNS INT4
AS 'babelfishpg_common', 'hashvarchar'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE OPERATOR CLASS varchar_ops
DEFAULT FOR TYPE sys.VARCHAR USING btree AS
OPERATOR 1 pg_catalog.< (sys.VARCHAR, sys.VARCHAR),
OPERATOR 2 pg_catalog.<= (sys.VARCHAR, sys.VARCHAR),
OPERATOR 3 pg_catalog.= (sys.VARCHAR, sys.VARCHAR),
OPERATOR 4 pg_catalog.>= (sys.VARCHAR, sys.VARCHAR),
OPERATOR 5 pg_catalog.> (sys.VARCHAR, sys.VARCHAR),
FUNCTION 1 sys.varcharcmp(sys.VARCHAR, sys.VARCHAR);
CREATE OPERATOR CLASS varchar_ops
DEFAULT FOR TYPE sys.VARCHAR USING hash AS
OPERATOR 1 pg_catalog.= (sys.VARCHAR, sys.VARCHAR),
FUNCTION 1 sys.hashvarchar(sys.VARCHAR);
-- Typmode cast function
CREATE OR REPLACE FUNCTION sys.varchar(sys.VARCHAR, integer, boolean)
RETURNS sys.VARCHAR
AS 'babelfishpg_common', 'varchar'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
-- To sys.VARCHAR
CREATE CAST (sys.VARCHAR AS sys.VARCHAR)
WITH FUNCTION sys.VARCHAR (sys.VARCHAR, integer, boolean) AS IMPLICIT;
CREATE CAST (pg_catalog.VARCHAR as sys.VARCHAR)
WITHOUT FUNCTION AS IMPLICIT;
CREATE CAST (pg_catalog.TEXT as sys.VARCHAR)
WITHOUT FUNCTION AS IMPLICIT;
CREATE CAST (sys.BPCHAR as sys.VARCHAR)
WITHOUT FUNCTION AS IMPLICIT;
CREATE CAST (pg_catalog.BOOL as sys.VARCHAR)
WITH FUNCTION pg_catalog.text(pg_catalog.BOOL) AS ASSIGNMENT;
-- From sys.VARCHAR
CREATE CAST (sys.VARCHAR AS pg_catalog.VARCHAR)
WITHOUT FUNCTION AS IMPLICIT;
CREATE CAST (sys.VARCHAR as pg_catalog.TEXT)
WITHOUT FUNCTION AS IMPLICIT;
CREATE CAST (sys.VARCHAR as pg_catalog.BPCHAR)
WITHOUT FUNCTION AS IMPLICIT;
SET enable_domain_typmod = TRUE;
CREATE DOMAIN sys.NVARCHAR AS sys.VARCHAR;
RESET enable_domain_typmod;
CREATE OR REPLACE FUNCTION sys.nvarchar(sys.nvarchar, integer, boolean)
RETURNS sys.nvarchar
AS 'babelfishpg_common', 'varchar'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
SET client_min_messages = 'ERROR';
CREATE CAST (sys.nvarchar AS sys.nvarchar)
WITH FUNCTION sys.nvarchar (sys.nvarchar, integer, BOOLEAN) AS ASSIGNMENT;
SET client_min_messages = 'WARNING';
-- 17 "sql/babelfishpg_common.in" 2
-- 1 "sql/numerics.sql" 1
CREATE DOMAIN sys.TINYINT AS SMALLINT CHECK (VALUE >= 0 AND VALUE <= 255);
CREATE DOMAIN sys.INT AS INTEGER;
CREATE DOMAIN sys.BIGINT AS BIGINT;
CREATE DOMAIN sys.REAL AS REAL;
CREATE DOMAIN sys.FLOAT AS DOUBLE PRECISION;
-- Types with different default typmod behavior
SET enable_domain_typmod = TRUE;
CREATE DOMAIN sys.DECIMAL AS NUMERIC;
RESET enable_domain_typmod;
-- Domain Self Cast Functions to support Typmod Cast in Domain
CREATE OR REPLACE FUNCTION sys.decimal(sys.nchar, integer, boolean)
RETURNS sys.nchar
AS 'numeric'
LANGUAGE INTERNAL IMMUTABLE STRICT PARALLEL SAFE;
CREATE OR REPLACE FUNCTION sys.tinyintxor(leftarg sys.tinyint, rightarg sys.tinyint)
RETURNS sys.tinyint
AS $$
SELECT CAST(CAST(sys.bitxor(CAST(CAST(leftarg AS int4) AS pg_catalog.bit(16)),
CAST(CAST(rightarg AS int4) AS pg_catalog.bit(16))) AS int4) AS sys.tinyint);
$$
LANGUAGE SQL;
CREATE OPERATOR sys.^ (
LEFTARG = sys.tinyint,
RIGHTARG = sys.tinyint,
FUNCTION = sys.tinyintxor,
COMMUTATOR = ^
);
CREATE OR REPLACE FUNCTION sys.int2xor(leftarg int2, rightarg int2)
RETURNS int2
AS $$
SELECT CAST(CAST(sys.bitxor(CAST(CAST(leftarg AS int4) AS pg_catalog.bit(16)),
CAST(CAST(rightarg AS int4) AS pg_catalog.bit(16))) AS int4) AS int2);
$$
LANGUAGE SQL;
CREATE OPERATOR sys.^ (
LEFTARG = int2,
RIGHTARG = int2,
FUNCTION = sys.int2xor,
COMMUTATOR = ^
);
CREATE OR REPLACE FUNCTION sys.intxor(leftarg int4, rightarg int4)
RETURNS int4
AS $$
SELECT CAST(sys.bitxor(CAST(leftarg AS pg_catalog.bit(32)),
CAST(rightarg AS pg_catalog.bit(32))) AS int4)
$$
LANGUAGE SQL;
CREATE OPERATOR sys.^ (
LEFTARG = int4,
RIGHTARG = int4,
FUNCTION = sys.intxor,
COMMUTATOR = ^
);
CREATE OR REPLACE FUNCTION sys.int8xor(leftarg int8, rightarg int8)
RETURNS int8
AS $$
SELECT CAST(sys.bitxor(CAST(leftarg AS pg_catalog.bit(64)),
CAST(rightarg AS pg_catalog.bit(64))) AS int8)
$$
LANGUAGE SQL;
CREATE OPERATOR sys.^ (
LEFTARG = int8,
RIGHTARG = int8,
FUNCTION = sys.int8xor,
COMMUTATOR = ^
);
-- 18 "sql/babelfishpg_common.in" 2
-- 1 "sql/strings.sql" 1
CREATE DOMAIN sys.NTEXT AS TEXT;
CREATE DOMAIN sys.SYSNAME AS sys.VARCHAR(128);
-- 19 "sql/babelfishpg_common.in" 2
-- 1 "sql/bit.sql" 1
CREATE TYPE sys.BIT;
CREATE OR REPLACE FUNCTION sys.bitin(cstring)
RETURNS sys.BIT
AS 'babelfishpg_common', 'bitin'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE OR REPLACE FUNCTION sys.bitout(sys.BIT)
RETURNS cstring
AS 'babelfishpg_common', 'bitout'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE OR REPLACE FUNCTION sys.bitrecv(internal)
RETURNS sys.BIT
AS 'babelfishpg_common', 'bitrecv'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE OR REPLACE FUNCTION sys.bitsend(sys.BIT)
RETURNS bytea
AS 'babelfishpg_common', 'bitsend'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE TYPE sys.BIT (
INPUT = sys.bitin,
OUTPUT = sys.bitout,
RECEIVE = sys.bitrecv,
SEND = sys.bitsend,
INTERNALLENGTH = 1,
PASSEDBYVALUE,
ALIGNMENT = 'char',
STORAGE = 'plain',
CATEGORY = 'B',
PREFERRED = true,
COLLATABLE = false
);
CREATE OR REPLACE FUNCTION sys.int2bit(INT2)
RETURNS sys.BIT
AS 'babelfishpg_common', 'int2bit'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE CAST (INT2 AS sys.BIT)
WITH FUNCTION sys.int2bit (INT2) AS ASSIGNMENT;
CREATE OR REPLACE FUNCTION sys.int4bit(INT4)
RETURNS sys.BIT
AS 'babelfishpg_common', 'int4bit'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE CAST (INT4 AS sys.BIT)
WITH FUNCTION sys.int4bit (INT4) AS ASSIGNMENT;
CREATE OR REPLACE FUNCTION sys.int8bit(INT8)
RETURNS sys.BIT
AS 'babelfishpg_common', 'int8bit'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE CAST (INT8 AS sys.BIT)
WITH FUNCTION sys.int8bit (INT8) AS ASSIGNMENT;
CREATE OR REPLACE FUNCTION sys.ftobit(REAL)
RETURNS sys.BIT
AS 'babelfishpg_common', 'ftobit'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE CAST (REAL AS sys.BIT)
WITH FUNCTION sys.ftobit (REAL) AS ASSIGNMENT;
CREATE OR REPLACE FUNCTION sys.dtobit(DOUBLE PRECISION)
RETURNS sys.BIT
AS 'babelfishpg_common', 'dtobit'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE CAST (DOUBLE PRECISION AS sys.BIT)
WITH FUNCTION sys.dtobit (DOUBLE PRECISION) AS ASSIGNMENT;
CREATE OR REPLACE FUNCTION sys.numeric_bit(NUMERIC)
RETURNS sys.BIT
AS 'babelfishpg_common', 'numeric_bit'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE CAST (NUMERIC AS sys.BIT)
WITH FUNCTION sys.numeric_bit (NUMERIC) AS ASSIGNMENT;
CREATE OR REPLACE FUNCTION sys.bit2int2(sys.BIT)
RETURNS INT2
AS 'babelfishpg_common', 'bit2int2'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE CAST (sys.BIT AS INT2)
WITH FUNCTION sys.bit2int2 (sys.BIT) AS IMPLICIT;
CREATE OR REPLACE FUNCTION sys.bit2int4(sys.BIT)
RETURNS INT4
AS 'babelfishpg_common', 'bit2int4'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE CAST (sys.BIT AS INT4)
WITH FUNCTION sys.bit2int4 (sys.BIT) AS IMPLICIT;
CREATE OR REPLACE FUNCTION sys.bit2int8(sys.BIT)
RETURNS INT8
AS 'babelfishpg_common', 'bit2int8'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE CAST (sys.BIT AS INT8)
WITH FUNCTION sys.bit2int8 (sys.BIT) AS IMPLICIT;
CREATE OR REPLACE FUNCTION sys.bit2numeric(sys.BIT)
RETURNS NUMERIC
AS 'babelfishpg_common', 'bit2numeric'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE CAST (sys.BIT AS NUMERIC)
WITH FUNCTION sys.bit2numeric (sys.BIT) AS IMPLICIT;
CREATE OR REPLACE FUNCTION sys.bit2fixeddec(sys.BIT)
RETURNS FIXEDDECIMAL
AS 'babelfishpg_common', 'bit2fixeddec'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE CAST (sys.BIT AS FIXEDDECIMAL)
WITH FUNCTION sys.bit2fixeddec (sys.BIT) AS IMPLICIT;
CREATE FUNCTION sys.bitneg(sys.BIT)
RETURNS sys.BIT
AS 'babelfishpg_common', 'bitneg'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE FUNCTION sys.biteq(sys.BIT, sys.BIT)
RETURNS bool
AS 'babelfishpg_common', 'biteq'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE FUNCTION sys.bitne(sys.BIT, sys.BIT)
RETURNS bool
AS 'babelfishpg_common', 'bitne'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE FUNCTION sys.bitlt(sys.BIT, sys.BIT)
RETURNS bool
AS 'babelfishpg_common', 'bitlt'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE FUNCTION sys.bitle(sys.BIT, sys.BIT)
RETURNS bool
AS 'babelfishpg_common', 'bitle'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE FUNCTION sys.bitgt(sys.BIT, sys.BIT)
RETURNS bool
AS 'babelfishpg_common', 'bitgt'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE FUNCTION sys.bitge(sys.BIT, sys.BIT)
RETURNS bool
AS 'babelfishpg_common', 'bitge'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE FUNCTION sys.bit_cmp(sys.BIT, sys.BIT)
RETURNS int
AS 'babelfishpg_common', 'bit_cmp'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
-- Operators for sys.BIT. TSQL doesn't support + - * / of bit
CREATE OPERATOR sys.- (
RIGHTARG = sys.BIT,
PROCEDURE = sys.bitneg
);
CREATE OPERATOR sys.= (
LEFTARG = sys.BIT,
RIGHTARG = sys.BIT,
COMMUTATOR = =,
NEGATOR = <>,
PROCEDURE = sys.biteq,
RESTRICT = eqsel,
JOIN = eqjoinsel,
MERGES
);
CREATE OPERATOR sys.<> (
LEFTARG = sys.BIT,
RIGHTARG = sys.BIT,
NEGATOR = =,
COMMUTATOR = <>,
PROCEDURE = sys.bitne,
RESTRICT = neqsel,
JOIN = neqjoinsel
);
CREATE OPERATOR sys.< (
LEFTARG = sys.BIT,
RIGHTARG = sys.BIT,
NEGATOR = >=,
COMMUTATOR = >,
PROCEDURE = sys.bitlt,
RESTRICT = scalarltsel,
JOIN = scalarltjoinsel
);
CREATE OPERATOR sys.<= (
LEFTARG = sys.BIT,
RIGHTARG = sys.BIT,
NEGATOR = >,
COMMUTATOR = >=,
PROCEDURE = sys.bitle,
RESTRICT = scalarltsel,
JOIN = scalarltjoinsel
);
CREATE OPERATOR sys.> (
LEFTARG = sys.BIT,
RIGHTARG = sys.BIT,
NEGATOR = <=,
COMMUTATOR = <,
PROCEDURE = sys.bitgt,
RESTRICT = scalargtsel,
JOIN = scalargtjoinsel
);
CREATE OPERATOR sys.>= (
LEFTARG = sys.BIT,
RIGHTARG = sys.BIT,
NEGATOR = <,
COMMUTATOR = <=,
PROCEDURE = sys.bitge,
RESTRICT = scalargtsel,
JOIN = scalargtjoinsel
);
CREATE OPERATOR CLASS sys.bit_ops
DEFAULT FOR TYPE sys.bit USING btree AS
OPERATOR 1 < (sys.bit, sys.bit),
OPERATOR 2 <= (sys.bit, sys.bit),
OPERATOR 3 = (sys.bit, sys.bit),
OPERATOR 4 >= (sys.bit, sys.bit),
OPERATOR 5 > (sys.bit, sys.bit),
FUNCTION 1 sys.bit_cmp(sys.bit, sys.bit);
CREATE FUNCTION sys.int4biteq(INT4, sys.BIT)
RETURNS bool
AS 'babelfishpg_common', 'int4biteq'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE FUNCTION sys.int4bitne(INT4, sys.BIT)
RETURNS bool
AS 'babelfishpg_common', 'int4bitne'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE FUNCTION sys.int4bitlt(INT4, sys.BIT)
RETURNS bool
AS 'babelfishpg_common', 'int4bitlt'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE FUNCTION sys.int4bitle(INT4, sys.BIT)
RETURNS bool
AS 'babelfishpg_common', 'int4bitle'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE FUNCTION sys.int4bitgt(INT4, sys.BIT)
RETURNS bool
AS 'babelfishpg_common', 'int4bitgt'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE FUNCTION sys.int4bitge(INT4, sys.BIT)
RETURNS bool
AS 'babelfishpg_common', 'int4bitge'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE OPERATOR sys.= (
LEFTARG = INT4,
RIGHTARG = sys.BIT,
COMMUTATOR = =,
NEGATOR = <>,
PROCEDURE = sys.int4biteq,
RESTRICT = eqsel,
JOIN = eqjoinsel,
MERGES
);
CREATE OPERATOR sys.<> (
LEFTARG = INT4,
RIGHTARG = sys.BIT,
NEGATOR = =,
COMMUTATOR = <>,
PROCEDURE = sys.int4bitne,
RESTRICT = neqsel,
JOIN = neqjoinsel
);
CREATE OPERATOR sys.< (
LEFTARG = INT4,
RIGHTARG = sys.BIT,
NEGATOR = >=,
COMMUTATOR = >,
PROCEDURE = sys.int4bitlt,
RESTRICT = scalarltsel,
JOIN = scalarltjoinsel
);
CREATE OPERATOR sys.<= (
LEFTARG = INT4,
RIGHTARG = sys.BIT,
NEGATOR = >,
COMMUTATOR = >=,
PROCEDURE = sys.int4bitle,
RESTRICT = scalarltsel,
JOIN = scalarltjoinsel
);
CREATE OPERATOR sys.> (
LEFTARG = INT4,
RIGHTARG = sys.BIT,
NEGATOR = <=,
COMMUTATOR = <,
PROCEDURE = sys.int4bitgt,
RESTRICT = scalargtsel,
JOIN = scalargtjoinsel
);
CREATE OPERATOR sys.>= (
LEFTARG = INT4,
RIGHTARG = sys.BIT,
NEGATOR = <,
COMMUTATOR = <=,
PROCEDURE = sys.int4bitge,
RESTRICT = scalargtsel,
JOIN = scalargtjoinsel
);
CREATE FUNCTION sys.bitint4eq(sys.BIT, INT4)
RETURNS bool
AS 'babelfishpg_common', 'bitint4eq'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE FUNCTION sys.bitint4ne(sys.BIT, INT4)
RETURNS bool
AS 'babelfishpg_common', 'bitint4ne'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE FUNCTION sys.bitint4lt(sys.BIT, INT4)
RETURNS bool
AS 'babelfishpg_common', 'bitint4lt'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE FUNCTION sys.bitint4le(sys.BIT, INT4)
RETURNS bool
AS 'babelfishpg_common', 'bitint4le'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE FUNCTION sys.bitint4gt(sys.BIT, INT4)
RETURNS bool
AS 'babelfishpg_common', 'bitint4gt'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE FUNCTION sys.bitint4ge(sys.BIT, INT4)
RETURNS bool
AS 'babelfishpg_common', 'bitint4ge'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE OPERATOR sys.= (
LEFTARG = sys.BIT,
RIGHTARG = INT4,
COMMUTATOR = =,
NEGATOR = <>,
PROCEDURE = sys.bitint4eq,
RESTRICT = eqsel,
JOIN = eqjoinsel,
MERGES
);
CREATE OPERATOR sys.<> (
LEFTARG = sys.BIT,
RIGHTARG = INT4,
NEGATOR = =,
COMMUTATOR = <>,
PROCEDURE = sys.bitint4ne,
RESTRICT = neqsel,
JOIN = neqjoinsel
);
CREATE OPERATOR sys.< (
LEFTARG = sys.BIT,
RIGHTARG = INT4,
NEGATOR = >=,
COMMUTATOR = >,
PROCEDURE = sys.bitint4lt,
RESTRICT = scalarltsel,
JOIN = scalarltjoinsel
);
CREATE OPERATOR sys.<= (
LEFTARG = sys.BIT,
RIGHTARG = INT4,
NEGATOR = >,
COMMUTATOR = >=,
PROCEDURE = sys.bitint4le,
RESTRICT = scalarltsel,
JOIN = scalarltjoinsel
);
CREATE OPERATOR sys.> (
LEFTARG = sys.BIT,
RIGHTARG = INT4,
NEGATOR = <=,
COMMUTATOR = <,
PROCEDURE = sys.bitint4gt,
RESTRICT = scalargtsel,
JOIN = scalargtjoinsel
);
CREATE OPERATOR sys.>= (
LEFTARG = sys.BIT,
RIGHTARG = INT4,
NEGATOR = <,
COMMUTATOR = <=,
PROCEDURE = sys.bitint4ge,
RESTRICT = scalargtsel,
JOIN = scalargtjoinsel
);
CREATE OR REPLACE FUNCTION sys.bitxor(leftarg pg_catalog.bit, rightarg pg_catalog.bit)
RETURNS pg_catalog.bit
AS $$
SELECT (leftarg & ~rightarg) | (~leftarg & rightarg);
$$
LANGUAGE SQL;
-- 20 "sql/babelfishpg_common.in" 2
-- 1 "sql/varbinary.sql" 1
-- VARBINARY
CREATE TYPE sys.BBF_VARBINARY;
CREATE OR REPLACE FUNCTION sys.varbinaryin(cstring, oid, integer)
RETURNS sys.BBF_VARBINARY
AS 'babelfishpg_common', 'varbinaryin'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE OR REPLACE FUNCTION sys.varbinaryout(sys.BBF_VARBINARY)
RETURNS cstring
AS 'babelfishpg_common', 'varbinaryout'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE OR REPLACE FUNCTION sys.varbinaryrecv(internal, oid, integer)
RETURNS sys.BBF_VARBINARY
AS 'babelfishpg_common', 'varbinaryrecv'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE OR REPLACE FUNCTION sys.varbinarysend(sys.BBF_VARBINARY)
RETURNS bytea
AS 'babelfishpg_common', 'varbinarysend'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE OR REPLACE FUNCTION sys.varbinarytypmodin(cstring[])
RETURNS integer
AS 'babelfishpg_common', 'varbinarytypmodin'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE OR REPLACE FUNCTION sys.varbinarytypmodout(integer)
RETURNS cstring
AS 'babelfishpg_common', 'varbinarytypmodout'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE TYPE sys.BBF_VARBINARY (
INPUT = sys.varbinaryin,
OUTPUT = sys.varbinaryout,
RECEIVE = sys.varbinaryrecv,
SEND = sys.varbinarysend,
TYPMOD_IN = sys.varbinarytypmodin,
TYPMOD_OUT = sys.varbinarytypmodout,
INTERNALLENGTH = VARIABLE,
ALIGNMENT = 'int4',
STORAGE = 'extended',
CATEGORY = 'U',
PREFERRED = false,
COLLATABLE = false
);
CREATE OR REPLACE FUNCTION sys.varcharvarbinary(sys.VARCHAR, integer, boolean)
RETURNS sys.BBF_VARBINARY
AS 'babelfishpg_common', 'varcharvarbinary'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE CAST (sys.VARCHAR AS sys.BBF_VARBINARY)
WITH FUNCTION sys.varcharvarbinary (sys.VARCHAR, integer, boolean) AS ASSIGNMENT;
CREATE OR REPLACE FUNCTION sys.varcharvarbinary(pg_catalog.VARCHAR, integer, boolean)
RETURNS sys.BBF_VARBINARY
AS 'babelfishpg_common', 'varcharvarbinary'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE CAST (pg_catalog.VARCHAR AS sys.BBF_VARBINARY)
WITH FUNCTION sys.varcharvarbinary (pg_catalog.VARCHAR, integer, boolean) AS ASSIGNMENT;
CREATE OR REPLACE FUNCTION sys.bpcharvarbinary(pg_catalog.BPCHAR, integer, boolean)
RETURNS sys.BBF_VARBINARY
AS 'babelfishpg_common', 'bpcharvarbinary'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE CAST (pg_catalog.BPCHAR AS sys.BBF_VARBINARY)
WITH FUNCTION sys.bpcharvarbinary (pg_catalog.BPCHAR, integer, boolean) AS ASSIGNMENT;
CREATE OR REPLACE FUNCTION sys.bpcharvarbinary(sys.BPCHAR, integer, boolean)
RETURNS sys.BBF_VARBINARY
AS 'babelfishpg_common', 'bpcharvarbinary'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE CAST (sys.BPCHAR AS sys.BBF_VARBINARY)
WITH FUNCTION sys.bpcharvarbinary (sys.BPCHAR, integer, boolean) AS ASSIGNMENT;
CREATE OR REPLACE FUNCTION sys.varbinarysysvarchar(sys.BBF_VARBINARY, integer, boolean)
RETURNS sys.VARCHAR
AS 'babelfishpg_common', 'varbinaryvarchar'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE CAST (sys.BBF_VARBINARY AS sys.VARCHAR)
WITH FUNCTION sys.varbinarysysvarchar (sys.BBF_VARBINARY, integer, boolean) AS ASSIGNMENT;
CREATE OR REPLACE FUNCTION sys.varbinaryvarchar(sys.BBF_VARBINARY, integer, boolean)
RETURNS pg_catalog.VARCHAR
AS 'babelfishpg_common', 'varbinaryvarchar'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE CAST (sys.BBF_VARBINARY AS pg_catalog.VARCHAR)
WITH FUNCTION sys.varbinaryvarchar (sys.BBF_VARBINARY, integer, boolean) AS ASSIGNMENT;
CREATE OR REPLACE FUNCTION sys.int2varbinary(INT2, integer, boolean)
RETURNS sys.BBF_VARBINARY
AS 'babelfishpg_common', 'int2varbinary'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE CAST (INT2 AS sys.BBF_VARBINARY)
WITH FUNCTION sys.int2varbinary (INT2, integer, boolean) AS ASSIGNMENT;
CREATE OR REPLACE FUNCTION sys.int4varbinary(INT4, integer, boolean)
RETURNS sys.BBF_VARBINARY
AS 'babelfishpg_common', 'int4varbinary'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE CAST (INT4 AS sys.BBF_VARBINARY)
WITH FUNCTION sys.int4varbinary (INT4, integer, boolean) AS ASSIGNMENT;
CREATE OR REPLACE FUNCTION sys.int8varbinary(INT8, integer, boolean)
RETURNS sys.BBF_VARBINARY
AS 'babelfishpg_common', 'int8varbinary'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE CAST (INT8 AS sys.BBF_VARBINARY)
WITH FUNCTION sys.int8varbinary (INT8, integer, boolean) AS ASSIGNMENT;
CREATE OR REPLACE FUNCTION sys.float4varbinary(REAL, integer, boolean)
RETURNS sys.BBF_VARBINARY
AS 'babelfishpg_common', 'float4varbinary'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE CAST (REAL AS sys.BBF_VARBINARY)
WITH FUNCTION sys.float4varbinary (REAL, integer, boolean) AS ASSIGNMENT;
CREATE OR REPLACE FUNCTION sys.float8varbinary(DOUBLE PRECISION, integer, boolean)
RETURNS sys.BBF_VARBINARY
AS 'babelfishpg_common', 'float8varbinary'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE CAST (DOUBLE PRECISION AS sys.BBF_VARBINARY)
WITH FUNCTION sys.float8varbinary (DOUBLE PRECISION, integer, boolean) AS ASSIGNMENT;
CREATE OR REPLACE FUNCTION sys.varbinaryint2(sys.BBF_VARBINARY)
RETURNS INT2
AS 'babelfishpg_common', 'varbinaryint2'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE CAST (sys.BBF_VARBINARY as INT2)
WITH FUNCTION sys.varbinaryint2 (sys.BBF_VARBINARY) AS ASSIGNMENT;
CREATE OR REPLACE FUNCTION sys.varbinaryint4(sys.BBF_VARBINARY)
RETURNS INT4
AS 'babelfishpg_common', 'varbinaryint4'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE CAST (sys.BBF_VARBINARY as INT4)
WITH FUNCTION sys.varbinaryint4 (sys.BBF_VARBINARY) AS ASSIGNMENT;
CREATE OR REPLACE FUNCTION sys.varbinaryint8(sys.BBF_VARBINARY)
RETURNS INT8
AS 'babelfishpg_common', 'varbinaryint8'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE CAST (sys.BBF_VARBINARY as INT8)
WITH FUNCTION sys.varbinaryint8 (sys.BBF_VARBINARY) AS ASSIGNMENT;
CREATE OR REPLACE FUNCTION sys.varbinaryfloat4(sys.BBF_VARBINARY)
RETURNS REAL
AS 'babelfishpg_common', 'varbinaryfloat4'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE CAST (sys.BBF_VARBINARY as REAL)
WITH FUNCTION sys.varbinaryfloat4 (sys.BBF_VARBINARY) AS ASSIGNMENT;
CREATE OR REPLACE FUNCTION sys.varbinaryfloat8(sys.BBF_VARBINARY)
RETURNS DOUBLE PRECISION
AS 'babelfishpg_common', 'varbinaryfloat8'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE CAST (sys.BBF_VARBINARY as DOUBLE PRECISION)
WITH FUNCTION sys.varbinaryfloat8 (sys.BBF_VARBINARY) AS ASSIGNMENT;
SET enable_domain_typmod = TRUE;
CREATE DOMAIN sys.VARBINARY AS sys.BBF_VARBINARY;
RESET enable_domain_typmod;
CREATE OR REPLACE FUNCTION sys.varbinary(sys.VARBINARY, integer, boolean)
RETURNS sys.VARBINARY
AS 'babelfishpg_common', 'varbinary'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
SET client_min_messages = 'ERROR';
CREATE CAST (sys.VARBINARY AS sys.VARBINARY)
WITH FUNCTION sys.varbinary (sys.VARBINARY, integer, BOOLEAN) AS ASSIGNMENT;
SET client_min_messages = 'WARNING';
-- Add support for varbinary and binary with operators
-- Support equals
CREATE FUNCTION sys.varbinary_eq(leftarg sys.bbf_varbinary, rightarg sys.bbf_varbinary)
RETURNS boolean
AS 'babelfishpg_common', 'varbinary_eq'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE OPERATOR sys.= (
LEFTARG = sys.bbf_varbinary,
RIGHTARG = sys.bbf_varbinary,
FUNCTION = sys.varbinary_eq,
COMMUTATOR = =
);
-- Support not equals
CREATE FUNCTION sys.varbinary_neq(leftarg sys.bbf_varbinary, rightarg sys.bbf_varbinary)
RETURNS boolean
AS 'babelfishpg_common', 'varbinary_neq'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE OPERATOR sys.<> (
LEFTARG = sys.bbf_varbinary,
RIGHTARG = sys.bbf_varbinary,
FUNCTION = sys.varbinary_neq,
COMMUTATOR = <>
);
-- Support greater than
CREATE FUNCTION sys.varbinary_gt(leftarg sys.bbf_varbinary, rightarg sys.bbf_varbinary)
RETURNS boolean
AS 'babelfishpg_common', 'varbinary_gt'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE OPERATOR sys.> (
LEFTARG = sys.bbf_varbinary,
RIGHTARG = sys.bbf_varbinary,
FUNCTION = sys.varbinary_gt,
COMMUTATOR = <
);
-- Support greater than equals
CREATE FUNCTION sys.varbinary_geq(leftarg sys.bbf_varbinary, rightarg sys.bbf_varbinary)
RETURNS boolean
AS 'babelfishpg_common', 'varbinary_geq'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE OPERATOR sys.>= (
LEFTARG = sys.bbf_varbinary,
RIGHTARG = sys.bbf_varbinary,
FUNCTION = sys.varbinary_geq,
COMMUTATOR = <=
);
-- Support less than
CREATE FUNCTION sys.varbinary_lt(leftarg sys.bbf_varbinary, rightarg sys.bbf_varbinary)
RETURNS boolean
AS 'babelfishpg_common', 'varbinary_lt'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE OPERATOR sys.< (
LEFTARG = sys.bbf_varbinary,
RIGHTARG = sys.bbf_varbinary,
FUNCTION = sys.varbinary_lt,
COMMUTATOR = >
);
-- Support less than equals
CREATE FUNCTION sys.varbinary_leq(leftarg sys.bbf_varbinary, rightarg sys.bbf_varbinary)
RETURNS boolean
AS 'babelfishpg_common', 'varbinary_leq'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE OPERATOR sys.<= (
LEFTARG = sys.bbf_varbinary,
RIGHTARG = sys.bbf_varbinary,
FUNCTION = sys.varbinary_leq,
COMMUTATOR = >=
);
CREATE FUNCTION sys.bbf_varbinary_cmp(sys.bbf_varbinary, sys.bbf_varbinary)
RETURNS int
AS 'babelfishpg_common', 'varbinary_cmp'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE OPERATOR CLASS sys.bbf_varbinary_ops
DEFAULT FOR TYPE sys.bbf_varbinary USING btree AS
OPERATOR 1 < (sys.bbf_varbinary, sys.bbf_varbinary),
OPERATOR 2 <= (sys.bbf_varbinary, sys.bbf_varbinary),
OPERATOR 3 = (sys.bbf_varbinary, sys.bbf_varbinary),
OPERATOR 4 >= (sys.bbf_varbinary, sys.bbf_varbinary),
OPERATOR 5 > (sys.bbf_varbinary, sys.bbf_varbinary),
FUNCTION 1 sys.bbf_varbinary_cmp(sys.bbf_varbinary, sys.bbf_varbinary);
-- 21 "sql/babelfishpg_common.in" 2
-- 1 "sql/binary.sql" 1
-- sys.BINARY
CREATE TYPE sys.BBF_BINARY;
CREATE OR REPLACE FUNCTION sys.binaryin(cstring, oid, integer)
RETURNS sys.BBF_BINARY
AS 'babelfishpg_common', 'varbinaryin'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE OR REPLACE FUNCTION sys.binaryout(sys.BBF_BINARY)
RETURNS cstring
AS 'babelfishpg_common', 'varbinaryout'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE OR REPLACE FUNCTION sys.binaryrecv(internal, oid, integer)
RETURNS sys.BBF_BINARY
AS 'babelfishpg_common', 'varbinaryrecv'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE OR REPLACE FUNCTION sys.binarysend(sys.BBF_BINARY)
RETURNS bytea
AS 'babelfishpg_common', 'varbinarysend'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE OR REPLACE FUNCTION sys.binarytypmodin(cstring[])
RETURNS integer
AS 'babelfishpg_common', 'varbinarytypmodin'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE OR REPLACE FUNCTION sys.binarytypmodout(integer)
RETURNS cstring
AS 'babelfishpg_common', 'varbinarytypmodout'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE TYPE sys.BBF_BINARY (
INPUT = sys.binaryin,
OUTPUT = sys.binaryout,
RECEIVE = sys.binaryrecv,
SEND = sys.binarysend,
TYPMOD_IN = sys.binarytypmodin,
TYPMOD_OUT = sys.binarytypmodout,
INTERNALLENGTH = VARIABLE,
ALIGNMENT = 'int4',
STORAGE = 'extended',
CATEGORY = 'U',
PREFERRED = false,
COLLATABLE = false
);
-- casting functions for sys.BINARY
CREATE OR REPLACE FUNCTION sys.varcharbinary(sys.VARCHAR, integer, boolean)
RETURNS sys.BBF_BINARY
AS 'babelfishpg_common', 'varcharbinary'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE CAST (sys.VARCHAR AS sys.BBF_BINARY)
WITH FUNCTION sys.varcharbinary (sys.VARCHAR, integer, boolean) AS ASSIGNMENT;
CREATE OR REPLACE FUNCTION sys.varcharbinary(pg_catalog.VARCHAR, integer, boolean)
RETURNS sys.BBF_BINARY
AS 'babelfishpg_common', 'varcharbinary'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE CAST (pg_catalog.VARCHAR AS sys.BBF_BINARY)
WITH FUNCTION sys.varcharbinary (pg_catalog.VARCHAR, integer, boolean) AS ASSIGNMENT;
CREATE OR REPLACE FUNCTION sys.bpcharbinary(pg_catalog.BPCHAR, integer, boolean)
RETURNS sys.BBF_BINARY
AS 'babelfishpg_common', 'bpcharbinary'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE CAST (pg_catalog.BPCHAR AS sys.BBF_BINARY)
WITH FUNCTION sys.bpcharbinary (pg_catalog.BPCHAR, integer, boolean) AS ASSIGNMENT;
CREATE OR REPLACE FUNCTION sys.bpcharbinary(sys.BPCHAR, integer, boolean)
RETURNS sys.BBF_BINARY
AS 'babelfishpg_common', 'bpcharbinary'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE CAST (sys.BPCHAR AS sys.BBF_BINARY)
WITH FUNCTION sys.bpcharbinary (sys.BPCHAR, integer, boolean) AS ASSIGNMENT;
CREATE OR REPLACE FUNCTION sys.binarysysvarchar(sys.BBF_BINARY)
RETURNS sys.VARCHAR
AS 'babelfishpg_common', 'varbinaryvarchar'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE CAST (sys.BBF_BINARY AS sys.VARCHAR)
WITH FUNCTION sys.binarysysvarchar (sys.BBF_BINARY) AS ASSIGNMENT;
CREATE OR REPLACE FUNCTION sys.binaryvarchar(sys.BBF_BINARY)
RETURNS pg_catalog.VARCHAR
AS 'babelfishpg_common', 'varbinaryvarchar'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE CAST (sys.BBF_BINARY AS pg_catalog.VARCHAR)
WITH FUNCTION sys.binaryvarchar (sys.BBF_BINARY) AS ASSIGNMENT;
CREATE OR REPLACE FUNCTION sys.int2binary(INT2, integer, boolean)
RETURNS sys.BBF_BINARY
AS 'babelfishpg_common', 'int2binary'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE CAST (INT2 AS sys.BBF_BINARY)
WITH FUNCTION sys.int2binary (INT2, integer, boolean) AS ASSIGNMENT;
CREATE OR REPLACE FUNCTION sys.int4binary(INT4, integer, boolean)
RETURNS sys.BBF_BINARY
AS 'babelfishpg_common', 'int4binary'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE CAST (INT4 AS sys.BBF_BINARY)
WITH FUNCTION sys.int4binary (INT4, integer, boolean) AS ASSIGNMENT;
CREATE OR REPLACE FUNCTION sys.int8binary(INT8, integer, boolean)
RETURNS sys.BBF_BINARY
AS 'babelfishpg_common', 'int8binary'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE CAST (INT8 AS sys.BBF_BINARY)
WITH FUNCTION sys.int8binary (INT8, integer, boolean) AS ASSIGNMENT;
CREATE OR REPLACE FUNCTION sys.binaryint2(sys.BBF_BINARY)
RETURNS INT2
AS 'babelfishpg_common', 'binaryint2'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE CAST (sys.BBF_BINARY as INT2)
WITH FUNCTION sys.binaryint2 (sys.BBF_BINARY) AS ASSIGNMENT;
CREATE OR REPLACE FUNCTION sys.binaryint4(sys.BBF_BINARY)
RETURNS INT4
AS 'babelfishpg_common', 'binaryint4'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE CAST (sys.BBF_BINARY as INT4)
WITH FUNCTION sys.binaryint4 (sys.BBF_BINARY) AS ASSIGNMENT;
CREATE OR REPLACE FUNCTION sys.binaryint8(sys.BBF_BINARY)
RETURNS INT8
AS 'babelfishpg_common', 'binaryint8'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE CAST (sys.BBF_BINARY as INT8)
WITH FUNCTION sys.binaryint8 (sys.BBF_BINARY) AS ASSIGNMENT;
CREATE OR REPLACE FUNCTION sys.float4binary(REAL, integer, boolean)
RETURNS sys.BBF_BINARY
AS 'babelfishpg_common', 'float4binary'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE CAST (REAL AS sys.BBF_BINARY)
WITH FUNCTION sys.float4binary (REAL, integer, boolean) AS ASSIGNMENT;
CREATE OR REPLACE FUNCTION sys.float8binary(DOUBLE PRECISION, integer, boolean)
RETURNS sys.BBF_BINARY
AS 'babelfishpg_common', 'float8binary'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE CAST (DOUBLE PRECISION AS sys.BBF_BINARY)
WITH FUNCTION sys.float8binary (DOUBLE PRECISION, integer, boolean) AS ASSIGNMENT;
CREATE OR REPLACE FUNCTION sys.binaryfloat4(sys.BBF_BINARY)
RETURNS REAL
AS 'babelfishpg_common', 'binaryfloat4'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE CAST (sys.BBF_BINARY as REAL)
WITH FUNCTION sys.binaryfloat4 (sys.BBF_BINARY) AS ASSIGNMENT;
CREATE OR REPLACE FUNCTION sys.binaryfloat8(sys.BBF_BINARY)
RETURNS DOUBLE PRECISION
AS 'babelfishpg_common', 'binaryfloat8'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE CAST (sys.BBF_BINARY as DOUBLE PRECISION)
WITH FUNCTION sys.binaryfloat8 (sys.BBF_BINARY) AS ASSIGNMENT;
CREATE DOMAIN sys.IMAGE AS sys.BBF_VARBINARY;
SET enable_domain_typmod = TRUE;
CREATE DOMAIN sys.BINARY AS sys.BBF_BINARY;
RESET enable_domain_typmod;
CREATE OR REPLACE FUNCTION sys.binary(sys.BINARY, integer, boolean)
RETURNS sys.BINARY
AS 'babelfishpg_common', 'binary'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
SET client_min_messages = 'ERROR';
CREATE CAST (sys.BINARY AS sys.BINARY)
WITH FUNCTION sys.binary (sys.BINARY, integer, BOOLEAN) AS ASSIGNMENT;
SET client_min_messages = 'WARNING';
CREATE FUNCTION sys.binary_eq(leftarg sys.bbf_binary, rightarg sys.bbf_binary)
RETURNS boolean
AS 'babelfishpg_common', 'varbinary_eq'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE OPERATOR sys.= (
LEFTARG = sys.bbf_binary,
RIGHTARG = sys.bbf_binary,
FUNCTION = sys.binary_eq,
COMMUTATOR = =
);
CREATE FUNCTION sys.binary_neq(leftarg sys.bbf_binary, rightarg sys.bbf_binary)
RETURNS boolean
AS 'babelfishpg_common', 'varbinary_neq'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE OPERATOR sys.<> (
LEFTARG = sys.bbf_binary,
RIGHTARG = sys.bbf_binary,
FUNCTION = sys.binary_neq,
COMMUTATOR = <>
);
CREATE FUNCTION sys.binary_gt(leftarg sys.bbf_binary, rightarg sys.bbf_binary)
RETURNS boolean
AS 'babelfishpg_common', 'varbinary_gt'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE OPERATOR sys.> (
LEFTARG = sys.bbf_binary,
RIGHTARG = sys.bbf_binary,
FUNCTION = sys.binary_gt,
COMMUTATOR = <
);
CREATE FUNCTION sys.binary_geq(leftarg sys.bbf_binary, rightarg sys.bbf_binary)
RETURNS boolean
AS 'babelfishpg_common', 'varbinary_geq'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE OPERATOR sys.>= (
LEFTARG = sys.bbf_binary,
RIGHTARG = sys.bbf_binary,
FUNCTION = sys.binary_geq,
COMMUTATOR = <=
);
CREATE FUNCTION sys.binary_lt(leftarg sys.bbf_binary, rightarg sys.bbf_binary)
RETURNS boolean
AS 'babelfishpg_common', 'varbinary_eq'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE OPERATOR sys.< (
LEFTARG = sys.bbf_binary,
RIGHTARG = sys.bbf_binary,
FUNCTION = sys.binary_lt,
COMMUTATOR = >
);
CREATE FUNCTION sys.binary_leq(leftarg sys.bbf_binary, rightarg sys.bbf_binary)
RETURNS boolean
AS 'babelfishpg_common', 'varbinary_leq'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE OPERATOR sys.<= (
LEFTARG = sys.bbf_binary,
RIGHTARG = sys.bbf_binary,
FUNCTION = sys.binary_leq,
COMMUTATOR = >=
);
CREATE FUNCTION sys.bbf_binary_cmp(sys.bbf_binary, sys.bbf_binary)
RETURNS int
AS 'babelfishpg_common', 'varbinary_cmp'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE OPERATOR CLASS sys.bbf_binary_ops
DEFAULT FOR TYPE sys.bbf_binary USING btree AS
OPERATOR 1 < (sys.bbf_binary, sys.bbf_binary),
OPERATOR 2 <= (sys.bbf_binary, sys.bbf_binary),
OPERATOR 3 = (sys.bbf_binary, sys.bbf_binary),
OPERATOR 4 >= (sys.bbf_binary, sys.bbf_binary),
OPERATOR 5 > (sys.bbf_binary, sys.bbf_binary),
FUNCTION 1 sys.bbf_binary_cmp(sys.bbf_binary, sys.bbf_binary);
-- 22 "sql/babelfishpg_common.in" 2
-- 1 "sql/uniqueidentifier.sql" 1
CREATE TYPE sys.UNIQUEIDENTIFIER;
CREATE OR REPLACE FUNCTION sys.uniqueidentifierin(cstring)
RETURNS sys.UNIQUEIDENTIFIER
AS 'babelfishpg_common', 'uniqueidentifier_in'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE OR REPLACE FUNCTION sys.uniqueidentifierout(sys.UNIQUEIDENTIFIER)
RETURNS cstring
AS 'babelfishpg_common', 'uniqueidentifier_out'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE OR REPLACE FUNCTION sys.uniqueidentifierrecv(internal)
RETURNS sys.UNIQUEIDENTIFIER
AS 'uuid_recv'
LANGUAGE internal IMMUTABLE STRICT PARALLEL SAFE;
CREATE OR REPLACE FUNCTION sys.uniqueidentifiersend(sys.UNIQUEIDENTIFIER)
RETURNS bytea
AS 'uuid_send'
LANGUAGE internal IMMUTABLE STRICT PARALLEL SAFE;
CREATE TYPE sys.UNIQUEIDENTIFIER (
INPUT = sys.uniqueidentifierin,
OUTPUT = sys.uniqueidentifierout,
RECEIVE = sys.uniqueidentifierrecv,
SEND = sys.uniqueidentifiersend,
INTERNALLENGTH = 16,
ALIGNMENT = 'int4',
STORAGE = 'plain',
CATEGORY = 'U',
PREFERRED = false,
COLLATABLE = false
);
CREATE OR REPLACE FUNCTION sys.newid()
RETURNS sys.UNIQUEIDENTIFIER
AS 'uuid-ossp', 'uuid_generate_v4' -- uuid-ossp was added as dependency
LANGUAGE C VOLATILE STRICT PARALLEL SAFE;
-- in tsql, NEWSEQUENTIALID() produces a new unique value
-- greater than a sequence of previous values. Since PG doesn't
-- have this capability, we will reuse the NEWID() functionality and be
-- aware of the functional shortcoming
CREATE OR REPLACE FUNCTION sys.NEWSEQUENTIALID()
RETURNS sys.UNIQUEIDENTIFIER
AS 'uuid-ossp', 'uuid_generate_v4'
LANGUAGE C VOLATILE STRICT PARALLEL SAFE;
CREATE FUNCTION sys.uniqueidentifiereq(sys.UNIQUEIDENTIFIER, sys.UNIQUEIDENTIFIER)
RETURNS bool
AS 'uuid_eq'
LANGUAGE internal IMMUTABLE STRICT PARALLEL SAFE;
CREATE FUNCTION sys.uniqueidentifierne(sys.UNIQUEIDENTIFIER, sys.UNIQUEIDENTIFIER)
RETURNS bool
AS 'uuid_ne'
LANGUAGE internal IMMUTABLE STRICT PARALLEL SAFE;
CREATE FUNCTION sys.uniqueidentifierlt(sys.UNIQUEIDENTIFIER, sys.UNIQUEIDENTIFIER)
RETURNS bool
AS 'uuid_lt'
LANGUAGE internal IMMUTABLE STRICT PARALLEL SAFE;
CREATE FUNCTION sys.uniqueidentifierle(sys.UNIQUEIDENTIFIER, sys.UNIQUEIDENTIFIER)
RETURNS bool
AS 'uuid_le'
LANGUAGE internal IMMUTABLE STRICT PARALLEL SAFE;
CREATE FUNCTION sys.uniqueidentifiergt(sys.UNIQUEIDENTIFIER, sys.UNIQUEIDENTIFIER)
RETURNS bool
AS 'uuid_gt'
LANGUAGE internal IMMUTABLE STRICT PARALLEL SAFE;
CREATE FUNCTION sys.uniqueidentifierge(sys.UNIQUEIDENTIFIER, sys.UNIQUEIDENTIFIER)
RETURNS bool
AS 'uuid_ge'
LANGUAGE internal IMMUTABLE STRICT PARALLEL SAFE;
CREATE OPERATOR sys.= (
LEFTARG = sys.UNIQUEIDENTIFIER,
RIGHTARG = sys.UNIQUEIDENTIFIER,
COMMUTATOR = =,
NEGATOR = <>,
PROCEDURE = sys.uniqueidentifiereq,
RESTRICT = eqsel,
JOIN = eqjoinsel,
MERGES
);
CREATE OPERATOR sys.<> (
LEFTARG = sys.UNIQUEIDENTIFIER,
RIGHTARG = sys.UNIQUEIDENTIFIER,
NEGATOR = =,
COMMUTATOR = <>,
PROCEDURE = sys.uniqueidentifierne,
RESTRICT = neqsel,
JOIN = neqjoinsel
);
CREATE OPERATOR sys.< (
LEFTARG = sys.UNIQUEIDENTIFIER,
RIGHTARG = sys.UNIQUEIDENTIFIER,
NEGATOR = >=,
COMMUTATOR = >,
PROCEDURE = sys.uniqueidentifierlt,
RESTRICT = scalarltsel,
JOIN = scalarltjoinsel
);
CREATE OPERATOR sys.<= (
LEFTARG = sys.UNIQUEIDENTIFIER,
RIGHTARG = sys.UNIQUEIDENTIFIER,
NEGATOR = >,
COMMUTATOR = >=,
PROCEDURE = sys.uniqueidentifierle,
RESTRICT = scalarltsel,
JOIN = scalarltjoinsel
);
CREATE OPERATOR sys.> (
LEFTARG = sys.UNIQUEIDENTIFIER,
RIGHTARG = sys.UNIQUEIDENTIFIER,
NEGATOR = <=,
COMMUTATOR = <,
PROCEDURE = sys.uniqueidentifiergt,
RESTRICT = scalargtsel,
JOIN = scalargtjoinsel
);
CREATE OPERATOR sys.>= (
LEFTARG = sys.UNIQUEIDENTIFIER,
RIGHTARG = sys.UNIQUEIDENTIFIER,
NEGATOR = <,
COMMUTATOR = <=,
PROCEDURE = sys.uniqueidentifierge,
RESTRICT = scalargtsel,
JOIN = scalargtjoinsel
);
CREATE FUNCTION uniqueidentifier_cmp(sys.UNIQUEIDENTIFIER, sys.UNIQUEIDENTIFIER)
RETURNS INT4
AS 'uuid_cmp'
LANGUAGE internal IMMUTABLE STRICT PARALLEL SAFE;
CREATE FUNCTION uniqueidentifier_hash(sys.UNIQUEIDENTIFIER)
RETURNS INT4
AS 'uuid_hash'
LANGUAGE internal IMMUTABLE STRICT PARALLEL SAFE;
CREATE OPERATOR CLASS sys.uniqueidentifier_ops
DEFAULT FOR TYPE sys.UNIQUEIDENTIFIER USING btree AS
OPERATOR 1 < (sys.UNIQUEIDENTIFIER, sys.UNIQUEIDENTIFIER),
OPERATOR 2 <= (sys.UNIQUEIDENTIFIER, sys.UNIQUEIDENTIFIER),
OPERATOR 3 = (sys.UNIQUEIDENTIFIER, sys.UNIQUEIDENTIFIER),
OPERATOR 4 >= (sys.UNIQUEIDENTIFIER, sys.UNIQUEIDENTIFIER),
OPERATOR 5 > (sys.UNIQUEIDENTIFIER, sys.UNIQUEIDENTIFIER),
FUNCTION 1 uniqueidentifier_cmp(sys.UNIQUEIDENTIFIER, sys.UNIQUEIDENTIFIER);
CREATE OPERATOR CLASS sys.uniqueidentifier_ops
DEFAULT FOR TYPE sys.UNIQUEIDENTIFIER USING hash AS
OPERATOR 1 = (sys.UNIQUEIDENTIFIER, sys.UNIQUEIDENTIFIER),
FUNCTION 1 uniqueidentifier_hash(sys.UNIQUEIDENTIFIER);
CREATE FUNCTION sys.varchar2uniqueidentifier(pg_catalog.VARCHAR, integer, boolean)
RETURNS sys.UNIQUEIDENTIFIER
AS 'babelfishpg_common', 'varchar2uniqueidentifier'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE CAST (pg_catalog.VARCHAR as sys.UNIQUEIDENTIFIER)
WITH FUNCTION sys.varchar2uniqueidentifier(pg_catalog.VARCHAR, integer, boolean) AS ASSIGNMENT;
CREATE FUNCTION sys.varchar2uniqueidentifier(sys.VARCHAR, integer, boolean)
RETURNS sys.UNIQUEIDENTIFIER
AS 'babelfishpg_common', 'varchar2uniqueidentifier'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE CAST (sys.VARCHAR as sys.UNIQUEIDENTIFIER)
WITH FUNCTION sys.varchar2uniqueidentifier(sys.VARCHAR, integer, boolean) AS ASSIGNMENT;
CREATE FUNCTION sys.varbinary2uniqueidentifier(sys.bbf_varbinary, integer, boolean)
RETURNS sys.UNIQUEIDENTIFIER
AS 'babelfishpg_common', 'varbinary2uniqueidentifier'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE CAST (sys.bbf_varbinary as sys.UNIQUEIDENTIFIER)
WITH FUNCTION sys.varbinary2uniqueidentifier(sys.bbf_varbinary, integer, boolean) AS ASSIGNMENT;
CREATE FUNCTION sys.binary2uniqueidentifier(sys.bbf_binary, integer, boolean)
RETURNS sys.UNIQUEIDENTIFIER
AS 'babelfishpg_common', 'varbinary2uniqueidentifier'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE CAST (sys.bbf_binary as sys.UNIQUEIDENTIFIER)
WITH FUNCTION sys.binary2uniqueidentifier(sys.bbf_binary, integer, boolean) AS ASSIGNMENT;
CREATE FUNCTION sys.uniqueidentifier2varbinary(sys.UNIQUEIDENTIFIER, integer, boolean)
RETURNS sys.bbf_varbinary
AS 'babelfishpg_common', 'uniqueidentifier2varbinary'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE CAST (sys.UNIQUEIDENTIFIER as sys.bbf_varbinary)
WITH FUNCTION sys.uniqueidentifier2varbinary(sys.UNIQUEIDENTIFIER, integer, boolean) AS IMPLICIT;
CREATE FUNCTION sys.uniqueidentifier2binary(sys.UNIQUEIDENTIFIER, integer, boolean)
RETURNS sys.bbf_binary
AS 'babelfishpg_common', 'uniqueidentifier2binary'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE CAST (sys.UNIQUEIDENTIFIER as sys.bbf_binary)
WITH FUNCTION sys.uniqueidentifier2binary(sys.UNIQUEIDENTIFIER, integer, boolean) AS IMPLICIT;
-- 23 "sql/babelfishpg_common.in" 2
-- 1 "sql/datetime.sql" 1
CREATE TYPE sys.DATETIME;
CREATE OR REPLACE FUNCTION sys.datetimein(cstring)
RETURNS sys.DATETIME
AS 'babelfishpg_common', 'datetime_in'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE OR REPLACE FUNCTION sys.datetimeout(sys.DATETIME)
RETURNS cstring
AS 'babelfishpg_common', 'datetime_out'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE OR REPLACE FUNCTION sys.datetimerecv(internal)
RETURNS sys.DATETIME
AS 'timestamp_recv'
LANGUAGE internal IMMUTABLE STRICT PARALLEL SAFE;
CREATE OR REPLACE FUNCTION sys.datetimesend(sys.DATETIME)
RETURNS bytea
AS 'timestamp_send'
LANGUAGE internal IMMUTABLE STRICT PARALLEL SAFE;
CREATE OR REPLACE FUNCTION sys.datetimetypmodin(cstring[])
RETURNS integer
AS 'timestamptypmodin'
LANGUAGE internal IMMUTABLE STRICT PARALLEL SAFE;
CREATE OR REPLACE FUNCTION sys.datetimetypmodout(integer)
RETURNS cstring
AS 'timestamptypmodout'
LANGUAGE internal IMMUTABLE STRICT PARALLEL SAFE;
CREATE TYPE sys.DATETIME (
INPUT = sys.datetimein,
OUTPUT = sys.datetimeout,
RECEIVE = sys.datetimerecv,
SEND = sys.datetimesend,
TYPMOD_IN = sys.datetimetypmodin,
TYPMOD_OUT = sys.datetimetypmodout,
INTERNALLENGTH = 8,
ALIGNMENT = 'double',
STORAGE = 'plain',
CATEGORY = 'D',
PREFERRED = false,
COLLATABLE = false,
DEFAULT = '1900-01-01 00:00:00',
PASSEDBYVALUE
);
CREATE FUNCTION sys.datetimeeq(sys.DATETIME, sys.DATETIME)
RETURNS bool
AS 'timestamp_eq'
LANGUAGE internal IMMUTABLE STRICT PARALLEL SAFE;
CREATE FUNCTION sys.datetimene(sys.DATETIME, sys.DATETIME)
RETURNS bool
AS 'timestamp_ne'
LANGUAGE internal IMMUTABLE STRICT PARALLEL SAFE;
CREATE FUNCTION sys.datetimelt(sys.DATETIME, sys.DATETIME)
RETURNS bool
AS 'timestamp_lt'
LANGUAGE internal IMMUTABLE STRICT PARALLEL SAFE;
CREATE FUNCTION sys.datetimele(sys.DATETIME, sys.DATETIME)
RETURNS bool
AS 'timestamp_le'
LANGUAGE internal IMMUTABLE STRICT PARALLEL SAFE;
CREATE FUNCTION sys.datetimegt(sys.DATETIME, sys.DATETIME)
RETURNS bool
AS 'timestamp_gt'
LANGUAGE internal IMMUTABLE STRICT PARALLEL SAFE;
CREATE FUNCTION sys.datetimege(sys.DATETIME, sys.DATETIME)
RETURNS bool
AS 'timestamp_ge'
LANGUAGE internal IMMUTABLE STRICT PARALLEL SAFE;
CREATE OPERATOR sys.= (
LEFTARG = sys.DATETIME,
RIGHTARG = sys.DATETIME,
COMMUTATOR = =,
NEGATOR = <>,
PROCEDURE = sys.datetimeeq,
RESTRICT = eqsel,
JOIN = eqjoinsel,
MERGES
);
CREATE OPERATOR sys.<> (
LEFTARG = sys.DATETIME,
RIGHTARG = sys.DATETIME,
NEGATOR = =,
COMMUTATOR = <>,
PROCEDURE = sys.datetimene,
RESTRICT = neqsel,
JOIN = neqjoinsel
);
CREATE OPERATOR sys.< (
LEFTARG = sys.DATETIME,
RIGHTARG = sys.DATETIME,
NEGATOR = >=,
COMMUTATOR = >,
PROCEDURE = sys.datetimelt,
RESTRICT = scalarltsel,
JOIN = scalarltjoinsel
);
CREATE OPERATOR sys.<= (
LEFTARG = sys.DATETIME,
RIGHTARG = sys.DATETIME,
NEGATOR = >,
COMMUTATOR = >=,
PROCEDURE = sys.datetimele,
RESTRICT = scalarlesel,
JOIN = scalarlejoinsel
);
CREATE OPERATOR sys.> (
LEFTARG = sys.DATETIME,
RIGHTARG = sys.DATETIME,
NEGATOR = <=,
COMMUTATOR = <,
PROCEDURE = sys.datetimegt,
RESTRICT = scalargtsel,
JOIN = scalargtjoinsel
);
CREATE OPERATOR sys.>= (
LEFTARG = sys.DATETIME,
RIGHTARG = sys.DATETIME,
NEGATOR = <,
COMMUTATOR = <=,
PROCEDURE = sys.datetimege,
RESTRICT = scalargesel,
JOIN = scalargejoinsel
);
-- datetime <-> int operators for datetime-int +/- arithmetic
CREATE FUNCTION sys.datetimeplint4(sys.DATETIME, INT4)
RETURNS sys.DATETIME
AS 'babelfishpg_common', 'datetime_pl_int4'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE FUNCTION sys.int4pldatetime(INT4, sys.DATETIME)
RETURNS sys.DATETIME
AS 'babelfishpg_common', 'int4_pl_datetime'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE FUNCTION sys.datetimemiint4(sys.DATETIME, INT4)
RETURNS sys.DATETIME
AS 'babelfishpg_common', 'datetime_mi_int4'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE FUNCTION sys.int4midatetime(INT4, sys.DATETIME)
RETURNS sys.DATETIME
AS 'babelfishpg_common', 'int4_mi_datetime'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE OPERATOR sys.+ (
LEFTARG = sys.DATETIME,
RIGHTARG = INT4,
PROCEDURE = sys.datetimeplint4
);
CREATE OPERATOR sys.+ (
LEFTARG = INT4,
RIGHTARG = sys.DATETIME,
PROCEDURE = sys.int4pldatetime
);
CREATE OPERATOR sys.- (
LEFTARG = sys.DATETIME,
RIGHTARG = INT4,
PROCEDURE = sys.datetimemiint4
);
CREATE OPERATOR sys.- (
LEFTARG = INT4,
RIGHTARG = sys.DATETIME,
PROCEDURE = sys.int4midatetime
);
CREATE FUNCTION sys.datetimeplfloat8(sys.DATETIME, float8)
RETURNS sys.DATETIME
AS 'babelfishpg_common', 'datetime_pl_float8'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE OPERATOR sys.+ (
LEFTARG = sys.DATETIME,
RIGHTARG = float8,
PROCEDURE = sys.datetimeplfloat8
);
CREATE FUNCTION sys.datetimemifloat8(sys.DATETIME, float8)
RETURNS sys.DATETIME
AS 'babelfishpg_common', 'datetime_mi_float8'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE OPERATOR sys.- (
LEFTARG = sys.DATETIME,
RIGHTARG = float8,
PROCEDURE = sys.datetimemifloat8
);
CREATE FUNCTION sys.float8pldatetime(float8, sys.DATETIME)
RETURNS sys.DATETIME
AS 'babelfishpg_common', 'float8_pl_datetime'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE OPERATOR sys.+ (
LEFTARG = float8,
RIGHTARG = sys.DATETIME,
PROCEDURE = sys.float8pldatetime
);
CREATE FUNCTION sys.float8midatetime(float8, sys.DATETIME)
RETURNS sys.DATETIME
AS 'babelfishpg_common', 'float8_mi_datetime'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE OPERATOR sys.- (
LEFTARG = float8,
RIGHTARG = sys.DATETIME,
PROCEDURE = sys.float8midatetime
);
CREATE FUNCTION datetime_cmp(sys.DATETIME, sys.DATETIME)
RETURNS INT4
AS 'timestamp_cmp'
LANGUAGE internal IMMUTABLE STRICT PARALLEL SAFE;
CREATE FUNCTION datetime_hash(sys.DATETIME)
RETURNS INT4
AS 'timestamp_hash'
LANGUAGE internal IMMUTABLE STRICT PARALLEL SAFE;
CREATE OPERATOR CLASS sys.datetime_ops
DEFAULT FOR TYPE sys.DATETIME USING btree AS
OPERATOR 1 < (sys.DATETIME, sys.DATETIME),
OPERATOR 2 <= (sys.DATETIME, sys.DATETIME),
OPERATOR 3 = (sys.DATETIME, sys.DATETIME),
OPERATOR 4 >= (sys.DATETIME, sys.DATETIME),
OPERATOR 5 > (sys.DATETIME, sys.DATETIME),
FUNCTION 1 datetime_cmp(sys.DATETIME, sys.DATETIME);
CREATE OPERATOR CLASS sys.datetime_ops
DEFAULT FOR TYPE sys.DATETIME USING hash AS
OPERATOR 1 = (sys.DATETIME, sys.DATETIME),
FUNCTION 1 datetime_hash(sys.DATETIME);
-- cast TO datetime
CREATE OR REPLACE FUNCTION sys.timestamp2datetime(TIMESTAMP)
RETURNS DATETIME
AS 'babelfishpg_common', 'timestamp_datetime'
LANGUAGE C VOLATILE STRICT PARALLEL SAFE;
CREATE CAST (TIMESTAMP AS DATETIME)
WITH FUNCTION sys.timestamp2datetime(TIMESTAMP) AS ASSIGNMENT;
CREATE OR REPLACE FUNCTION sys.timestamptz2datetime(TIMESTAMPTZ)
RETURNS DATETIME
AS 'babelfishpg_common', 'timestamptz_datetime'
LANGUAGE C VOLATILE STRICT PARALLEL SAFE;
CREATE CAST (TIMESTAMPTZ AS DATETIME)
WITH FUNCTION sys.timestamptz2datetime (TIMESTAMPTZ) AS ASSIGNMENT;
CREATE OR REPLACE FUNCTION sys.date2datetime(DATE)
RETURNS DATETIME
AS 'babelfishpg_common', 'date_datetime'
LANGUAGE C VOLATILE STRICT PARALLEL SAFE;
CREATE CAST (DATE AS DATETIME)
WITH FUNCTION sys.date2datetime (DATE) AS IMPLICIT;
CREATE OR REPLACE FUNCTION sys.time2datetime(TIME)
RETURNS DATETIME
AS 'babelfishpg_common', 'time_datetime'
LANGUAGE C VOLATILE STRICT PARALLEL SAFE;
CREATE CAST (TIME AS DATETIME)
WITH FUNCTION sys.time2datetime (TIME) AS IMPLICIT;
CREATE OR REPLACE FUNCTION sys.varchar2datetime(sys.VARCHAR)
RETURNS DATETIME
AS 'babelfishpg_common', 'varchar_datetime'
LANGUAGE C VOLATILE STRICT PARALLEL SAFE;
CREATE CAST (sys.VARCHAR AS DATETIME)
WITH FUNCTION sys.varchar2datetime (sys.VARCHAR) AS ASSIGNMENT;
CREATE OR REPLACE FUNCTION sys.varchar2datetime(pg_catalog.VARCHAR)
RETURNS DATETIME
AS 'babelfishpg_common', 'varchar_datetime'
LANGUAGE C VOLATILE STRICT PARALLEL SAFE;
CREATE CAST (pg_catalog.VARCHAR AS DATETIME)
WITH FUNCTION sys.varchar2datetime (pg_catalog.VARCHAR) AS ASSIGNMENT;
CREATE OR REPLACE FUNCTION sys.char2datetime(CHAR)
RETURNS DATETIME
AS 'babelfishpg_common', 'char_datetime'
LANGUAGE C VOLATILE STRICT PARALLEL SAFE;
CREATE CAST (CHAR AS DATETIME)
WITH FUNCTION sys.char2datetime (CHAR) AS ASSIGNMENT;
CREATE OR REPLACE FUNCTION sys.bpchar2datetime(sys.BPCHAR)
RETURNS sys.DATETIME
AS 'babelfishpg_common', 'char_datetime'
LANGUAGE C VOLATILE STRICT PARALLEL SAFE;
CREATE CAST (sys.BPCHAR AS sys.DATETIME)
WITH FUNCTION sys.bpchar2datetime (sys.BPCHAR) AS ASSIGNMENT;
-- cast FROM datetime
CREATE CAST (DATETIME AS TIMESTAMP)
WITHOUT FUNCTION AS IMPLICIT;
CREATE OR REPLACE FUNCTION sys.datetime2timestamptz(DATETIME)
RETURNS TIMESTAMPTZ
AS 'timestamp_timestamptz'
LANGUAGE internal VOLATILE STRICT PARALLEL SAFE;
CREATE CAST (DATETIME AS TIMESTAMPTZ)
WITH FUNCTION sys.datetime2timestamptz (DATETIME) AS IMPLICIT;
CREATE OR REPLACE FUNCTION sys.datetime2date(DATETIME)
RETURNS DATE
AS 'timestamp_date'
LANGUAGE internal VOLATILE STRICT PARALLEL SAFE;
CREATE CAST (DATETIME AS DATE)
WITH FUNCTION sys.datetime2date (DATETIME) AS ASSIGNMENT;
CREATE OR REPLACE FUNCTION sys.datetime2time(DATETIME)
RETURNS TIME
AS 'timestamp_time'
LANGUAGE internal VOLATILE STRICT PARALLEL SAFE;
CREATE CAST (DATETIME AS TIME)
WITH FUNCTION sys.datetime2time (DATETIME) AS ASSIGNMENT;
CREATE OR REPLACE FUNCTION sys.datetime2sysvarchar(DATETIME)
RETURNS sys.VARCHAR
AS 'babelfishpg_common', 'datetime_varchar'
LANGUAGE C VOLATILE STRICT PARALLEL SAFE;
CREATE CAST (DATETIME AS sys.VARCHAR)
WITH FUNCTION sys.datetime2sysvarchar (DATETIME) AS ASSIGNMENT;
CREATE OR REPLACE FUNCTION sys.datetime2varchar(DATETIME)
RETURNS pg_catalog.VARCHAR
AS 'babelfishpg_common', 'datetime_varchar'
LANGUAGE C VOLATILE STRICT PARALLEL SAFE;
CREATE CAST (DATETIME AS pg_catalog.VARCHAR)
WITH FUNCTION sys.datetime2varchar (DATETIME) AS ASSIGNMENT;
CREATE OR REPLACE FUNCTION sys.datetime2char(DATETIME)
RETURNS CHAR
AS 'babelfishpg_common', 'datetime_char'
LANGUAGE C VOLATILE STRICT PARALLEL SAFE;
CREATE CAST (DATETIME AS CHAR)
WITH FUNCTION sys.datetime2char (DATETIME) AS ASSIGNMENT;
CREATE OR REPLACE FUNCTION sys.datetime2bpchar(sys.DATETIME)
RETURNS sys.BPCHAR
AS 'babelfishpg_common', 'datetime_char'
LANGUAGE C VOLATILE STRICT PARALLEL SAFE;
CREATE CAST (sys.DATETIME AS sys.BPCHAR)
WITH FUNCTION sys.datetime2bpchar (sys.DATETIME) AS ASSIGNMENT;
-- 24 "sql/babelfishpg_common.in" 2
-- 1 "sql/datetime2.sql" 1
CREATE TYPE sys.DATETIME2;
CREATE OR REPLACE FUNCTION sys.datetime2in(cstring)
RETURNS sys.DATETIME2
AS 'babelfishpg_common', 'datetime2_in'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE OR REPLACE FUNCTION sys.datetime2out(sys.DATETIME2)
RETURNS cstring
AS 'timestamp_out'
LANGUAGE internal IMMUTABLE STRICT PARALLEL SAFE;
CREATE OR REPLACE FUNCTION sys.datetime2recv(internal)
RETURNS sys.DATETIME2
AS 'timestamp_recv'
LANGUAGE internal IMMUTABLE STRICT PARALLEL SAFE;
CREATE OR REPLACE FUNCTION sys.datetime2send(sys.DATETIME2)
RETURNS bytea
AS 'timestamp_send'
LANGUAGE internal IMMUTABLE STRICT PARALLEL SAFE;
CREATE OR REPLACE FUNCTION sys.datetime2typmodin(cstring[])
RETURNS integer
AS 'timestamptypmodin'
LANGUAGE internal IMMUTABLE STRICT PARALLEL SAFE;
CREATE OR REPLACE FUNCTION sys.datetime2typmodout(integer)
RETURNS cstring
AS 'timestamptypmodout'
LANGUAGE internal IMMUTABLE STRICT PARALLEL SAFE;
CREATE TYPE sys.DATETIME2 (
INPUT = sys.datetime2in,
OUTPUT = sys.datetime2out,
RECEIVE = sys.datetime2recv,
SEND = sys.datetime2send,
TYPMOD_IN = sys.datetime2typmodin,
TYPMOD_OUT = sys.datetime2typmodout,
INTERNALLENGTH = 8,
ALIGNMENT = 'double',
STORAGE = 'plain',
CATEGORY = 'D',
PREFERRED = false,
COLLATABLE = false,
DEFAULT = '1900-01-01 00:00:00',
PASSEDBYVALUE
);
CREATE FUNCTION sys.datetime2eq(sys.DATETIME2, sys.DATETIME2)
RETURNS bool
AS 'timestamp_eq'
LANGUAGE internal IMMUTABLE STRICT PARALLEL SAFE;
CREATE FUNCTION sys.datetime2ne(sys.DATETIME2, sys.DATETIME2)
RETURNS bool
AS 'timestamp_ne'
LANGUAGE internal IMMUTABLE STRICT PARALLEL SAFE;
CREATE FUNCTION sys.datetime2lt(sys.DATETIME2, sys.DATETIME2)
RETURNS bool
AS 'timestamp_lt'
LANGUAGE internal IMMUTABLE STRICT PARALLEL SAFE;
CREATE FUNCTION sys.datetime2le(sys.DATETIME2, sys.DATETIME2)
RETURNS bool
AS 'timestamp_le'
LANGUAGE internal IMMUTABLE STRICT PARALLEL SAFE;
CREATE FUNCTION sys.datetime2gt(sys.DATETIME2, sys.DATETIME2)
RETURNS bool
AS 'timestamp_gt'
LANGUAGE internal IMMUTABLE STRICT PARALLEL SAFE;
CREATE FUNCTION sys.datetime2ge(sys.DATETIME2, sys.DATETIME2)
RETURNS bool
AS 'timestamp_ge'
LANGUAGE internal IMMUTABLE STRICT PARALLEL SAFE;
CREATE OPERATOR sys.= (
LEFTARG = sys.DATETIME2,
RIGHTARG = sys.DATETIME2,
COMMUTATOR = =,
NEGATOR = <>,
PROCEDURE = sys.datetime2eq,
RESTRICT = eqsel,
JOIN = eqjoinsel,
MERGES
);
CREATE OPERATOR sys.<> (
LEFTARG = sys.DATETIME2,
RIGHTARG = sys.DATETIME2,
NEGATOR = =,
COMMUTATOR = <>,
PROCEDURE = sys.datetime2ne,
RESTRICT = neqsel,
JOIN = neqjoinsel
);
CREATE OPERATOR sys.< (
LEFTARG = sys.DATETIME2,
RIGHTARG = sys.DATETIME2,
NEGATOR = >=,
COMMUTATOR = >,
PROCEDURE = sys.datetime2lt,
RESTRICT = scalarltsel,
JOIN = scalarltjoinsel
);
CREATE OPERATOR sys.<= (
LEFTARG = sys.DATETIME2,
RIGHTARG = sys.DATETIME2,
NEGATOR = >,
COMMUTATOR = >=,
PROCEDURE = sys.datetime2le,
RESTRICT = scalarlesel,
JOIN = scalarlejoinsel
);
CREATE OPERATOR sys.> (
LEFTARG = sys.DATETIME2,
RIGHTARG = sys.DATETIME2,
NEGATOR = <=,
COMMUTATOR = <,
PROCEDURE = sys.datetime2gt,
RESTRICT = scalargtsel,
JOIN = scalargtjoinsel
);
CREATE OPERATOR sys.>= (
LEFTARG = sys.DATETIME2,
RIGHTARG = sys.DATETIME2,
NEGATOR = <,
COMMUTATOR = <=,
PROCEDURE = sys.datetime2ge,
RESTRICT = scalargesel,
JOIN = scalargejoinsel
);
CREATE FUNCTION datetime2_cmp(sys.DATETIME2, sys.DATETIME2)
RETURNS INT4
AS 'timestamp_cmp'
LANGUAGE internal IMMUTABLE STRICT PARALLEL SAFE;
CREATE FUNCTION datetime2_hash(sys.DATETIME2)
RETURNS INT4
AS 'timestamp_hash'
LANGUAGE internal IMMUTABLE STRICT PARALLEL SAFE;
CREATE OPERATOR CLASS sys.datetime2_ops
DEFAULT FOR TYPE sys.DATETIME2 USING btree AS
OPERATOR 1 < (sys.DATETIME2, sys.DATETIME2),
OPERATOR 2 <= (sys.DATETIME2, sys.DATETIME2),
OPERATOR 3 = (sys.DATETIME2, sys.DATETIME2),
OPERATOR 4 >= (sys.DATETIME2, sys.DATETIME2),
OPERATOR 5 > (sys.DATETIME2, sys.DATETIME2),
FUNCTION 1 datetime2_cmp(sys.DATETIME2, sys.DATETIME2);
CREATE OPERATOR CLASS sys.datetime2_ops
DEFAULT FOR TYPE sys.DATETIME2 USING hash AS
OPERATOR 1 = (sys.DATETIME2, sys.DATETIME2),
FUNCTION 1 datetime2_hash(sys.DATETIME2);
-- cast TO datetime2
CREATE OR REPLACE FUNCTION sys.timestamp2datetime2(TIMESTAMP)
RETURNS DATETIME2
AS 'babelfishpg_common', 'timestamp_datetime2'
LANGUAGE C VOLATILE STRICT PARALLEL SAFE;
CREATE CAST (TIMESTAMP AS DATETIME2)
WITH FUNCTION sys.timestamp2datetime2(TIMESTAMP) AS ASSIGNMENT;
-- CREATE CAST (TIMESTAMP AS DATETIME2)
-- WITHOUT FUNCTION AS IMPLICIT;
CREATE OR REPLACE FUNCTION sys.timestamptz2datetime2(TIMESTAMPTZ)
RETURNS DATETIME2
AS 'babelfishpg_common', 'timestamptz_datetime2'
LANGUAGE C VOLATILE STRICT PARALLEL SAFE;
CREATE CAST (TIMESTAMPTZ AS DATETIME2)
WITH FUNCTION sys.timestamptz2datetime2 (TIMESTAMPTZ) AS ASSIGNMENT;
CREATE OR REPLACE FUNCTION sys.date2datetime2(DATE)
RETURNS DATETIME2
AS 'babelfishpg_common', 'date_datetime2'
LANGUAGE C VOLATILE STRICT PARALLEL SAFE;
CREATE CAST (DATE AS DATETIME2)
WITH FUNCTION sys.date2datetime2 (DATE) AS IMPLICIT;
CREATE OR REPLACE FUNCTION sys.time2datetime2(TIME)
RETURNS DATETIME2
AS 'babelfishpg_common', 'time_datetime2'
LANGUAGE C VOLATILE STRICT PARALLEL SAFE;
CREATE CAST (TIME AS DATETIME2)
WITH FUNCTION sys.time2datetime2 (TIME) AS IMPLICIT;
CREATE CAST (DATETIME AS DATETIME2)
WITHOUT FUNCTION AS IMPLICIT;
-- BABEL-1465 CAST from VARCHAR/NVARCHAR/CHAR/NCHAR to datetime2 is VOLATILE
CREATE OR REPLACE FUNCTION sys.varchar2datetime2(sys.VARCHAR)
RETURNS DATETIME2
AS 'babelfishpg_common', 'varchar_datetime2'
LANGUAGE C VOLATILE STRICT PARALLEL SAFE;
CREATE CAST (sys.VARCHAR AS DATETIME2)
WITH FUNCTION sys.varchar2datetime2 (sys.VARCHAR) AS ASSIGNMENT;
CREATE OR REPLACE FUNCTION sys.varchar2datetime2(pg_catalog.VARCHAR)
RETURNS DATETIME2
AS 'babelfishpg_common', 'varchar_datetime2'
LANGUAGE C VOLATILE STRICT PARALLEL SAFE;
CREATE CAST (pg_catalog.VARCHAR AS DATETIME2)
WITH FUNCTION sys.varchar2datetime2 (pg_catalog.VARCHAR) AS ASSIGNMENT;
CREATE OR REPLACE FUNCTION sys.char2datetime2(CHAR)
RETURNS DATETIME2
AS 'babelfishpg_common', 'char_datetime2'
LANGUAGE C VOLATILE STRICT PARALLEL SAFE;
CREATE CAST (CHAR AS DATETIME2)
WITH FUNCTION sys.char2datetime2 (CHAR) AS ASSIGNMENT;
CREATE OR REPLACE FUNCTION sys.bpchar2datetime2(sys.BPCHAR)
RETURNS sys.DATETIME2
AS 'babelfishpg_common', 'char_datetime2'
LANGUAGE C VOLATILE STRICT PARALLEL SAFE;
CREATE CAST (sys.BPCHAR AS sys.DATETIME2)
WITH FUNCTION sys.bpchar2datetime2 (sys.BPCHAR) AS ASSIGNMENT;
-- cast FROM datetime2
CREATE CAST (DATETIME2 AS TIMESTAMP)
WITHOUT FUNCTION AS IMPLICIT;
CREATE OR REPLACE FUNCTION sys.datetime22datetime(DATETIME2)
RETURNS DATETIME
AS 'babelfishpg_common', 'timestamp_datetime'
LANGUAGE C VOLATILE STRICT PARALLEL SAFE;
CREATE CAST (DATETIME2 AS DATETIME)
WITH FUNCTION sys.datetime22datetime(DATETIME2) AS ASSIGNMENT;
CREATE OR REPLACE FUNCTION sys.datetime22timestamptz(DATETIME2)
RETURNS TIMESTAMPTZ
AS 'timestamp_timestamptz'
LANGUAGE internal VOLATILE STRICT PARALLEL SAFE;
CREATE CAST (DATETIME2 AS TIMESTAMPTZ)
WITH FUNCTION sys.datetime22timestamptz (DATETIME2) AS IMPLICIT;
CREATE OR REPLACE FUNCTION sys.datetime22date(DATETIME2)
RETURNS DATE
AS 'timestamp_date'
LANGUAGE internal VOLATILE STRICT PARALLEL SAFE;
CREATE CAST (DATETIME2 AS DATE)
WITH FUNCTION sys.datetime22date (DATETIME2) AS ASSIGNMENT;
CREATE OR REPLACE FUNCTION sys.datetime22time(DATETIME2)
RETURNS TIME
AS 'timestamp_time'
LANGUAGE internal VOLATILE STRICT PARALLEL SAFE;
CREATE CAST (DATETIME2 AS TIME)
WITH FUNCTION sys.datetime22time (DATETIME2) AS ASSIGNMENT;
CREATE FUNCTION sys.datetime2scale(sys.DATETIME2, INT4)
RETURNS sys.DATETIME2
AS 'babelfishpg_common', 'datetime2_scale'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE CAST (sys.DATETIME2 AS sys.DATETIME2)
WITH FUNCTION datetime2scale (sys.DATETIME2, INT4) AS ASSIGNMENT;
-- BABEL-1465 CAST from datetime2 to VARCHAR/NVARCHAR/CHAR/NCHAR is VOLATILE
CREATE OR REPLACE FUNCTION sys.datetime22sysvarchar(DATETIME2)
RETURNS sys.VARCHAR
AS 'babelfishpg_common', 'datetime2_varchar'
LANGUAGE C VOLATILE STRICT PARALLEL SAFE;
CREATE CAST (DATETIME2 AS sys.VARCHAR)
WITH FUNCTION sys.datetime22sysvarchar (DATETIME2) AS ASSIGNMENT;
CREATE OR REPLACE FUNCTION sys.datetime22varchar(DATETIME2)
RETURNS pg_catalog.VARCHAR
AS 'babelfishpg_common', 'datetime2_varchar'
LANGUAGE C VOLATILE STRICT PARALLEL SAFE;
CREATE CAST (DATETIME2 AS pg_catalog.VARCHAR)
WITH FUNCTION sys.datetime22varchar (DATETIME2) AS ASSIGNMENT;
CREATE OR REPLACE FUNCTION sys.datetime22char(DATETIME2)
RETURNS CHAR
AS 'babelfishpg_common', 'datetime2_char'
LANGUAGE C VOLATILE STRICT PARALLEL SAFE;
CREATE CAST (DATETIME2 AS CHAR)
WITH FUNCTION sys.datetime22char (DATETIME2) AS ASSIGNMENT;
CREATE OR REPLACE FUNCTION sys.datetime22bpchar(sys.DATETIME2)
RETURNS sys.BPCHAR
AS 'babelfishpg_common', 'datetime2_char'
LANGUAGE C VOLATILE STRICT PARALLEL SAFE;
CREATE CAST (sys.DATETIME2 AS sys.BPCHAR)
WITH FUNCTION sys.datetime22bpchar (sys.DATETIME2) AS ASSIGNMENT;
-- 25 "sql/babelfishpg_common.in" 2
-- 1 "sql/smalldatetime.sql" 1
CREATE TYPE sys.SMALLDATETIME;
CREATE OR REPLACE FUNCTION sys.smalldatetimein(cstring)
RETURNS sys.SMALLDATETIME
AS 'babelfishpg_common', 'smalldatetime_in'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE OR REPLACE FUNCTION sys.smalldatetimeout(sys.SMALLDATETIME)
RETURNS cstring
AS 'timestamp_out'
LANGUAGE internal IMMUTABLE STRICT PARALLEL SAFE;
CREATE OR REPLACE FUNCTION sys.smalldatetimerecv(internal)
RETURNS sys.SMALLDATETIME
AS 'timestamp_recv'
LANGUAGE internal IMMUTABLE STRICT PARALLEL SAFE;
CREATE OR REPLACE FUNCTION sys.smalldatetimesend(sys.SMALLDATETIME)
RETURNS bytea
AS 'timestamp_send'
LANGUAGE internal IMMUTABLE STRICT PARALLEL SAFE;
CREATE OR REPLACE FUNCTION sys.smalltypmodin(cstring[])
RETURNS integer
AS 'timestamptypmodin'
LANGUAGE internal IMMUTABLE STRICT PARALLEL SAFE;
CREATE OR REPLACE FUNCTION sys.smalltypmodout(integer)
RETURNS cstring
AS 'timestamptypmodout'
LANGUAGE internal IMMUTABLE STRICT PARALLEL SAFE;
CREATE TYPE sys.SMALLDATETIME (
INPUT = sys.smalldatetimein,
OUTPUT = sys.smalldatetimeout,
RECEIVE = sys.smalldatetimerecv,
SEND = sys.smalldatetimesend,
TYPMOD_IN = sys.smalltypmodin,
TYPMOD_OUT = sys.smalltypmodout,
INTERNALLENGTH = 8,
ALIGNMENT = 'double',
STORAGE = 'plain',
CATEGORY = 'D',
PREFERRED = false,
COLLATABLE = false,
DEFAULT = '1900-01-01 00:00',
PASSEDBYVALUE
);
CREATE FUNCTION sys.smalldatetimeeq(sys.SMALLDATETIME, sys.SMALLDATETIME)
RETURNS bool
AS 'timestamp_eq'
LANGUAGE internal IMMUTABLE STRICT PARALLEL SAFE;
CREATE FUNCTION sys.smalldatetimene(sys.SMALLDATETIME, sys.SMALLDATETIME)
RETURNS bool
AS 'timestamp_ne'
LANGUAGE internal IMMUTABLE STRICT PARALLEL SAFE;
CREATE FUNCTION sys.smalldatetimelt(sys.SMALLDATETIME, sys.SMALLDATETIME)
RETURNS bool
AS 'timestamp_lt'
LANGUAGE internal IMMUTABLE STRICT PARALLEL SAFE;
CREATE FUNCTION sys.smalldatetimele(sys.SMALLDATETIME, sys.SMALLDATETIME)
RETURNS bool
AS 'timestamp_le'
LANGUAGE internal IMMUTABLE STRICT PARALLEL SAFE;
CREATE FUNCTION sys.smalldatetimegt(sys.SMALLDATETIME, sys.SMALLDATETIME)
RETURNS bool
AS 'timestamp_gt'
LANGUAGE internal IMMUTABLE STRICT PARALLEL SAFE;
CREATE FUNCTION sys.smalldatetimege(sys.SMALLDATETIME, sys.SMALLDATETIME)
RETURNS bool
AS 'timestamp_ge'
LANGUAGE internal IMMUTABLE STRICT PARALLEL SAFE;
CREATE OPERATOR sys.= (
LEFTARG = sys.SMALLDATETIME,
RIGHTARG = sys.SMALLDATETIME,
COMMUTATOR = =,
NEGATOR = <>,
PROCEDURE = sys.smalldatetimeeq,
RESTRICT = eqsel,
JOIN = eqjoinsel,
MERGES
);
CREATE OPERATOR sys.<> (
LEFTARG = sys.SMALLDATETIME,
RIGHTARG = sys.SMALLDATETIME,
NEGATOR = =,
COMMUTATOR = <>,
PROCEDURE = sys.smalldatetimene,
RESTRICT = neqsel,
JOIN = neqjoinsel
);
CREATE OPERATOR sys.< (
LEFTARG = sys.SMALLDATETIME,
RIGHTARG = sys.SMALLDATETIME,
NEGATOR = >=,
COMMUTATOR = >,
PROCEDURE = sys.smalldatetimelt,
RESTRICT = scalarltsel,
JOIN = scalarltjoinsel
);
CREATE OPERATOR sys.<= (
LEFTARG = sys.SMALLDATETIME,
RIGHTARG = sys.SMALLDATETIME,
NEGATOR = >,
COMMUTATOR = >=,
PROCEDURE = sys.smalldatetimele,
RESTRICT = scalarlesel,
JOIN = scalarlejoinsel
);
CREATE OPERATOR sys.> (
LEFTARG = sys.SMALLDATETIME,
RIGHTARG = sys.SMALLDATETIME,
NEGATOR = <=,
COMMUTATOR = <,
PROCEDURE = sys.smalldatetimegt,
RESTRICT = scalargtsel,
JOIN = scalargtjoinsel
);
CREATE OPERATOR sys.>= (
LEFTARG = sys.SMALLDATETIME,
RIGHTARG = sys.SMALLDATETIME,
NEGATOR = <,
COMMUTATOR = <=,
PROCEDURE = sys.smalldatetimege,
RESTRICT = scalargesel,
JOIN = scalargejoinsel
);
-- smalldate vs pg_catalog.date
CREATE FUNCTION sys.smalldatetime_eq_date(sys.SMALLDATETIME, pg_catalog.date)
RETURNS bool
AS 'timestamp_eq_date'
LANGUAGE internal IMMUTABLE STRICT PARALLEL SAFE;
CREATE FUNCTION sys.smalldatetime_ne_date(sys.SMALLDATETIME, pg_catalog.date)
RETURNS bool
AS 'timestamp_ne_date'
LANGUAGE internal IMMUTABLE STRICT PARALLEL SAFE;
CREATE FUNCTION sys.smalldatetime_lt_date(sys.SMALLDATETIME, pg_catalog.date)
RETURNS bool
AS 'timestamp_lt_date'
LANGUAGE internal IMMUTABLE STRICT PARALLEL SAFE;
CREATE FUNCTION sys.smalldatetime_le_date(sys.SMALLDATETIME, pg_catalog.date)
RETURNS bool
AS 'timestamp_le_date'
LANGUAGE internal IMMUTABLE STRICT PARALLEL SAFE;
CREATE FUNCTION sys.smalldatetime_gt_date(sys.SMALLDATETIME, pg_catalog.date)
RETURNS bool
AS 'timestamp_gt_date'
LANGUAGE internal IMMUTABLE STRICT PARALLEL SAFE;
CREATE FUNCTION sys.smalldatetime_ge_date(sys.SMALLDATETIME, pg_catalog.date)
RETURNS bool
AS 'timestamp_ge_date'
LANGUAGE internal IMMUTABLE STRICT PARALLEL SAFE;
CREATE OPERATOR sys.= (
LEFTARG = sys.SMALLDATETIME,
RIGHTARG = pg_catalog.date,
COMMUTATOR = =,
NEGATOR = <>,
PROCEDURE = smalldatetime_eq_date,
RESTRICT = eqsel,
JOIN = eqjoinsel,
MERGES
);
CREATE OPERATOR sys.<> (
LEFTARG = sys.SMALLDATETIME,
RIGHTARG = pg_catalog.date,
NEGATOR = =,
COMMUTATOR = <>,
PROCEDURE = smalldatetime_ne_date,
RESTRICT = neqsel,
JOIN = neqjoinsel
);
CREATE OPERATOR sys.< (
LEFTARG = sys.SMALLDATETIME,
RIGHTARG = pg_catalog.date,
NEGATOR = >=,
COMMUTATOR = >,
PROCEDURE = smalldatetime_lt_date,
RESTRICT = scalarltsel,
JOIN = scalarltjoinsel
);
CREATE OPERATOR sys.<= (
LEFTARG = sys.SMALLDATETIME,
RIGHTARG = pg_catalog.date,
NEGATOR = >,
COMMUTATOR = >=,
PROCEDURE = smalldatetime_le_date,
RESTRICT = scalarlesel,
JOIN = scalarlejoinsel
);
CREATE OPERATOR sys.> (
LEFTARG = sys.SMALLDATETIME,
RIGHTARG = pg_catalog.date,
NEGATOR = <=,
COMMUTATOR = <,
PROCEDURE = smalldatetime_gt_date,
RESTRICT = scalargtsel,
JOIN = scalargtjoinsel
);
CREATE OPERATOR sys.>= (
LEFTARG = sys.SMALLDATETIME,
RIGHTARG = pg_catalog.date,
NEGATOR = <,
COMMUTATOR = <=,
PROCEDURE = smalldatetime_ge_date,
RESTRICT = scalargesel,
JOIN = scalargejoinsel
);
-- pg_catalog.date vs smalldate
CREATE FUNCTION sys.date_eq_smalldatetime(pg_catalog.date, sys.SMALLDATETIME)
RETURNS bool
AS 'date_eq_timestamp'
LANGUAGE internal IMMUTABLE STRICT PARALLEL SAFE;
CREATE FUNCTION sys.date_ne_smalldatetime(pg_catalog.date, sys.SMALLDATETIME)
RETURNS bool
AS 'date_ne_timestamp'
LANGUAGE internal IMMUTABLE STRICT PARALLEL SAFE;
CREATE FUNCTION sys.date_lt_smalldatetime(pg_catalog.date, sys.SMALLDATETIME)
RETURNS bool
AS 'date_lt_timestamp'
LANGUAGE internal IMMUTABLE STRICT PARALLEL SAFE;
CREATE FUNCTION sys.date_le_smalldatetime(pg_catalog.date, sys.SMALLDATETIME)
RETURNS bool
AS 'date_le_timestamp'
LANGUAGE internal IMMUTABLE STRICT PARALLEL SAFE;
CREATE FUNCTION sys.date_gt_smalldatetime(pg_catalog.date, sys.SMALLDATETIME)
RETURNS bool
AS 'date_gt_timestamp'
LANGUAGE internal IMMUTABLE STRICT PARALLEL SAFE;
CREATE FUNCTION sys.date_ge_smalldatetime(pg_catalog.date, sys.SMALLDATETIME)
RETURNS bool
AS 'date_ge_timestamp'
LANGUAGE internal IMMUTABLE STRICT PARALLEL SAFE;
CREATE OPERATOR sys.= (
LEFTARG = pg_catalog.date,
RIGHTARG = sys.SMALLDATETIME,
COMMUTATOR = =,
NEGATOR = <>,
PROCEDURE = date_eq_smalldatetime,
RESTRICT = eqsel,
JOIN = eqjoinsel,
MERGES
);
CREATE OPERATOR sys.<> (
LEFTARG = pg_catalog.date,
RIGHTARG = sys.SMALLDATETIME,
NEGATOR = =,
COMMUTATOR = <>,
PROCEDURE = date_ne_smalldatetime,
RESTRICT = neqsel,
JOIN = neqjoinsel
);
CREATE OPERATOR sys.< (
LEFTARG = pg_catalog.date,
RIGHTARG = sys.SMALLDATETIME,
NEGATOR = >=,
COMMUTATOR = >,
PROCEDURE = date_lt_smalldatetime,
RESTRICT = scalarltsel,
JOIN = scalarltjoinsel
);
CREATE OPERATOR sys.<= (
LEFTARG = pg_catalog.date,
RIGHTARG = sys.SMALLDATETIME,
NEGATOR = >,
COMMUTATOR = >=,
PROCEDURE = date_le_smalldatetime,
RESTRICT = scalarlesel,
JOIN = scalarlejoinsel
);
CREATE OPERATOR sys.> (
LEFTARG = pg_catalog.date,
RIGHTARG = sys.SMALLDATETIME,
NEGATOR = <=,
COMMUTATOR = <,
PROCEDURE = date_gt_smalldatetime,
RESTRICT = scalargtsel,
JOIN = scalargtjoinsel
);
CREATE OPERATOR sys.>= (
LEFTARG = pg_catalog.date,
RIGHTARG = sys.SMALLDATETIME,
NEGATOR = <,
COMMUTATOR = <=,
PROCEDURE = date_ge_smalldatetime,
RESTRICT = scalargesel,
JOIN = scalargejoinsel
);
-- smalldatetime <-> int/float operators for smalldatetime-int +/- arithmetic
CREATE FUNCTION sys.smalldatetimeplint4(sys.smalldatetime, INT4)
RETURNS sys.smalldatetime
AS 'babelfishpg_common', 'smalldatetime_pl_int4'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE FUNCTION sys.int4plsmalldatetime(INT4, sys.smalldatetime)
RETURNS sys.smalldatetime
AS 'babelfishpg_common', 'int4_pl_smalldatetime'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE FUNCTION sys.smalldatetimemiint4(sys.smalldatetime, INT4)
RETURNS sys.smalldatetime
AS 'babelfishpg_common', 'smalldatetime_mi_int4'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE FUNCTION sys.int4mismalldatetime(INT4, sys.smalldatetime)
RETURNS sys.smalldatetime
AS 'babelfishpg_common', 'int4_mi_smalldatetime'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE OPERATOR sys.+ (
LEFTARG = sys.smalldatetime,
RIGHTARG = INT4,
PROCEDURE = sys.smalldatetimeplint4
);
CREATE OPERATOR sys.+ (
LEFTARG = INT4,
RIGHTARG = sys.smalldatetime,
PROCEDURE = sys.int4plsmalldatetime
);
CREATE OPERATOR sys.- (
LEFTARG = sys.smalldatetime,
RIGHTARG = INT4,
PROCEDURE = sys.smalldatetimemiint4
);
CREATE OPERATOR sys.- (
LEFTARG = INT4,
RIGHTARG = sys.smalldatetime,
PROCEDURE = sys.int4mismalldatetime
);
CREATE FUNCTION sys.smalldatetimeplfloat8(sys.smalldatetime, float8)
RETURNS sys.smalldatetime
AS 'babelfishpg_common', 'smalldatetime_pl_float8'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE OPERATOR sys.+ (
LEFTARG = sys.smalldatetime,
RIGHTARG = float8,
PROCEDURE = sys.smalldatetimeplfloat8
);
CREATE FUNCTION sys.smalldatetimemifloat8(sys.smalldatetime, float8)
RETURNS sys.smalldatetime
AS 'babelfishpg_common', 'smalldatetime_mi_float8'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE OPERATOR sys.- (
LEFTARG = sys.smalldatetime,
RIGHTARG = float8,
PROCEDURE = sys.smalldatetimemifloat8
);
CREATE FUNCTION sys.float8plsmalldatetime(float8, sys.smalldatetime)
RETURNS sys.smalldatetime
AS 'babelfishpg_common', 'float8_pl_smalldatetime'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE OPERATOR sys.+ (
LEFTARG = float8,
RIGHTARG = sys.smalldatetime,
PROCEDURE = sys.float8plsmalldatetime
);
CREATE FUNCTION sys.float8mismalldatetime(float8, sys.smalldatetime)
RETURNS sys.smalldatetime
AS 'babelfishpg_common', 'float8_mi_smalldatetime'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE OPERATOR sys.- (
LEFTARG = float8,
RIGHTARG = sys.smalldatetime,
PROCEDURE = sys.float8mismalldatetime
);
CREATE FUNCTION smalldatetime_cmp(sys.SMALLDATETIME, sys.SMALLDATETIME)
RETURNS INT4
AS 'timestamp_cmp'
LANGUAGE internal IMMUTABLE STRICT PARALLEL SAFE;
CREATE FUNCTION smalldatetime_hash(sys.SMALLDATETIME)
RETURNS INT4
AS 'timestamp_hash'
LANGUAGE internal IMMUTABLE STRICT PARALLEL SAFE;
CREATE OPERATOR CLASS sys.smalldatetime_ops
DEFAULT FOR TYPE sys.SMALLDATETIME USING btree AS
OPERATOR 1 < (sys.SMALLDATETIME, sys.SMALLDATETIME),
OPERATOR 2 <= (sys.SMALLDATETIME, sys.SMALLDATETIME),
OPERATOR 3 = (sys.SMALLDATETIME, sys.SMALLDATETIME),
OPERATOR 4 >= (sys.SMALLDATETIME, sys.SMALLDATETIME),
OPERATOR 5 > (sys.SMALLDATETIME, sys.SMALLDATETIME),
FUNCTION 1 smalldatetime_cmp(sys.SMALLDATETIME, sys.SMALLDATETIME);
CREATE OPERATOR CLASS sys.smalldatetime_ops
DEFAULT FOR TYPE sys.SMALLDATETIME USING hash AS
OPERATOR 1 = (sys.SMALLDATETIME, sys.SMALLDATETIME),
FUNCTION 1 smalldatetime_hash(sys.SMALLDATETIME);
CREATE OR REPLACE FUNCTION sys.timestamp2smalldatetime(TIMESTAMP)
RETURNS SMALLDATETIME
AS 'babelfishpg_common', 'timestamp_smalldatetime'
LANGUAGE C VOLATILE STRICT PARALLEL SAFE;
CREATE OR REPLACE FUNCTION sys.datetime2smalldatetime(DATETIME)
RETURNS SMALLDATETIME
AS 'babelfishpg_common', 'timestamp_smalldatetime'
LANGUAGE C VOLATILE STRICT PARALLEL SAFE;
CREATE OR REPLACE FUNCTION sys.datetime22smalldatetime(DATETIME2)
RETURNS SMALLDATETIME
AS 'babelfishpg_common', 'timestamp_smalldatetime'
LANGUAGE C VOLATILE STRICT PARALLEL SAFE;
CREATE OR REPLACE FUNCTION sys.date2smalldatetime(DATE)
RETURNS SMALLDATETIME
AS 'babelfishpg_common', 'date_smalldatetime'
LANGUAGE C VOLATILE STRICT PARALLEL SAFE;
CREATE OR REPLACE FUNCTION sys.smalldatetime2date(SMALLDATETIME)
RETURNS DATE
AS 'timestamp_date'
LANGUAGE internal VOLATILE STRICT PARALLEL SAFE;
CREATE OR REPLACE FUNCTION sys.timestamptz2smalldatetime(TIMESTAMPTZ)
RETURNS SMALLDATETIME
AS 'babelfishpg_common', 'timestamptz_smalldatetime'
LANGUAGE C VOLATILE STRICT PARALLEL SAFE;
CREATE OR REPLACE FUNCTION sys.smalldatetime2timestamptz(SMALLDATETIME)
RETURNS TIMESTAMPTZ
AS 'timestamp_timestamptz'
LANGUAGE internal VOLATILE STRICT PARALLEL SAFE;
CREATE OR REPLACE FUNCTION sys.time2smalldatetime(TIME)
RETURNS SMALLDATETIME
AS 'babelfishpg_common', 'time_smalldatetime'
LANGUAGE C VOLATILE STRICT PARALLEL SAFE;
CREATE OR REPLACE FUNCTION sys.smalldatetime2time(SMALLDATETIME)
RETURNS TIME
AS 'timestamp_time'
LANGUAGE internal VOLATILE STRICT PARALLEL SAFE;
CREATE CAST (TIMESTAMP AS SMALLDATETIME)
WITH FUNCTION sys.timestamp2smalldatetime(TIMESTAMP) AS ASSIGNMENT;
CREATE CAST (DATETIME AS SMALLDATETIME)
WITH FUNCTION sys.datetime2smalldatetime(DATETIME) AS ASSIGNMENT;
CREATE CAST (DATETIME2 AS SMALLDATETIME)
WITH FUNCTION sys.datetime22smalldatetime(DATETIME2) AS ASSIGNMENT;
CREATE CAST (SMALLDATETIME AS DATETIME)
WITHOUT FUNCTION AS IMPLICIT;
CREATE CAST (SMALLDATETIME AS DATETIME2)
WITHOUT FUNCTION AS IMPLICIT;
CREATE CAST (SMALLDATETIME AS TIMESTAMP)
WITHOUT FUNCTION AS IMPLICIT;
CREATE CAST (TIMESTAMPTZ AS SMALLDATETIME)
WITH FUNCTION sys.timestamptz2smalldatetime (TIMESTAMPTZ) AS IMPLICIT;
CREATE CAST (SMALLDATETIME AS TIMESTAMPTZ)
WITH FUNCTION sys.smalldatetime2timestamptz (SMALLDATETIME) AS ASSIGNMENT;
CREATE CAST (DATE AS SMALLDATETIME)
WITH FUNCTION sys.date2smalldatetime (DATE) AS IMPLICIT;
CREATE CAST (SMALLDATETIME AS DATE)
WITH FUNCTION sys.smalldatetime2date (SMALLDATETIME) AS ASSIGNMENT;
CREATE CAST (TIME AS SMALLDATETIME)
WITH FUNCTION sys.time2smalldatetime (TIME) AS IMPLICIT;
CREATE CAST (SMALLDATETIME AS TIME)
WITH FUNCTION sys.smalldatetime2time (SMALLDATETIME) AS ASSIGNMENT;
-- BABEL-1465 CAST from VARCHAR/NVARCHAR/CHAR/NCHAR to smalldatetime is VOLATILE
CREATE OR REPLACE FUNCTION sys.varchar2smalldatetime(sys.VARCHAR)
RETURNS SMALLDATETIME
AS 'babelfishpg_common', 'varchar_smalldatetime'
LANGUAGE C VOLATILE STRICT PARALLEL SAFE;
CREATE CAST (sys.VARCHAR AS SMALLDATETIME)
WITH FUNCTION sys.varchar2smalldatetime (sys.VARCHAR) AS ASSIGNMENT;
CREATE OR REPLACE FUNCTION sys.varchar2smalldatetime(pg_catalog.VARCHAR)
RETURNS SMALLDATETIME
AS 'babelfishpg_common', 'varchar_smalldatetime'
LANGUAGE C VOLATILE STRICT PARALLEL SAFE;
CREATE CAST (pg_catalog.VARCHAR AS SMALLDATETIME)
WITH FUNCTION sys.varchar2smalldatetime (pg_catalog.VARCHAR) AS ASSIGNMENT;
CREATE OR REPLACE FUNCTION sys.char2smalldatetime(CHAR)
RETURNS SMALLDATETIME
AS 'babelfishpg_common', 'char_smalldatetime'
LANGUAGE C VOLATILE STRICT PARALLEL SAFE;
CREATE CAST (CHAR AS SMALLDATETIME)
WITH FUNCTION sys.char2smalldatetime (CHAR) AS ASSIGNMENT;
CREATE OR REPLACE FUNCTION sys.bpchar2smalldatetime(sys.BPCHAR)
RETURNS sys.SMALLDATETIME
AS 'babelfishpg_common', 'char_smalldatetime'
LANGUAGE C VOLATILE STRICT PARALLEL SAFE;
CREATE CAST (sys.BPCHAR AS sys.SMALLDATETIME)
WITH FUNCTION sys.bpchar2smalldatetime (sys.BPCHAR) AS ASSIGNMENT;
-- BABEL-1465 CAST from smalldatetime to VARCHAR/NVARCHAR/CHAR/NCHAR is VOLATILE
CREATE OR REPLACE FUNCTION sys.smalldatetime2sysvarchar(SMALLDATETIME)
RETURNS sys.VARCHAR
AS 'babelfishpg_common', 'smalldatetime_varchar'
LANGUAGE C VOLATILE STRICT PARALLEL SAFE;
CREATE CAST (SMALLDATETIME AS sys.VARCHAR)
WITH FUNCTION sys.smalldatetime2sysvarchar (SMALLDATETIME) AS ASSIGNMENT;
CREATE OR REPLACE FUNCTION sys.smalldatetime2varchar(SMALLDATETIME)
RETURNS pg_catalog.VARCHAR
AS 'babelfishpg_common', 'smalldatetime_varchar'
LANGUAGE C VOLATILE STRICT PARALLEL SAFE;
CREATE CAST (SMALLDATETIME AS pg_catalog.VARCHAR)
WITH FUNCTION sys.smalldatetime2varchar (SMALLDATETIME) AS ASSIGNMENT;
CREATE OR REPLACE FUNCTION sys.smalldatetime2char(SMALLDATETIME)
RETURNS CHAR
AS 'babelfishpg_common', 'smalldatetime_char'
LANGUAGE C VOLATILE STRICT PARALLEL SAFE;
CREATE CAST (SMALLDATETIME AS CHAR)
WITH FUNCTION sys.smalldatetime2char (SMALLDATETIME) AS ASSIGNMENT;
CREATE OR REPLACE FUNCTION sys.smalldatetime2bpchar(sys.SMALLDATETIME)
RETURNS sys.BPCHAR
AS 'babelfishpg_common', 'smalldatetime_char'
LANGUAGE C VOLATILE STRICT PARALLEL SAFE;
CREATE CAST (sys.SMALLDATETIME AS sys.BPCHAR)
WITH FUNCTION sys.smalldatetime2bpchar (sys.SMALLDATETIME) AS ASSIGNMENT;
-- 26 "sql/babelfishpg_common.in" 2
-- 1 "sql/datetimeoffset.sql" 1
CREATE TYPE sys.DATETIMEOFFSET;
CREATE OR REPLACE FUNCTION sys.datetimeoffsetin(cstring)
RETURNS sys.DATETIMEOFFSET
AS 'babelfishpg_common', 'datetimeoffset_in'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE OR REPLACE FUNCTION sys.datetimeoffsetout(sys.DATETIMEOFFSET)
RETURNS cstring
AS 'babelfishpg_common', 'datetimeoffset_out'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE OR REPLACE FUNCTION sys.datetimeoffsetrecv(internal)
RETURNS sys.DATETIMEOFFSET
AS 'babelfishpg_common', 'datetimeoffset_recv'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE OR REPLACE FUNCTION sys.datetimeoffsetsend(sys.DATETIMEOFFSET)
RETURNS bytea
AS 'babelfishpg_common', 'datetimeoffset_send'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE OR REPLACE FUNCTION sys.datetimeofftypmodin(cstring[])
RETURNS integer
AS 'timestamptztypmodin'
LANGUAGE internal IMMUTABLE STRICT PARALLEL SAFE;
CREATE OR REPLACE FUNCTION sys.datetimeofftypmodout(integer)
RETURNS cstring
AS 'timestamptztypmodout'
LANGUAGE internal IMMUTABLE STRICT PARALLEL SAFE;
CREATE TYPE sys.DATETIMEOFFSET (
INPUT = sys.datetimeoffsetin,
OUTPUT = sys.datetimeoffsetout,
RECEIVE = sys.datetimeoffsetrecv,
SEND = sys.datetimeoffsetsend,
TYPMOD_IN = sys.datetimeofftypmodin,
TYPMOD_OUT = sys.datetimeofftypmodout,
INTERNALLENGTH = 10,
ALIGNMENT = 'double',
STORAGE = 'plain',
CATEGORY = 'D',
PREFERRED = false,
DEFAULT = '1900-01-01 00:00+0'
);
CREATE FUNCTION sys.datetimeoffseteq(sys.DATETIMEOFFSET, sys.DATETIMEOFFSET)
RETURNS bool
AS 'babelfishpg_common', 'datetimeoffset_eq'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE FUNCTION sys.datetimeoffsetne(sys.DATETIMEOFFSET, sys.DATETIMEOFFSET)
RETURNS bool
AS 'babelfishpg_common', 'datetimeoffset_ne'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE FUNCTION sys.datetimeoffsetlt(sys.DATETIMEOFFSET, sys.DATETIMEOFFSET)
RETURNS bool
AS 'babelfishpg_common', 'datetimeoffset_lt'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE FUNCTION sys.datetimeoffsetle(sys.DATETIMEOFFSET, sys.DATETIMEOFFSET)
RETURNS bool
AS 'babelfishpg_common', 'datetimeoffset_le'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE FUNCTION sys.datetimeoffsetgt(sys.DATETIMEOFFSET, sys.DATETIMEOFFSET)
RETURNS bool
AS 'babelfishpg_common', 'datetimeoffset_gt'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE FUNCTION sys.datetimeoffsetge(sys.DATETIMEOFFSET, sys.DATETIMEOFFSET)
RETURNS bool
AS 'babelfishpg_common', 'datetimeoffset_ge'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE FUNCTION sys.datetimeoffsetplinterval(sys.DATETIMEOFFSET, INTERVAL)
RETURNS sys.DATETIMEOFFSET
AS 'babelfishpg_common', 'datetimeoffset_pl_interval'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE FUNCTION sys.intervalpldatetimeoffset(INTERVAL, sys.DATETIMEOFFSET)
RETURNS sys.DATETIMEOFFSET
AS 'babelfishpg_common', 'interval_pl_datetimeoffset'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE FUNCTION sys.datetimeoffsetmiinterval(sys.DATETIMEOFFSET, INTERVAL)
RETURNS sys.DATETIMEOFFSET
AS 'babelfishpg_common', 'datetimeoffset_mi_interval'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE FUNCTION sys.datetimeoffsetmi(sys.DATETIMEOFFSET, sys.DATETIMEOFFSET)
RETURNS INTERVAL
AS 'babelfishpg_common', 'datetimeoffset_mi'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE OPERATOR sys.= (
LEFTARG = sys.DATETIMEOFFSET,
RIGHTARG = sys.DATETIMEOFFSET,
COMMUTATOR = =,
NEGATOR = <>,
PROCEDURE = sys.datetimeoffseteq,
RESTRICT = eqsel,
JOIN = eqjoinsel,
MERGES
);
CREATE OPERATOR sys.<> (
LEFTARG = sys.DATETIMEOFFSET,
RIGHTARG = sys.DATETIMEOFFSET,
NEGATOR = =,
COMMUTATOR = <>,
PROCEDURE = sys.datetimeoffsetne,
RESTRICT = neqsel,
JOIN = neqjoinsel
);
CREATE OPERATOR sys.< (
LEFTARG = sys.DATETIMEOFFSET,
RIGHTARG = sys.DATETIMEOFFSET,
NEGATOR = >=,
COMMUTATOR = >,
PROCEDURE = sys.datetimeoffsetlt,
RESTRICT = scalarltsel,
JOIN = scalarltjoinsel
);
CREATE OPERATOR sys.<= (
LEFTARG = sys.DATETIMEOFFSET,
RIGHTARG = sys.DATETIMEOFFSET,
NEGATOR = >,
COMMUTATOR = >=,
PROCEDURE = sys.datetimeoffsetle,
RESTRICT = scalarlesel,
JOIN = scalarlejoinsel
);
CREATE OPERATOR sys.> (
LEFTARG = sys.DATETIMEOFFSET,
RIGHTARG = sys.DATETIMEOFFSET,
NEGATOR = <=,
COMMUTATOR = <,
PROCEDURE = sys.datetimeoffsetgt,
RESTRICT = scalargtsel,
JOIN = scalargtjoinsel
);
CREATE OPERATOR sys.>= (
LEFTARG = sys.DATETIMEOFFSET,
RIGHTARG = sys.DATETIMEOFFSET,
NEGATOR = <,
COMMUTATOR = <=,
PROCEDURE = sys.datetimeoffsetge,
RESTRICT = scalargesel,
JOIN = scalargejoinsel
);
CREATE OPERATOR sys.+ (
LEFTARG = sys.DATETIMEOFFSET,
RIGHTARG = interval,
PROCEDURE = sys.datetimeoffsetplinterval
);
CREATE OPERATOR sys.+ (
LEFTARG = interval,
RIGHTARG = sys.DATETIMEOFFSET,
PROCEDURE = sys.intervalpldatetimeoffset
);
CREATE OPERATOR sys.- (
LEFTARG = sys.DATETIMEOFFSET,
RIGHTARG = interval,
PROCEDURE = sys.datetimeoffsetmiinterval
);
CREATE OPERATOR sys.- (
LEFTARG = sys.DATETIMEOFFSET,
RIGHTARG = sys.DATETIMEOFFSET,
PROCEDURE = sys.datetimeoffsetmi
);
CREATE FUNCTION datetimeoffset_cmp(sys.DATETIMEOFFSET, sys.DATETIMEOFFSET)
RETURNS INT4
AS 'babelfishpg_common', 'datetimeoffset_cmp'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE FUNCTION datetimeoffset_hash(sys.DATETIMEOFFSET)
RETURNS INT4
AS 'babelfishpg_common', 'datetimeoffset_hash'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE OPERATOR CLASS sys.datetimeoffset_ops
DEFAULT FOR TYPE sys.DATETIMEOFFSET USING btree AS
OPERATOR 1 < (sys.DATETIMEOFFSET, sys.DATETIMEOFFSET),
OPERATOR 2 <= (sys.DATETIMEOFFSET, sys.DATETIMEOFFSET),
OPERATOR 3 = (sys.DATETIMEOFFSET, sys.DATETIMEOFFSET),
OPERATOR 4 >= (sys.DATETIMEOFFSET, sys.DATETIMEOFFSET),
OPERATOR 5 > (sys.DATETIMEOFFSET, sys.DATETIMEOFFSET),
FUNCTION 1 datetimeoffset_cmp(sys.DATETIMEOFFSET, sys.DATETIMEOFFSET);
CREATE OPERATOR CLASS sys.datetimeoffset_ops
DEFAULT FOR TYPE sys.DATETIMEOFFSET USING hash AS
OPERATOR 1 = (sys.DATETIMEOFFSET, sys.DATETIMEOFFSET),
FUNCTION 1 datetimeoffset_hash(sys.DATETIMEOFFSET);
-- Casts
CREATE FUNCTION sys.datetimeoffsetscale(sys.DATETIMEOFFSET, INT4)
RETURNS sys.DATETIMEOFFSET
AS 'babelfishpg_common', 'datetimeoffset_scale'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE OR REPLACE FUNCTION sys.timestamp2datetimeoffset(TIMESTAMP)
RETURNS sys.DATETIMEOFFSET
AS 'babelfishpg_common', 'timestamp_datetimeoffset'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE OR REPLACE FUNCTION sys.datetimeoffset2timestamp(sys.DATETIMEOFFSET)
RETURNS TIMESTAMP
AS 'babelfishpg_common', 'datetimeoffset_timestamp'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE OR REPLACE FUNCTION sys.date2datetimeoffset(DATE)
RETURNS sys.DATETIMEOFFSET
AS 'babelfishpg_common', 'date_datetimeoffset'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE OR REPLACE FUNCTION sys.datetimeoffset2date(sys.DATETIMEOFFSET)
RETURNS DATE
AS 'babelfishpg_common', 'datetimeoffset_date'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE OR REPLACE FUNCTION sys.time2datetimeoffset(TIME)
RETURNS sys.DATETIMEOFFSET
AS 'babelfishpg_common', 'time_datetimeoffset'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE OR REPLACE FUNCTION sys.datetimeoffset2time(sys.DATETIMEOFFSET)
RETURNS TIME
AS 'babelfishpg_common', 'datetimeoffset_time'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE OR REPLACE FUNCTION sys.smalldatetime2datetimeoffset(sys.SMALLDATETIME)
RETURNS sys.DATETIMEOFFSET
AS 'babelfishpg_common', 'smalldatetime_datetimeoffset'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE OR REPLACE FUNCTION sys.datetimeoffset2smalldatetime(sys.DATETIMEOFFSET)
RETURNS sys.SMALLDATETIME
AS 'babelfishpg_common', 'datetimeoffset_smalldatetime'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE OR REPLACE FUNCTION sys.datetime2datetimeoffset(sys.DATETIME)
RETURNS sys.DATETIMEOFFSET
AS 'babelfishpg_common', 'datetime_datetimeoffset'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE OR REPLACE FUNCTION sys.datetimeoffset2datetime(sys.DATETIMEOFFSET)
RETURNS sys.DATETIME
AS 'babelfishpg_common', 'datetimeoffset_datetime'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE OR REPLACE FUNCTION sys.datetime22datetimeoffset(sys.DATETIME2)
RETURNS sys.DATETIMEOFFSET
AS 'babelfishpg_common', 'datetime2_datetimeoffset'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE OR REPLACE FUNCTION sys.datetimeoffset2datetime2(sys.DATETIMEOFFSET)
RETURNS sys.DATETIME2
AS 'babelfishpg_common', 'datetimeoffset_datetime2'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE CAST (sys.DATETIMEOFFSET AS sys.DATETIMEOFFSET)
WITH FUNCTION datetimeoffsetscale (sys.DATETIMEOFFSET, INT4) AS ASSIGNMENT;
CREATE CAST (TIMESTAMP AS sys.DATETIMEOFFSET)
WITH FUNCTION sys.timestamp2datetimeoffset(TIMESTAMP) AS IMPLICIT;
CREATE CAST (sys.DATETIMEOFFSET AS TIMESTAMP)
WITH FUNCTION sys.datetimeoffset2timestamp(sys.DATETIMEOFFSET) AS ASSIGNMENT;
CREATE CAST (DATE AS sys.DATETIMEOFFSET)
WITH FUNCTION sys.date2datetimeoffset(DATE) AS IMPLICIT;
CREATE CAST (sys.DATETIMEOFFSET AS DATE)
WITH FUNCTION sys.datetimeoffset2date(sys.DATETIMEOFFSET) AS ASSIGNMENT;
CREATE CAST (TIME AS sys.DATETIMEOFFSET)
WITH FUNCTION sys.time2datetimeoffset(TIME) AS IMPLICIT;
CREATE CAST (sys.DATETIMEOFFSET AS TIME)
WITH FUNCTION sys.datetimeoffset2time(sys.DATETIMEOFFSET) AS ASSIGNMENT;
CREATE CAST (sys.SMALLDATETIME AS sys.DATETIMEOFFSET)
WITH FUNCTION sys.smalldatetime2datetimeoffset(sys.SMALLDATETIME) AS IMPLICIT;
CREATE CAST (sys.DATETIMEOFFSET AS sys.SMALLDATETIME)
WITH FUNCTION sys.datetimeoffset2smalldatetime(sys.DATETIMEOFFSET) AS ASSIGNMENT;
CREATE CAST (sys.DATETIME AS sys.DATETIMEOFFSET)
WITH FUNCTION sys.datetime2datetimeoffset(sys.DATETIME) AS IMPLICIT;
CREATE CAST (sys.DATETIMEOFFSET AS sys.DATETIME)
WITH FUNCTION sys.datetimeoffset2datetime(sys.DATETIMEOFFSET) AS ASSIGNMENT;
CREATE CAST (sys.DATETIME2 AS sys.DATETIMEOFFSET)
WITH FUNCTION sys.datetime22datetimeoffset(sys.DATETIME2) AS IMPLICIT;
CREATE CAST (sys.DATETIMEOFFSET AS sys.DATETIME2)
WITH FUNCTION sys.datetimeoffset2datetime2(sys.DATETIMEOFFSET) AS ASSIGNMENT;
-- 27 "sql/babelfishpg_common.in" 2
-- 1 "sql/sqlvariant.sql" 1
CREATE TYPE sys.SQL_VARIANT;
CREATE OR REPLACE FUNCTION sys.sqlvariantin(cstring, oid, integer)
RETURNS sys.SQL_VARIANT
AS 'babelfishpg_common', 'sqlvariantin'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE OR REPLACE FUNCTION sys.sqlvariantout(sys.SQL_VARIANT)
RETURNS cstring
AS 'babelfishpg_common', 'sqlvariantout'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE OR REPLACE FUNCTION sys.sqlvariantrecv(internal, oid, integer)
RETURNS sys.SQL_VARIANT
AS 'babelfishpg_common', 'sqlvariantrecv'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE OR REPLACE FUNCTION sys.sqlvariantsend(sys.SQL_VARIANT)
RETURNS bytea
AS 'babelfishpg_common', 'sqlvariantsend'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE TYPE sys.SQL_VARIANT (
INPUT = sys.sqlvariantin,
OUTPUT = sys.sqlvariantout,
RECEIVE = sys.sqlvariantrecv,
SEND = sys.sqlvariantsend,
INTERNALLENGTH = VARIABLE,
ALIGNMENT = 'int4',
STORAGE = 'extended',
CATEGORY = 'U',
PREFERRED = false,
COLLATABLE = true
);
-- DATALENGTH function for SQL_VARIANT
CREATE OR REPLACE FUNCTION sys.datalength(sys.SQL_VARIANT)
RETURNS integer
AS 'babelfishpg_common', 'datalength_sqlvariant'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
-- CAST FUNCTIONS to SQL_VARIANT
-- cast functions from domain types are overloaded such that we support casts both in pg and tsql:
-- money/smallmoney, smallint/tinyint, varchar/nvarchar, char/nchar
-- in pg, we will have minimal support of casts since domains are not distinguished
-- in tsql, we will allow domain casts in coerce.sql such that exact type info are saved
-- this is required for sql_variant since we may call sql_variant_property() to retrieve base type
CREATE OR REPLACE FUNCTION sys.datetime_sqlvariant(sys.DATETIME)
RETURNS sys.SQL_VARIANT
AS 'babelfishpg_common', 'datetime2sqlvariant'
LANGUAGE C VOLATILE STRICT PARALLEL SAFE;
CREATE CAST (sys.DATETIME AS sys.SQL_VARIANT)
WITH FUNCTION sys.datetime_sqlvariant (sys.DATETIME) AS IMPLICIT;
CREATE OR REPLACE FUNCTION sys.datetime2_sqlvariant(sys.DATETIME2)
RETURNS sys.SQL_VARIANT
AS 'babelfishpg_common', 'datetime22sqlvariant'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE CAST (sys.DATETIME2 AS sys.SQL_VARIANT)
WITH FUNCTION sys.datetime2_sqlvariant (sys.DATETIME2) AS IMPLICIT;
CREATE OR REPLACE FUNCTION sys.datetimeoffset_sqlvariant(sys.DATETIMEOFFSET)
RETURNS sys.SQL_VARIANT
AS 'babelfishpg_common', 'datetimeoffset2sqlvariant'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE CAST (sys.DATETIMEOFFSET AS sys.SQL_VARIANT)
WITH FUNCTION sys.datetimeoffset_sqlvariant (sys.DATETIMEOFFSET) AS IMPLICIT;
CREATE OR REPLACE FUNCTION sys.smalldatetime_sqlvariant(sys.SMALLDATETIME)
RETURNS sys.SQL_VARIANT
AS 'babelfishpg_common', 'smalldatetime2sqlvariant'
LANGUAGE C VOLATILE STRICT PARALLEL SAFE;
CREATE CAST (sys.SMALLDATETIME AS sys.SQL_VARIANT)
WITH FUNCTION sys.smalldatetime_sqlvariant (sys.SMALLDATETIME) AS IMPLICIT;
CREATE OR REPLACE FUNCTION sys.date_sqlvariant(DATE)
RETURNS sys.SQL_VARIANT
AS 'babelfishpg_common', 'date2sqlvariant'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE CAST (DATE AS sys.SQL_VARIANT)
WITH FUNCTION sys.date_sqlvariant (DATE) AS IMPLICIT;
CREATE OR REPLACE FUNCTION sys.time_sqlvariant(TIME)
RETURNS sys.SQL_VARIANT
AS 'babelfishpg_common', 'time2sqlvariant'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE CAST (TIME AS sys.SQL_VARIANT)
WITH FUNCTION sys.time_sqlvariant (TIME) AS IMPLICIT;
CREATE OR REPLACE FUNCTION sys.float_sqlvariant(FLOAT)
RETURNS sys.SQL_VARIANT
AS 'babelfishpg_common', 'float2sqlvariant'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE CAST (FLOAT AS sys.SQL_VARIANT)
WITH FUNCTION sys.float_sqlvariant (FLOAT) AS IMPLICIT;
CREATE OR REPLACE FUNCTION sys.real_sqlvariant(REAL)
RETURNS sys.SQL_VARIANT
AS 'babelfishpg_common', 'real2sqlvariant'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE CAST (REAL AS sys.SQL_VARIANT)
WITH FUNCTION sys.real_sqlvariant (REAL) AS IMPLICIT;
CREATE OR REPLACE FUNCTION sys.numeric_sqlvariant(NUMERIC)
RETURNS sys.SQL_VARIANT
AS 'babelfishpg_common', 'numeric2sqlvariant'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE CAST (NUMERIC AS sys.SQL_VARIANT)
WITH FUNCTION sys.numeric_sqlvariant (NUMERIC) AS IMPLICIT;
CREATE OR REPLACE FUNCTION sys.money_sqlvariant(FIXEDDECIMAL)
RETURNS sys.SQL_VARIANT
AS 'babelfishpg_common', 'money2sqlvariant'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE OR REPLACE FUNCTION sys.money_sqlvariant(sys.money)
RETURNS sys.SQL_VARIANT
AS 'babelfishpg_common', 'money2sqlvariant'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE OR REPLACE FUNCTION sys.smallmoney_sqlvariant(sys.smallmoney)
RETURNS sys.SQL_VARIANT
AS 'babelfishpg_common', 'smallmoney2sqlvariant'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE CAST (FIXEDDECIMAL AS sys.SQL_VARIANT)
WITH FUNCTION sys.money_sqlvariant (FIXEDDECIMAL) AS IMPLICIT;
CREATE OR REPLACE FUNCTION sys.bigint_sqlvariant(BIGINT)
RETURNS sys.SQL_VARIANT
AS 'babelfishpg_common', 'bigint2sqlvariant'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE CAST (BIGINT AS sys.SQL_VARIANT)
WITH FUNCTION sys.bigint_sqlvariant (BIGINT) AS IMPLICIT;
CREATE OR REPLACE FUNCTION sys.int_sqlvariant(INT)
RETURNS sys.SQL_VARIANT
AS 'babelfishpg_common', 'int2sqlvariant'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE CAST (INT AS sys.SQL_VARIANT)
WITH FUNCTION sys.int_sqlvariant (INT) AS IMPLICIT;
CREATE OR REPLACE FUNCTION sys.smallint_sqlvariant(SMALLINT)
RETURNS sys.SQL_VARIANT
AS 'babelfishpg_common', 'smallint2sqlvariant'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE OR REPLACE FUNCTION sys.smallint_sqlvariant(smallint)
RETURNS sys.SQL_VARIANT
AS 'babelfishpg_common', 'smallint2sqlvariant'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE OR REPLACE FUNCTION sys.tinyint_sqlvariant(sys.tinyint)
RETURNS sys.SQL_VARIANT
AS 'babelfishpg_common', 'tinyint2sqlvariant'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE CAST (SMALLINT AS sys.SQL_VARIANT)
WITH FUNCTION sys.smallint_sqlvariant (SMALLINT) AS IMPLICIT;
CREATE OR REPLACE FUNCTION sys.bit_sqlvariant(sys.BIT)
RETURNS sys.SQL_VARIANT
AS 'babelfishpg_common', 'bit2sqlvariant'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE CAST (sys.BIT AS sys.SQL_VARIANT)
WITH FUNCTION sys.bit_sqlvariant (sys.BIT) AS IMPLICIT;
CREATE OR REPLACE FUNCTION sys.varchar_sqlvariant(sys.varchar)
RETURNS sys.SQL_VARIANT
AS 'babelfishpg_common', 'varchar2sqlvariant'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE OR REPLACE FUNCTION sys.nvarchar_sqlvariant(sys.nvarchar)
RETURNS sys.SQL_VARIANT
AS 'babelfishpg_common', 'nvarchar2sqlvariant'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE CAST (sys.VARCHAR AS sys.SQL_VARIANT)
WITH FUNCTION sys.varchar_sqlvariant (sys.VARCHAR) AS IMPLICIT;
CREATE OR REPLACE FUNCTION sys.varchar_sqlvariant(pg_catalog.varchar)
RETURNS sys.SQL_VARIANT
AS 'babelfishpg_common', 'varchar2sqlvariant'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE CAST (pg_catalog.VARCHAR AS sys.SQL_VARIANT)
WITH FUNCTION sys.varchar_sqlvariant (pg_catalog.VARCHAR) AS IMPLICIT;
CREATE OR REPLACE FUNCTION sys.char_sqlvariant(CHAR)
RETURNS sys.SQL_VARIANT
AS 'babelfishpg_common', 'char2sqlvariant'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE OR REPLACE FUNCTION sys.nchar_sqlvariant(sys.nchar)
RETURNS sys.SQL_VARIANT
AS 'babelfishpg_common', 'nchar2sqlvariant'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE CAST (CHAR AS sys.SQL_VARIANT)
WITH FUNCTION sys.char_sqlvariant (CHAR) AS IMPLICIT;
CREATE OR REPLACE FUNCTION sys.char_sqlvariant(sys.BPCHAR)
RETURNS sys.SQL_VARIANT
AS 'babelfishpg_common', 'char2sqlvariant'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE CAST (sys.BPCHAR AS sys.SQL_VARIANT)
WITH FUNCTION sys.char_sqlvariant (sys.BPCHAR) AS IMPLICIT;
CREATE OR REPLACE FUNCTION sys.bbfvarbinary_sqlvariant(sys.BBF_VARBINARY)
RETURNS sys.SQL_VARIANT
AS 'babelfishpg_common', 'bbfvarbinary2sqlvariant'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE CAST (sys.BBF_VARBINARY AS sys.SQL_VARIANT)
WITH FUNCTION sys.bbfvarbinary_sqlvariant (sys.BBF_VARBINARY) AS IMPLICIT;
CREATE OR REPLACE FUNCTION sys.bbfbinary_sqlvariant(sys.BBF_BINARY)
RETURNS sys.SQL_VARIANT
AS 'babelfishpg_common', 'bbfbinary2sqlvariant'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE CAST (sys.BBF_BINARY AS sys.SQL_VARIANT)
WITH FUNCTION sys.bbfbinary_sqlvariant (sys.BBF_BINARY) AS IMPLICIT;
CREATE OR REPLACE FUNCTION sys.uniqueidentifier_sqlvariant(sys.UNIQUEIDENTIFIER)
RETURNS sys.SQL_VARIANT
AS 'babelfishpg_common', 'uniqueidentifier2sqlvariant'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE CAST (sys.UNIQUEIDENTIFIER AS sys.SQL_VARIANT)
WITH FUNCTION sys.uniqueidentifier_sqlvariant (sys.UNIQUEIDENTIFIER) AS IMPLICIT;
-- CAST functions from SQL_VARIANT
CREATE OR REPLACE FUNCTION sys.sqlvariant_datetime(sys.SQL_VARIANT)
RETURNS sys.DATETIME
AS 'babelfishpg_common', 'sqlvariant2timestamp'
LANGUAGE C VOLATILE STRICT PARALLEL SAFE;
CREATE CAST (sys.SQL_VARIANT AS sys.DATETIME)
WITH FUNCTION sys.sqlvariant_datetime (sys.SQL_VARIANT) AS ASSIGNMENT;
CREATE OR REPLACE FUNCTION sys.sqlvariant_datetime2(sys.SQL_VARIANT)
RETURNS sys.DATETIME2
AS 'babelfishpg_common', 'sqlvariant2timestamp'
LANGUAGE C VOLATILE STRICT PARALLEL SAFE;
CREATE CAST (sys.SQL_VARIANT AS sys.DATETIME2)
WITH FUNCTION sys.sqlvariant_datetime2 (sys.SQL_VARIANT) AS ASSIGNMENT;
CREATE OR REPLACE FUNCTION sys.sqlvariant_datetimeoffset(sys.SQL_VARIANT)
RETURNS sys.DATETIMEOFFSET
AS 'babelfishpg_common', 'sqlvariant2datetimeoffset'
LANGUAGE C VOLATILE STRICT PARALLEL SAFE;
CREATE CAST (sys.SQL_VARIANT AS sys.DATETIMEOFFSET)
WITH FUNCTION sys.sqlvariant_datetimeoffset (sys.SQL_VARIANT) AS ASSIGNMENT;
CREATE OR REPLACE FUNCTION sys.sqlvariant_smalldatetime(sys.SQL_VARIANT)
RETURNS sys.SMALLDATETIME
AS 'babelfishpg_common', 'sqlvariant2timestamp'
LANGUAGE C VOLATILE STRICT PARALLEL SAFE;
CREATE CAST (sys.SQL_VARIANT AS sys.SMALLDATETIME)
WITH FUNCTION sys.sqlvariant_smalldatetime (sys.SQL_VARIANT) AS ASSIGNMENT;
CREATE OR REPLACE FUNCTION sys.sqlvariant_date(sys.SQL_VARIANT)
RETURNS DATE
AS 'babelfishpg_common', 'sqlvariant2date'
LANGUAGE C VOLATILE STRICT PARALLEL SAFE;
CREATE CAST (sys.SQL_VARIANT AS DATE)
WITH FUNCTION sys.sqlvariant_date (sys.SQL_VARIANT) AS ASSIGNMENT;
CREATE OR REPLACE FUNCTION sys.sqlvariant_time(sys.SQL_VARIANT)
RETURNS TIME
AS 'babelfishpg_common', 'sqlvariant2time'
LANGUAGE C VOLATILE STRICT PARALLEL SAFE;
CREATE CAST (sys.SQL_VARIANT AS TIME)
WITH FUNCTION sys.sqlvariant_time (sys.SQL_VARIANT) AS ASSIGNMENT;
CREATE OR REPLACE FUNCTION sys.sqlvariant_float(sys.SQL_VARIANT)
RETURNS FLOAT
AS 'babelfishpg_common', 'sqlvariant2float'
LANGUAGE C VOLATILE STRICT PARALLEL SAFE;
CREATE CAST (sys.SQL_VARIANT AS FLOAT)
WITH FUNCTION sys.sqlvariant_float (sys.SQL_VARIANT) AS ASSIGNMENT;
CREATE OR REPLACE FUNCTION sys.sqlvariant_real(sys.SQL_VARIANT)
RETURNS REAL
AS 'babelfishpg_common', 'sqlvariant2real'
LANGUAGE C VOLATILE STRICT PARALLEL SAFE;
CREATE CAST (sys.SQL_VARIANT AS REAL)
WITH FUNCTION sys.sqlvariant_real (sys.SQL_VARIANT) AS ASSIGNMENT;
CREATE OR REPLACE FUNCTION sys.sqlvariant_numeric(sys.SQL_VARIANT)
RETURNS NUMERIC
AS 'babelfishpg_common', 'sqlvariant2numeric'
LANGUAGE C VOLATILE STRICT PARALLEL SAFE;
CREATE CAST (sys.SQL_VARIANT AS NUMERIC)
WITH FUNCTION sys.sqlvariant_numeric (sys.SQL_VARIANT) AS ASSIGNMENT;
CREATE OR REPLACE FUNCTION sys.sqlvariant_money(sys.SQL_VARIANT)
RETURNS sys.MONEY
AS 'babelfishpg_common', 'sqlvariant2fixeddecimal'
LANGUAGE C VOLATILE STRICT PARALLEL SAFE;
CREATE OR REPLACE FUNCTION sys.sqlvariant_smallmoney(sys.SQL_VARIANT)
RETURNS sys.SMALLMONEY
AS 'babelfishpg_common', 'sqlvariant2fixeddecimal'
LANGUAGE C VOLATILE STRICT PARALLEL SAFE;
CREATE CAST (sys.SQL_VARIANT AS FIXEDDECIMAL)
WITH FUNCTION sys.sqlvariant_money (sys.SQL_VARIANT) AS ASSIGNMENT;
CREATE OR REPLACE FUNCTION sys.sqlvariant_bigint(sys.SQL_VARIANT)
RETURNS BIGINT
AS 'babelfishpg_common', 'sqlvariant2bigint'
LANGUAGE C VOLATILE STRICT PARALLEL SAFE;
CREATE CAST (sys.SQL_VARIANT AS BIGINT)
WITH FUNCTION sys.sqlvariant_bigint (sys.SQL_VARIANT) AS ASSIGNMENT;
CREATE OR REPLACE FUNCTION sys.sqlvariant_int(sys.SQL_VARIANT)
RETURNS INT
AS 'babelfishpg_common', 'sqlvariant2int'
LANGUAGE C VOLATILE STRICT PARALLEL SAFE;
CREATE CAST (sys.SQL_VARIANT AS INT)
WITH FUNCTION sys.sqlvariant_int (sys.SQL_VARIANT) AS ASSIGNMENT;
CREATE OR REPLACE FUNCTION sys.sqlvariant_smallint(sys.SQL_VARIANT)
RETURNS SMALLINT
AS 'babelfishpg_common', 'sqlvariant2smallint'
LANGUAGE C VOLATILE STRICT PARALLEL SAFE;
CREATE OR REPLACE FUNCTION sys.sqlvariant_tinyint(sys.SQL_VARIANT)
RETURNS sys.TINYINT
AS 'babelfishpg_common', 'sqlvariant2smallint'
LANGUAGE C VOLATILE STRICT PARALLEL SAFE;
CREATE CAST (sys.SQL_VARIANT AS SMALLINT)
WITH FUNCTION sys.sqlvariant_smallint (sys.SQL_VARIANT) AS ASSIGNMENT;
CREATE OR REPLACE FUNCTION sys.sqlvariant_bit(sys.SQL_VARIANT)
RETURNS sys.BIT
AS 'babelfishpg_common', 'sqlvariant2bit'
LANGUAGE C VOLATILE STRICT PARALLEL SAFE;
CREATE CAST (sys.SQL_VARIANT AS sys.BIT)
WITH FUNCTION sys.sqlvariant_bit (sys.SQL_VARIANT) AS ASSIGNMENT;
CREATE OR REPLACE FUNCTION sys.sqlvariant_sysvarchar(sys.SQL_VARIANT)
RETURNS sys.VARCHAR
AS 'babelfishpg_common', 'sqlvariant2varchar'
LANGUAGE C VOLATILE STRICT PARALLEL SAFE;
CREATE CAST (sys.SQL_VARIANT AS sys.VARCHAR)
WITH FUNCTION sys.sqlvariant_sysvarchar (sys.SQL_VARIANT) AS ASSIGNMENT;
CREATE OR REPLACE FUNCTION sys.sqlvariant_varchar(sys.SQL_VARIANT)
RETURNS pg_catalog.VARCHAR
AS 'babelfishpg_common', 'sqlvariant2varchar'
LANGUAGE C VOLATILE STRICT PARALLEL SAFE;
CREATE CAST (sys.SQL_VARIANT AS pg_catalog.VARCHAR)
WITH FUNCTION sys.sqlvariant_varchar (sys.SQL_VARIANT) AS ASSIGNMENT;
CREATE OR REPLACE FUNCTION sys.sqlvariant_nvarchar(sys.SQL_VARIANT)
RETURNS sys.NVARCHAR
AS 'babelfishpg_common', 'sqlvariant2varchar'
LANGUAGE C VOLATILE STRICT PARALLEL SAFE;
CREATE OR REPLACE FUNCTION sys.sqlvariant_char(sys.SQL_VARIANT)
RETURNS CHAR
AS 'babelfishpg_common', 'sqlvariant2char'
LANGUAGE C VOLATILE STRICT PARALLEL SAFE;
CREATE OR REPLACE FUNCTION sys.sqlvariant_nchar(sys.SQL_VARIANT)
RETURNS sys.NCHAR
AS 'babelfishpg_common', 'sqlvariant2char'
LANGUAGE C VOLATILE STRICT PARALLEL SAFE;
CREATE CAST (sys.SQL_VARIANT AS CHAR)
WITH FUNCTION sys.sqlvariant_char (sys.SQL_VARIANT) AS ASSIGNMENT;
CREATE OR REPLACE FUNCTION sys.sqlvariant_bbfvarbinary(sys.SQL_VARIANT)
RETURNS sys.VARBINARY
AS 'babelfishpg_common', 'sqlvariant2bbfvarbinary'
LANGUAGE C VOLATILE STRICT PARALLEL SAFE;
CREATE CAST (sys.SQL_VARIANT AS sys.BBF_VARBINARY)
WITH FUNCTION sys.sqlvariant_bbfvarbinary (sys.SQL_VARIANT) AS ASSIGNMENT;
CREATE OR REPLACE FUNCTION sys.sqlvariant_bbfbinary(sys.SQL_VARIANT)
RETURNS sys.BINARY
AS 'babelfishpg_common', 'sqlvariant2bbfbinary'
LANGUAGE C VOLATILE STRICT PARALLEL SAFE;
CREATE CAST (sys.SQL_VARIANT AS sys.BBF_BINARY)
WITH FUNCTION sys.sqlvariant_bbfbinary (sys.SQL_VARIANT) AS ASSIGNMENT;
CREATE OR REPLACE FUNCTION sys.sqlvariant_uniqueidentifier(sys.SQL_VARIANT)
RETURNS sys.UNIQUEIDENTIFIER
AS 'babelfishpg_common', 'sqlvariant2uniqueidentifier'
LANGUAGE C VOLATILE STRICT PARALLEL SAFE;
CREATE CAST (sys.SQL_VARIANT AS sys.UNIQUEIDENTIFIER)
WITH FUNCTION sys.sqlvariant_uniqueidentifier (sys.SQL_VARIANT) AS ASSIGNMENT;
CREATE OR REPLACE FUNCTION sys.SQL_VARIANT_PROPERTY(sys.SQL_VARIANT, sys.VARCHAR(20))
RETURNS sys.SQL_VARIANT
AS 'babelfishpg_common', 'sql_variant_property'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE FUNCTION sys.sqlvarianteq(sys.SQL_VARIANT, sys.SQL_VARIANT)
RETURNS bool
AS 'babelfishpg_common', 'sqlvarianteq'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE FUNCTION sys.sqlvariantne(sys.SQL_VARIANT, sys.SQL_VARIANT)
RETURNS bool
AS 'babelfishpg_common', 'sqlvariantne'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE FUNCTION sys.sqlvariantlt(sys.SQL_VARIANT, sys.SQL_VARIANT)
RETURNS bool
AS 'babelfishpg_common', 'sqlvariantlt'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE FUNCTION sys.sqlvariantle(sys.SQL_VARIANT, sys.SQL_VARIANT)
RETURNS bool
AS 'babelfishpg_common', 'sqlvariantle'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE FUNCTION sys.sqlvariantgt(sys.SQL_VARIANT, sys.SQL_VARIANT)
RETURNS bool
AS 'babelfishpg_common', 'sqlvariantgt'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE FUNCTION sys.sqlvariantge(sys.SQL_VARIANT, sys.SQL_VARIANT)
RETURNS bool
AS 'babelfishpg_common', 'sqlvariantge'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE OPERATOR sys.= (
LEFTARG = sys.SQL_VARIANT,
RIGHTARG = sys.SQL_VARIANT,
COMMUTATOR = =,
NEGATOR = <>,
PROCEDURE = sys.sqlvarianteq,
RESTRICT = eqsel,
JOIN = eqjoinsel,
MERGES
);
CREATE OPERATOR sys.<> (
LEFTARG = sys.SQL_VARIANT,
RIGHTARG = sys.SQL_VARIANT,
NEGATOR = =,
COMMUTATOR = <>,
PROCEDURE = sys.sqlvariantne,
RESTRICT = neqsel,
JOIN = neqjoinsel
);
CREATE OPERATOR sys.< (
LEFTARG = sys.SQL_VARIANT,
RIGHTARG = sys.SQL_VARIANT,
NEGATOR = >=,
COMMUTATOR = >,
PROCEDURE = sys.sqlvariantlt,
RESTRICT = scalarltsel,
JOIN = scalarltjoinsel
);
CREATE OPERATOR sys.<= (
LEFTARG = sys.SQL_VARIANT,
RIGHTARG = sys.SQL_VARIANT,
NEGATOR = >,
COMMUTATOR = >=,
PROCEDURE = sys.sqlvariantle,
RESTRICT = scalarltsel,
JOIN = scalarltjoinsel
);
CREATE OPERATOR sys.> (
LEFTARG = sys.SQL_VARIANT,
RIGHTARG = sys.SQL_VARIANT,
NEGATOR = <=,
COMMUTATOR = <,
PROCEDURE = sys.sqlvariantgt,
RESTRICT = scalargtsel,
JOIN = scalargtjoinsel
);
CREATE OPERATOR sys.>= (
LEFTARG = sys.SQL_VARIANT,
RIGHTARG = sys.SQL_VARIANT,
NEGATOR = <,
COMMUTATOR = <=,
PROCEDURE = sys.sqlvariantge,
RESTRICT = scalargtsel,
JOIN = scalargtjoinsel
);
CREATE FUNCTION sqlvariant_cmp(sys.SQL_VARIANT, sys.SQL_VARIANT)
RETURNS INT4
AS 'babelfishpg_common', 'sqlvariant_cmp'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE FUNCTION sqlvariant_hash(sys.SQL_VARIANT)
RETURNS INT4
AS 'babelfishpg_common', 'sqlvariant_hash'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE OPERATOR CLASS sys.sqlvariant_ops
DEFAULT FOR TYPE sys.SQL_VARIANT USING btree AS
OPERATOR 1 < (sys.SQL_VARIANT, sys.SQL_VARIANT),
OPERATOR 2 <= (sys.SQL_VARIANT, sys.SQL_VARIANT),
OPERATOR 3 = (sys.SQL_VARIANT, sys.SQL_VARIANT),
OPERATOR 4 >= (sys.SQL_VARIANT, sys.SQL_VARIANT),
OPERATOR 5 > (sys.SQL_VARIANT, sys.SQL_VARIANT),
FUNCTION 1 sqlvariant_cmp(sys.SQL_VARIANT, sys.SQL_VARIANT);
CREATE OPERATOR CLASS sys.sqlvariant_ops
DEFAULT FOR TYPE sys.SQL_VARIANT USING hash AS
OPERATOR 1 = (sys.SQL_VARIANT, sys.SQL_VARIANT),
FUNCTION 1 sqlvariant_hash(sys.SQL_VARIANT);
-- 28 "sql/babelfishpg_common.in" 2
-- 1 "sql/string_operators.sql" 1
-- Wrap built-in CONCAT function to accept two text arguments.
-- This is necessary because CONCAT accepts arguments of type VARIADIC "any".
-- CONCAT also automatically handles NULL which || does not.
CREATE OR REPLACE FUNCTION sys.babelfish_concat_wrapper(leftarg text, rightarg text) RETURNS TEXT AS
$$
SELECT
CASE WHEN (current_setting('babelfishpg_tsql.concat_null_yields_null') = 'on') THEN
CASE
WHEN leftarg IS NULL OR rightarg IS NULL THEN NULL
ELSE CONCAT(leftarg, rightarg)
END
ELSE
CONCAT(leftarg, rightarg)
END
$$
LANGUAGE SQL VOLATILE;
-- Support strings for + operator.
CREATE OPERATOR sys.+ (
LEFTARG = text,
RIGHTARG = text,
FUNCTION = sys.babelfish_concat_wrapper
);
create or replace function sys.CHAR(x in int)returns char
AS
$body$
BEGIN
if x between 1 and 255 then
return chr(x);
else
return null;
end if;
END;
$body$
language plpgsql;
CREATE OR REPLACE FUNCTION sys.nchar(IN x INTEGER) RETURNS sys.nvarchar
AS
$body$
BEGIN
--- 1114111 is 0x10FFFF - max value permitted as specified by documentation
if x between 1 and 1114111 then
return(select chr(x))::sys.nvarchar;
else
return null;
end if;
END;
$body$
LANGUAGE plpgsql IMMUTABLE STRICT PARALLEL SAFE;
CREATE OR REPLACE FUNCTION sys.nchar(IN x varbinary) RETURNS sys.nvarchar
AS
$body$
BEGIN
--- 1114111 is 0x10FFFF - max value permitted as specified by documentation
if x::integer between 1 and 1114111 then
return(select chr(x::integer))::sys.nvarchar;
else
return null;
end if;
END;
$body$
LANGUAGE plpgsql IMMUTABLE STRICT PARALLEL SAFE;
-- 29 "sql/babelfishpg_common.in" 2
-- 1 "sql/coerce.sql" 1
-- Add Missing casting functions
-- Casting functions used in catalog should use the exact type of castsource and casttarget.
-- double precision -> int8
CREATE OR REPLACE FUNCTION sys.dtrunci8(double precision)
RETURNS INT8
AS 'babelfishpg_common', 'dtrunci8'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
-- double precision -> int4
CREATE OR REPLACE FUNCTION sys.dtrunci4(double precision)
RETURNS INT4
AS 'babelfishpg_common', 'dtrunci4'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
-- double precision -> int2
CREATE OR REPLACE FUNCTION sys.dtrunci2(double precision)
RETURNS INT2
AS 'babelfishpg_common', 'dtrunci2'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
-- real -> int8
CREATE OR REPLACE FUNCTION sys.ftrunci8(real)
RETURNS INT8
AS 'babelfishpg_common', 'ftrunci8'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
-- real -> int4
CREATE OR REPLACE FUNCTION sys.ftrunci4(real)
RETURNS INT4
AS 'babelfishpg_common', 'ftrunci4'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
-- real -> int2
CREATE OR REPLACE FUNCTION sys.ftrunci2(real)
RETURNS INT2
AS 'babelfishpg_common', 'ftrunci2'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
--- XXX: it is desriable to use SQL (or C) rather than plpgsql. But SQL function is not working
--- if tsql is enabled for some reasons. (BABEL-766)
-- fixeddecimal -> int8
CREATE OR REPLACE FUNCTION sys._round_fixeddecimal_to_int8(In arg sys.fixeddecimal)
RETURNS INT8 AS $$
BEGIN
RETURN CAST(round(arg) AS INT8);
END;
$$ LANGUAGE plpgsql;
-- fixeddecimal -> int8
CREATE OR REPLACE FUNCTION sys._round_fixeddecimal_to_int4(In arg sys.fixeddecimal)
RETURNS INT4 AS $$
BEGIN
RETURN CAST(round(arg) AS INT4);
END;
$$ LANGUAGE plpgsql;
-- fixeddecimal -> int8
CREATE OR REPLACE FUNCTION sys._round_fixeddecimal_to_int2(In arg sys.fixeddecimal)
RETURNS INT2 AS $$
BEGIN
RETURN CAST(round(arg) AS INT2);
END;
$$ LANGUAGE plpgsql;
-- numeric -> int8
CREATE OR REPLACE FUNCTION sys._trunc_numeric_to_int8(In arg numeric)
RETURNS INT8 AS $$
BEGIN
RETURN CAST(trunc(arg) AS INT8);
END;
$$ LANGUAGE plpgsql;
-- numeric -> int4
CREATE OR REPLACE FUNCTION sys._trunc_numeric_to_int4(In arg numeric)
RETURNS INT4 AS $$
BEGIN
RETURN CAST(trunc(arg) AS INT4);
END;
$$ LANGUAGE plpgsql;
-- numeric -> int2
CREATE OR REPLACE FUNCTION sys._trunc_numeric_to_int2(In arg numeric)
RETURNS INT2 AS $$
BEGIN
RETURN CAST(trunc(arg) AS INT2);
END;
$$ LANGUAGE plpgsql;
-- text -> fixeddecimal
CREATE FUNCTION sys.char_to_fixeddecimal(text)
RETURNS sys.FIXEDDECIMAL
AS 'babelfishpg_money', 'char_to_fixeddecimal'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
-- char -> fixeddecimal
CREATE FUNCTION sys.char_to_fixeddecimal(char)
RETURNS sys.FIXEDDECIMAL
AS 'babelfishpg_money', 'char_to_fixeddecimal'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE FUNCTION sys.char_to_fixeddecimal(sys.bpchar)
RETURNS sys.FIXEDDECIMAL
AS 'babelfishpg_money', 'char_to_fixeddecimal'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
-- varchar -> fixeddecimal
CREATE FUNCTION sys.char_to_fixeddecimal(sys.varchar)
RETURNS sys.FIXEDDECIMAL
AS 'babelfishpg_money', 'char_to_fixeddecimal'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE FUNCTION sys.char_to_fixeddecimal(pg_catalog.varchar)
RETURNS sys.FIXEDDECIMAL
AS 'babelfishpg_money', 'char_to_fixeddecimal'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
-- text -> name
CREATE FUNCTION sys.text_to_name(text)
RETURNS pg_catalog.name
AS 'babelfishpg_common', 'pltsql_text_name'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
-- bpchar -> name
CREATE FUNCTION sys.bpchar_to_name(pg_catalog.bpchar)
RETURNS pg_catalog.name
AS 'babelfishpg_common', 'pltsql_bpchar_name'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE FUNCTION sys.bpchar_to_name(sys.bpchar)
RETURNS pg_catalog.name
AS 'babelfishpg_common', 'pltsql_bpchar_name'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
-- varchar -> name
CREATE FUNCTION sys.varchar_to_name(sys.varchar)
RETURNS pg_catalog.name
AS 'babelfishpg_common', 'pltsql_text_name'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE FUNCTION sys.varchar_to_name(pg_catalog.varchar)
RETURNS pg_catalog.name
AS 'babelfishpg_common', 'pltsql_text_name'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
-- 30 "sql/babelfishpg_common.in" 2
-- 1 "sql/utils.sql" 1
CREATE OR REPLACE PROCEDURE sys.babel_type_initializer()
LANGUAGE C
AS 'babelfishpg_common', 'init_tcode_trans_tab';
CALL sys.babel_type_initializer();
DROP PROCEDURE sys.babel_type_initializer();
CREATE OR REPLACE FUNCTION sys.babelfish_typecode_list()
RETURNS table (
oid int,
pg_namespace text,
pg_typname text,
tsql_typname text,
type_family_priority smallint,
priority smallint,
sql_variant_hdr_size smallint
) AS 'babelfishpg_common', 'typecode_list' LANGUAGE C;
-- 32 "sql/babelfishpg_common.in" 2
SELECT set_config('search_path', trim(leading 'sys, ' from current_setting('search_path')), false);
RESET client_min_messages; | the_stack |
USE `hoj`;
/*
* 2021.08.07 修改OI题目得分在OI排行榜新计分字段 分数计算为:OI题目总得分*0.1+2*题目难度
*/
DROP PROCEDURE
IF EXISTS judge_Add_oi_rank_score;
DELIMITER $$
CREATE PROCEDURE judge_Add_oi_rank_score ()
BEGIN
IF NOT EXISTS (
SELECT
1
FROM
information_schema.`COLUMNS`
WHERE
table_name = 'judge'
AND column_name = 'oi_rank'
) THEN
ALTER TABLE judge ADD COLUMN oi_rank INT(11) NULL COMMENT '该题在OI排行榜的分数';
END
IF ; END$$
DELIMITER ;
CALL judge_Add_oi_rank_score ;
DROP PROCEDURE judge_Add_oi_rank_score;
/*
* 2021.08.08 增加vjudge_submit_id在vjudge判题获取提交id后存储,当等待结果超时,下次重判时可用该提交id直接获取结果。
同时vjudge_username、vjudge_password分别记录提交账号密码
*/
DROP PROCEDURE
IF EXISTS judge_Add_vjudge_submit_id;
DELIMITER $$
CREATE PROCEDURE judge_Add_vjudge_submit_id ()
BEGIN
IF NOT EXISTS (
SELECT
1
FROM
information_schema.`COLUMNS`
WHERE
table_name = 'judge'
AND column_name = 'vjudge_submit_id'
) THEN
ALTER TABLE judge ADD COLUMN vjudge_submit_id BIGINT UNSIGNED NULL COMMENT 'vjudge判题在其它oj的提交id';
ALTER TABLE judge ADD COLUMN vjudge_username VARCHAR(255) NULL COMMENT 'vjudge判题在其它oj的提交用户名';
ALTER TABLE judge ADD COLUMN vjudge_password VARCHAR(255) NULL COMMENT 'vjudge判题在其它oj的提交账号密码';
END
IF ; END$$
DELIMITER ;
CALL judge_Add_vjudge_submit_id ;
DROP PROCEDURE judge_Add_vjudge_submit_id;
/*
* 2021.09.21 比赛增加打印、账号限制的功能,增大真实姓名长度
*/
DROP PROCEDURE
IF EXISTS contest_Add_print_and_limit;
DELIMITER $$
CREATE PROCEDURE contest_Add_print_and_limit ()
BEGIN
IF NOT EXISTS (
SELECT
1
FROM
information_schema.`COLUMNS`
WHERE
table_name = 'contest'
AND column_name = 'open_print'
) THEN
ALTER TABLE contest ADD COLUMN open_print tinyint(1) DEFAULT '0' COMMENT '是否打开打印功能';
ALTER TABLE contest ADD COLUMN open_account_limit tinyint(1) DEFAULT '0' COMMENT '是否开启账号限制';
ALTER TABLE contest ADD COLUMN account_limit_rule mediumtext COMMENT '账号限制规则';
ALTER TABLE `hoj`.`user_info` CHANGE `realname` `realname` VARCHAR(100) CHARSET utf8 COLLATE utf8_general_ci NULL COMMENT '真实姓名';
END
IF ; END$$
DELIMITER ;
CALL contest_Add_print_and_limit ;
DROP PROCEDURE contest_Add_print_and_limit;
DROP PROCEDURE
IF EXISTS Add_contest_print;
DELIMITER $$
CREATE PROCEDURE Add_contest_print ()
BEGIN
IF NOT EXISTS (
SELECT
1
FROM
information_schema.`COLUMNS`
WHERE
table_name = 'contest_print'
) THEN
CREATE TABLE `contest_print` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`username` varchar(100) DEFAULT NULL,
`realname` varchar(100) DEFAULT NULL,
`cid` bigint(20) unsigned DEFAULT NULL,
`content` longtext NOT NULL,
`status` int(11) DEFAULT '0',
`gmt_create` datetime DEFAULT CURRENT_TIMESTAMP,
`gmt_modified` datetime DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
KEY `cid` (`cid`),
KEY `username` (`username`),
CONSTRAINT `contest_print_ibfk_1` FOREIGN KEY (`cid`) REFERENCES `contest` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `contest_print_ibfk_2` FOREIGN KEY (`username`) REFERENCES `user_info` (`username`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
END
IF ; END$$
DELIMITER ;
CALL Add_contest_print ;
DROP PROCEDURE Add_contest_print;
/*
* 2021.10.04 增加站内消息系统,包括评论我的、收到的赞、回复我的、系统通知、我的消息五个模块
*/
DROP PROCEDURE
IF EXISTS Add_msg_table;
DELIMITER $$
CREATE PROCEDURE Add_msg_table ()
BEGIN
IF NOT EXISTS (
SELECT
1
FROM
information_schema.`COLUMNS`
WHERE
table_name = 'msg_remind'
) THEN
CREATE TABLE `admin_sys_notice` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`title` varchar(255) DEFAULT NULL COMMENT '标题',
`content` longtext COMMENT '内容',
`type` varchar(255) DEFAULT NULL COMMENT '发给哪些用户类型',
`state` tinyint(1) DEFAULT '0' COMMENT '是否已拉取给用户',
`recipient_id` varchar(32) DEFAULT NULL COMMENT '接受通知的用户id',
`admin_id` varchar(32) DEFAULT NULL COMMENT '发送通知的管理员id',
`gmt_create` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`gmt_modified` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
PRIMARY KEY (`id`),
KEY `recipient_id` (`recipient_id`),
KEY `admin_id` (`admin_id`),
CONSTRAINT `admin_sys_notice_ibfk_1` FOREIGN KEY (`recipient_id`) REFERENCES `user_info` (`uuid`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `admin_sys_notice_ibfk_2` FOREIGN KEY (`admin_id`) REFERENCES `user_info` (`uuid`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `msg_remind` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`action` varchar(255) NOT NULL COMMENT '动作类型,如点赞讨论帖Like_Post、点赞评论Like_Discuss、评论Discuss、回复Reply等',
`source_id` int(10) unsigned DEFAULT NULL COMMENT '消息来源id,讨论id或比赛id',
`source_type` varchar(255) DEFAULT NULL COMMENT '事件源类型:''Discussion''、''Contest''等',
`source_content` varchar(255) DEFAULT NULL COMMENT '事件源的内容,比如回复的内容,评论的帖子标题等等',
`quote_id` int(10) unsigned DEFAULT NULL COMMENT '事件引用上一级评论或回复id',
`quote_type` varchar(255) DEFAULT NULL COMMENT '事件引用上一级的类型:Comment、Reply',
`url` varchar(255) DEFAULT NULL COMMENT '事件所发生的地点链接 url',
`state` tinyint(1) DEFAULT '0' COMMENT '是否已读',
`sender_id` varchar(32) DEFAULT NULL COMMENT '操作者的id',
`recipient_id` varchar(32) DEFAULT NULL COMMENT '接受消息的用户id',
`gmt_create` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`gmt_modified` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
PRIMARY KEY (`id`),
KEY `sender_id` (`sender_id`),
KEY `recipient_id` (`recipient_id`),
CONSTRAINT `msg_remind_ibfk_1` FOREIGN KEY (`sender_id`) REFERENCES `user_info` (`uuid`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `msg_remind_ibfk_2` FOREIGN KEY (`recipient_id`) REFERENCES `user_info` (`uuid`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `user_sys_notice` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`sys_notice_id` bigint(20) unsigned DEFAULT NULL COMMENT '系统通知的id',
`recipient_id` varchar(32) DEFAULT NULL COMMENT '接受通知的用户id',
`type` varchar(255) DEFAULT NULL COMMENT '消息类型,系统通知sys、我的信息mine',
`state` tinyint(1) DEFAULT '0' COMMENT '是否已读',
`gmt_create` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '读取时间',
`gmt_modified` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
KEY `sys_notice_id` (`sys_notice_id`),
KEY `recipient_id` (`recipient_id`),
CONSTRAINT `user_sys_notice_ibfk_1` FOREIGN KEY (`sys_notice_id`) REFERENCES `admin_sys_notice` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `user_sys_notice_ibfk_2` FOREIGN KEY (`recipient_id`) REFERENCES `user_info` (`uuid`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
END
IF ; END$$
DELIMITER ;
CALL Add_msg_table;
DROP PROCEDURE Add_msg_table;
/*
* 2021.10.06 user_info增加性别列gender 比赛榜单用户名称显示可选
*/
DROP PROCEDURE
IF EXISTS user_info_Add_gender;
DELIMITER $$
CREATE PROCEDURE user_info_Add_gender ()
BEGIN
IF NOT EXISTS (
SELECT
1
FROM
information_schema.`COLUMNS`
WHERE
table_name = 'user_info'
AND column_name = 'gender'
) THEN
ALTER TABLE user_info ADD COLUMN gender varchar(20) DEFAULT 'secrecy' NOT NULL COMMENT '性别';
END
IF ; END$$
DELIMITER ;
CALL user_info_Add_gender ;
DROP PROCEDURE user_info_Add_gender;
DROP PROCEDURE
IF EXISTS contest_Add_rank_show_name;
DELIMITER $$
CREATE PROCEDURE contest_Add_rank_show_name ()
BEGIN
IF NOT EXISTS (
SELECT
1
FROM
information_schema.`COLUMNS`
WHERE
table_name = 'contest'
AND column_name = 'rank_show_name'
) THEN
ALTER TABLE contest ADD COLUMN rank_show_name varchar(20) DEFAULT 'username' COMMENT '排行榜显示(username、nickname、realname)';
END
IF ; END$$
DELIMITER ;
CALL contest_Add_rank_show_name ;
DROP PROCEDURE contest_Add_rank_show_name;
/*
* 2021.10.08 user_info增加性别列gender 比赛榜单用户名称显示可选
*/
DROP PROCEDURE
IF EXISTS contest_problem_Add_color;
DELIMITER $$
CREATE PROCEDURE contest_problem_Add_color ()
BEGIN
IF NOT EXISTS (
SELECT
1
FROM
information_schema.`COLUMNS`
WHERE
table_name = 'contest_problem'
AND column_name = 'color'
) THEN
ALTER TABLE contest_problem ADD COLUMN `color` VARCHAR(255) NULL COMMENT '气球颜色';
ALTER TABLE user_info ADD COLUMN `title_name` VARCHAR(255) NULL COMMENT '头衔、称号';
ALTER TABLE user_info ADD COLUMN `title_color` VARCHAR(255) NULL COMMENT '头衔、称号的颜色';
END
IF ; END$$
DELIMITER ;
CALL contest_problem_Add_color ;
DROP PROCEDURE contest_problem_Add_color;
/*
* 2021.11.17 judge_server增加cf_submittable控制单台判题机只能一个账号提交CF
*/
DROP PROCEDURE
IF EXISTS judge_server_Add_cf_submittable;
DELIMITER $$
CREATE PROCEDURE judge_serverm_Add_cf_submittable ()
BEGIN
IF NOT EXISTS (
SELECT
1
FROM
information_schema.`COLUMNS`
WHERE
table_name = 'judge_server'
AND column_name = 'cf_submittable'
) THEN
ALTER TABLE `hoj`.`judge_server` ADD COLUMN `cf_submittable` BOOLEAN DEFAULT 1 NULL COMMENT '是否可提交CF';
END
IF ; END$$
DELIMITER ;
CALL judge_serverm_Add_cf_submittable ;
DROP PROCEDURE judge_serverm_Add_cf_submittable;
/*
* 2021.11.29 增加训练模块
*/
DROP PROCEDURE
IF EXISTS Add_training_table;
DELIMITER $$
CREATE PROCEDURE Add_training_table ()
BEGIN
IF NOT EXISTS (
SELECT
1
FROM
information_schema.`COLUMNS`
WHERE
table_name = 'training'
) THEN
CREATE TABLE `training` (
`id` bigint unsigned NOT NULL AUTO_INCREMENT,
`title` varchar(255) DEFAULT NULL COMMENT '训练题单名称',
`description` longtext COMMENT '训练题单简介',
`author` varchar(255) NOT NULL COMMENT '训练题单创建者用户名',
`auth` varchar(255) NOT NULL COMMENT '训练题单权限类型:Public、Private',
`private_pwd` varchar(255) DEFAULT NULL COMMENT '训练题单权限为Private时的密码',
`rank` int DEFAULT '0' COMMENT '编号,升序',
`status` tinyint(1) DEFAULT '1' COMMENT '是否可用',
`gmt_create` datetime DEFAULT CURRENT_TIMESTAMP,
`gmt_modified` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `training_category` (
`id` bigint unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(255) DEFAULT NULL,
`color` varchar(255) DEFAULT NULL,
`gmt_create` datetime DEFAULT CURRENT_TIMESTAMP,
`gmt_modified` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `training_problem` (
`id` bigint unsigned NOT NULL AUTO_INCREMENT,
`tid` bigint unsigned NOT NULL COMMENT '训练id',
`pid` bigint unsigned NOT NULL COMMENT '题目id',
`rank` int DEFAULT '0',
`display_id` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
`gmt_create` datetime DEFAULT CURRENT_TIMESTAMP,
`gmt_modified` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
KEY `tid` (`tid`),
KEY `pid` (`pid`),
KEY `display_id` (`display_id`),
CONSTRAINT `training_problem_ibfk_1` FOREIGN KEY (`tid`) REFERENCES `training` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `training_problem_ibfk_2` FOREIGN KEY (`pid`) REFERENCES `problem` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `training_problem_ibfk_3` FOREIGN KEY (`display_id`) REFERENCES `problem` (`problem_id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `training_record` (
`id` bigint unsigned NOT NULL AUTO_INCREMENT,
`tid` bigint unsigned NOT NULL,
`tpid` bigint unsigned NOT NULL,
`pid` bigint unsigned NOT NULL,
`uid` varchar(255) NOT NULL,
`submit_id` bigint unsigned NOT NULL,
`gmt_create` datetime DEFAULT CURRENT_TIMESTAMP,
`gmt_modified` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
KEY `tid` (`tid`),
KEY `tpid` (`tpid`),
KEY `pid` (`pid`),
KEY `uid` (`uid`),
KEY `submit_id` (`submit_id`),
CONSTRAINT `training_record_ibfk_1` FOREIGN KEY (`tid`) REFERENCES `training` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `training_record_ibfk_2` FOREIGN KEY (`tpid`) REFERENCES `training_problem` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `training_record_ibfk_3` FOREIGN KEY (`pid`) REFERENCES `problem` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `training_record_ibfk_4` FOREIGN KEY (`uid`) REFERENCES `user_info` (`uuid`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `training_record_ibfk_5` FOREIGN KEY (`submit_id`) REFERENCES `judge` (`submit_id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `training_register` (
`id` bigint unsigned NOT NULL AUTO_INCREMENT,
`tid` bigint unsigned NOT NULL COMMENT '训练id',
`uid` varchar(255) NOT NULL COMMENT '用户id',
`status` tinyint(1) DEFAULT '1' COMMENT '是否可用',
`gmt_create` datetime DEFAULT CURRENT_TIMESTAMP,
`gmt_modified` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
KEY `tid` (`tid`),
KEY `uid` (`uid`),
CONSTRAINT `training_register_ibfk_1` FOREIGN KEY (`tid`) REFERENCES `training` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `training_register_ibfk_2` FOREIGN KEY (`uid`) REFERENCES `user_info` (`uuid`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `mapping_training_category` (
`id` bigint unsigned NOT NULL AUTO_INCREMENT,
`tid` bigint unsigned NOT NULL,
`cid` bigint unsigned NOT NULL,
`gmt_create` datetime DEFAULT CURRENT_TIMESTAMP,
`gmt_modified` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
KEY `tid` (`tid`),
KEY `cid` (`cid`),
CONSTRAINT `mapping_training_category_ibfk_1` FOREIGN KEY (`tid`) REFERENCES `training` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `mapping_training_category_ibfk_2` FOREIGN KEY (`cid`) REFERENCES `training_category` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
ALTER TABLE `hoj`.`judge` ADD COLUMN `tid` BIGINT UNSIGNED NULL AFTER `cpid`,
ADD FOREIGN KEY (`tid`) REFERENCES `hoj`.`training`(`id`) ON UPDATE CASCADE ON DELETE CASCADE;
END
IF ; END$$
DELIMITER ;
CALL Add_training_table;
DROP PROCEDURE Add_training_table;
/*
* 2021.12.05 contest增加auto_real_rank比赛结束是否自动解除封榜,自动转换成真实榜单
*/
DROP PROCEDURE
IF EXISTS contest_Add_auto_real_rank;
DELIMITER $$
CREATE PROCEDURE contest_Add_auto_real_rank()
BEGIN
IF NOT EXISTS (
SELECT
1
FROM
information_schema.`COLUMNS`
WHERE
table_name = 'contest'
AND column_name = 'auto_real_rank'
) THEN
ALTER TABLE `hoj`.`contest` ADD COLUMN `auto_real_rank` BOOLEAN DEFAULT 1 NULL COMMENT '比赛结束是否自动解除封榜,自动转换成真实榜单';
DROP TABLE `hoj`.`training_problem`;
DROP TABLE `hoj`.`training_record`;
CREATE TABLE `training_problem` (
`id` bigint unsigned NOT NULL AUTO_INCREMENT,
`tid` bigint unsigned NOT NULL COMMENT '训练id',
`pid` bigint unsigned NOT NULL COMMENT '题目id',
`rank` int DEFAULT '0',
`display_id` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
`gmt_create` datetime DEFAULT CURRENT_TIMESTAMP,
`gmt_modified` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
KEY `tid` (`tid`),
KEY `pid` (`pid`),
KEY `display_id` (`display_id`),
CONSTRAINT `training_problem_ibfk_1` FOREIGN KEY (`tid`) REFERENCES `training` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `training_problem_ibfk_2` FOREIGN KEY (`pid`) REFERENCES `problem` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `training_problem_ibfk_3` FOREIGN KEY (`display_id`) REFERENCES `problem` (`problem_id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `training_record` (
`id` bigint unsigned NOT NULL AUTO_INCREMENT,
`tid` bigint unsigned NOT NULL,
`tpid` bigint unsigned NOT NULL,
`pid` bigint unsigned NOT NULL,
`uid` varchar(255) NOT NULL,
`submit_id` bigint unsigned NOT NULL,
`gmt_create` datetime DEFAULT CURRENT_TIMESTAMP,
`gmt_modified` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
KEY `tid` (`tid`),
KEY `tpid` (`tpid`),
KEY `pid` (`pid`),
KEY `uid` (`uid`),
KEY `submit_id` (`submit_id`),
CONSTRAINT `training_record_ibfk_1` FOREIGN KEY (`tid`) REFERENCES `training` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `training_record_ibfk_2` FOREIGN KEY (`tpid`) REFERENCES `training_problem` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `training_record_ibfk_3` FOREIGN KEY (`pid`) REFERENCES `problem` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `training_record_ibfk_4` FOREIGN KEY (`uid`) REFERENCES `user_info` (`uuid`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `training_record_ibfk_5` FOREIGN KEY (`submit_id`) REFERENCES `judge` (`submit_id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
END
IF ; END$$
DELIMITER ;
CALL contest_Add_auto_real_rank;
DROP PROCEDURE contest_Add_auto_real_rank;
/*
* 2021.12.07 contest增加打星账号列表、是否开放榜单
*/
DROP PROCEDURE
IF EXISTS contest_Add_star_account_And_open_rank;
DELIMITER $$
CREATE PROCEDURE contest_Add_star_account_And_open_rank ()
BEGIN
IF NOT EXISTS (
SELECT
1
FROM
information_schema.`COLUMNS`
WHERE
table_name = 'contest'
AND column_name = 'star_account'
) THEN
ALTER TABLE `hoj`.`contest` ADD COLUMN `star_account` mediumtext COMMENT '打星用户列表';
ALTER TABLE `hoj`.`contest` ADD COLUMN `open_rank` BOOLEAN DEFAULT 0 NULL COMMENT '是否开放比赛榜单';
END
IF ; END$$
DELIMITER ;
CALL contest_Add_star_account_And_open_rank ;
DROP PROCEDURE contest_Add_star_account_And_open_rank;
/*
* 2021.12.19 judge表删除tid
*/
DROP PROCEDURE
IF EXISTS judge_Delete_tid;
DELIMITER $$
CREATE PROCEDURE judge_Delete_tid ()
BEGIN
IF EXISTS (
SELECT
1
FROM
information_schema.`COLUMNS`
WHERE
table_name = 'judge'
AND column_name = 'tid'
) THEN
ALTER TABLE `hoj`.`judge` DROP foreign key `judge_ibfk_4`;
ALTER TABLE `hoj`.`judge` DROP COLUMN `tid`;
END
IF ; END$$
DELIMITER ;
CALL judge_Delete_tid ;
DROP PROCEDURE judge_Delete_tid; | the_stack |
--1. Update latest_update field to new date
DO $_$
BEGIN
PERFORM VOCABULARY_PACK.SetLatestUpdate(
pVocabularyName => 'CIEL',
pVocabularyDate => (SELECT vocabulary_date FROM sources.ciel_concept_class LIMIT 1),
pVocabularyVersion => (SELECT vocabulary_version FROM sources.ciel_concept_class LIMIT 1),
pVocabularyDevSchema => 'DEV_CIEL'
);
END $_$;
--2. Truncate all working tables
TRUNCATE TABLE concept_stage;
TRUNCATE TABLE concept_relationship_stage;
TRUNCATE TABLE concept_synonym_stage;
TRUNCATE TABLE pack_content_stage;
TRUNCATE TABLE drug_strength_stage;
--3. Load into concept_stage
INSERT INTO concept_stage (
concept_name,
domain_id,
vocabulary_id,
concept_class_id,
standard_concept,
concept_code,
valid_start_date,
valid_end_date,
invalid_reason
)
SELECT DISTINCT COALESCE(FIRST_VALUE(cn.ciel_name) OVER (
PARTITION BY c.concept_id ORDER BY CASE
WHEN LENGTH(cn.ciel_name) <= 255
THEN LENGTH(cn.ciel_name)
ELSE 0
END DESC,
LENGTH(cn.ciel_name)
), 'Concept ' || c.concept_id /*for strange reason we have 4 concepts without concept_name*/) AS concept_name,
CASE ccl.ciel_name
WHEN 'Test'
THEN 'Measurement'
WHEN 'Procedure'
THEN 'Procedure'
WHEN 'Drug'
THEN 'Drug'
WHEN 'Diagnosis'
THEN 'Condition'
WHEN 'Finding'
THEN 'Condition'
WHEN 'Anatomy'
THEN 'Spec Anatomic Site'
WHEN 'Question'
THEN 'Observation'
WHEN 'LabSet'
THEN 'Measurement'
WHEN 'MedSet'
THEN 'Drug'
WHEN 'ConvSet'
THEN 'Observation'
WHEN 'Misc'
THEN 'Observation'
WHEN 'Symptom'
THEN 'Condition'
WHEN 'Symptom/Finding'
THEN 'Condition'
WHEN 'Specimen'
THEN 'Specimen'
WHEN 'Misc Order'
THEN 'Observation'
WHEN 'Workflow'
THEN 'Observation' -- no concepts of this class in table
WHEN 'State'
THEN 'Observation'
WHEN 'Program'
THEN 'Observation'
WHEN 'Aggregate Measurement'
THEN 'Measurement'
WHEN 'Indicator'
THEN 'Observation' -- no concepts of this class in table
WHEN 'Health Care Monitoring Topics'
THEN 'Observation' -- no concepts of this class in table
WHEN 'Radiology/Imaging Procedure'
THEN 'Procedure' -- there are LOINC codes which are Measurement, but results are not connected
WHEN 'Frequency'
THEN 'Observation' -- this is SIG in CDM, which is not normalized today
WHEN 'Pharmacologic Drug Class'
THEN 'Drug'
WHEN 'Units of Measure'
THEN 'Unit'
WHEN 'Organism'
THEN 'Observation'
WHEN 'Drug form'
THEN 'Drug'
WHEN 'Medical supply'
THEN 'Device'
-- begin change M. Kallfelz 2021-05-06
WHEN 'InteractSet' -- Set of drugs that interact with parent drug.
THEN 'Drug'
-- end change M. Kallfelz 2021-05-06
END AS domain_id,
'CIEL' AS vocabulary_id,
CASE ccl.ciel_name -- shorten the ones that won't fit the 20 char limit
WHEN 'Aggregate Measurement'
THEN 'Aggregate Meas'
WHEN 'Health Care Monitoring Topics'
THEN 'Monitoring' -- no concepts of this class in table
WHEN 'Radiology/Imaging Procedure'
THEN 'Radiology' -- there are LOINC codes which are Measurement, but results are not connected
WHEN 'Pharmacologic Drug Class'
THEN 'Drug Class'
-- begin change M. Kallfelz 2021-05-06
WHEN 'InteractSet' -- Set of drugs that interact with parent drug.
THEN 'Drug Class' -- Class 'Drug Interaction' is not suitable and not in use
-- end change M. Kallfelz 2021-05-06
ELSE ccl.ciel_name
END AS concept_class_id,
NULL AS standard_concept,
c.concept_id AS concept_code,
COALESCE(c.date_created, TO_DATE('19700101', 'yyyymmdd')) AS valid_start_date,
CASE c.retired
WHEN 0
THEN TO_DATE('20991231', 'yyyymmdd')
ELSE (
SELECT latest_update
FROM vocabulary
WHERE vocabulary_id = 'CIEL'
)
END AS valid_end_date,
CASE c.retired
WHEN 0
THEN NULL
ELSE 'D' -- we might change that.
END AS invalid_reason
FROM sources.ciel_concept c
LEFT JOIN sources.ciel_concept_class ccl ON ccl.concept_class_id = c.class_id
LEFT JOIN sources.ciel_concept_name cn ON cn.concept_id = c.concept_id
AND cn.locale = 'en';
-- begin addition M. Kallfelz 2021-05-06
--4. Add synonyms to concept_synonym_stage by language
--SELECT DISTINCT ON (locale) * FROM ciel_concept_name
-- WHERE voided = 0;
-- am = Amharic => no OMOP language
-- bn = Bengali, Bangla => no OMOP language
-- en
-- es = Spanish, Castilian => 4182511
-- fr = French => 4180190
-- ht = Haitian => no OMOP language
-- in = Indonesian (ISO code is id!) => no OMOP language
-- it = Italian => 4182507
-- nl = Dutch => 4182503
-- om = Oromo => no OMOP language
-- pt = Portuguese => 4181536
-- ru = Russian => no OMOP language
-- rw = Kinyarwanda => no OMOP language
-- sw = Swahili => no OMOP language
-- ti = Tigrinya => no OMOP language
-- ur = Urdu => no OMOP language
-- vi = Vietnamese => no OMOP language
INSERT INTO concept_synonym_stage (
synonym_name,
synonym_concept_code,
synonym_vocabulary_id,
language_concept_id
)
SELECT cn.ciel_name AS synonym_name,
cn.concept_id AS synonym_concept_code,
'CIEL' AS synonym_vocabulary_id,
CASE cn.locale
WHEN 'es'
THEN 4182511
WHEN 'fr'
THEN 4180190
WHEN 'it'
THEN 4182507
WHEN 'nl'
THEN 4182503
WHEN 'pt'
THEN 4181536
END AS language_concept_id
FROM sources.ciel_concept_name AS cn
WHERE cn.locale IN (
'es',
'fr',
'it',
'nl',
'pt'
);-- no other OMOP languages match the locale
-- end addition M. Kallfelz 2021-05-06
--5. Create chain between CIEL and the best OMOP concept and create map
DROP TABLE IF EXISTS ciel_to_concept_map;
CREATE UNLOGGED TABLE ciel_to_concept_map AS
WITH RECURSIVE hierarchy_concepts AS (
SELECT concept_name_1,
concept_code_1,
vocabulary_id_1,
concept_name_2,
concept_code_2,
vocabulary_id_2,
concept_name_1 AS root_concept_name_1,
concept_code_1 AS root_concept_code_1,
vocabulary_id_1 AS root_vocabulary_id_1,
ARRAY [ROW (concept_code_2, vocabulary_id_2)] AS nocycle,
ARRAY [vocabulary_id_2||'-'||concept_code_2] AS path
FROM r
WHERE vocabulary_id_1 = 'CIEL' --start with the CIELs
UNION ALL
SELECT r.concept_name_1,
r.concept_code_1,
r.vocabulary_id_1,
r.concept_name_2,
r.concept_code_2,
r.vocabulary_id_2,
root_concept_name_1,
root_concept_code_1,
root_vocabulary_id_1,
hc.nocycle || ROW(r.concept_code_2, r.vocabulary_id_2) AS nocycle,
hc.path || (r.vocabulary_id_2 || '-' || r.concept_code_2) AS path
FROM r
JOIN hierarchy_concepts hc ON hc.concept_code_2 = r.concept_code_1
AND devv5.INSTR(hc.vocabulary_id_2, r.vocabulary_id_1) > 0
-- nocycle shouldn't be necessary, but for some reason it won't do it without, even though I can't find a loop
-- The logic is to thread them up by matching the ending concept_code to the beginning of the next relationship, and to make sure the vocabulary of the next fits into the previous one
WHERE ROW(r.concept_code_2, r.vocabulary_id_2) <> ALL (nocycle) --excluding loops
),
r AS (
-- create connections between CIEL and RxNorm/SNOMED, and then from SNOMED to RxNorm Ingredient and from RxNorm MIN to RxNorm Ingredient
SELECT COALESCE(FIRST_VALUE(cn.ciel_name) OVER (
PARTITION BY c.concept_id ORDER BY CASE
WHEN LENGTH(cn.ciel_name) <= 255
THEN LENGTH(cn.ciel_name)
ELSE 0
END DESC,
LENGTH(cn.ciel_name)
), 'Concept ' || c.concept_id /*for strange reason we have 4 concepts without concept_name*/) AS concept_name_1,
c.concept_id::TEXT AS concept_code_1,
'CIEL' AS vocabulary_id_1,
'' AS concept_name_2,
crt.ciel_code AS concept_code_2,
CASE crs.ciel_name
-- The name of the vocabularies is composed of the OMOP vocabulary_id, and the suffix '-c' for "chained" and the number of precedence it should be used (ordered by in a partition statement)
WHEN 'SNOMED CT'
THEN 'SNOMED-c1'
WHEN 'SNOMED NP'
THEN 'SNOMED-c2'
WHEN 'SNOMED US'
THEN 'SNOMED-c3'
WHEN 'RxNORM'
THEN 'RxNorm-c'
WHEN 'ICD-10-WHO'
THEN 'XICD10-c1' -- X so it will be ordered by after SNOMED
WHEN 'ICD-10-WHO 2nd'
THEN 'XICD10-c2'
WHEN 'ICD-10-WHO NP'
THEN 'XICD10-c3'
WHEN 'ICD-10-WHO NP2'
THEN 'XICD10-c4'
WHEN 'NDF-RT NUI'
THEN 'NDFRT-c'
ELSE NULL
END AS vocabulary_id_2
FROM sources.ciel_concept c
JOIN sources.ciel_concept_class ccl ON ccl.concept_class_id = c.class_id
JOIN sources.ciel_concept_name cn ON cn.concept_id = c.concept_id
AND cn.locale = 'en'
JOIN sources.ciel_concept_reference_map crm ON crm.concept_id = c.concept_id
JOIN sources.ciel_concept_reference_term crt ON crt.concept_reference_term_id = crm.concept_reference_term_id
JOIN sources.ciel_concept_reference_source crs ON crs.concept_source_id = crt.concept_source_id
WHERE crt.retired = 0
AND crs.ciel_name IN (
'RxNORM',
'SNOMED CT',
'SNOMED NP',
'ICD-10-WHO',
'ICD-10-WHO NP',
'ICD-10-WHO 2nd',
'ICD-10-WHO NP2',
'SNOMED US',
'NDF-RT NUI'
)
UNION
-- resolve RxNorm MIN to RxNorm IN (not currently in Vocabularies)
SELECT DISTINCT FIRST_VALUE(rx_min.str) OVER (
PARTITION BY rx_min.rxcui ORDER BY CASE
WHEN LENGTH(rx_min.str) <= 255
THEN LENGTH(rx_min.str)
ELSE 0
END DESC,
LENGTH(rx_min.str)
) AS concept_name_1,
rx_min.rxcui AS concept_code_1,
'RxNorm-c' AS vocabulary_id_1,
FIRST_VALUE(ing.str) OVER (
PARTITION BY ing.rxcui ORDER BY CASE
WHEN LENGTH(ing.str) <= 255
THEN LENGTH(ing.str)
ELSE 0
END DESC,
LENGTH(ing.str)
) AS concept_name_2,
ing.rxcui AS concept_code_2,
'RxNorm-c' AS vocabulary_id_2
FROM sources.rxnconso rx_min
JOIN sources.rxnrel r ON r.rxcui1 = rx_min.rxcui
JOIN sources.rxnconso ing ON ing.rxcui = r.rxcui2
AND ing.sab = 'RXNORM'
AND ing.tty = 'IN'
WHERE rx_min.sab = 'RXNORM'
AND rx_min.tty = 'MIN'
UNION
-- add concept_relationships between SNOMED and RxNorm
SELECT c1.concept_name AS concept_name_1,
c1.concept_code AS concept_code_1,
c1.vocabulary_id || '-c' AS vocabulary_id_1,
c2.concept_name AS concept_name_2,
c2.concept_code AS concept_code_2,
c2.vocabulary_id || '-c' AS vocabulary_id_2
FROM concept c1
JOIN concept_relationship r ON r.concept_id_1 = c1.concept_id
JOIN concept c2 ON c2.concept_id = r.concept_id_2
WHERE r.invalid_reason IS NULL
AND c1.vocabulary_id = 'SNOMED'
AND c2.vocabulary_id = 'RxNorm'
AND r.relationship_id = 'Maps to'
UNION
-- add concept_relationships between NDFRT and RxNorm
SELECT c1.concept_name AS concept_name_1,
c1.concept_code AS concept_code_1,
c1.vocabulary_id || '-c' AS vocabulary_id_1,
c2.concept_name AS concept_name_2,
c2.concept_code AS concept_code_2,
c2.vocabulary_id || '-c' AS vocabulary_id_2
FROM concept c1
JOIN concept_relationship r ON r.concept_id_1 = c1.concept_id
JOIN concept c2 ON c2.concept_id = r.concept_id_2
WHERE r.invalid_reason IS NULL
AND c1.vocabulary_id = 'NDFRT'
AND c2.vocabulary_id = 'RxNorm'
AND r.relationship_id = 'NDFRT - RxNorm eq'
UNION
-- add concept_relationships within SNOMED to decomponse multiple ingredients and map from procedure to drug
SELECT c1.concept_name AS concept_name_1,
c1.concept_code AS concept_code_1,
c1.vocabulary_id || '-c' AS vocabulary_id_1,
c2.concept_name AS concept_name_2,
c2.concept_code AS concept_code_2,
c2.vocabulary_id || '-c' AS vocabulary_id_2
FROM concept c1
JOIN concept_relationship r ON r.concept_id_1 = c1.concept_id
JOIN concept c2 ON c2.concept_id = r.concept_id_2
WHERE r.invalid_reason IS NULL
AND c1.vocabulary_id = 'SNOMED'
AND c2.vocabulary_id = 'SNOMED'
AND r.relationship_id IN (
'Has active ing',
'Has dir subst'
)
UNION
-- add concept_relationships within RxNorm from Ingredient to Ingredient
SELECT c1.concept_name AS concept_name_1,
c1.concept_code AS concept_code_1,
c1.vocabulary_id || '-c' AS vocabulary_id_1,
c2.concept_name AS concept_name_2,
c2.concept_code AS concept_code_2,
c2.vocabulary_id || '-c' AS vocabulary_id_2
FROM concept c1
JOIN concept_relationship r ON r.concept_id_1 = c1.concept_id
JOIN concept c2 ON c2.concept_id = r.concept_id_2
WHERE r.invalid_reason IS NULL
AND c1.vocabulary_id = 'RxNorm'
AND c2.vocabulary_id = 'RxNorm'
AND r.relationship_id = 'Form of'
UNION
-- connect deprecated RxNorm ingredients to fresh ones by first word in concept_name
SELECT dep.concept_name AS concept_name_1,
dep.concept_code AS concept_code_1,
'RxNorm-c' AS vocabulary_id_1,
fre.concept_name AS concept_name_2,
fre.concept_code AS concept_code_2,
'RxNorm-c' AS vocabulary_id_2
FROM concept dep
JOIN concept fre ON SUBSTRING(LOWER(dep.concept_name), '\w+') = SUBSTRING(LOWER(fre.concept_name), '\w+')
AND fre.vocabulary_id = 'RxNorm'
AND fre.concept_class_id = 'Ingredient'
AND fre.invalid_reason IS NULL
JOIN (
SELECT fir,
COUNT(*)
FROM (
SELECT concept_name,
SUBSTRING(LOWER(dep.concept_name), '\w+') AS fir
FROM concept dep
WHERE vocabulary_id = 'RxNorm'
AND concept_class_id = 'Ingredient'
) AS s0
GROUP BY fir
HAVING COUNT(*) < 4
) ns ON fir = SUBSTRING(LOWER(dep.concept_name), '\w+')
WHERE dep.vocabulary_id = 'RxNorm'
AND dep.concept_class_id = 'Ingredient'
AND dep.invalid_reason = 'D'
UNION
-- connect SNOMED ingredients to RxNorm by first word in concept_name
SELECT dep.concept_name AS concept_name_1,
dep.concept_code AS concept_code_1,
'SNOMED-c' AS vocabulary_id_1,
fre.concept_name AS concept_name_2,
fre.concept_code AS concept_code_2,
'RxNorm-c' AS vocabulary_id_2
FROM concept dep
JOIN concept fre ON SUBSTRING(LOWER(dep.concept_name), '\w+') = SUBSTRING(LOWER(fre.concept_name), '\w+')
AND fre.vocabulary_id = 'RxNorm'
AND fre.concept_class_id = 'Ingredient'
AND fre.invalid_reason IS NULL
JOIN (
SELECT fir,
COUNT(*)
FROM (
SELECT concept_name,
SUBSTRING(LOWER(dep.concept_name), '\w+') AS fir
FROM concept dep
WHERE vocabulary_id = 'RxNorm'
AND concept_class_id = 'Ingredient'
) AS s1
GROUP BY fir
HAVING COUNT(*) < 4
) ns ON fir = SUBSTRING(LOWER(dep.concept_name), '\w+')
WHERE dep.vocabulary_id = 'SNOMED'
AND dep.domain_id = 'Drug'
AND LOWER(dep.concept_name) NOT LIKE '% with %'
AND dep.concept_name NOT LIKE '% + %'
AND LOWER(dep.concept_name) NOT LIKE '% and %'
UNION
-- add concept_relationships between ICD10 and SNOMED
SELECT c1.concept_name AS concept_name_1,
c1.concept_code AS concept_code_1,
c1.vocabulary_id || '-c' AS vocabulary_id_1,
c2.concept_name AS concept_name_2,
c2.concept_code AS concept_code_2,
c2.vocabulary_id AS vocabulary_id_2 -- SNOMED mappings are final, so no suffix
FROM concept c1
JOIN concept_relationship r ON r.concept_id_1 = c1.concept_id
JOIN concept c2 ON c2.concept_id = r.concept_id_2
WHERE r.invalid_reason IS NULL
AND c1.vocabulary_id = 'ICD10'
AND c2.vocabulary_id = 'SNOMED'
AND r.relationship_id = 'Maps to'
UNION
-- add concept_relationships between ICD10 and SNOMED
SELECT c1.concept_name AS concept_name_1,
c1.concept_code AS concept_code_1,
c1.vocabulary_id || '-c' AS vocabulary_id_1,
c2.concept_name AS concept_name_2,
c2.concept_code AS concept_code_2,
c2.vocabulary_id AS vocabulary_id_2 -- Mappings are final, so no suffix
FROM concept c1
JOIN concept_relationship r ON r.concept_id_1 = c1.concept_id
JOIN concept c2 ON c2.concept_id = r.concept_id_2
WHERE r.invalid_reason IS NULL
AND c1.vocabulary_id = 'SNOMED'
AND c2.vocabulary_id IN (
'Provider Specialty',
'CMS Place of Service'
)
AND r.relationship_id = 'Maps to'
UNION
-- add concept_relationships between SNOMED Drug classes and NDFRT
SELECT c1.concept_name AS concept_name_1,
c1.concept_code AS concept_code_1,
c1.vocabulary_id || '-c' AS vocabulary_id_1,
c2.concept_name AS concept_name_2,
c2.concept_code AS concept_code_2,
c2.vocabulary_id || '-c' AS vocabulary_id_2
FROM concept c1
JOIN concept_relationship r ON r.concept_id_1 = c1.concept_id
JOIN concept c2 ON c2.concept_id = r.concept_id_2
WHERE r.invalid_reason IS NULL
AND c1.vocabulary_id = 'SNOMED'
AND c2.vocabulary_id = 'NDFRT'
AND c1.domain_id = 'Drug'
UNION
-- Mapping from SNOMED to UCUM
SELECT c1.concept_name AS concept_name_1,
c1.concept_code AS concept_code_1,
c1.vocabulary_id || '-c' AS vocabulary_id_1,
c2.concept_name AS concept_name_2,
c2.concept_code AS concept_code_2,
c2.vocabulary_id AS vocabulary_id_2 -- UCUM mappings are final, so no suffix
FROM concept c1
JOIN concept_relationship r ON r.concept_id_1 = c1.concept_id
JOIN concept c2 ON c2.concept_id = r.concept_id_2
WHERE r.invalid_reason IS NULL
AND c1.vocabulary_id = 'SNOMED'
AND c2.vocabulary_id = 'UCUM'
UNION
-- Add replacement mappings
SELECT c1.concept_name AS concept_name_1,
c1.concept_code AS concept_code_1,
c1.vocabulary_id || '-c' AS vocabulary_id_1,
c2.concept_name AS concept_name_2,
c2.concept_code AS concept_code_2,
c2.vocabulary_id || '-c' AS vocabulary_id_2
FROM concept c1
JOIN concept_relationship r ON r.concept_id_1 = c1.concept_id
JOIN concept c2 ON c2.concept_id = r.concept_id_2
WHERE r.invalid_reason IS NULL
-- and c1.vocabulary_id in ('SNOMED', 'RxNorm', 'ICD10', 'LOINC', 'NDFRT'
AND c1.vocabulary_id IN (
'SNOMED',
'ICD10',
'RxNorm',
'LOINC'
)
AND c2.vocabulary_id IN (
'SNOMED',
'ICD10',
'RxNorm',
'LOINC'
)
AND relationship_id IN (
'Concept replaced by',
'Concept same_as to',
'Concept alt_to to',
'Concept poss_eq to',
'Concept was_a to'
)
UNION
-- Final terminators for RxNorm Ingredients
SELECT concept_name AS concept_name_1,
concept_code AS concept_code_1,
'RxNorm-c' AS vocabulary_id_1,
concept_name AS concept_name_2,
concept_code AS concept_code_2,
'RxNorm' AS vocabulary_id_2 -- RxNorm ingredient mappings are final
FROM concept
WHERE vocabulary_id = 'RxNorm'
AND concept_class_id = 'Ingredient'
AND invalid_reason IS NULL
UNION
-- Final terminators for standard_concept SNOMEDs
SELECT concept_name AS concept_name_1,
concept_code AS concept_code_1,
'SNOMED-c' AS vocabulary_id_1, -- map from interim with suffix "-c" to blessed concept
concept_name AS concept_name_2,
concept_code AS concept_code_2,
'SNOMED' AS vocabulary_id_2 -- SNOMED mappings are final
FROM concept
WHERE vocabulary_id = 'SNOMED'
AND standard_concept = 'S'
AND invalid_reason IS NULL
UNION
-- Final terminators for LOINC
SELECT concept_name AS concept_name_1,
concept_code AS concept_code_1,
'LOINC-c' AS vocabulary_id_1, -- map from interim with suffix "-c" to blessed concept
concept_name AS concept_name_2,
concept_code AS concept_code_2,
'LOINC' AS vocabulary_id_2 -- SNOMED mappings are final
FROM concept
WHERE vocabulary_id = 'LOINC'
AND invalid_reason IS NULL
)
-- Finally let the connect by find a path between the CIEL concept and an OMOP stnadard_concept='S'
SELECT CASE
WHEN vocabulary_id_2 LIKE '%-c%'
THEN 0
ELSE 1
END AS found,
root_concept_name_1 AS concept_name_1,
root_concept_code_1 AS concept_code_1,
root_vocabulary_id_1 AS vocabulary_id_1,
':' || ARRAY_TO_STRING(path, ':') AS path,
concept_name_2,
concept_code_2,
vocabulary_id_2
FROM hierarchy_concepts
-- The latter is necessary because we use suffixes in the definition of the vocabulary_id for the first relationship from the CIEL concept for the purpose of distinguishing
-- intermediate steps from the final and then pick the best path from a possible list
WHERE vocabulary_id_2 NOT LIKE '%-c%';-- the terminating relationshp should have no suffix, indicating it is a proper standard concept.
--6. Create temporary table of CIEL concepts that have mapping to some useful vocabulary, even though if it doesn't work. This is for debugging, in the final release we won't need that
DROP TABLE IF EXISTS ciel_concept_with_map;
CREATE UNLOGGED TABLE ciel_concept_with_map AS
SELECT DISTINCT COALESCE(FIRST_VALUE(cn.ciel_name) OVER (
PARTITION BY c.concept_id ORDER BY CASE
WHEN LENGTH(cn.ciel_name) <= 255
THEN LENGTH(cn.ciel_name)
ELSE 0
END DESC,
LENGTH(cn.ciel_name)
), 'Concept ' || c.concept_id /*for strange reason we have 4 concepts without concept_name*/) AS concept_name,
ccl.ciel_name AS domain_id,
c.concept_id::TEXT AS concept_code,
CASE c.retired
WHEN 0
THEN NULL
ELSE 'D'
END AS invalid_reason
FROM sources.ciel_concept c
LEFT JOIN sources.ciel_concept_class ccl ON ccl.concept_class_id = c.class_id
LEFT JOIN sources.ciel_concept_name cn ON cn.concept_id = c.concept_id
AND cn.locale = 'en'
LEFT JOIN sources.ciel_concept_reference_map crm ON crm.concept_id = c.concept_id
LEFT JOIN sources.ciel_concept_reference_term crt ON crt.concept_reference_term_id = crm.concept_reference_term_id
LEFT JOIN sources.ciel_concept_reference_source crs ON crs.concept_source_id = crt.concept_source_id
WHERE crs.ciel_name IN (
'SNOMED CT',
'SNOMED NP',
'ICD-10-WHO',
'RxNORM',
'ICD-10-WHO NP',
'ICD-10-WHO 2nd',
'ICD-10-WHO NP2',
'SNOMED US',
'NDF-RT NUI'
);
--7. Create concept_relationship_stage records
INSERT INTO concept_relationship_stage (
concept_code_1,
concept_code_2,
vocabulary_id_1,
vocabulary_id_2,
relationship_id,
valid_start_date,
valid_end_date,
invalid_reason
)
SELECT DISTINCT cm.concept_code_1 AS concept_code_1,
CASE c.domain_id
WHEN 'Drug'
THEN cm.concept_code_2
ELSE FIRST_VALUE(cm.concept_code_2) OVER (
PARTITION BY c.concept_code ORDER BY cm.path
)
END AS concept_code_2,
'CIEL' AS vocabulary_id_1,
CASE c.domain_id
WHEN 'Drug'
THEN cm.vocabulary_id_2
ELSE FIRST_VALUE(cm.vocabulary_id_2) OVER (
PARTITION BY c.concept_code ORDER BY cm.path
)
END AS vocabulary_id_2,
'Maps to' AS relationship_id,
TO_DATE('19700101', 'yyyymmdd') AS valid_start_date,
TO_DATE('20991231', 'yyyymmdd') AS valid_end_date,
NULL AS invalid_reason
FROM ciel_concept_with_map c
JOIN ciel_to_concept_map cm ON c.concept_code = cm.concept_code_1;
--8. Add manual relationships
DO $_$
BEGIN
PERFORM VOCABULARY_PACK.ProcessManualRelationships();
END $_$;
--9. Working with replacement mappings
DO $_$
BEGIN
PERFORM VOCABULARY_PACK.CheckReplacementMappings();
END $_$;
--10. Add mapping from deprecated to fresh concepts
DO $_$
BEGIN
PERFORM VOCABULARY_PACK.AddFreshMAPSTO();
END $_$;
--11. Deprecate 'Maps to' mappings to deprecated and upgraded concepts
DO $_$
BEGIN
PERFORM VOCABULARY_PACK.DeprecateWrongMAPSTO();
END $_$;
--12. Delete ambiguous 'Maps to' mappings
DO $_$
BEGIN
PERFORM VOCABULARY_PACK.DeleteAmbiguousMAPSTO();
END $_$;
--13. Clean up
DROP TABLE ciel_concept_with_map;
DROP TABLE ciel_to_concept_map;
-- At the end, the three tables concept_stage, concept_relationship_stage and concept_synonym_stage should be ready to be fed into the generic_update.sql script
-- Before generic update, go through stage table QA checks with functions qa_ddl and check_stage_tables | the_stack |
-- 2019-02-13T12:04:07.126
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_Element (AD_Client_ID,AD_Element_ID,AD_Org_ID,ColumnName,Created,CreatedBy,EntityType,IsActive,Name,PrintName,Updated,UpdatedBy) VALUES (0,576109,0,'AllowQuickInput',TO_TIMESTAMP('2019-02-13 12:04:06','YYYY-MM-DD HH24:MI:SS'),100,'D','Y','Allow Quick Input','Allow Quick Input',TO_TIMESTAMP('2019-02-13 12:04:06','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 2019-02-13T12:04:07.159
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_Element_Trl (AD_Language,AD_Element_ID, CommitWarning,Description,Help,Name,PO_Description,PO_Help,PO_Name,PO_PrintName,PrintName,WEBUI_NameBrowse,WEBUI_NameNew,WEBUI_NameNewBreadcrumb, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language, t.AD_Element_ID, t.CommitWarning,t.Description,t.Help,t.Name,t.PO_Description,t.PO_Help,t.PO_Name,t.PO_PrintName,t.PrintName,t.WEBUI_NameBrowse,t.WEBUI_NameNew,t.WEBUI_NameNewBreadcrumb, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Element t WHERE l.IsActive='Y'AND (l.IsSystemLanguage='Y' OR l.IsBaseLanguage='Y') AND t.AD_Element_ID=576109 AND NOT EXISTS (SELECT 1 FROM AD_Element_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Element_ID=t.AD_Element_ID)
;
-- 2019-02-13T12:49:31.645
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Element_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2019-02-13 12:49:31','YYYY-MM-DD HH24:MI:SS'),IsTranslated='Y',Name='Schnelleingabe abschalten',PrintName='Schnelleingabe abschalten' WHERE AD_Element_ID=576109 AND AD_Language='de_CH'
;
-- 2019-02-13T12:49:31.922
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
/* DDL */ select update_TRL_Tables_On_AD_Element_TRL_Update(576109,'de_CH')
;
-- 2019-02-13T12:49:36.149
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Element_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2019-02-13 12:49:36','YYYY-MM-DD HH24:MI:SS'),IsTranslated='Y',Name='Schnelleingabe abschalten',PrintName='Schnelleingabe abschalten' WHERE AD_Element_ID=576109 AND AD_Language='de_DE'
;
-- 2019-02-13T12:49:36.172
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
/* DDL */ select update_TRL_Tables_On_AD_Element_TRL_Update(576109,'de_DE')
;
-- 2019-02-13T12:49:36.200
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
/* DDL */ select update_ad_element_on_ad_element_trl_update(576109,'de_DE')
;
-- 2019-02-13T12:49:36.209
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Column SET ColumnName='AllowQuickInput', Name='Schnelleingabe abschalten', Description=NULL, Help=NULL WHERE AD_Element_ID=576109
;
-- 2019-02-13T12:49:36.217
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Process_Para SET ColumnName='AllowQuickInput', Name='Schnelleingabe abschalten', Description=NULL, Help=NULL, AD_Element_ID=576109 WHERE UPPER(ColumnName)='ALLOWQUICKINPUT' AND IsCentrallyMaintained='Y' AND AD_Element_ID IS NULL
;
-- 2019-02-13T12:49:36.228
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Process_Para SET ColumnName='AllowQuickInput', Name='Schnelleingabe abschalten', Description=NULL, Help=NULL WHERE AD_Element_ID=576109 AND IsCentrallyMaintained='Y'
;
-- 2019-02-13T12:49:36.235
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Field SET Name='Schnelleingabe abschalten', Description=NULL, Help=NULL WHERE (AD_Column_ID IN (SELECT AD_Column_ID FROM AD_Column WHERE AD_Element_ID=576109) AND AD_Name_ID IS NULL ) OR (AD_Name_ID = 576109)
;
-- 2019-02-13T12:49:36.279
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_PrintFormatItem pi SET PrintName='Schnelleingabe abschalten', Name='Schnelleingabe abschalten' WHERE IsCentrallyMaintained='Y' AND EXISTS (SELECT * FROM AD_Column c WHERE c.AD_Column_ID=pi.AD_Column_ID AND c.AD_Element_ID=576109)
;
-- 2019-02-13T12:49:36.289
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Tab SET Name='Schnelleingabe abschalten', Description=NULL, Help=NULL, CommitWarning = NULL WHERE AD_Element_ID = 576109
;
-- 2019-02-13T12:49:36.297
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_WINDOW SET Name='Schnelleingabe abschalten', Description=NULL, Help=NULL WHERE AD_Element_ID = 576109
;
-- 2019-02-13T12:49:36.304
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Menu SET Name='Schnelleingabe abschalten', Description=NULL, WEBUI_NameBrowse = NULL, WEBUI_NameNew = NULL, WEBUI_NameNewBreadcrumb = NULL WHERE AD_Element_ID = 576109
;
-- 2019-02-13T12:49:42.709
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Element_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2019-02-13 12:49:42','YYYY-MM-DD HH24:MI:SS'),IsTranslated='Y' WHERE AD_Element_ID=576109 AND AD_Language='en_US'
;
-- 2019-02-13T12:49:42.724
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
/* DDL */ select update_TRL_Tables_On_AD_Element_TRL_Update(576109,'en_US')
;
-- 2019-02-13T12:58:17.756
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_Column (AD_Client_ID,AD_Column_ID,AD_Element_ID,AD_Org_ID,AD_Reference_ID,AD_Table_ID,ColumnName,Created,CreatedBy,DDL_NoForeignKey,DefaultValue,EntityType,FieldLength,IsActive,IsAdvancedText,IsAllowLogging,IsAlwaysUpdateable,IsAutoApplyValidationRule,IsAutocomplete,IsCalculated,IsDimension,IsDLMPartitionBoundary,IsEncrypted,IsForceIncludeInGeneratedModel,IsGenericZoomKeyColumn,IsGenericZoomOrigin,IsIdentifier,IsKey,IsLazyLoading,IsMandatory,IsParent,IsRangeFilter,IsSelectionColumn,IsShowFilterIncrementButtons,IsStaleable,IsSyncDatabase,IsTranslated,IsUpdateable,IsUseDocSequence,Name,SelectionColumnSeqNo,SeqNo,Updated,UpdatedBy,Version) VALUES (0,564137,576109,0,20,106,'AllowQuickInput',TO_TIMESTAMP('2019-02-13 12:58:17','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','D',1,'Y','N','Y','N','N','N','N','N','N','N','N','N','N','N','N','N','Y','N','N','N','N','N','N','N','Y','N','Schnelleingabe abschalten',0,0,TO_TIMESTAMP('2019-02-13 12:58:17','YYYY-MM-DD HH24:MI:SS'),100,0)
;
-- 2019-02-13T12:58:17.778
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language, t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y'AND (l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N') AND t.AD_Column_ID=564137 AND NOT EXISTS (SELECT 1 FROM AD_Column_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Column_ID=t.AD_Column_ID)
;
-- 2019-02-13T12:58:28.244
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
-- moved to 5512600_sys_gh1146webui_AD_Tab_AllowQuickInput_DDL.sql
--/* DDL */ SELECT public.db_alter_table('AD_Tab','ALTER TABLE public.AD_Tab ADD COLUMN AllowQuickInput CHAR(1) DEFAULT ''Y'' CHECK (AllowQuickInput IN (''Y'',''N'')) NOT NULL')
--;
-- 2019-02-13T13:12:56.238
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_Field (AD_Client_ID,AD_Column_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,Created,CreatedBy,DisplayLength,EntityType,IsActive,IsDisplayed,IsDisplayedGrid,IsEncrypted,IsFieldOnly,IsHeading,IsReadOnly,IsSameLine,Name,Updated,UpdatedBy) VALUES (0,564137,574809,0,106,TO_TIMESTAMP('2019-02-13 13:12:56','YYYY-MM-DD HH24:MI:SS'),100,1,'D','Y','N','N','N','N','N','N','N','Schnelleingabe abschalten',TO_TIMESTAMP('2019-02-13 13:12:56','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 2019-02-13T13:12:56.245
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_Field_Trl (AD_Language,AD_Field_ID, Description,Help,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language, t.AD_Field_ID, t.Description,t.Help,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Field t WHERE l.IsActive='Y'AND (l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N') AND t.AD_Field_ID=574809 AND NOT EXISTS (SELECT 1 FROM AD_Field_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Field_ID=t.AD_Field_ID)
;
-- 2019-02-13T13:13:18.497
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Field SET IsDisplayed='Y', SeqNo=40,Updated=TO_TIMESTAMP('2019-02-13 13:13:18','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=565631
;
-- 2019-02-13T13:13:18.507
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Field SET IsDisplayed='Y', SeqNo=50,Updated=TO_TIMESTAMP('2019-02-13 13:13:18','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=569313
;
-- 2019-02-13T13:13:18.510
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Field SET IsDisplayed='Y', SeqNo=60,Updated=TO_TIMESTAMP('2019-02-13 13:13:18','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=120
;
-- 2019-02-13T13:13:18.514
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Field SET IsDisplayed='Y', SeqNo=70,Updated=TO_TIMESTAMP('2019-02-13 13:13:18','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=121
;
-- 2019-02-13T13:13:18.517
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Field SET IsDisplayed='Y', SeqNo=80,Updated=TO_TIMESTAMP('2019-02-13 13:13:18','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=122
;
-- 2019-02-13T13:13:18.519
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Field SET IsDisplayed='Y', SeqNo=90,Updated=TO_TIMESTAMP('2019-02-13 13:13:18','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=271
;
-- 2019-02-13T13:13:18.523
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Field SET IsDisplayed='Y', SeqNo=100,Updated=TO_TIMESTAMP('2019-02-13 13:13:18','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=131
;
-- 2019-02-13T13:13:18.527
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Field SET IsDisplayed='Y', SeqNo=110,Updated=TO_TIMESTAMP('2019-02-13 13:13:18','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=5824
;
-- 2019-02-13T13:13:18.531
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Field SET IsDisplayed='Y', SeqNo=120,Updated=TO_TIMESTAMP('2019-02-13 13:13:18','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=123
;
-- 2019-02-13T13:13:18.535
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Field SET IsDisplayed='Y', SeqNo=130,Updated=TO_TIMESTAMP('2019-02-13 13:13:18','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=5326
;
-- 2019-02-13T13:13:18.539
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Field SET IsDisplayed='Y', SeqNo=140,Updated=TO_TIMESTAMP('2019-02-13 13:13:18','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=564333
;
-- 2019-02-13T13:13:18.542
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Field SET IsDisplayed='Y', SeqNo=150,Updated=TO_TIMESTAMP('2019-02-13 13:13:18','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=124
;
-- 2019-02-13T13:13:18.545
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Field SET IsDisplayed='Y', SeqNo=160,Updated=TO_TIMESTAMP('2019-02-13 13:13:18','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=11997
;
-- 2019-02-13T13:13:18.549
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Field SET IsDisplayed='Y', SeqNo=170,Updated=TO_TIMESTAMP('2019-02-13 13:13:18','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=312
;
-- 2019-02-13T13:13:18.553
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Field SET IsDisplayed='Y', SeqNo=180,Updated=TO_TIMESTAMP('2019-02-13 13:13:18','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=927
;
-- 2019-02-13T13:13:18.557
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Field SET IsDisplayed='Y', SeqNo=190,Updated=TO_TIMESTAMP('2019-02-13 13:13:18','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=5707
;
-- 2019-02-13T13:13:18.560
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Field SET IsDisplayed='Y', SeqNo=200,Updated=TO_TIMESTAMP('2019-02-13 13:13:18','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=928
;
-- 2019-02-13T13:13:18.563
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Field SET IsDisplayed='Y', SeqNo=210,Updated=TO_TIMESTAMP('2019-02-13 13:13:18','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=5709
;
-- 2019-02-13T13:13:18.567
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Field SET IsDisplayed='Y', SeqNo=220,Updated=TO_TIMESTAMP('2019-02-13 13:13:18','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=5708
;
-- 2019-02-13T13:13:18.570
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Field SET IsDisplayed='Y', SeqNo=230,Updated=TO_TIMESTAMP('2019-02-13 13:13:18','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=1546
;
-- 2019-02-13T13:13:18.580
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Field SET IsDisplayed='Y', SeqNo=240,Updated=TO_TIMESTAMP('2019-02-13 13:13:18','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=57266
;
-- 2019-02-13T13:13:18.584
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Field SET IsDisplayed='Y', SeqNo=250,Updated=TO_TIMESTAMP('2019-02-13 13:13:18','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=2575
;
-- 2019-02-13T13:13:18.588
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Field SET IsDisplayed='Y', SeqNo=260,Updated=TO_TIMESTAMP('2019-02-13 13:13:18','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=11265
;
-- 2019-02-13T13:13:18.592
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Field SET IsDisplayed='Y', SeqNo=270,Updated=TO_TIMESTAMP('2019-02-13 13:13:18','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=929
;
-- 2019-02-13T13:13:18.596
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Field SET IsDisplayed='Y', SeqNo=280,Updated=TO_TIMESTAMP('2019-02-13 13:13:18','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=11998
;
-- 2019-02-13T13:13:18.599
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Field SET IsDisplayed='Y', SeqNo=290,Updated=TO_TIMESTAMP('2019-02-13 13:13:18','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=11266
;
-- 2019-02-13T13:13:18.602
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Field SET IsDisplayed='Y', SeqNo=300,Updated=TO_TIMESTAMP('2019-02-13 13:13:18','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=1548
;
-- 2019-02-13T13:13:18.606
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Field SET IsDisplayed='Y', SeqNo=310,Updated=TO_TIMESTAMP('2019-02-13 13:13:18','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=542630
;
-- 2019-02-13T13:13:18.609
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Field SET IsDisplayed='Y', SeqNo=320,Updated=TO_TIMESTAMP('2019-02-13 13:13:18','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=1550
;
-- 2019-02-13T13:13:18.612
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Field SET IsDisplayed='Y', SeqNo=330,Updated=TO_TIMESTAMP('2019-02-13 13:13:18','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=1549
;
-- 2019-02-13T13:13:18.616
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Field SET IsDisplayed='Y', SeqNo=340,Updated=TO_TIMESTAMP('2019-02-13 13:13:18','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=4956
;
-- 2019-02-13T13:13:18.619
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Field SET IsDisplayed='Y', SeqNo=350,Updated=TO_TIMESTAMP('2019-02-13 13:13:18','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=5131
;
-- 2019-02-13T13:13:18.622
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Field SET IsDisplayed='Y', SeqNo=360,Updated=TO_TIMESTAMP('2019-02-13 13:13:18','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=58083
;
-- 2019-02-13T13:13:18.626
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Field SET IsDisplayed='Y', SeqNo=370,Updated=TO_TIMESTAMP('2019-02-13 13:13:18','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=118
;
-- 2019-02-13T13:13:18.635
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Field SET IsDisplayed='Y', SeqNo=380,Updated=TO_TIMESTAMP('2019-02-13 13:13:18','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=3205
;
-- 2019-02-13T13:13:18.640
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Field SET IsDisplayed='Y', SeqNo=390,Updated=TO_TIMESTAMP('2019-02-13 13:13:18','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=545243
;
-- 2019-02-13T13:13:18.643
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Field SET IsDisplayed='Y', SeqNo=400,Updated=TO_TIMESTAMP('2019-02-13 13:13:18','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=542629
;
-- 2019-02-13T13:13:18.647
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Field SET IsDisplayed='Y', SeqNo=410,Updated=TO_TIMESTAMP('2019-02-13 13:13:18','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=542857
;
-- 2019-02-13T13:13:18.652
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Field SET IsDisplayed='Y', SeqNo=420,Updated=TO_TIMESTAMP('2019-02-13 13:13:18','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=542858
;
-- 2019-02-13T13:13:18.656
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Field SET IsDisplayed='Y', SeqNo=430,Updated=TO_TIMESTAMP('2019-02-13 13:13:18','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=543156
;
-- 2019-02-13T13:13:18.659
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Field SET IsDisplayed='Y', SeqNo=440,Updated=TO_TIMESTAMP('2019-02-13 13:13:18','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=63006
;
-- 2019-02-13T13:13:18.663
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Field SET IsDisplayed='Y', SeqNo=450,Updated=TO_TIMESTAMP('2019-02-13 13:13:18','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=549351
;
-- 2019-02-13T13:13:18.668
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Field SET IsDisplayed='Y', SeqNo=460,Updated=TO_TIMESTAMP('2019-02-13 13:13:18','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=555895
;
-- 2019-02-13T13:13:18.671
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Field SET IsDisplayed='Y', SeqNo=470,Updated=TO_TIMESTAMP('2019-02-13 13:13:18','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=574809
; | the_stack |
-- 2017-12-20T17:36:33.546
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_Element (AD_Client_ID,AD_Element_ID,AD_Org_ID,ColumnName,Created,CreatedBy,EntityType,IsActive,Name,PrintName,Updated,UpdatedBy) VALUES (0,543687,0,'KAEP_Price_List_ID',TO_TIMESTAMP('2017-12-20 17:36:33','YYYY-MM-DD HH24:MI:SS'),100,'de.metas.vertical.pharma','Y','Price List KAEP','Price List KAEP',TO_TIMESTAMP('2017-12-20 17:36:33','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 2017-12-20T17:36:33.553
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_Element_Trl (AD_Language,AD_Element_ID, Description,Help,Name,PO_Description,PO_Help,PO_Name,PO_PrintName,PrintName, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Element_ID, t.Description,t.Help,t.Name,t.PO_Description,t.PO_Help,t.PO_Name,t.PO_PrintName,t.PrintName, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Element t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Element_ID=543687 AND NOT EXISTS (SELECT 1 FROM AD_Element_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Element_ID=t.AD_Element_ID)
;
-- 2017-12-20T17:37:04.594
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_Column (AD_Client_ID,AD_Column_ID,AD_Element_ID,AD_Org_ID,AD_Reference_ID,AD_Reference_Value_ID,AD_Table_ID,AllowZoomTo,ColumnName,Created,CreatedBy,DDL_NoForeignKey,EntityType,FieldLength,IsActive,IsAdvancedText,IsAllowLogging,IsAlwaysUpdateable,IsAutocomplete,IsCalculated,IsDimension,IsDLMPartitionBoundary,IsEncrypted,IsGenericZoomKeyColumn,IsGenericZoomOrigin,IsIdentifier,IsKey,IsLazyLoading,IsMandatory,IsParent,IsRangeFilter,IsSelectionColumn,IsShowFilterIncrementButtons,IsStaleable,IsSyncDatabase,IsTranslated,IsUpdateable,IsUseDocSequence,Name,SelectionColumnSeqNo,SeqNo,Updated,UpdatedBy,Version) VALUES (0,558325,543687,0,18,166,540880,'N','KAEP_Price_List_ID',TO_TIMESTAMP('2017-12-20 17:37:04','YYYY-MM-DD HH24:MI:SS'),100,'N','de.metas.vertical.pharma',10,'Y','N','Y','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','Y','N','Price List KAEP',0,0,TO_TIMESTAMP('2017-12-20 17:37:04','YYYY-MM-DD HH24:MI:SS'),100,0)
;
-- 2017-12-20T17:37:04.597
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=558325 AND NOT EXISTS (SELECT 1 FROM AD_Column_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Column_ID=t.AD_Column_ID)
;
-- 2017-12-20T17:37:11.926
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
/* DDL */ SELECT public.db_alter_table('I_Pharma_Product','ALTER TABLE public.I_Pharma_Product ADD COLUMN KAEP_Price_List_ID NUMERIC(10)')
;
-- 2017-12-20T17:37:11.957
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
ALTER TABLE I_Pharma_Product ADD CONSTRAINT KAEPPriceList_IPharmaProduct FOREIGN KEY (KAEP_Price_List_ID) REFERENCES public.M_PriceList DEFERRABLE INITIALLY DEFERRED
;
-- 2017-12-20T17:37:59.135
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_Element (AD_Client_ID,AD_Element_ID,AD_Org_ID,ColumnName,Created,CreatedBy,EntityType,IsActive,Name,PrintName,Updated,UpdatedBy) VALUES (0,543688,0,'AEP_Price_List_ID',TO_TIMESTAMP('2017-12-20 17:37:59','YYYY-MM-DD HH24:MI:SS'),100,'de.metas.vertical.pharma','Y','Price List AEP','Price List APU',TO_TIMESTAMP('2017-12-20 17:37:59','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 2017-12-20T17:37:59.139
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_Element_Trl (AD_Language,AD_Element_ID, Description,Help,Name,PO_Description,PO_Help,PO_Name,PO_PrintName,PrintName, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Element_ID, t.Description,t.Help,t.Name,t.PO_Description,t.PO_Help,t.PO_Name,t.PO_PrintName,t.PrintName, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Element t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Element_ID=543688 AND NOT EXISTS (SELECT 1 FROM AD_Element_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Element_ID=t.AD_Element_ID)
;
-- 2017-12-20T17:38:13.216
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_Column (AD_Client_ID,AD_Column_ID,AD_Element_ID,AD_Org_ID,AD_Reference_ID,AD_Reference_Value_ID,AD_Table_ID,AllowZoomTo,ColumnName,Created,CreatedBy,DDL_NoForeignKey,EntityType,FieldLength,IsActive,IsAdvancedText,IsAllowLogging,IsAlwaysUpdateable,IsAutocomplete,IsCalculated,IsDimension,IsDLMPartitionBoundary,IsEncrypted,IsGenericZoomKeyColumn,IsGenericZoomOrigin,IsIdentifier,IsKey,IsLazyLoading,IsMandatory,IsParent,IsRangeFilter,IsSelectionColumn,IsShowFilterIncrementButtons,IsStaleable,IsSyncDatabase,IsTranslated,IsUpdateable,IsUseDocSequence,Name,SelectionColumnSeqNo,SeqNo,Updated,UpdatedBy,Version) VALUES (0,558326,543688,0,18,166,540880,'N','AEP_Price_List_ID',TO_TIMESTAMP('2017-12-20 17:38:13','YYYY-MM-DD HH24:MI:SS'),100,'N','de.metas.vertical.pharma',10,'Y','N','Y','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','Y','N','Price List AEP',0,0,TO_TIMESTAMP('2017-12-20 17:38:13','YYYY-MM-DD HH24:MI:SS'),100,0)
;
-- 2017-12-20T17:38:13.221
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=558326 AND NOT EXISTS (SELECT 1 FROM AD_Column_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Column_ID=t.AD_Column_ID)
;
-- 2017-12-20T17:38:15.046
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
/* DDL */ SELECT public.db_alter_table('I_Pharma_Product','ALTER TABLE public.I_Pharma_Product ADD COLUMN AEP_Price_List_ID NUMERIC(10)')
;
-- 2017-12-20T17:38:15.056
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
ALTER TABLE I_Pharma_Product ADD CONSTRAINT AEPPriceList_IPharmaProduct FOREIGN KEY (AEP_Price_List_ID) REFERENCES public.M_PriceList DEFERRABLE INITIALLY DEFERRED
;
-- 2017-12-20T17:38:57.597
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Element SET PrintName='Price List AEP',Updated=TO_TIMESTAMP('2017-12-20 17:38:57','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=543688
;
-- 2017-12-20T17:38:57.598
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_PrintFormatItem pi SET PrintName='Price List AEP', Name='Price List AEP' WHERE IsCentrallyMaintained='Y' AND EXISTS (SELECT * FROM AD_Column c WHERE c.AD_Column_ID=pi.AD_Column_ID AND c.AD_Element_ID=543688)
;
-- 2017-12-20T17:39:12.099
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_Element (AD_Client_ID,AD_Element_ID,AD_Org_ID,ColumnName,Created,CreatedBy,EntityType,IsActive,Name,PrintName,Updated,UpdatedBy) VALUES (0,543689,0,'APU_Price_List_ID',TO_TIMESTAMP('2017-12-20 17:39:11','YYYY-MM-DD HH24:MI:SS'),100,'de.metas.vertical.pharma','Y','Price List APU','Price List APU',TO_TIMESTAMP('2017-12-20 17:39:11','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 2017-12-20T17:39:12.100
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_Element_Trl (AD_Language,AD_Element_ID, Description,Help,Name,PO_Description,PO_Help,PO_Name,PO_PrintName,PrintName, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Element_ID, t.Description,t.Help,t.Name,t.PO_Description,t.PO_Help,t.PO_Name,t.PO_PrintName,t.PrintName, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Element t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Element_ID=543689 AND NOT EXISTS (SELECT 1 FROM AD_Element_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Element_ID=t.AD_Element_ID)
;
-- 2017-12-20T17:39:25.749
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_Column (AD_Client_ID,AD_Column_ID,AD_Element_ID,AD_Org_ID,AD_Reference_ID,AD_Reference_Value_ID,AD_Table_ID,AllowZoomTo,ColumnName,Created,CreatedBy,DDL_NoForeignKey,EntityType,FieldLength,IsActive,IsAdvancedText,IsAllowLogging,IsAlwaysUpdateable,IsAutocomplete,IsCalculated,IsDimension,IsDLMPartitionBoundary,IsEncrypted,IsGenericZoomKeyColumn,IsGenericZoomOrigin,IsIdentifier,IsKey,IsLazyLoading,IsMandatory,IsParent,IsRangeFilter,IsSelectionColumn,IsShowFilterIncrementButtons,IsStaleable,IsSyncDatabase,IsTranslated,IsUpdateable,IsUseDocSequence,Name,SelectionColumnSeqNo,SeqNo,Updated,UpdatedBy,Version) VALUES (0,558327,543689,0,18,166,540880,'N','APU_Price_List_ID',TO_TIMESTAMP('2017-12-20 17:39:25','YYYY-MM-DD HH24:MI:SS'),100,'N','de.metas.vertical.pharma',10,'Y','N','Y','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','Y','N','Price List APU',0,0,TO_TIMESTAMP('2017-12-20 17:39:25','YYYY-MM-DD HH24:MI:SS'),100,0)
;
-- 2017-12-20T17:39:25.750
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=558327 AND NOT EXISTS (SELECT 1 FROM AD_Column_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Column_ID=t.AD_Column_ID)
;
-- 2017-12-20T17:39:48.960
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_Element (AD_Client_ID,AD_Element_ID,AD_Org_ID,ColumnName,Created,CreatedBy,EntityType,IsActive,Name,PrintName,Updated,UpdatedBy) VALUES (0,543690,0,'AVP_Price_List_ID',TO_TIMESTAMP('2017-12-20 17:39:48','YYYY-MM-DD HH24:MI:SS'),100,'de.metas.vertical.pharma','Y','Price List AVP','Price List AVP',TO_TIMESTAMP('2017-12-20 17:39:48','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 2017-12-20T17:39:48.961
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_Element_Trl (AD_Language,AD_Element_ID, Description,Help,Name,PO_Description,PO_Help,PO_Name,PO_PrintName,PrintName, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Element_ID, t.Description,t.Help,t.Name,t.PO_Description,t.PO_Help,t.PO_Name,t.PO_PrintName,t.PrintName, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Element t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Element_ID=543690 AND NOT EXISTS (SELECT 1 FROM AD_Element_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Element_ID=t.AD_Element_ID)
;
-- 2017-12-20T17:39:58.298
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_Column (AD_Client_ID,AD_Column_ID,AD_Element_ID,AD_Org_ID,AD_Reference_ID,AD_Reference_Value_ID,AD_Table_ID,AllowZoomTo,ColumnName,Created,CreatedBy,DDL_NoForeignKey,EntityType,FieldLength,IsActive,IsAdvancedText,IsAllowLogging,IsAlwaysUpdateable,IsAutocomplete,IsCalculated,IsDimension,IsDLMPartitionBoundary,IsEncrypted,IsGenericZoomKeyColumn,IsGenericZoomOrigin,IsIdentifier,IsKey,IsLazyLoading,IsMandatory,IsParent,IsRangeFilter,IsSelectionColumn,IsShowFilterIncrementButtons,IsStaleable,IsSyncDatabase,IsTranslated,IsUpdateable,IsUseDocSequence,Name,SelectionColumnSeqNo,SeqNo,Updated,UpdatedBy,Version) VALUES (0,558328,543690,0,18,166,540880,'N','AVP_Price_List_ID',TO_TIMESTAMP('2017-12-20 17:39:58','YYYY-MM-DD HH24:MI:SS'),100,'N','de.metas.vertical.pharma',10,'Y','N','Y','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','Y','N','Price List AVP',0,0,TO_TIMESTAMP('2017-12-20 17:39:58','YYYY-MM-DD HH24:MI:SS'),100,0)
;
-- 2017-12-20T17:39:58.303
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=558328 AND NOT EXISTS (SELECT 1 FROM AD_Column_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Column_ID=t.AD_Column_ID)
;
-- 2017-12-20T17:40:00.618
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
/* DDL */ SELECT public.db_alter_table('I_Pharma_Product','ALTER TABLE public.I_Pharma_Product ADD COLUMN AVP_Price_List_ID NUMERIC(10)')
;
-- 2017-12-20T17:40:00.625
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
ALTER TABLE I_Pharma_Product ADD CONSTRAINT AVPPriceList_IPharmaProduct FOREIGN KEY (AVP_Price_List_ID) REFERENCES public.M_PriceList DEFERRABLE INITIALLY DEFERRED
;
-- 2017-12-20T17:40:03.948
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
/* DDL */ SELECT public.db_alter_table('I_Pharma_Product','ALTER TABLE public.I_Pharma_Product ADD COLUMN APU_Price_List_ID NUMERIC(10)')
;
-- 2017-12-20T17:40:03.957
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
ALTER TABLE I_Pharma_Product ADD CONSTRAINT APUPriceList_IPharmaProduct FOREIGN KEY (APU_Price_List_ID) REFERENCES public.M_PriceList DEFERRABLE INITIALLY DEFERRED
;
-- 2017-12-20T17:40:28.372
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_Element (AD_Client_ID,AD_Element_ID,AD_Org_ID,ColumnName,Created,CreatedBy,EntityType,IsActive,Name,PrintName,Updated,UpdatedBy) VALUES (0,543691,0,'UVP_Price_List_ID',TO_TIMESTAMP('2017-12-20 17:40:28','YYYY-MM-DD HH24:MI:SS'),100,'de.metas.vertical.pharma','Y','Price List UVP','Price List UVP',TO_TIMESTAMP('2017-12-20 17:40:28','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 2017-12-20T17:40:28.373
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_Element_Trl (AD_Language,AD_Element_ID, Description,Help,Name,PO_Description,PO_Help,PO_Name,PO_PrintName,PrintName, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Element_ID, t.Description,t.Help,t.Name,t.PO_Description,t.PO_Help,t.PO_Name,t.PO_PrintName,t.PrintName, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Element t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Element_ID=543691 AND NOT EXISTS (SELECT 1 FROM AD_Element_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Element_ID=t.AD_Element_ID)
;
-- 2017-12-20T17:40:37.128
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_Column (AD_Client_ID,AD_Column_ID,AD_Element_ID,AD_Org_ID,AD_Reference_ID,AD_Reference_Value_ID,AD_Table_ID,AllowZoomTo,ColumnName,Created,CreatedBy,DDL_NoForeignKey,EntityType,FieldLength,IsActive,IsAdvancedText,IsAllowLogging,IsAlwaysUpdateable,IsAutocomplete,IsCalculated,IsDimension,IsDLMPartitionBoundary,IsEncrypted,IsGenericZoomKeyColumn,IsGenericZoomOrigin,IsIdentifier,IsKey,IsLazyLoading,IsMandatory,IsParent,IsRangeFilter,IsSelectionColumn,IsShowFilterIncrementButtons,IsStaleable,IsSyncDatabase,IsTranslated,IsUpdateable,IsUseDocSequence,Name,SelectionColumnSeqNo,SeqNo,Updated,UpdatedBy,Version) VALUES (0,558329,543691,0,18,166,540880,'N','UVP_Price_List_ID',TO_TIMESTAMP('2017-12-20 17:40:37','YYYY-MM-DD HH24:MI:SS'),100,'N','de.metas.vertical.pharma',10,'Y','N','Y','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','Y','N','Price List UVP',0,0,TO_TIMESTAMP('2017-12-20 17:40:37','YYYY-MM-DD HH24:MI:SS'),100,0)
;
-- 2017-12-20T17:40:37.129
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=558329 AND NOT EXISTS (SELECT 1 FROM AD_Column_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Column_ID=t.AD_Column_ID)
;
-- 2017-12-20T17:40:38.975
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
/* DDL */ SELECT public.db_alter_table('I_Pharma_Product','ALTER TABLE public.I_Pharma_Product ADD COLUMN UVP_Price_List_ID NUMERIC(10)')
;
-- 2017-12-20T17:40:38.982
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
ALTER TABLE I_Pharma_Product ADD CONSTRAINT UVPPriceList_IPharmaProduct FOREIGN KEY (UVP_Price_List_ID) REFERENCES public.M_PriceList DEFERRABLE INITIALLY DEFERRED
;
-- 2017-12-20T17:41:27.379
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_Element (AD_Client_ID,AD_Element_ID,AD_Org_ID,ColumnName,Created,CreatedBy,EntityType,IsActive,Name,PrintName,Updated,UpdatedBy) VALUES (0,543692,0,'ZVB_Price_List_ID',TO_TIMESTAMP('2017-12-20 17:41:27','YYYY-MM-DD HH24:MI:SS'),100,'de.metas.vertical.pharma','Y','Price List ZBB','Price List ZVB',TO_TIMESTAMP('2017-12-20 17:41:27','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 2017-12-20T17:41:27.382
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_Element_Trl (AD_Language,AD_Element_ID, Description,Help,Name,PO_Description,PO_Help,PO_Name,PO_PrintName,PrintName, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Element_ID, t.Description,t.Help,t.Name,t.PO_Description,t.PO_Help,t.PO_Name,t.PO_PrintName,t.PrintName, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Element t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Element_ID=543692 AND NOT EXISTS (SELECT 1 FROM AD_Element_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Element_ID=t.AD_Element_ID)
;
-- 2017-12-20T17:41:38.356
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_Column (AD_Client_ID,AD_Column_ID,AD_Element_ID,AD_Org_ID,AD_Reference_ID,AD_Reference_Value_ID,AD_Table_ID,AllowZoomTo,ColumnName,Created,CreatedBy,DDL_NoForeignKey,EntityType,FieldLength,IsActive,IsAdvancedText,IsAllowLogging,IsAlwaysUpdateable,IsAutocomplete,IsCalculated,IsDimension,IsDLMPartitionBoundary,IsEncrypted,IsGenericZoomKeyColumn,IsGenericZoomOrigin,IsIdentifier,IsKey,IsLazyLoading,IsMandatory,IsParent,IsRangeFilter,IsSelectionColumn,IsShowFilterIncrementButtons,IsStaleable,IsSyncDatabase,IsTranslated,IsUpdateable,IsUseDocSequence,Name,SelectionColumnSeqNo,SeqNo,Updated,UpdatedBy,Version) VALUES (0,558330,543692,0,18,166,540880,'N','ZVB_Price_List_ID',TO_TIMESTAMP('2017-12-20 17:41:35','YYYY-MM-DD HH24:MI:SS'),100,'N','de.metas.vertical.pharma',10,'Y','N','Y','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','Y','N','Price List ZBB',0,0,TO_TIMESTAMP('2017-12-20 17:41:35','YYYY-MM-DD HH24:MI:SS'),100,0)
;
-- 2017-12-20T17:41:38.360
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=558330 AND NOT EXISTS (SELECT 1 FROM AD_Column_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Column_ID=t.AD_Column_ID)
;
-- 2017-12-20T17:41:39.947
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
/* DDL */ SELECT public.db_alter_table('I_Pharma_Product','ALTER TABLE public.I_Pharma_Product ADD COLUMN ZVB_Price_List_ID NUMERIC(10)')
;
-- 2017-12-20T17:41:39.954
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
ALTER TABLE I_Pharma_Product ADD CONSTRAINT ZVBPriceList_IPharmaProduct FOREIGN KEY (ZVB_Price_List_ID) REFERENCES public.M_PriceList DEFERRABLE INITIALLY DEFERRED
;
-- 2017-12-20T17:42:00.295
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Element SET Name='Price List ZBV', PrintName='Price List ZBV',Updated=TO_TIMESTAMP('2017-12-20 17:42:00','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=543692
;
-- 2017-12-20T17:42:00.298
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Column SET ColumnName='ZVB_Price_List_ID', Name='Price List ZBV', Description=NULL, Help=NULL WHERE AD_Element_ID=543692
;
-- 2017-12-20T17:42:00.327
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Process_Para SET ColumnName='ZVB_Price_List_ID', Name='Price List ZBV', Description=NULL, Help=NULL, AD_Element_ID=543692 WHERE UPPER(ColumnName)='ZVB_PRICE_LIST_ID' AND IsCentrallyMaintained='Y' AND AD_Element_ID IS NULL
;
-- 2017-12-20T17:42:00.331
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Process_Para SET ColumnName='ZVB_Price_List_ID', Name='Price List ZBV', Description=NULL, Help=NULL WHERE AD_Element_ID=543692 AND IsCentrallyMaintained='Y'
;
-- 2017-12-20T17:42:00.333
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Field SET Name='Price List ZBV', Description=NULL, Help=NULL WHERE AD_Column_ID IN (SELECT AD_Column_ID FROM AD_Column WHERE AD_Element_ID=543692) AND IsCentrallyMaintained='Y'
;
-- 2017-12-20T17:42:00.344
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_PrintFormatItem pi SET PrintName='Price List ZBV', Name='Price List ZBV' WHERE IsCentrallyMaintained='Y' AND EXISTS (SELECT * FROM AD_Column c WHERE c.AD_Column_ID=pi.AD_Column_ID AND c.AD_Element_ID=543692)
;
-- 2017-12-20T17:42:11.351
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Element SET ColumnName='ZBV_Price_List_ID',Updated=TO_TIMESTAMP('2017-12-20 17:42:11','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=543692
;
-- 2017-12-20T17:42:11.353
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Column SET ColumnName='ZBV_Price_List_ID', Name='Price List ZBV', Description=NULL, Help=NULL WHERE AD_Element_ID=543692
;
-- 2017-12-20T17:42:11.374
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Process_Para SET ColumnName='ZBV_Price_List_ID', Name='Price List ZBV', Description=NULL, Help=NULL, AD_Element_ID=543692 WHERE UPPER(ColumnName)='ZBV_PRICE_LIST_ID' AND IsCentrallyMaintained='Y' AND AD_Element_ID IS NULL
;
-- 2017-12-20T17:42:11.375
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Process_Para SET ColumnName='ZBV_Price_List_ID', Name='Price List ZBV', Description=NULL, Help=NULL WHERE AD_Element_ID=543692 AND IsCentrallyMaintained='Y'
;
alter table I_Pharma_Product rename column ZVB_Price_List_ID to ZBV_Price_List_ID;
-- 2017-12-20T17:44:53.235
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_Field (AD_Client_ID,AD_Column_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,ColumnDisplayLength,Created,CreatedBy,DisplayLength,EntityType,IncludedTabHeight,IsActive,IsCentrallyMaintained,IsDisplayed,IsDisplayedGrid,IsEncrypted,IsFieldOnly,IsHeading,IsReadOnly,IsSameLine,Name,SeqNo,SeqNoGrid,SortNo,SpanX,SpanY,Updated,UpdatedBy) VALUES (0,558325,561191,0,540908,0,TO_TIMESTAMP('2017-12-20 17:44:53','YYYY-MM-DD HH24:MI:SS'),100,0,'de.metas.vertical.pharma',0,'Y','Y','Y','Y','N','N','N','N','Y','Price List KAEP',425,60,0,1,1,TO_TIMESTAMP('2017-12-20 17:44:53','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 2017-12-20T17:44:53.248
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_Field_Trl (AD_Language,AD_Field_ID, Description,Help,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Field_ID, t.Description,t.Help,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Field t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Field_ID=561191 AND NOT EXISTS (SELECT 1 FROM AD_Field_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Field_ID=t.AD_Field_ID)
;
-- 2017-12-20T17:45:32.697
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_Field (AD_Client_ID,AD_Column_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,ColumnDisplayLength,Created,CreatedBy,DisplayLength,EntityType,IncludedTabHeight,IsActive,IsCentrallyMaintained,IsDisplayed,IsDisplayedGrid,IsEncrypted,IsFieldOnly,IsHeading,IsReadOnly,IsSameLine,Name,SeqNo,SpanX,SpanY,Updated,UpdatedBy) VALUES (0,558327,561192,0,540908,0,TO_TIMESTAMP('2017-12-20 17:45:32','YYYY-MM-DD HH24:MI:SS'),100,1,'de.metas.vertical.pharma',0,'Y','Y','Y','Y','N','N','N','N','Y','Price List APU',435,1,1,TO_TIMESTAMP('2017-12-20 17:45:32','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 2017-12-20T17:45:32.700
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_Field_Trl (AD_Language,AD_Field_ID, Description,Help,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Field_ID, t.Description,t.Help,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Field t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Field_ID=561192 AND NOT EXISTS (SELECT 1 FROM AD_Field_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Field_ID=t.AD_Field_ID)
;
-- 2017-12-20T17:45:51.495
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_Field (AD_Client_ID,AD_Column_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,ColumnDisplayLength,Created,CreatedBy,DisplayLength,EntityType,IncludedTabHeight,IsActive,IsCentrallyMaintained,IsDisplayed,IsDisplayedGrid,IsEncrypted,IsFieldOnly,IsHeading,IsReadOnly,IsSameLine,Name,SeqNo,SpanX,SpanY,Updated,UpdatedBy) VALUES (0,558326,561193,0,540908,0,TO_TIMESTAMP('2017-12-20 17:45:51','YYYY-MM-DD HH24:MI:SS'),100,1,'de.metas.vertical.pharma',0,'Y','Y','Y','Y','N','N','N','N','Y','Price List AEP',445,1,1,TO_TIMESTAMP('2017-12-20 17:45:51','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 2017-12-20T17:45:51.497
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_Field_Trl (AD_Language,AD_Field_ID, Description,Help,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Field_ID, t.Description,t.Help,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Field t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Field_ID=561193 AND NOT EXISTS (SELECT 1 FROM AD_Field_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Field_ID=t.AD_Field_ID)
;
-- 2017-12-20T17:46:10.626
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_Field (AD_Client_ID,AD_Column_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,ColumnDisplayLength,Created,CreatedBy,DisplayLength,EntityType,IncludedTabHeight,IsActive,IsCentrallyMaintained,IsDisplayed,IsDisplayedGrid,IsEncrypted,IsFieldOnly,IsHeading,IsReadOnly,IsSameLine,Name,SeqNo,SpanX,SpanY,Updated,UpdatedBy) VALUES (0,558328,561194,0,540908,0,TO_TIMESTAMP('2017-12-20 17:46:10','YYYY-MM-DD HH24:MI:SS'),100,1,'de.metas.vertical.pharma',0,'Y','Y','Y','Y','N','N','N','N','Y','Price List AVP',455,1,1,TO_TIMESTAMP('2017-12-20 17:46:10','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 2017-12-20T17:46:10.629
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_Field_Trl (AD_Language,AD_Field_ID, Description,Help,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Field_ID, t.Description,t.Help,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Field t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Field_ID=561194 AND NOT EXISTS (SELECT 1 FROM AD_Field_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Field_ID=t.AD_Field_ID)
;
-- 2017-12-20T17:46:26.793
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_Field (AD_Client_ID,AD_Column_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,ColumnDisplayLength,Created,CreatedBy,DisplayLength,EntityType,IncludedTabHeight,IsActive,IsCentrallyMaintained,IsDisplayed,IsDisplayedGrid,IsEncrypted,IsFieldOnly,IsHeading,IsReadOnly,IsSameLine,Name,SeqNo,SpanX,SpanY,Updated,UpdatedBy) VALUES (0,558329,561195,0,540908,0,TO_TIMESTAMP('2017-12-20 17:46:26','YYYY-MM-DD HH24:MI:SS'),100,1,'de.metas.vertical.pharma',0,'Y','Y','Y','Y','N','N','N','N','Y','Price List UVP',465,1,1,TO_TIMESTAMP('2017-12-20 17:46:26','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 2017-12-20T17:46:26.794
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_Field_Trl (AD_Language,AD_Field_ID, Description,Help,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Field_ID, t.Description,t.Help,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Field t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Field_ID=561195 AND NOT EXISTS (SELECT 1 FROM AD_Field_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Field_ID=t.AD_Field_ID)
;
-- 2017-12-20T17:46:45.256
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_Field (AD_Client_ID,AD_Column_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,ColumnDisplayLength,Created,CreatedBy,DisplayLength,EntityType,IncludedTabHeight,IsActive,IsCentrallyMaintained,IsDisplayed,IsDisplayedGrid,IsEncrypted,IsFieldOnly,IsHeading,IsReadOnly,IsSameLine,Name,SeqNo,SpanX,SpanY,Updated,UpdatedBy) VALUES (0,558330,561196,0,540908,0,TO_TIMESTAMP('2017-12-20 17:46:45','YYYY-MM-DD HH24:MI:SS'),100,1,'de.metas.vertical.pharma',0,'Y','Y','Y','Y','N','N','N','N','Y','Price List ZBV',475,1,1,TO_TIMESTAMP('2017-12-20 17:46:45','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 2017-12-20T17:46:45.259
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_Field_Trl (AD_Language,AD_Field_ID, Description,Help,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Field_ID, t.Description,t.Help,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Field t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Field_ID=561196 AND NOT EXISTS (SELECT 1 FROM AD_Field_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Field_ID=t.AD_Field_ID)
;
-- 2017-12-20T17:47:22.714
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Field SET AD_FieldGroup_ID=540074,Updated=TO_TIMESTAMP('2017-12-20 17:47:22','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=561196
;
-- 2017-12-20T17:47:31.423
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Field SET AD_FieldGroup_ID=540074,Updated=TO_TIMESTAMP('2017-12-20 17:47:31','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=560839
;
-- 2017-12-20T17:47:34.487
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Field SET AD_FieldGroup_ID=540074,Updated=TO_TIMESTAMP('2017-12-20 17:47:34','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=560840
;
-- 2017-12-20T17:47:37.416
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Field SET AD_FieldGroup_ID=540074,Updated=TO_TIMESTAMP('2017-12-20 17:47:37','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=561191
;
-- 2017-12-20T17:47:40.587
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Field SET AD_FieldGroup_ID=540074,Updated=TO_TIMESTAMP('2017-12-20 17:47:40','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=560841
;
-- 2017-12-20T17:47:43.521
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Field SET AD_FieldGroup_ID=540074,Updated=TO_TIMESTAMP('2017-12-20 17:47:43','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=561192
;
-- 2017-12-20T17:47:46.729
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Field SET AD_FieldGroup_ID=540074,Updated=TO_TIMESTAMP('2017-12-20 17:47:46','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=560842
;
-- 2017-12-20T17:47:50.912
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Field SET AD_FieldGroup_ID=540074,Updated=TO_TIMESTAMP('2017-12-20 17:47:50','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=561193
;
-- 2017-12-20T17:47:54.202
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Field SET AD_FieldGroup_ID=540074,Updated=TO_TIMESTAMP('2017-12-20 17:47:54','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=560843
;
-- 2017-12-20T17:47:57.539
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Field SET AD_FieldGroup_ID=540074,Updated=TO_TIMESTAMP('2017-12-20 17:47:57','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=561194
;
-- 2017-12-20T17:48:02.612
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Field SET AD_FieldGroup_ID=540074,Updated=TO_TIMESTAMP('2017-12-20 17:48:02','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=560844
;
-- 2017-12-20T17:48:06.031
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Field SET AD_FieldGroup_ID=540074,Updated=TO_TIMESTAMP('2017-12-20 17:48:06','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=561195
;
-- 2017-12-20T17:48:10.224
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Field SET AD_FieldGroup_ID=540074,Updated=TO_TIMESTAMP('2017-12-20 17:48:10','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=560845
;
-- 2017-12-20T17:48:32.421
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Field SET AD_FieldGroup_ID=540074,Updated=TO_TIMESTAMP('2017-12-20 17:48:32','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=560846
;
-- 2017-12-20T17:48:36.771
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Field SET AD_FieldGroup_ID=540074,Updated=TO_TIMESTAMP('2017-12-20 17:48:36','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=560847
;
-- 2017-12-20T17:48:39.659
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Field SET AD_FieldGroup_ID=540074,Updated=TO_TIMESTAMP('2017-12-20 17:48:39','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=560848
;
-- 2017-12-20T17:48:42.895
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Field SET AD_FieldGroup_ID=540074,Updated=TO_TIMESTAMP('2017-12-20 17:48:42','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=560849
;
-- 2017-12-20T17:48:47.282
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Field SET AD_FieldGroup_ID=540074,Updated=TO_TIMESTAMP('2017-12-20 17:48:47','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=560850
;
-- 2017-12-20T17:48:50.299
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Field SET AD_FieldGroup_ID=540074,Updated=TO_TIMESTAMP('2017-12-20 17:48:50','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=560851
;
-- 2017-12-20T17:48:53.321
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Field SET AD_FieldGroup_ID=540074,Updated=TO_TIMESTAMP('2017-12-20 17:48:53','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=560852
;
-- 2017-12-20T17:48:56.314
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Field SET AD_FieldGroup_ID=540074,Updated=TO_TIMESTAMP('2017-12-20 17:48:56','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=560853
;
-- 2017-12-20T17:48:59.434
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Field SET AD_FieldGroup_ID=540074,Updated=TO_TIMESTAMP('2017-12-20 17:48:59','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=560854
;
-- 2017-12-20T17:49:07.338
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Field SET AD_FieldGroup_ID=540074,Updated=TO_TIMESTAMP('2017-12-20 17:49:07','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=560855
;
-- 2017-12-20T17:49:10.031
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Field SET AD_FieldGroup_ID=540074,Updated=TO_TIMESTAMP('2017-12-20 17:49:10','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=560856
;
-- 2017-12-20T17:49:14.039
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Field SET AD_FieldGroup_ID=540074,Updated=TO_TIMESTAMP('2017-12-20 17:49:14','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=560857
;
-- 2017-12-20T17:49:17.380
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Field SET AD_FieldGroup_ID=540074,Updated=TO_TIMESTAMP('2017-12-20 17:49:17','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=560858
;
-- 2017-12-20T17:49:20.480
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Field SET AD_FieldGroup_ID=540074,Updated=TO_TIMESTAMP('2017-12-20 17:49:20','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=560859
;
-- 2017-12-20T17:49:23.093
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Field SET AD_FieldGroup_ID=540074,Updated=TO_TIMESTAMP('2017-12-20 17:49:23','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=560860
;
-- 2017-12-20T17:49:30.627
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Field SET AD_FieldGroup_ID=540074,Updated=TO_TIMESTAMP('2017-12-20 17:49:30','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=560861
;
-------------
-- 2017-12-21T16:30:50.326
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_Column (AD_Client_ID,AD_Column_ID,AD_Element_ID,AD_Org_ID,AD_Reference_ID,AD_Table_ID,AllowZoomTo,ColumnName,Created,CreatedBy,DDL_NoForeignKey,Description,EntityType,FieldLength,Help,IsActive,IsAdvancedText,IsAllowLogging,IsAlwaysUpdateable,IsAutocomplete,IsCalculated,IsDimension,IsDLMPartitionBoundary,IsEncrypted,IsGenericZoomKeyColumn,IsGenericZoomOrigin,IsIdentifier,IsKey,IsLazyLoading,IsMandatory,IsParent,IsRangeFilter,IsSelectionColumn,IsShowFilterIncrementButtons,IsStaleable,IsSyncDatabase,IsTranslated,IsUpdateable,IsUseDocSequence,Name,SelectionColumnSeqNo,SeqNo,Updated,UpdatedBy,Version) VALUES (0,558400,211,0,19,540880,'N','C_TaxCategory_ID',TO_TIMESTAMP('2017-12-21 16:30:49','YYYY-MM-DD HH24:MI:SS'),100,'N','Steuerkategorie','de.metas.vertical.pharma',10,'Die Steuerkategorie hilft, ähnliche Steuern zu gruppieren. Z.B. Verkaufssteuer oder Mehrwertsteuer.
','Y','N','Y','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','Y','N','Steuerkategorie',0,0,TO_TIMESTAMP('2017-12-21 16:30:49','YYYY-MM-DD HH24:MI:SS'),100,0)
;
-- 2017-12-21T16:30:50.331
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=558400 AND NOT EXISTS (SELECT 1 FROM AD_Column_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Column_ID=t.AD_Column_ID)
;
-- 2017-12-21T16:30:52.268
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
/* DDL */ SELECT public.db_alter_table('I_Pharma_Product','ALTER TABLE public.I_Pharma_Product ADD COLUMN C_TaxCategory_ID NUMERIC(10)')
;
-- 2017-12-21T16:30:52.296
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
ALTER TABLE I_Pharma_Product ADD CONSTRAINT CTaxCategory_IPharmaProduct FOREIGN KEY (C_TaxCategory_ID) REFERENCES public.C_TaxCategory DEFERRABLE INITIALLY DEFERRED
;
-- 2017-12-21T16:31:56.164
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_Field (AD_Client_ID,AD_Column_ID,AD_Field_ID,AD_FieldGroup_ID,AD_Org_ID,AD_Tab_ID,ColumnDisplayLength,Created,CreatedBy,DisplayLength,EntityType,IncludedTabHeight,IsActive,IsDisplayed,IsDisplayedGrid,IsEncrypted,IsFieldOnly,IsHeading,IsReadOnly,IsSameLine,Name,SeqNo,SpanX,SpanY,Updated,UpdatedBy) VALUES (0,558400,561232,540074,0,540908,0,TO_TIMESTAMP('2017-12-21 16:31:56','YYYY-MM-DD HH24:MI:SS'),100,2,'de.metas.vertical.pharma',0,'Y','Y','Y','N','N','N','N','Y','Steuerkategorie',575,1,1,TO_TIMESTAMP('2017-12-21 16:31:56','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 2017-12-21T16:31:56.166
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_Field_Trl (AD_Language,AD_Field_ID, Description,Help,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Field_ID, t.Description,t.Help,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Field t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Field_ID=561232 AND NOT EXISTS (SELECT 1 FROM AD_Field_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Field_ID=t.AD_Field_ID)
;
-- 2017-12-21T16:57:38.366
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_Reference (AD_Client_ID,AD_Org_ID,AD_Reference_ID,Created,CreatedBy,EntityType,IsActive,IsOrderByValue,Name,Updated,UpdatedBy,ValidationType) VALUES (0,0,540801,TO_TIMESTAMP('2017-12-21 16:57:38','YYYY-MM-DD HH24:MI:SS'),100,'de.metas.vertical.pharma','Y','N','Pharma_Tax',TO_TIMESTAMP('2017-12-21 16:57:38','YYYY-MM-DD HH24:MI:SS'),100,'L')
;
-- 2017-12-21T16:57:38.368
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_Reference_Trl (AD_Language,AD_Reference_ID, Description,Help,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Reference_ID, t.Description,t.Help,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Reference t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Reference_ID=540801 AND NOT EXISTS (SELECT 1 FROM AD_Reference_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Reference_ID=t.AD_Reference_ID)
;
-- 2017-12-21T16:58:33.513
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_Ref_List (AD_Client_ID,AD_Org_ID,AD_Ref_List_ID,AD_Reference_ID,Created,CreatedBy,EntityType,IsActive,Name,Updated,UpdatedBy,Value,ValueName) VALUES (0,0,541506,540801,TO_TIMESTAMP('2017-12-21 16:58:33','YYYY-MM-DD HH24:MI:SS'),100,'de.metas.vertical.pharma','Y','voll',TO_TIMESTAMP('2017-12-21 16:58:33','YYYY-MM-DD HH24:MI:SS'),100,'00','00')
;
-- 2017-12-21T16:58:33.519
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_Ref_List_Trl (AD_Language,AD_Ref_List_ID, Description,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Ref_List_ID, t.Description,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Ref_List t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Ref_List_ID=541506 AND NOT EXISTS (SELECT 1 FROM AD_Ref_List_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Ref_List_ID=t.AD_Ref_List_ID)
;
-- 2017-12-21T16:58:52.020
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_Ref_List (AD_Client_ID,AD_Org_ID,AD_Ref_List_ID,AD_Reference_ID,Created,CreatedBy,Description,EntityType,IsActive,Name,Updated,UpdatedBy,Value,ValueName) VALUES (0,0,541507,540801,TO_TIMESTAMP('2017-12-21 16:58:51','YYYY-MM-DD HH24:MI:SS'),100,'','de.metas.vertical.pharma','Y','ermäßigt',TO_TIMESTAMP('2017-12-21 16:58:51','YYYY-MM-DD HH24:MI:SS'),100,'01','01')
;
-- 2017-12-21T16:58:52.021
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_Ref_List_Trl (AD_Language,AD_Ref_List_ID, Description,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Ref_List_ID, t.Description,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Ref_List t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Ref_List_ID=541507 AND NOT EXISTS (SELECT 1 FROM AD_Ref_List_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Ref_List_ID=t.AD_Ref_List_ID)
;
-- 2017-12-21T16:59:04.366
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_Ref_List (AD_Client_ID,AD_Org_ID,AD_Ref_List_ID,AD_Reference_ID,Created,CreatedBy,EntityType,IsActive,Name,Updated,UpdatedBy,Value,ValueName) VALUES (0,0,541508,540801,TO_TIMESTAMP('2017-12-21 16:59:04','YYYY-MM-DD HH24:MI:SS'),100,'de.metas.vertical.pharma','Y','ohne',TO_TIMESTAMP('2017-12-21 16:59:04','YYYY-MM-DD HH24:MI:SS'),100,'02','02')
;
-- 2017-12-21T16:59:04.368
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_Ref_List_Trl (AD_Language,AD_Ref_List_ID, Description,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Ref_List_ID, t.Description,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Ref_List t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Ref_List_ID=541508 AND NOT EXISTS (SELECT 1 FROM AD_Ref_List_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Ref_List_ID=t.AD_Ref_List_ID)
;
-- 2017-12-21T16:59:18.577
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Column SET AD_Reference_ID=17, AD_Reference_Value_ID=540801,Updated=TO_TIMESTAMP('2017-12-21 16:59:18','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=558189
; | the_stack |
-- CLean-up
delete from holiday;
-- 2014 - Baden Württemberg
insert into holiday (id, day, name, federalstate) values (1, '2014-01-01', 'Neujahr', 'BADEN_WUERTTEMBERG');
insert into holiday (id, day, name, federalstate) values (2, '2014-01-06', 'Heilige Drei Könige', 'BADEN_WUERTTEMBERG');
insert into holiday (id, day, name, federalstate) values (3, '2014-04-18', 'Karfreitag', 'BADEN_WUERTTEMBERG');
insert into holiday (id, day, name, federalstate) values (4, '2014-04-21', 'Ostermontag', 'BADEN_WUERTTEMBERG');
insert into holiday (id, day, name, federalstate) values (5, '2014-05-01', 'Tag der Arbeit', 'BADEN_WUERTTEMBERG');
insert into holiday (id, day, name, federalstate) values (6, '2014-05-29', 'Christi Himmelfahrt', 'BADEN_WUERTTEMBERG');
insert into holiday (id, day, name, federalstate) values (7, '2014-06-09', 'Pfingstmontag', 'BADEN_WUERTTEMBERG');
insert into holiday (id, day, name, federalstate) values (8, '2014-06-19', 'Fronleichnam', 'BADEN_WUERTTEMBERG');
insert into holiday (id, day, name, federalstate) values (9, '2014-10-03', 'Tag der Deutschen Einheit', 'BADEN_WUERTTEMBERG');
insert into holiday (id, day, name, federalstate) values (10, '2014-11-01', 'Allerheiligen', 'BADEN_WUERTTEMBERG');
insert into holiday (id, day, name, federalstate) values (11, '2014-12-25', '1. Weihnachtstag', 'BADEN_WUERTTEMBERG');
insert into holiday (id, day, name, federalstate) values (12, '2014-12-26', '2. Weihnachtstag', 'BADEN_WUERTTEMBERG');
-- 2014 - Bayern
insert into holiday (id, day, name, federalstate) values (13, '2014-01-01', 'Neujahr', 'BAYERN');
insert into holiday (id, day, name, federalstate) values (14, '2014-01-06', 'Heilige Drei Könige', 'BAYERN');
insert into holiday (id, day, name, federalstate) values (15, '2014-04-18', 'Karfreitag', 'BAYERN');
insert into holiday (id, day, name, federalstate) values (16, '2014-04-21', 'Ostermontag', 'BAYERN');
insert into holiday (id, day, name, federalstate) values (17, '2014-05-01', 'Tag der Arbeit', 'BAYERN');
insert into holiday (id, day, name, federalstate) values (18, '2014-05-29', 'Christi Himmelfahrt', 'BAYERN');
insert into holiday (id, day, name, federalstate) values (19, '2014-06-09', 'Pfingstmontag', 'BAYERN');
insert into holiday (id, day, name, federalstate) values (20, '2014-06-19', 'Fronleichnam', 'BAYERN');
insert into holiday (id, day, name, federalstate) values (21, '2014-08-15', 'Mariä Himmelfahrt', 'BAYERN');
insert into holiday (id, day, name, federalstate) values (22, '2014-10-03', 'Tag der Deutschen Einheit', 'BAYERN');
insert into holiday (id, day, name, federalstate) values (23, '2014-11-01', 'Allerheiligen', 'BAYERN');
insert into holiday (id, day, name, federalstate) values (24, '2014-12-25', '1. Weihnachtstag', 'BAYERN');
insert into holiday (id, day, name, federalstate) values (25, '2014-12-26', '2. Weihnachtstag', 'BAYERN');
-- 2014 - Berlin
insert into holiday (id, day, name, federalstate) values (26, '2014-01-01', 'Neujahr', 'BERLIN');
insert into holiday (id, day, name, federalstate) values (27, '2014-04-18', 'Karfreitag', 'BERLIN');
insert into holiday (id, day, name, federalstate) values (28, '2014-04-21', 'Ostermontag', 'BERLIN');
insert into holiday (id, day, name, federalstate) values (29, '2014-05-01', 'Tag der Arbeit', 'BERLIN');
insert into holiday (id, day, name, federalstate) values (30, '2014-05-29', 'Christi Himmelfahrt', 'BERLIN');
insert into holiday (id, day, name, federalstate) values (31, '2014-06-09', 'Pfingstmontag', 'BERLIN');
insert into holiday (id, day, name, federalstate) values (32, '2014-10-03', 'Tag der Deutschen Einheit', 'BERLIN');
insert into holiday (id, day, name, federalstate) values (33, '2014-12-25', '1. Weihnachtstag', 'BERLIN');
insert into holiday (id, day, name, federalstate) values (34, '2014-12-26', '2. Weihnachtstag', 'BERLIN');
-- 2014 - Brandenburg
insert into holiday (id, day, name, federalstate) values (35, '2014-01-01', 'Neujahr', 'BRANDENBURG');
insert into holiday (id, day, name, federalstate) values (36, '2014-04-18', 'Karfreitag', 'BRANDENBURG');
insert into holiday (id, day, name, federalstate) values (37, '2014-04-21', 'Ostermontag', 'BRANDENBURG');
insert into holiday (id, day, name, federalstate) values (38, '2014-05-01', 'Tag der Arbeit', 'BRANDENBURG');
insert into holiday (id, day, name, federalstate) values (39, '2014-05-29', 'Christi Himmelfahrt', 'BRANDENBURG');
insert into holiday (id, day, name, federalstate) values (40, '2014-06-09', 'Pfingstmontag', 'BRANDENBURG');
insert into holiday (id, day, name, federalstate) values (41, '2014-10-03', 'Tag der Deutschen Einheit', 'BRANDENBURG');
insert into holiday (id, day, name, federalstate) values (42, '2014-10-31', 'Reformationstag', 'BRANDENBURG');
insert into holiday (id, day, name, federalstate) values (43, '2014-12-25', '1. Weihnachtstag', 'BRANDENBURG');
insert into holiday (id, day, name, federalstate) values (44, '2014-12-26', '2. Weihnachtstag', 'BRANDENBURG');
-- 2014 - Bremen
insert into holiday (id, day, name, federalstate) values (45, '2014-01-01', 'Neujahr', 'BREMEN');
insert into holiday (id, day, name, federalstate) values (46, '2014-04-18', 'Karfreitag', 'BREMEN');
insert into holiday (id, day, name, federalstate) values (47, '2014-04-21', 'Ostermontag', 'BREMEN');
insert into holiday (id, day, name, federalstate) values (48, '2014-05-01', 'Tag der Arbeit', 'BREMEN');
insert into holiday (id, day, name, federalstate) values (49, '2014-05-29', 'Christi Himmelfahrt', 'BREMEN');
insert into holiday (id, day, name, federalstate) values (50, '2014-06-09', 'Pfingstmontag', 'BREMEN');
insert into holiday (id, day, name, federalstate) values (51, '2014-10-03', 'Tag der Deutschen Einheit', 'BREMEN');
insert into holiday (id, day, name, federalstate) values (52, '2014-12-25', '1. Weihnachtstag', 'BREMEN');
insert into holiday (id, day, name, federalstate) values (53, '2014-12-26', '2. Weihnachtstag', 'BREMEN');
-- 2014 - Hamburg
insert into holiday (id, day, name, federalstate) values (54, '2014-01-01', 'Neujahr', 'HAMBURG');
insert into holiday (id, day, name, federalstate) values (55, '2014-04-18', 'Karfreitag', 'HAMBURG');
insert into holiday (id, day, name, federalstate) values (56, '2014-04-21', 'Ostermontag', 'HAMBURG');
insert into holiday (id, day, name, federalstate) values (57, '2014-05-01', 'Tag der Arbeit', 'HAMBURG');
insert into holiday (id, day, name, federalstate) values (58, '2014-05-29', 'Christi Himmelfahrt', 'HAMBURG');
insert into holiday (id, day, name, federalstate) values (59, '2014-06-09', 'Pfingstmontag', 'HAMBURG');
insert into holiday (id, day, name, federalstate) values (60, '2014-10-03', 'Tag der Deutschen Einheit', 'HAMBURG');
insert into holiday (id, day, name, federalstate) values (61, '2014-12-25', '1. Weihnachtstag', 'HAMBURG');
insert into holiday (id, day, name, federalstate) values (62, '2014-12-26', '2. Weihnachtstag', 'HAMBURG');
-- 2014 - Hessen
insert into holiday (id, day, name, federalstate) values (63, '2014-01-01', 'Neujahr', 'HESSEN');
insert into holiday (id, day, name, federalstate) values (64, '2014-04-18', 'Karfreitag', 'HESSEN');
insert into holiday (id, day, name, federalstate) values (65, '2014-04-21', 'Ostermontag', 'HESSEN');
insert into holiday (id, day, name, federalstate) values (66, '2014-05-01', 'Tag der Arbeit', 'HESSEN');
insert into holiday (id, day, name, federalstate) values (67, '2014-05-29', 'Christi Himmelfahrt', 'HESSEN');
insert into holiday (id, day, name, federalstate) values (68, '2014-06-09', 'Pfingstmontag', 'HESSEN');
insert into holiday (id, day, name, federalstate) values (69, '2014-06-19', 'Fronleichnam', 'HESSEN');
insert into holiday (id, day, name, federalstate) values (70, '2014-10-03', 'Tag der Deutschen Einheit', 'HESSEN');
insert into holiday (id, day, name, federalstate) values (71, '2014-12-25', '1. Weihnachtstag', 'HESSEN');
insert into holiday (id, day, name, federalstate) values (72, '2014-12-26', '2. Weihnachtstag', 'HESSEN');
-- 2014 - Mecklenburg-Vorpommern
insert into holiday (id, day, name, federalstate) values (73, '2014-01-01', 'Neujahr', 'MECKLENBURG_VORPOMMERN');
insert into holiday (id, day, name, federalstate) values (74, '2014-04-18', 'Karfreitag', 'MECKLENBURG_VORPOMMERN');
insert into holiday (id, day, name, federalstate) values (75, '2014-04-21', 'Ostermontag', 'MECKLENBURG_VORPOMMERN');
insert into holiday (id, day, name, federalstate) values (76, '2014-05-01', 'Tag der Arbeit', 'MECKLENBURG_VORPOMMERN');
insert into holiday (id, day, name, federalstate) values (77, '2014-05-29', 'Christi Himmelfahrt', 'MECKLENBURG_VORPOMMERN');
insert into holiday (id, day, name, federalstate) values (78, '2014-06-09', 'Pfingstmontag', 'MECKLENBURG_VORPOMMERN');
insert into holiday (id, day, name, federalstate) values (79, '2014-10-03', 'Tag der Deutschen Einheit', 'MECKLENBURG_VORPOMMERN');
insert into holiday (id, day, name, federalstate) values (80, '2014-10-31', 'Reformationstag', 'MECKLENBURG_VORPOMMERN');
insert into holiday (id, day, name, federalstate) values (81, '2014-12-25', '1. Weihnachtstag', 'MECKLENBURG_VORPOMMERN');
insert into holiday (id, day, name, federalstate) values (82, '2014-12-26', '2. Weihnachtstag', 'MECKLENBURG_VORPOMMERN');
-- 2014 - Niedersachsen
insert into holiday (id, day, name, federalstate) values (83, '2014-01-01', 'Neujahr', 'NIEDERSACHSEN');
insert into holiday (id, day, name, federalstate) values (84, '2014-04-18', 'Karfreitag', 'NIEDERSACHSEN');
insert into holiday (id, day, name, federalstate) values (85, '2014-04-21', 'Ostermontag', 'NIEDERSACHSEN');
insert into holiday (id, day, name, federalstate) values (86, '2014-05-01', 'Tag der Arbeit', 'NIEDERSACHSEN');
insert into holiday (id, day, name, federalstate) values (87, '2014-05-29', 'Christi Himmelfahrt', 'NIEDERSACHSEN');
insert into holiday (id, day, name, federalstate) values (88, '2014-06-09', 'Pfingstmontag', 'NIEDERSACHSEN');
insert into holiday (id, day, name, federalstate) values (89, '2014-10-03', 'Tag der Deutschen Einheit', 'NIEDERSACHSEN');
insert into holiday (id, day, name, federalstate) values (90, '2014-12-25', '1. Weihnachtstag', 'NIEDERSACHSEN');
insert into holiday (id, day, name, federalstate) values (91, '2014-12-26', '2. Weihnachtstag', 'NIEDERSACHSEN');
-- 2014 - Nordrhein-Westfalen
insert into holiday (id, day, name, federalstate) values (92, '2014-01-01', 'Neujahr', 'NORDRHEIN_WESTFALEN');
insert into holiday (id, day, name, federalstate) values (93, '2014-04-18', 'Karfreitag', 'NORDRHEIN_WESTFALEN');
insert into holiday (id, day, name, federalstate) values (94, '2014-04-21', 'Ostermontag', 'NORDRHEIN_WESTFALEN');
insert into holiday (id, day, name, federalstate) values (95, '2014-05-01', 'Tag der Arbeit', 'NORDRHEIN_WESTFALEN');
insert into holiday (id, day, name, federalstate) values (96, '2014-05-29', 'Christi Himmelfahrt', 'NORDRHEIN_WESTFALEN');
insert into holiday (id, day, name, federalstate) values (97, '2014-06-09', 'Pfingstmontag', 'NORDRHEIN_WESTFALEN');
insert into holiday (id, day, name, federalstate) values (98, '2014-06-19', 'Fronleichnam', 'NORDRHEIN_WESTFALEN');
insert into holiday (id, day, name, federalstate) values (99, '2014-10-03', 'Tag der Deutschen Einheit', 'NORDRHEIN_WESTFALEN');
insert into holiday (id, day, name, federalstate) values (100, '2014-11-01', 'Allerheiligen', 'NORDRHEIN_WESTFALEN');
insert into holiday (id, day, name, federalstate) values (101, '2014-12-25', '1. Weihnachtstag', 'NORDRHEIN_WESTFALEN');
insert into holiday (id, day, name, federalstate) values (102, '2014-12-26', '2. Weihnachtstag', 'NORDRHEIN_WESTFALEN');
-- 2014 - Rheinland-Pfalz
insert into holiday (id, day, name, federalstate) values (103, '2014-01-01', 'Neujahr', 'RHEINLAND_PFALZ');
insert into holiday (id, day, name, federalstate) values (104, '2014-04-18', 'Karfreitag', 'RHEINLAND_PFALZ');
insert into holiday (id, day, name, federalstate) values (105, '2014-04-21', 'Ostermontag', 'RHEINLAND_PFALZ');
insert into holiday (id, day, name, federalstate) values (106, '2014-05-01', 'Tag der Arbeit', 'RHEINLAND_PFALZ');
insert into holiday (id, day, name, federalstate) values (107, '2014-05-29', 'Christi Himmelfahrt', 'RHEINLAND_PFALZ');
insert into holiday (id, day, name, federalstate) values (108, '2014-06-09', 'Pfingstmontag', 'RHEINLAND_PFALZ');
insert into holiday (id, day, name, federalstate) values (109, '2014-06-19', 'Fronleichnam', 'RHEINLAND_PFALZ');
insert into holiday (id, day, name, federalstate) values (110, '2014-10-03', 'Tag der Deutschen Einheit', 'RHEINLAND_PFALZ');
insert into holiday (id, day, name, federalstate) values (111, '2014-11-01', 'Allerheiligen', 'RHEINLAND_PFALZ');
insert into holiday (id, day, name, federalstate) values (112, '2014-12-25', '1. Weihnachtstag', 'RHEINLAND_PFALZ');
insert into holiday (id, day, name, federalstate) values (113, '2014-12-26', '2. Weihnachtstag', 'RHEINLAND_PFALZ');
-- 2014 - Saarland
insert into holiday (id, day, name, federalstate) values (114, '2014-01-01', 'Neujahr', 'SAARLAND');
insert into holiday (id, day, name, federalstate) values (115, '2014-04-18', 'Karfreitag', 'SAARLAND');
insert into holiday (id, day, name, federalstate) values (116, '2014-04-21', 'Ostermontag', 'SAARLAND');
insert into holiday (id, day, name, federalstate) values (117, '2014-05-01', 'Tag der Arbeit', 'SAARLAND');
insert into holiday (id, day, name, federalstate) values (118, '2014-05-29', 'Christi Himmelfahrt', 'SAARLAND');
insert into holiday (id, day, name, federalstate) values (119, '2014-06-09', 'Pfingstmontag', 'SAARLAND');
insert into holiday (id, day, name, federalstate) values (120, '2014-06-19', 'Fronleichnam', 'SAARLAND');
insert into holiday (id, day, name, federalstate) values (121, '2014-08-15', 'Mariä Himmelfahrt', 'SAARLAND');
insert into holiday (id, day, name, federalstate) values (122, '2014-10-03', 'Tag der Deutschen Einheit', 'SAARLAND');
insert into holiday (id, day, name, federalstate) values (123, '2014-11-01', 'Allerheiligen', 'SAARLAND');
insert into holiday (id, day, name, federalstate) values (124, '2014-12-25', '1. Weihnachtstag', 'SAARLAND');
insert into holiday (id, day, name, federalstate) values (125, '2014-12-26', '2. Weihnachtstag', 'SAARLAND');
-- 2014 - Sachsen
insert into holiday (id, day, name, federalstate) values (126, '2014-01-01', 'Neujahr', 'SACHSEN');
insert into holiday (id, day, name, federalstate) values (127, '2014-04-18', 'Karfreitag', 'SACHSEN');
insert into holiday (id, day, name, federalstate) values (128, '2014-04-21', 'Ostermontag', 'SACHSEN');
insert into holiday (id, day, name, federalstate) values (129, '2014-05-01', 'Tag der Arbeit', 'SACHSEN');
insert into holiday (id, day, name, federalstate) values (130, '2014-05-29', 'Christi Himmelfahrt', 'SACHSEN');
insert into holiday (id, day, name, federalstate) values (131, '2014-06-09', 'Pfingstmontag', 'SACHSEN');
insert into holiday (id, day, name, federalstate) values (132, '2014-10-03', 'Tag der Deutschen Einheit', 'SACHSEN');
insert into holiday (id, day, name, federalstate) values (133, '2014-10-31', 'Reformationstag', 'SACHSEN');
insert into holiday (id, day, name, federalstate) values (134, '2014-11-19', 'Buß- und Bettag', 'SACHSEN');
insert into holiday (id, day, name, federalstate) values (135, '2014-12-25', '1. Weihnachtstag', 'SACHSEN');
insert into holiday (id, day, name, federalstate) values (136, '2014-12-26', '2. Weihnachtstag', 'SACHSEN');
-- 2014 - Sachsen-Anhalt
insert into holiday (id, day, name, federalstate) values (137, '2014-01-01', 'Neujahr', 'SACHSEN_ANHALT');
insert into holiday (id, day, name, federalstate) values (138, '2014-01-06', 'Helige Drei Könige', 'SACHSEN_ANHALT');
insert into holiday (id, day, name, federalstate) values (139, '2014-04-18', 'Karfreitag', 'SACHSEN_ANHALT');
insert into holiday (id, day, name, federalstate) values (140, '2014-04-21', 'Ostermontag', 'SACHSEN_ANHALT');
insert into holiday (id, day, name, federalstate) values (141, '2014-05-01', 'Tag der Arbeit', 'SACHSEN_ANHALT');
insert into holiday (id, day, name, federalstate) values (142, '2014-05-29', 'Christi Himmelfahrt', 'SACHSEN_ANHALT');
insert into holiday (id, day, name, federalstate) values (143, '2014-06-09', 'Pfingstmontag', 'SACHSEN_ANHALT');
insert into holiday (id, day, name, federalstate) values (144, '2014-10-03', 'Tag der Deutschen Einheit', 'SACHSEN_ANHALT');
insert into holiday (id, day, name, federalstate) values (145, '2014-10-31', 'Reformationstag', 'SACHSEN_ANHALT');
insert into holiday (id, day, name, federalstate) values (146, '2014-12-25', '1. Weihnachtstag', 'SACHSEN_ANHALT');
insert into holiday (id, day, name, federalstate) values (147, '2014-12-26', '2. Weihnachtstag', 'SACHSEN_ANHALT');
-- 2014 - Schleswig-Holstein
insert into holiday (id, day, name, federalstate) values (148, '2014-01-01', 'Neujahr', 'SCHLESWIG_HOLSTEIN');
insert into holiday (id, day, name, federalstate) values (149, '2014-04-18', 'Karfreitag', 'SCHLESWIG_HOLSTEIN');
insert into holiday (id, day, name, federalstate) values (150, '2014-04-21', 'Ostermontag', 'SCHLESWIG_HOLSTEIN');
insert into holiday (id, day, name, federalstate) values (151, '2014-05-01', 'Tag der Arbeit', 'SCHLESWIG_HOLSTEIN');
insert into holiday (id, day, name, federalstate) values (152, '2014-05-29', 'Christi Himmelfahrt', 'SCHLESWIG_HOLSTEIN');
insert into holiday (id, day, name, federalstate) values (153, '2014-06-09', 'Pfingstmontag', 'SCHLESWIG_HOLSTEIN');
insert into holiday (id, day, name, federalstate) values (154, '2014-10-03', 'Tag der Deutschen Einheit', 'SCHLESWIG_HOLSTEIN');
insert into holiday (id, day, name, federalstate) values (155, '2014-12-25', '1. Weihnachtstag', 'SCHLESWIG_HOLSTEIN');
insert into holiday (id, day, name, federalstate) values (156, '2014-12-26', '2. Weihnachtstag', 'SCHLESWIG_HOLSTEIN');
-- 2014 - Thüringen
insert into holiday (id, day, name, federalstate) values (157, '2014-01-01', 'Neujahr', 'THUERINGEN');
insert into holiday (id, day, name, federalstate) values (158, '2014-04-18', 'Karfreitag', 'THUERINGEN');
insert into holiday (id, day, name, federalstate) values (159, '2014-04-21', 'Ostermontag', 'THUERINGEN');
insert into holiday (id, day, name, federalstate) values (160, '2014-05-01', 'Tag der Arbeit', 'THUERINGEN');
insert into holiday (id, day, name, federalstate) values (161, '2014-05-29', 'Christi Himmelfahrt', 'THUERINGEN');
insert into holiday (id, day, name, federalstate) values (162, '2014-06-09', 'Pfingstmontag', 'THUERINGEN');
insert into holiday (id, day, name, federalstate) values (163, '2014-10-03', 'Tag der Deutschen Einheit', 'THUERINGEN');
insert into holiday (id, day, name, federalstate) values (164, '2014-10-31', 'Tag der Deutschen Einheit', 'THUERINGEN');
insert into holiday (id, day, name, federalstate) values (165, '2014-12-25', 'Reformationstag', 'THUERINGEN');
insert into holiday (id, day, name, federalstate) values (166, '2014-12-26', '2. Weihnachtstag', 'THUERINGEN'); | the_stack |
--
-- Generated by tidycat
--
CREATE TABLE gp_interfaces
(
interfaceid smallint,
address name,
status smallint
);
CREATE TABLE gp_db_interfaces
(
dbid smallint,
interfaceid smallint,
priority smallint
);
CREATE TABLE gp_configuration
(
content smallint,
definedprimary boolean,
dbid smallint,
isprimary boolean,
valid boolean,
hostname name,
port integer,
datadir text
);
CREATE TABLE gp_configuration_history
(
time timestamp with time zone,
dbid smallint,
"desc" text
);
CREATE TABLE gp_fastsequence
(
objid oid,
objmod bigint,
last_sequence bigint
);
CREATE TABLE gp_global_sequence
(
sequence_num bigint
);
CREATE TABLE gp_id
(
gpname name ,
numsegments smallint ,
dbid smallint ,
content smallint
);
CREATE TABLE gp_master_mirroring
(
summary_state text,
detail_state text,
log_time timestamp with time zone,
error_message text
);
CREATE TABLE gp_persistent_tablespace_node
(
filespace_oid oid ,
tablespace_oid oid ,
persistent_state smallint ,
create_mirror_data_loss_tracking_session_num bigint ,
mirror_existence_state smallint ,
reserved integer ,
parent_xid integer ,
persistent_serial_num bigint ,
previous_free_tid tid
);
CREATE TABLE gp_relation_node
(
relfilenode_oid oid ,
segment_file_num integer ,
create_mirror_data_loss_tracking_session_num bigint ,
persistent_tid tid ,
persistent_serial_num bigint
);
CREATE TABLE gp_persistent_database_node
(
tablespace_oid oid ,
database_oid oid ,
persistent_state smallint ,
create_mirror_data_loss_tracking_session_num bigint ,
mirror_existence_state smallint ,
reserved integer ,
parent_xid integer ,
persistent_serial_num bigint ,
previous_free_tid tid
);
CREATE TABLE gp_persistent_relation_node
(
tablespace_oid oid ,
database_oid oid ,
relfilenode_oid oid ,
segment_file_num integer ,
relation_storage_manager smallint ,
persistent_state smallint ,
create_mirror_data_loss_tracking_session_num bigint ,
mirror_existence_state smallint ,
mirror_data_synchronization_state smallint ,
mirror_bufpool_marked_for_scan_incremental_resync boolean ,
mirror_bufpool_resync_changed_page_count bigint ,
mirror_bufpool_resync_ckpt_loc gpxlogloc ,
mirror_bufpool_resync_ckpt_block_num integer ,
mirror_append_only_loss_eof bigint ,
mirror_append_only_new_eof bigint ,
reserved integer ,
parent_xid integer ,
persistent_serial_num bigint ,
previous_free_tid tid
);
CREATE TABLE gp_persistent_filespace_node
(
filespace_oid oid ,
db_id_1 smallint ,
location_1 text ,
db_id_2 smallint ,
location_2 text ,
persistent_state smallint ,
create_mirror_data_loss_tracking_session_num bigint ,
mirror_existence_state smallint ,
reserved integer ,
parent_xid integer ,
persistent_serial_num bigint ,
previous_free_tid tid
);
CREATE TABLE gp_distribution_policy
(
localoid oid,
attrnums smallint[]
);
CREATE TABLE gp_san_configuration
(
mountid smallint ,
active_host "char" ,
san_type "char" ,
primary_host text ,
primary_mountpoint text ,
primary_device text ,
mirror_host text ,
mirror_mountpoint text ,
mirror_device text
);
CREATE TABLE gp_fault_strategy
(
fault_strategy "char"
);
CREATE TABLE gp_segment_configuration
(
dbid smallint , -- up to 32767 segment databases
content smallint , -- up to 32767 contents -- only 16384 usable with mirroring (see dbid)
role "char" ,
preferred_role "char" ,
mode "char" ,
status "char" ,
port integer ,
hostname text ,
address text ,
replication_port integer ,
san_mounts int2vector -- one or more mount-points used by this segment.
);
CREATE TABLE gp_version_at_initdb
(
schemaversion smallint ,
productversion text
);
CREATE TABLE pg_aggregate
(
aggfnoid regproc,
aggtransfn regproc,
agginvtransfn regproc, -- MPP windowing
aggprelimfn regproc, -- MPP 2-phase agg
agginvprelimfn regproc, -- MPP windowing
aggfinalfn regproc,
aggsortop oid,
aggtranstype oid,
agginitval text -- VARIABLE LENGTH FIELD
);
CREATE TABLE pg_am
(
amname name,
amstrategies smallint,
amsupport smallint,
amorderstrategy smallint,
amcanunique boolean,
amcanmulticol boolean,
amoptionalkey boolean,
amindexnulls boolean,
amstorage boolean,
amclusterable boolean,
amcanshrink boolean,
aminsert regproc,
ambeginscan regproc,
amgettuple regproc,
amgetmulti regproc,
amrescan regproc,
amendscan regproc,
ammarkpos regproc,
amrestrpos regproc,
ambuild regproc,
ambulkdelete regproc,
amvacuumcleanup regproc,
amcostestimate regproc,
amoptions regproc
);
CREATE TABLE pg_amop
(
amopclaid oid,
amopsubtype oid,
amopstrategy smallint,
amopreqcheck boolean,
amopopr oid
);
CREATE TABLE pg_amproc
(
amopclaid oid,
amprocsubtype oid,
amprocnum smallint,
amproc regproc
);
CREATE TABLE pg_appendonly
(
relid oid,
blocksize integer,
safefswritesize integer,
compresslevel smallint,
majorversion smallint,
minorversion smallint,
checksum boolean,
compresstype text,
columnstore boolean,
segrelid oid,
segidxid oid,
blkdirrelid oid,
blkdiridxid oid,
version integer
);
CREATE TABLE pg_appendonly_alter_column
(
relid oid,
changenum integer,
segfilenums integer[],
highwaterrownums bytea
);
CREATE TABLE pg_attrdef
(
adrelid oid,
adnum smallint,
adbin text,
adsrc text
);
CREATE TABLE pg_attribute
(
attrelid oid,
attname name,
atttypid oid,
attstattarget integer,
attlen smallint,
attnum smallint,
attndims integer,
attcacheoff integer,
atttypmod integer,
attbyval boolean,
attstorage "char",
attalign "char",
attnotnull boolean,
atthasdef boolean,
attisdropped boolean,
attislocal boolean,
attinhcount integer
);
CREATE TABLE pg_auth_members
(
roleid oid,
member oid,
grantor oid,
admin_option boolean
);
CREATE TABLE pg_authid
(
rolname name, -- name of role
rolsuper boolean, -- read this field via superuser() only!
rolinherit boolean, -- inherit privileges from other roles?
rolcreaterole boolean, -- allowed to create more roles?
rolcreatedb boolean, -- allowed to create databases?
rolcatupdate boolean, -- allowed to alter catalogs manually?
rolcanlogin boolean, -- allowed to log in as session user?
rolconnlimit integer, -- max connections allowed (-1=no limit)
-- remaining fields may be null. use heap_getattr to read them!
rolpassword text, -- password, if any
rolvaliduntil timestamp with time zone, -- password expiration time, if any
rolconfig text[], -- GUC settings to apply at login
rolresqueue oid, -- ID of resource queue for this role
-- GP added fields
rolcreaterextgpfd boolean, -- allowed to create readable gpfdist tbl?
rolcreaterexthttp boolean, -- allowed to create readable http tbl?
rolcreatewextgpfd boolean -- allowed to create writable gpfdist tbl?
);
CREATE TABLE pg_autovacuum
(
vacrelid oid,
enabled boolean,
vac_base_thresh integer,
vac_scale_factor real,
anl_base_thresh integer,
anl_scale_factor real,
vac_cost_delay integer,
vac_cost_limit integer,
freeze_min_age integer,
freeze_max_age integer
);
CREATE TABLE pg_cast
(
castsource oid,
casttarget oid,
castfunc oid,
castcontext "char"
);
CREATE TABLE pg_class
(
relname name ,
relnamespace oid ,
reltype oid ,
relowner oid ,
relam oid ,
relfilenode oid ,
reltablespace oid ,
relpages integer ,
reltuples real ,
reltoastrelid oid ,
reltoastidxid oid ,
relaosegrelid oid ,
relaosegidxid oid ,
relhasindex boolean ,
relisshared boolean ,
relkind "char" ,
relstorage "char" ,
relnatts smallint ,
relchecks smallint ,
reltriggers smallint ,
relukeys smallint ,
relfkeys smallint ,
relrefs smallint ,
relhasoids boolean ,
relhaspkey boolean ,
relhasrules boolean ,
relhassubclass boolean ,
relfrozenxid xid ,
relacl aclitem[] ,
reloptions text[]
);
CREATE TABLE pg_constraint
(
conname name,
connamespace oid,
contype "char",
condeferrable boolean,
condeferred boolean,
conrelid oid,
contypid oid,
confrelid oid,
confupdtype "char",
confdeltype "char",
confmatchtype "char",
conkey smallint[],
confkey smallint[],
conbin text,
consrc text
);
CREATE TABLE pg_conversion
(
conname name,
connamespace oid,
conowner oid,
conforencoding integer,
contoencoding integer,
conproc regproc,
condefault boolean
);
CREATE TABLE pg_database
(
datname name,
datdba oid,
encoding integer,
datistemplate boolean,
datallowconn boolean,
datconnlimit integer,
datlastsysoid oid,
datfrozenxid xid,
dattablespace oid,
datconfig text[],
datacl aclitem[]
);
CREATE TABLE pg_depend
(
classid oid,
objid oid,
objsubid integer,
refclassid oid,
refobjid oid,
refobjsubid integer,
deptype "char"
);
CREATE TABLE pg_description
(
objoid oid,
classoid oid,
objsubid integer,
description text
);
CREATE TABLE pg_exttable
(
reloid oid, -- refers to this relation's oid in pg_class
location text[], -- array of URI strings
fmttype "char", -- 't' (text) or 'c' (csv)
fmtopts text, -- the data format options
command text, -- the command string to EXECUTE
rejectlimit integer, -- error count reject limit per segment
rejectlimittype "char", -- 'r' (rows) or 'p' (percent)
fmterrtbl oid, -- the data format error table oid in pg_class
encoding integer, -- character encoding of this external table
writable boolean -- 't' if writable, 'f' if readable
);
CREATE TABLE pg_filespace
(
fsname name, -- filespace name
fsowner oid -- owner of filespace
);
CREATE TABLE pg_filespace_entry
(
fsefsoid oid, -- foreign key to pg_filespace
fsedbid smallint, -- segment dbid this refers to
fselocation text -- location of filespace directory
);
CREATE TABLE pg_foreign_data_wrapper
(
fdwname name, -- foreign-data wrapper name
fdwowner oid, -- FDW owner
fdwvalidator oid, -- optional validation function
-- VARIABLE LENGTH FIELDS start here.
fdwacl aclitem[], -- access permissions
fdwoptions text[] -- FDW options
);
CREATE TABLE pg_foreign_server
(
srvname name, -- foreign server name
srvowner oid, -- server owner
srvfdw oid, -- server FDW
-- VARIABLE LENGTH FIELDS start here. These fields may be NULL, too.
srvtype text,
srvversion text,
srvacl aclitem[], -- access permissions
srvoptions text[] -- FDW-specific options
);
CREATE TABLE pg_foreign_table
(
reloid oid, -- refers to this relation's oid in pg_class
server oid, -- table's foreign server
-- VARIABLE LENGTH FIELDS start here. These fields may be NULL, too.
tbloptions text[] -- foreign table-specific options
);
CREATE TABLE pg_index
(
indexrelid oid ,
indrelid oid ,
indnatts smallint ,
indisunique boolean ,
indisprimary boolean ,
indisclustered boolean ,
indisvalid boolean ,
indkey int2vector ,
indclass oidvector ,
indexprs text ,
indpred text
);
CREATE TABLE pg_inherits
(
inhrelid oid ,
inhparent oid ,
inhseqno integer
);
CREATE TABLE pg_language
(
lanname name,
lanispl boolean,
lanpltrusted boolean,
lanplcallfoid oid,
lanvalidator oid,
lanacl aclitem[]
);
CREATE TABLE pg_largeobject
(
loid oid , -- Identifier of large object
pageno integer , -- Page number (starting from 0)
data bytea -- Data for page (may be zero-length)
);
CREATE TABLE pg_listener
(
relname name ,
listenerpid integer ,
notification integer
);
CREATE TABLE pg_namespace
(
nspname name ,
nspowner oid ,
nspacl aclitem[] -- VARIABLE LENGTH FIELD
);
CREATE TABLE pg_opclass
(
opcamid oid ,
opcname name ,
opcnamespace oid ,
opcowner oid ,
opcintype oid ,
opcdefault boolean ,
opckeytype oid
);
CREATE TABLE pg_operator
(
oprname name ,
oprnamespace oid ,
oprowner oid ,
oprkind "char" ,
oprcanhash boolean ,
oprleft oid ,
oprright oid ,
oprresult oid ,
oprcom oid ,
oprnegate oid ,
oprlsortop oid ,
oprrsortop oid ,
oprltcmpop oid ,
oprgtcmpop oid ,
oprcode regproc ,
oprrest regproc ,
oprjoin regproc
);
CREATE TABLE pg_partition
(
parrelid oid,
parkind "char",
parlevel smallint,
paristemplate boolean,
parnatts smallint,
paratts int2vector,
parclass oidvector
);
CREATE TABLE pg_partition_rule
(
paroid oid,
parchildrelid oid,
parparentrule oid,
parname name,
parisdefault boolean,
parruleord smallint,
parrangestartincl boolean,
parrangeendincl boolean,
parrangestart text,
parrangeend text,
parrangeevery text,
parlistvalues text,
parreloptions text[],
partemplatespace oid
);
CREATE TABLE pg_pltemplate
(
tmplname name,
tmpltrusted boolean,
tmplhandler text,
tmplvalidator text,
tmpllibrary text,
tmplacl aclitem[]
);
CREATE TABLE pg_proc
(
proname name,
pronamespace oid,
proowner oid,
prolang oid,
proisagg boolean,
prosecdef boolean,
proisstrict boolean,
proretset boolean,
provolatile "char",
pronargs smallint,
prorettype oid,
proiswin boolean,
proargtypes oidvector,
proallargtypes oid[],
proargmodes "char"[],
proargnames text[],
prosrc text,
probin bytea,
proacl aclitem[]
);
CREATE TABLE pg_resqueue
(
rsqname name, -- name of resource queue
rsqcountlimit real, -- max active count limit
rsqcostlimit real, -- max cost limit
rsqovercommit boolean, -- allow overcommit on suitable limits
rsqignorecostlimit real -- ignore queries with cost less than
);
CREATE TABLE pg_resqueuecapability
(
resqueueid oid, -- OID of the queue with this capability
restypid smallint, -- resource type id (key to pg_resourcetype)
ressetting text -- resource setting (opaque type)
);
CREATE TABLE pg_resourcetype
(
resname name, -- name of resource type
restypid smallint, -- resource type id
resrequired boolean, -- if required, user must specify during CREATE
reshasdefault boolean, -- create a default entry for optional type
reshasdisable boolean, -- whether the type can be removed or shut off
resdefaultsetting text, -- default resource setting
resdisabledsetting text -- value that turns it off
);
CREATE TABLE pg_rewrite
(
rulename name,
ev_class oid,
ev_attr smallint,
ev_type "char",
is_instead boolean,
ev_qual text,
ev_action text
);
CREATE TABLE pg_shdepend
(
dbid oid,
classid oid,
objid oid,
refclassid oid,
refobjid oid,
deptype "char"
);
CREATE TABLE pg_shdescription
(
objoid oid,
classoid oid,
description text
);
CREATE TABLE pg_stat_last_shoperation
(
classid oid,
objid oid,
staactionname name,
stasysid oid,
stausename name,
stasubtype text,
statime timestamp with time zone
);
CREATE TABLE pg_statistic
(
starelid oid,
staattnum smallint,
stanullfrac real,
stawidth integer,
stadistinct real,
stakind1 smallint,
stakind2 smallint,
stakind3 smallint,
stakind4 smallint,
staop1 oid,
staop2 oid,
staop3 oid,
staop4 oid,
stanumbers1 real[],
stanumbers2 real[],
stanumbers3 real[],
stanumbers4 real[],
stavalues1 text,
stavalues2 text,
stavalues3 text,
stavalues4 text
);
CREATE TABLE pg_stat_last_operation
(
classid oid,
objid oid,
staactionname name,
stasysid oid,
stausename name,
stasubtype text,
statime timestamp with time zone
);
CREATE TABLE pg_tablespace
(
spcname name,
spcowner oid,
spclocation text,
spcacl aclitem[],
spcprilocations text[],
spcmirlocations text[],
spcfsoid oid
);
CREATE TABLE pg_trigger
(
tgrelid oid,
tgname name,
tgfoid oid,
tgtype smallint,
tgenabled boolean,
tgisconstraint boolean,
tgconstrname name,
tgconstrrelid oid,
tgdeferrable boolean,
tginitdeferred boolean,
tgnargs smallint,
tgattr int2vector,
tgargs bytea
);
CREATE TABLE pg_type
(
typname name ,
typnamespace oid ,
typowner oid ,
typlen smallint ,
typbyval boolean ,
typtype "char" ,
typisdefined boolean ,
typdelim "char" ,
typrelid oid ,
typelem oid ,
typinput regproc ,
typoutput regproc ,
typreceive regproc ,
typsend regproc ,
typanalyze regproc ,
typalign "char" ,
typstorage "char" ,
typnotnull boolean ,
typbasetype oid ,
typtypmod integer ,
typndims integer ,
typdefaultbin text ,
typdefault text
);
CREATE TABLE pg_user_mapping
(
umuser oid,
umserver oid,
umoptions text[]
);
CREATE TABLE pg_window
(
winfnoid regproc, -- pg_proc OID of the window function itself
winrequireorder boolean, -- does wf require order by?
winallowframe boolean, -- does wf allow framing?
winpeercount boolean, -- does wf definition need peer row count?
wincount boolean, -- does wf definition need partition row count?
winfunc regproc, -- immediate function (0 if none)
winprefunc regproc, -- preliminary function (0 if none)
winpretype oid, -- type of preliminary function result
winfinfunc regproc, -- final function (0 if none)
winkind "char"
); | the_stack |
-- 2017-11-22T17:20:57.974
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Field SET IsDisplayedGrid='Y', SeqNoGrid=170,Updated=TO_TIMESTAMP('2017-11-22 17:20:57','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=560399
;
-- 2017-11-22T17:20:57.978
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Field SET IsDisplayedGrid='Y', SeqNoGrid=180,Updated=TO_TIMESTAMP('2017-11-22 17:20:57','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=560400
;
-- 2017-11-22T17:20:57.981
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Field SET IsDisplayedGrid='Y', SeqNoGrid=190,Updated=TO_TIMESTAMP('2017-11-22 17:20:57','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=5927
;
-- 2017-11-22T17:20:57.984
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Field SET IsDisplayedGrid='Y', SeqNoGrid=200,Updated=TO_TIMESTAMP('2017-11-22 17:20:57','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=5933
;
-- 2017-11-22T17:20:57.987
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Field SET IsDisplayedGrid='Y', SeqNoGrid=210,Updated=TO_TIMESTAMP('2017-11-22 17:20:57','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=5945
;
-- 2017-11-22T17:20:57.990
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Field SET IsDisplayedGrid='Y', SeqNoGrid=220,Updated=TO_TIMESTAMP('2017-11-22 17:20:57','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=5951
;
-- 2017-11-22T17:20:58.002
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Field SET IsDisplayedGrid='Y', SeqNoGrid=230,Updated=TO_TIMESTAMP('2017-11-22 17:20:57','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=5954
;
-- 2017-11-22T17:20:58.005
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Field SET IsDisplayedGrid='Y', SeqNoGrid=240,Updated=TO_TIMESTAMP('2017-11-22 17:20:58','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=5918
;
-- 2017-11-22T17:20:58.009
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Field SET IsDisplayedGrid='Y', SeqNoGrid=250,Updated=TO_TIMESTAMP('2017-11-22 17:20:58','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=5949
;
-- 2017-11-22T17:20:58.012
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Field SET IsDisplayedGrid='Y', SeqNoGrid=260,Updated=TO_TIMESTAMP('2017-11-22 17:20:58','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=5922
;
-- 2017-11-22T17:20:58.015
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Field SET IsDisplayedGrid='Y', SeqNoGrid=270,Updated=TO_TIMESTAMP('2017-11-22 17:20:58','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=5929
;
-- 2017-11-22T17:20:58.018
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Field SET IsDisplayedGrid='Y', SeqNoGrid=280,Updated=TO_TIMESTAMP('2017-11-22 17:20:58','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=556302
;
-- 2017-11-22T17:20:58.021
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Field SET IsDisplayedGrid='Y', SeqNoGrid=290,Updated=TO_TIMESTAMP('2017-11-22 17:20:58','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=556303
;
-- 2017-11-22T17:20:58.023
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Field SET IsDisplayedGrid='Y', SeqNoGrid=300,Updated=TO_TIMESTAMP('2017-11-22 17:20:58','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=5946
;
-- 2017-11-22T17:20:58.026
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Field SET IsDisplayedGrid='Y', SeqNoGrid=310,Updated=TO_TIMESTAMP('2017-11-22 17:20:58','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=559884
;
-- 2017-11-22T17:20:58.029
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Field SET IsDisplayedGrid='Y', SeqNoGrid=320,Updated=TO_TIMESTAMP('2017-11-22 17:20:58','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=5920
;
-- 2017-11-22T17:20:58.032
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Field SET IsDisplayedGrid='Y', SeqNoGrid=330,Updated=TO_TIMESTAMP('2017-11-22 17:20:58','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=5921
;
-- 2017-11-22T17:20:58.034
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Field SET IsDisplayedGrid='Y', SeqNoGrid=340,Updated=TO_TIMESTAMP('2017-11-22 17:20:58','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=5923
;
-- 2017-11-22T17:20:58.037
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Field SET IsDisplayedGrid='Y', SeqNoGrid=350,Updated=TO_TIMESTAMP('2017-11-22 17:20:58','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=5952
;
-- 2017-11-22T17:20:58.039
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Field SET IsDisplayedGrid='Y', SeqNoGrid=360,Updated=TO_TIMESTAMP('2017-11-22 17:20:58','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=5930
;
-- 2017-11-22T17:20:58.042
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Field SET IsDisplayedGrid='Y', SeqNoGrid=370,Updated=TO_TIMESTAMP('2017-11-22 17:20:58','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=5944
;
-- 2017-11-22T17:20:58.044
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Field SET IsDisplayedGrid='Y', SeqNoGrid=380,Updated=TO_TIMESTAMP('2017-11-22 17:20:58','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=5919
;
-- 2017-11-22T17:20:58.046
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Field SET IsDisplayedGrid='Y', SeqNoGrid=390,Updated=TO_TIMESTAMP('2017-11-22 17:20:58','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=5934
;
-- 2017-11-22T17:20:58.050
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Field SET IsDisplayedGrid='Y', SeqNoGrid=400,Updated=TO_TIMESTAMP('2017-11-22 17:20:58','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=58038
;
-- 2017-11-22T17:20:58.053
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Field SET IsDisplayedGrid='Y', SeqNoGrid=410,Updated=TO_TIMESTAMP('2017-11-22 17:20:58','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=58039
;
-- 2017-11-22T17:20:58.056
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Field SET IsDisplayedGrid='Y', SeqNoGrid=420,Updated=TO_TIMESTAMP('2017-11-22 17:20:58','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=58040
;
-- 2017-11-22T17:20:58.058
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Field SET IsDisplayedGrid='Y', SeqNoGrid=430,Updated=TO_TIMESTAMP('2017-11-22 17:20:58','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=557474
;
-- 2017-11-22T17:20:58.060
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Field SET IsDisplayedGrid='Y', SeqNoGrid=440,Updated=TO_TIMESTAMP('2017-11-22 17:20:58','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=559883
;
-- 2017-11-22T17:20:58.063
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Field SET IsDisplayedGrid='Y', SeqNoGrid=450,Updated=TO_TIMESTAMP('2017-11-22 17:20:58','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=557475
;
-- 2017-11-22T17:20:58.065
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Field SET IsDisplayedGrid='Y', SeqNoGrid=460,Updated=TO_TIMESTAMP('2017-11-22 17:20:58','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=559882
;
-- 2017-11-22T17:20:58.067
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Field SET IsDisplayedGrid='Y', SeqNoGrid=470,Updated=TO_TIMESTAMP('2017-11-22 17:20:58','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=560563
;
-- 2017-11-22T17:20:58.070
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Field SET IsDisplayedGrid='Y', SeqNoGrid=480,Updated=TO_TIMESTAMP('2017-11-22 17:20:58','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=560564
;
-- 2017-11-22T17:20:58.072
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Field SET IsDisplayedGrid='Y', SeqNoGrid=490,Updated=TO_TIMESTAMP('2017-11-22 17:20:58','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=560565
;
-- 2017-11-22T17:20:58.074
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Field SET IsDisplayedGrid='Y', SeqNoGrid=500,Updated=TO_TIMESTAMP('2017-11-22 17:20:58','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=560566
;
-- 2017-11-22T17:20:58.077
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Field SET IsDisplayedGrid='Y', SeqNoGrid=510,Updated=TO_TIMESTAMP('2017-11-22 17:20:58','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=5941
;
-- 2017-11-22T17:20:58.078
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Field SET IsDisplayedGrid='Y', SeqNoGrid=520,Updated=TO_TIMESTAMP('2017-11-22 17:20:58','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=5924
;
-- 2017-11-22T17:20:58.081
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Field SET IsDisplayedGrid='Y', SeqNoGrid=530,Updated=TO_TIMESTAMP('2017-11-22 17:20:58','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=559903
;
-- 2017-11-22T17:20:58.083
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Field SET IsDisplayedGrid='Y', SeqNoGrid=540,Updated=TO_TIMESTAMP('2017-11-22 17:20:58','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=559904
;
-- 2017-11-22T17:20:58.085
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Field SET IsDisplayedGrid='Y', SeqNoGrid=550,Updated=TO_TIMESTAMP('2017-11-22 17:20:58','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=559947
;
-- 2017-11-22T17:20:58.086
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Field SET IsDisplayedGrid='Y', SeqNoGrid=560,Updated=TO_TIMESTAMP('2017-11-22 17:20:58','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=560543
;
-- 2017-11-22T17:21:38.548
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Field SET IsDisplayed='Y', SeqNo=510,Updated=TO_TIMESTAMP('2017-11-22 17:21:38','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=560563
;
-- 2017-11-22T17:21:38.554
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Field SET IsDisplayed='Y', SeqNo=520,Updated=TO_TIMESTAMP('2017-11-22 17:21:38','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=560564
;
-- 2017-11-22T17:21:38.560
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Field SET IsDisplayed='Y', SeqNo=530,Updated=TO_TIMESTAMP('2017-11-22 17:21:38','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=560565
;
-- 2017-11-22T17:21:38.565
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Field SET IsDisplayed='Y', SeqNo=540,Updated=TO_TIMESTAMP('2017-11-22 17:21:38','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=560566
;
-- 2017-11-22T17:21:38.569
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Field SET IsDisplayed='Y', SeqNo=550,Updated=TO_TIMESTAMP('2017-11-22 17:21:38','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=5941
;
-- 2017-11-22T17:21:38.571
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Field SET IsDisplayed='Y', SeqNo=560,Updated=TO_TIMESTAMP('2017-11-22 17:21:38','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=5924
;
-- 2017-11-22T17:22:14.772
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Field SET IsDisplayed='Y', SeqNo=509,Updated=TO_TIMESTAMP('2017-11-22 17:22:14','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=5928
;
-- 2017-11-22T17:22:41.569
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Field SET IsSameLine='Y',Updated=TO_TIMESTAMP('2017-11-22 17:22:41','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=560563
;
-- 2017-11-22T17:22:59.140
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Field SET IsSameLine='Y',Updated=TO_TIMESTAMP('2017-11-22 17:22:59','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=560566
; | the_stack |
-- bit of cleanup:
drop table x_mrp_productinfo_mv;
DROP FUNCTION IF EXISTS refresh_X_MRP_ProductInfo_MV();
DROP FUNCTION IF EXISTS refresh_X_MRP_ProductInfo_MV_aux_temp(Date);
delete from ad_menu where ad_process_id=540539;
DELETE FROM AD_Scheduler WHERE AD_Scheduler_ID=550022; -- X_MRP_ProductInfo_MV_refresh_matview
DELETE FROM AD_Process WHERE AD_Process_ID=540539; --X_MRP_ProductInfo_MV_refresh_matview
----------------------------
ALTER TABLE x_mrp_productinfo_detail_mv ADD COLUMN PMM_QtyPromised_OnDate numeric NOT NULL DEFAULT (0)::numeric;
--
-- might be overridden in an endcustomer project
--
DROP VIEW IF EXISTS "de.metas.fresh".X_MRP_ProductInfo_AttributeVal_Raw_V;
CREATE OR REPLACE VIEW "de.metas.fresh".X_MRP_ProductInfo_AttributeVal_Raw_V AS
SELECT
p.ad_client_id, p.ad_org_id, p.m_product_id, p.name,
p.value, p.ispurchased, p.issold, p.m_product_category_id, p.isactive,
v.DateGeneral,
dim.GroupName,
SUM(v.PMM_QtyPromised_OnDate) AS PMM_QtyPromised_OnDate, -- FRESH-86
SUM(v.qtyreserved_ondate) AS qtyreserved_ondate,
SUM(v.qtyordered_ondate) AS qtyordered_ondate,
SUM(v.qtymaterialentnahme) AS qtymaterialentnahme,
SUM(v.fresh_qtyonhand_ondate) AS fresh_qtyonhand_ondate,
SUM(v.fresh_qtypromised) AS fresh_qtypromised,
(
SELECT SUM(Fresh_QtyMRP)
FROM "de.metas.fresh".X_MRP_ProductInfo_Detail_Poor_Mans_MRP mrp
WHERE mrp.DateGeneral = v.DateGeneral
AND mrp.M_Product_MRP_ID = p.M_Product_ID
AND dim.GroupName = ANY("de.metas.dimension".DIM_Get_GroupName('MRP_Product_Info_ASI_Values', mrp.ASIKey_MRP))
GROUP BY DateGeneral, M_Product_MRP_ID
) AS Fresh_QtyMRP
FROM
(select distinct GroupName from "de.metas.dimension".DIM_Dimension_Spec_Attribute_AllValues where InternalName='MRP_Product_Info_ASI_Values') as dim
JOIN M_Product p ON true
JOIN X_MRP_ProductInfo_Detail_MV v
ON v.M_Product_ID=p.M_Product_ID
AND dim.GroupName = ANY(v.GroupNames)
WHERE true
GROUP BY
p.ad_client_id, p.ad_org_id, p.m_product_id, p.name,
p.value, p.ispurchased, p.issold, p.m_product_category_id, p.isactive,
v.DateGeneral,
dim.GroupName
;
COMMENT ON VIEW "de.metas.fresh".X_MRP_ProductInfo_AttributeVal_Raw_V IS 'Selects those attribute values that have a matching X_MRP_ProductInfo_Detail_MV record.';
---------------------------------------------------------------------
DROP VIEW IF EXISTS "de.metas.fresh".M_Product_ID_M_AttributeSetInstance_ID_V;
CREATE OR REPLACE VIEW "de.metas.fresh".M_Product_ID_M_AttributeSetInstance_ID_V AS
SELECT M_Product_ID, M_AttributeSetInstance_ID, DateGeneral
FROM (
SELECT t.M_Product_ID, t.M_AttributeSetInstance_ID, t.MovementDate::date as DateGeneral, 'M_Transaction' as source
FROM M_Transaction t
UNION
SELECT ol.M_Product_ID, ol.M_AttributeSetInstance_ID,
COALESCE(
sched.PreparationDate_Override, sched.PreparationDate, -- task 08931: the user works with PreparationDate instead of DatePromised
o.PreparationDate, -- fallback in case the schedule does not exist yet
o.DatePromised -- fallback in case of orders created by the system (e.g. EDI) and missing proper tour planning master data
)::Date AS DateGeneral,
'C_OrderLine'
FROM C_Order o
JOIN C_OrderLine ol ON ol.C_Order_ID=o.C_Order_ID
LEFT JOIN M_ShipmentSchedule sched ON sched.C_OrderLine_ID=ol.C_OrderLine_ID AND sched.IsActive='Y'
WHERE o.DocStatus IN ('CO', 'CL')
UNION
SELECT qohl.M_Product_ID, qohl.M_AttributeSetInstance_ID, qoh.DateDoc::date, 'Fresh_QtyOnHand_Line'
FROM Fresh_QtyOnHand qoh
JOIN Fresh_QtyOnHand_Line qohl ON qoh.fresh_qtyonhand_id = qohl.Fresh_qtyonhand_id
WHERE qoh.Processed='Y' AND qoh.IsActive='Y' AND qohl.IsActive='Y'
UNION -- FRESH-86
SELECT pc.M_Product_ID, pc.M_AttributeSetInstance_ID, pc.DatePromised::Date, 'PMM_PurchaseCandidate'
FROM PMM_PurchaseCandidate pc
WHERE pc.IsActive='Y'
) data
WHERE true
AND M_Product_ID IS NOT NULL
-- AND M_Product_ID=(select M_Product_ID from M_Product where Value='P000037')
-- AND DateGeneral::date='2015-04-09'::date
GROUP BY M_Product_ID, M_AttributeSetInstance_ID, DateGeneral;
COMMENT ON VIEW "de.metas.fresh".M_Product_ID_M_AttributeSetInstance_ID_V IS 'Used in X_MRP_ProductInfo_Detail_V to enumerate all the products and ASIs for which we need numbers.
Note: i tried changing this view into an SQL function with dateFrom and dateTo as where-clause paramters, but it didn''t bring any gain in X_MRP_ProductInfo_Detail_V.'
;
-----------------------------------------------------------------------
--
-- endcustomer projects can contain an overriding version of this view
--
DROP FUNCTION X_MRP_ProductInfo_AttributeVal_V(IN DateAt date) ;
CREATE OR REPLACE FUNCTION X_MRP_ProductInfo_AttributeVal_V(IN DateAt date)
RETURNS TABLE(
ad_client_id numeric, ad_org_id numeric, m_product_id numeric, name text,
value text, ispurchased character(1), issold character(1), m_product_category_id numeric, isactive character(1),
DateGeneral date,
GroupName text,
PMM_QtyPromised_OnDate numeric, -- FRESH-86
qtyreserved_ondate numeric,
qtyordered_ondate numeric,
qtymaterialentnahme numeric,
fresh_qtyonhand_ondate numeric,
fresh_qtypromised numeric,
fresh_qtymrp numeric
) AS
$BODY$
SELECT
ad_client_id, ad_org_id, m_product_id, name,
value, ispurchased, issold, m_product_category_id, isactive,
DateGeneral,
GroupName,
SUM(PMM_QtyPromised_OnDate) AS PMM_QtyPromised_OnDate, -- FRESH-86
SUM(qtyreserved_ondate) AS qtyreserved_ondate,
SUM(qtyordered_ondate) AS qtyordered_ondate,
SUM(qtymaterialentnahme) AS qtymaterialentnahme,
SUM(fresh_qtyonhand_ondate) AS fresh_qtyonhand_ondate,
SUM(fresh_qtypromised) AS fresh_qtypromised,
SUM(fresh_qtymrp) AS fresh_qtymrp
FROM (
SELECT *
FROM "de.metas.fresh".X_MRP_ProductInfo_AttributeVal_Raw_V
WHERE DateGeneral=$1
UNION ALL
SELECT DISTINCT
p.ad_client_id, p.ad_org_id, p.m_product_id, p.name,
p.value, p.ispurchased, p.issold, p.m_product_category_id, p.isactive,
$1::date,
dim.GroupName,
0::numeric, -- FRESH-86 PMM_QtyPromised_OnDate
0::numeric,
0::numeric,
0::numeric,
0::numeric,
0::numeric,
0::numeric
FROM "de.metas.dimension".DIM_Dimension_Spec_Attribute_AllValues dim
JOIN M_Product p ON true
WHERE true
AND dim.InternalName='MRP_Product_Info_ASI_Values'
/*
AND NOT EXISTS (
SELECT 1
FROM X_MRP_ProductInfo_Detail_MV mv
WHERE true
AND mv.M_Product_ID=p.M_Product_ID
AND mv.DateGeneral=$1
AND (
-- match on ASIKey containing ValueName as substring
(mv.ASIKey ILIKE '%'||dim.ValueName||'%')
-- or match on 'DIM_EMPTY' and the absence of any other match
OR (dim.ValueName='DIM_EMPTY' AND NOT EXISTS (select 1 from "de.metas.dimension".DIM_Dimension_Spec_Attribute_AllValues dim2 where dim2.InternalName=dim.InternalName and mv.ASIKey ILIKE '%'||dim2.ValueName||'%'))
)
)
*/
) data
GROUP BY
ad_client_id, ad_org_id, m_product_id, name,
value, ispurchased, issold, m_product_category_id, isactive,
DateGeneral,
GroupName
;
$BODY$
LANGUAGE sql STABLE;
COMMENT ON FUNCTION X_MRP_ProductInfo_AttributeVal_V(date) IS 'This function is a union of X_MRP_ProductInfo_AttributeVal_V_Raw and the dimension spec''s attribute values that do *not* have matching X_MRP_ProductInfo_Detail_MV records for the given date';
-------------------------------------------------------------------------------
--
-- endcustomer projects can contain an overriding version of this view
--
DROP FUNCTION X_MRP_ProductInfo_AttributeVal_V(IN DateAt date) ;
CREATE OR REPLACE FUNCTION X_MRP_ProductInfo_AttributeVal_V(IN DateAt date)
RETURNS TABLE(
ad_client_id numeric, ad_org_id numeric, m_product_id numeric, name text,
value text, ispurchased character(1), issold character(1), m_product_category_id numeric, isactive character(1),
DateGeneral date,
GroupName text,
PMM_QtyPromised_OnDate numeric, -- FRESH-86
qtyreserved_ondate numeric,
qtyordered_ondate numeric,
qtymaterialentnahme numeric,
fresh_qtyonhand_ondate numeric,
fresh_qtypromised numeric,
fresh_qtymrp numeric
) AS
$BODY$
SELECT
ad_client_id, ad_org_id, m_product_id, name,
value, ispurchased, issold, m_product_category_id, isactive,
DateGeneral,
GroupName,
SUM(PMM_QtyPromised_OnDate) AS PMM_QtyPromised_OnDate, -- FRESH-86
SUM(qtyreserved_ondate) AS qtyreserved_ondate,
SUM(qtyordered_ondate) AS qtyordered_ondate,
SUM(qtymaterialentnahme) AS qtymaterialentnahme,
SUM(fresh_qtyonhand_ondate) AS fresh_qtyonhand_ondate,
SUM(fresh_qtypromised) AS fresh_qtypromised,
SUM(fresh_qtymrp) AS fresh_qtymrp
FROM (
SELECT *
FROM "de.metas.fresh".X_MRP_ProductInfo_AttributeVal_Raw_V
WHERE DateGeneral=$1
UNION ALL
SELECT DISTINCT
p.ad_client_id, p.ad_org_id, p.m_product_id, p.name,
p.value, p.ispurchased, p.issold, p.m_product_category_id, p.isactive,
$1::date,
dim.GroupName,
0::numeric, -- FRESH-86 PMM_QtyPromised_OnDate
0::numeric,
0::numeric,
0::numeric,
0::numeric,
0::numeric,
0::numeric
FROM "de.metas.dimension".DIM_Dimension_Spec_Attribute_AllValues dim
JOIN M_Product p ON true
WHERE true
AND dim.InternalName='MRP_Product_Info_ASI_Values'
/*
AND NOT EXISTS (
SELECT 1
FROM X_MRP_ProductInfo_Detail_MV mv
WHERE true
AND mv.M_Product_ID=p.M_Product_ID
AND mv.DateGeneral=$1
AND (
-- match on ASIKey containing ValueName as substring
(mv.ASIKey ILIKE '%'||dim.ValueName||'%')
-- or match on 'DIM_EMPTY' and the absence of any other match
OR (dim.ValueName='DIM_EMPTY' AND NOT EXISTS (select 1 from "de.metas.dimension".DIM_Dimension_Spec_Attribute_AllValues dim2 where dim2.InternalName=dim.InternalName and mv.ASIKey ILIKE '%'||dim2.ValueName||'%'))
)
)
*/
) data
GROUP BY
ad_client_id, ad_org_id, m_product_id, name,
value, ispurchased, issold, m_product_category_id, isactive,
DateGeneral,
GroupName
;
$BODY$
LANGUAGE sql STABLE;
COMMENT ON FUNCTION X_MRP_ProductInfo_AttributeVal_V(date) IS 'This function is a union of X_MRP_ProductInfo_AttributeVal_V_Raw and the dimension spec''s attribute values that do *not* have matching X_MRP_ProductInfo_Detail_MV records for the given date';
-------------------------------------------------------------------------------
--
-- there can be an overriding function in an endcustomer project
--
DROP FUNCTION IF EXISTS X_MRP_ProductInfo_Detail_V(date, numeric);
CREATE OR REPLACE FUNCTION X_MRP_ProductInfo_Detail_V(
IN DateFrom date,
IN M_Product_ID numeric)
RETURNS TABLE (
m_product_id numeric(10,0),
dategeneral date,
asikey text,
PMM_QtyPromised_OnDate numeric, -- FRESH-86
qtyreserved_ondate numeric,
qtyordered_ondate numeric,
qtyordered_sale_ondate numeric,
qtymaterialentnahme numeric,
fresh_qtyonhand_ondate numeric,
fresh_qtypromised numeric,
isfallback character(1),
groupnames character varying[]
) AS
$BODY$
SELECT
p.M_Product_ID as M_Product_ID
,p.DateGeneral::date AS DateGeneral
,GenerateHUStorageASIKey(p.M_AttributeSetInstance_ID,'') as ASIKey
,CEIL(SUM(COALESCE(qp.PMM_QtyPromised_OnDate, 0))) AS PMM_QtyPromised_OnDate -- FRESH-86
,CEIL(SUM(COALESCE(ol_d.QtyReserved_Sale, 0))) AS QtyReserved_OnDate
,CEIL(SUM(COALESCE(ol_d.QtyReserved_Purchase, 0))) AS QtyOrdered_OnDate
,CEIL(SUM(COALESCE(ol_d.QtyOrdered_Sale, 0))) AS QtyOrdered_Sale_OnDate
,CEIL(SUM(COALESCE(hu_me_d.qtymaterialentnahme, 0))) AS QtyMaterialentnahme --T1-OK
,CEIL(SUM(COALESCE(qoh_d.qty, 0)) + sum(COALESCE(qohl.QtyCountSum, 0)) - SUM(COALESCE(hu_me_d.qtymaterialentnahme, 0))) AS fresh_qtyonhand_ondate
,CEIL(SUM(COALESCE(qoh_d.qty, 0)) + SUM(COALESCE(qohl.QtyCountSum, 0)) - SUM(COALESCE(hu_me_d.qtymaterialentnahme, 0)) + SUM(COALESCE(ol_d.qtypromised, 0))) AS fresh_qtypromised
,'N'::character(1) as IsFallback
,"de.metas.dimension".DIM_Get_GroupName('MRP_Product_Info_ASI_Values', GenerateHUStorageASIKey(p.M_AttributeSetInstance_ID)) AS GroupNames
FROM
-- join all specific products and ASI-IDs that we have at 'DateGeneral'
-- it's not enough to just join records with our current ASIKey, because there might be other records with differnt, but "overlapping" ASIs
-- note: '&&' is the array "overlap" operator
"de.metas.fresh".M_Product_ID_M_AttributeSetInstance_ID_V p
LEFT JOIN "de.metas.fresh".RV_C_OrderLine_QtyOrderedReservedPromised_OnDate_V ol_d ON ol_d.m_product_id = p.M_Product_ID AND ol_d.DateGeneral::date=p.DateGeneral::date
AND COALESCE(ol_d.M_AttributeSetInstance_ID,-1)=COALESCE(p.M_AttributeSetInstance_ID,-1)
LEFT JOIN "de.metas.fresh".RV_HU_QtyMaterialentnahme_OnDate hu_me_d ON hu_me_d.m_product_id = p.M_Product_ID AND hu_me_d.updated_date::date = p.DateGeneral::date
AND COALESCE(hu_me_d.M_AttributesetInstance_ID,-1)=COALESCE(p.M_AttributesetInstance_ID,-1)
LEFT JOIN (
-- task 09473: we might have mutiple records with the same date, product and ASI, so we need to aggregate.
select movementdate::date as movementdate, m_product_id, M_AttributesetInstance_ID, sum(qty) AS qty
from "de.metas.fresh".X_Fresh_QtyOnHand_OnDate
group by movementdate::date, m_product_id, M_AttributesetInstance_ID
) qoh_d ON qoh_d.movementdate = p.DateGeneral::date AND qoh_d.m_product_id = p.M_Product_ID
AND COALESCE(qoh_d.M_AttributesetInstance_ID,-1)=COALESCE(p.M_AttributesetInstance_ID,-1)
LEFT JOIN (
SELECT SUM(qohl.QtyCount) AS QtyCountSum, qoh.datedoc::date, qohl.M_Product_ID, qohl.M_AttributesetInstance_ID
FROM Fresh_qtyonhand qoh
LEFT JOIN Fresh_qtyonhand_line qohl ON qoh.Fresh_qtyonhand_id = qohl.Fresh_qtyonhand_id
WHERE true
AND qoh.Processed='Y'
GROUP BY qoh.datedoc::date, qohl.M_Product_ID, qohl.M_AttributesetInstance_ID
) qohl ON qohl.datedoc = p.DateGeneral::date AND qohl.m_product_id = p.M_Product_ID
AND COALESCE(qohl.M_AttributesetInstance_ID,-1)=COALESCE(p.M_AttributesetInstance_ID,-1)
-- FRESH-86
-- qp = "quantity promised"
LEFT JOIN (
SELECT SUM(pc.QtyPromised) AS PMM_QtyPromised_OnDate, pc.DatePromised::Date, pc.M_Product_ID, pc.M_AttributesetInstance_ID
FROM pmm_purchasecandidate pc
GROUP BY pc.DatePromised::date, pc.M_Product_ID, pc.M_AttributesetInstance_ID
) qp ON qp.DatePromised = p.DateGeneral::date AND qp.M_Product_ID = p.M_Product_ID
AND COALESCE(qp.M_AttributesetInstance_ID,-1)=COALESCE(p.M_AttributesetInstance_ID,-1)
LEFT JOIN (
SELECT SUM(qohl.QtyCount) AS QtyCountSum, qoh.datedoc::date, qohl.M_Product_ID, qohl.M_AttributesetInstance_ID
FROM Fresh_qtyonhand qoh
LEFT JOIN Fresh_qtyonhand_line qohl ON qoh.Fresh_qtyonhand_id = qohl.Fresh_qtyonhand_id
WHERE true
AND qoh.Processed='Y'
AND qohl.PP_Plant_ID=1000001
GROUP BY qoh.datedoc::date, qohl.M_Product_ID, qohl.M_AttributesetInstance_ID
) qohl_s ON qohl_s.datedoc = p.DateGeneral::date AND qohl_s.m_product_id = p.M_Product_ID
AND COALESCE(qohl_s.M_AttributesetInstance_ID,-1)=COALESCE(p.M_AttributesetInstance_ID,-1)
LEFT JOIN (
SELECT SUM(qohl.QtyCount) AS QtyCountSum, qoh.datedoc::date, qohl.M_Product_ID, qohl.M_AttributesetInstance_ID
FROM Fresh_qtyonhand qoh
LEFT JOIN Fresh_qtyonhand_line qohl ON qoh.Fresh_qtyonhand_id = qohl.Fresh_qtyonhand_id
WHERE true
AND qoh.Processed='Y'
AND qohl.PP_Plant_ID=1000002
GROUP BY qoh.datedoc::date, qohl.M_Product_ID, qohl.M_AttributesetInstance_ID
) qohl_i ON qohl_i.datedoc = p.DateGeneral::date AND qohl_i.m_product_id = p.M_Product_ID
AND COALESCE(qohl_i.M_AttributesetInstance_ID,-1)=COALESCE(p.M_AttributesetInstance_ID,-1)
WHERE true
AND p.DateGeneral::Date=$1::Date
AND p.M_Product_ID=$2
-- AND p.M_Product_ID=2000039
-- AND p.DateGeneral::Date='2015-03-24'::Date
GROUP BY
p.M_Product_ID, ASIKey, p.DateGeneral::date,
GroupNames -- groupnames is just required by postgres, but it doesn't make a difference: same ASIKey allways means same GroupNames
;
$BODY$
LANGUAGE sql STABLE;
COMMENT ON FUNCTION X_MRP_ProductInfo_Detail_V(date, numeric) IS 'Creates tha basic info for the MRP info window, for a given date and M_Product_ID.
The returned rows always have IsFallback=''N'' to indicate that these rows are the "real" rows, with actual data.
';
-------------------------------------------------------------------------------
DROP FUNCTION IF EXISTS X_MRP_ProductInfo_Detail_Fallback_V(date);
CREATE OR REPLACE FUNCTION X_MRP_ProductInfo_Detail_Fallback_V(IN DateFrom date)
RETURNS TABLE (
m_product_id numeric(10,0),
dategeneral date,
asikey text,
PMM_QtyPromised_OnDate numeric, -- FRESH-86
qtyreserved_ondate numeric,
qtyordered_ondate numeric,
qtyordered_sale_ondate numeric,
qtymaterialentnahme numeric,
fresh_qtyonhand_ondate numeric,
fresh_qtypromised numeric,
isfallback character(1),
groupnames character varying[]
) AS
$BODY$
SELECT data.*
FROM
(
SELECT
p_fallback.M_Product_ID
,$1 AS DateGeneral
,'' AS ASIKey
,0::numeric AS PMM_QtyPromised_OnDate -- FRESH-86
,0::numeric AS QtyReserved_OnDate
,0::numeric AS QtyOrdered_OnDate
,0::numeric AS QtyOrdered_Sale_OnDate
,0::numeric AS QtyMaterialentnahme
,0::numeric AS fresh_qtyonhand_ondate
,0::numeric AS fresh_qtypromised
,'Y'::character(1) as IsFallback
,"de.metas.dimension".DIM_Get_GroupName('MRP_Product_Info_ASI_Values', null) AS GroupNames
FROM
M_Product p_fallback
UNION
-- Insert empty records for those raw materials (AND their ASI) that are not yet included, but that have an end-product which is already included.
-- This will allow us to update them later on
SELECT
v.bl_M_Product_ID as M_Product_ID
,mv.DateGeneral
,GenerateHUStorageASIKey(v.bl_M_AttributeSetInstance_ID, '') as ASIKey
,0::numeric -- FRESH-86
,0::numeric
,0::numeric
,0::numeric
,0::numeric
,0::numeric
,0::numeric
,'Y'::character(1) as IsFallback
,"de.metas.dimension".DIM_Get_GroupName('MRP_Product_Info_ASI_Values', GenerateHUStorageASIKey(v.bl_M_AttributeSetInstance_ID)) AS GroupNames
FROM X_mrp_productinfo_detail_mv mv
-- join the existing end-products from X_mrp_productinfo_detail_mv to their raw materials and add records for those raw materials
JOIN "de.metas.fresh".MRP_ProductInfo_Poor_Mans_MRP_V v
ON mv.M_Product_ID=v.b_m_Product_ID
AND mv.ASIKey= GenerateHUStorageASIKey(v.b_M_AttributeSetInstance_ID,'')
WHERE true
AND mv.IsFallback='N' -- we don't need to raw-materials for end-products of fallback records, because they don't have a reserved qty, so they don't contribute to any raw material's Poor_Mans_MRP_Purchase_Qty
AND v.IsPurchased='Y' -- only include raw-materials that are purchased, other wise there is no use showing it (because stuff is for the purchase department)
) data
LEFT JOIN X_MRP_ProductInfo_Detail_MV mv_ext -- anti-join existing mv records; better performance than with "where not exists"
ON mv_ext.M_Product_ID=data.M_Product_ID
AND mv_ext.DateGeneral=data.DateGeneral
AND mv_ext.ASIKey=data.ASIKey
WHERE true
AND mv_ext.M_Product_ID IS NULL;
$BODY$
LANGUAGE sql STABLE;
COMMENT ON FUNCTION X_MRP_ProductInfo_Detail_Fallback_V(date) IS 'Supplemental function to X_MRP_ProductInfo_Detail_V that returns one "empty" row for
*each product.
*each raw-material row that has an end-product row (with the ASIKey according to the BOMLine), using the view MRP_ProductInfo_Poor_Mans_MRP_V
"empty row" means:
*numeric values being 0
*IsFallback=''Y''
Note that we want an empty row (with ASIKey=null) even if there is also a "non-empty" row (with ASIKey!=null, created by X_MRP_ProductInfo_Detail_V) for the given date and product.
';
-------------------------------------------------------------------------------
CREATE OR REPLACE FUNCTION "de.metas.fresh".X_MRP_ProductInfo_Detail_MV_Refresh(
IN DateAt date,
IN M_Product_ID numeric,
IN M_AttributesetInstance_ID numeric)
RETURNS void AS
$BODY$
-- Delete existing records from X_MRP_ProductInfo_Detail_MV.
-- They will be recreated if there is anything to be recreated
-- we don't do any ASI related filtering, because there might be an inout line with an ASI that is totally different from the order line,
-- but still we need to change both the the X_MRP_ProductInfo_Detail_MV records for the inout and the order line
DELETE FROM X_MRP_ProductInfo_Detail_MV
WHERE DateGeneral::Date = $1 AND M_Product_ID = $2
;
-- Insert new rows.
INSERT INTO X_MRP_ProductInfo_Detail_MV (
m_product_id,
dategeneral,
asikey,
PMM_QtyPromised_OnDate, -- FRESH-86
qtyreserved_ondate,
qtyordered_ondate,
qtyordered_sale_ondate,
qtymaterialentnahme,
fresh_qtyonhand_ondate,
fresh_qtypromised,
isfallback,
groupnames)
SELECT
m_product_id,
dategeneral,
asikey,
PMM_QtyPromised_OnDate, -- FRESH-86: Qty from PMM_PurchaseCandidate
qtyreserved_ondate,
qtyordered_ondate,
qtyordered_sale_ondate,
qtymaterialentnahme,
fresh_qtyonhand_ondate,
fresh_qtypromised,
isfallback,
groupnames
FROM X_MRP_ProductInfo_Detail_V($1, $2);
$BODY$
LANGUAGE sql VOLATILE
COST 100;
COMMENT ON FUNCTION "de.metas.fresh".X_MRP_ProductInfo_Detail_MV_Refresh(date, numeric, numeric) IS 'tasks 08681 and 08682: refreshes the table X_MRP_ProductInfo_Detail_MV.
1. deleting existing records
2. calling X_MRP_ProductInfo_Detail_MV so add new records
3. updating fresh_qtymrp using the view "de.metas.fresh".MRP_ProductInfo_Poor_Mans_MRP_V
';
---------------------------------------------------------------------------
--
-- endcustomer projects can contain an overriding version of this view
--
DROP VIEW IF EXISTS X_MRP_ProductInfo_V;
CREATE OR REPLACE VIEW X_MRP_ProductInfo_V AS
SELECT
p.ad_client_id, p.ad_org_id, p.m_product_id, p.name AS ProductName,
p.value, p.ispurchased, p.issold, p.m_product_category_id, p.isactive,
v.DateGeneral,
SUM(v.PMM_QtyPromised_OnDate) AS PMM_QtyPromised_OnDate, -- FRESH-86
SUM(v.qtyreserved_ondate) AS qtyreserved_ondate,
SUM(v.qtyordered_ondate) AS qtyordered_ondate,
SUM(v.qtymaterialentnahme) AS qtymaterialentnahme,
SUM(v.fresh_qtyonhand_ondate) AS fresh_qtyonhand_ondate,
SUM(v.fresh_qtypromised) AS fresh_qtypromised,
COALESCE((
SELECT sum(mrp.fresh_qtymrp) AS sum
FROM "de.metas.fresh".x_mrp_productinfo_detail_poor_mans_mrp mrp
WHERE mrp.dategeneral = v.dategeneral AND mrp.m_product_mrp_id = p.m_product_id
GROUP BY mrp.dategeneral, mrp.m_product_mrp_id), 0::numeric) AS fresh_qtymrp
FROM
M_Product p
JOIN X_MRP_ProductInfo_Detail_MV v ON v.M_Product_ID=p.M_Product_ID
GROUP BY
p.ad_client_id, p.ad_org_id, p.m_product_id, p.name,
-- p.qtyreserved, p.qtyordered, p.qtyonhand, p.qtyavailable,
p.value, p.ispurchased, p.issold, p.m_product_category_id, p.isactive,
v.DateGeneral
; | the_stack |
set enable_global_stats = true;
/*
* This file is used to test the function of vecexpression.cpp
*/
/*******************************
Expression Type:
T_Var,
T_Const,
T_Param,
T_Aggref,
T_WindowFunc,
T_ArrayRef,
T_FuncExpr,
T_NamedArgExpr,
T_OpExpr,
T_DistinctExpr,
T_NullIfExpr,
T_ScalarArrayOpExpr,
T_BoolExpr,
T_SubLink,
T_SubPlan,
T_AlternativeSubPlan,
T_FieldSelect,
T_FieldStore,
T_RelabelType,
T_CoerceViaIO,
T_ArrayCoerceExpr,
T_ConvertRowtypeExpr,
T_CollateExpr,
T_CaseExpr,
T_CaseWhen,
T_CaseTestExpr,
T_ArrayExpr,
T_RowExpr,
T_RowCompareExpr,
T_CoalesceExpr,
T_MinMaxExpr,
T_XmlExpr,
T_NullTest,
T_BooleanTest
Using Type:
qual
targetlist
*********************************/
----
--- Create Table and Insert Data
----
create schema vector_expression_engine;
set current_schema=vector_expression_engine;
create table vector_expression_engine.VECTOR_EXPR_TABLE_01
(
a bool
,b bool
,c int
)with (orientation = orc) tablespace hdfs_ts;
COPY VECTOR_EXPR_TABLE_01(a, b, c) FROM stdin;
true false 1
true true 1
true \N 1
false true 1
false false 1
false \N 1
\N true 1
\N false 1
\N \N 1
\.
create table vector_expression_engine.VECTOR_EXPR_TABLE_02
(
col_int int
,col_int2 int
,col_char char(20)
,col_varchar varchar(30)
,col_date date
,col_num numeric(10,2)
,col_num2 numeric(10,4)
,col_float float4
,col_float2 float8
)with (orientation = orc) tablespace hdfs_ts;
COPY VECTOR_EXPR_TABLE_02(col_int, col_int2, col_char, col_varchar, col_date, col_num, col_num2, col_float, col_float2) FROM stdin;
0 1935401906 aabccd aabccd 2011-11-01 00:00:00 1.20 10.0000 \N 1.1
1 1345971420 abccd abccd 2012-11-02 00:00:00 11.18 1.1181 55.555 55.555
2 656473370 aabccd aabccd 2011-11-01 00:00:00 1.20 10.0000 1.1 1.1
2 1269710788 abccd abccd 2012-11-02 00:00:00 11.18 1.1181 55.555 55.555
2 1156776517 aabccd aabccd 2011-11-01 00:00:00 1.20 10.0000 1.1 1.1
2 1289013296 abccd abccd 2012-11-02 00:00:00 11.18 1.1181 55.555 55.555
2 1415564928 aabccd aabccd \N 1.20 10.0000 1.1 1.1
8 1345971420 abccd abccd 2012-11-02 00:00:00 11.18 1.1181 55.555 55.555
8 435456494 aabccd aabccd 2011-11-01 00:00:00 1.20 10.0000 1.1 1.1
8 66302641 \N abccd 2012-11-02 00:00:00 11.18 1.1181 55.555 55.555
8 915852158 aabccd aabccd 2011-11-01 00:00:00 1.20 10.0000 1.1 1.1
8 1345971420 abccd abccd 2012-11-02 00:00:00 11.18 1.1181 55.555 55.555
8 961711400 aabccd aabccd 2011-11-01 00:00:00 1.20 10.0000 1.1 1.1
8 74070078 abccd \N 2012-11-02 00:00:00 11.18 1.1181 55.555 55.555
87 656473370 aabccd aabccd 2011-11-01 00:00:00 1.20 10.0000 1.1 1.1
87 843938989 abccd abccd 2012-11-02 00:00:00 11.18 1.1181 55.555 55.555
87 189351248 abbccd abbccd 2012-11-02 00:00:00 1.62 6.2110 2.2 2.2
87 1388679963 abbccd abbccd 2012-11-02 00:00:00 1.62 6.2110 2.2 2.2
87 556726251 abbccd abbccd 2012-11-02 00:00:00 1.62 6.2110 2.2 2.2
87 634715959 abbccd abbccd 2012-11-02 00:00:00 1.62 6.2110 2.2 2.2
87 1489080225 abbccd abbccd 2012-11-02 00:00:00 1.62 6.2110 2.2 2.2
87 649132105 abbccd abbccd 2012-11-02 00:00:00 1.62 6.2110 2.2 2.2
87 886008616 abbccd abbccd 2012-11-02 00:00:00 1.62 6.2110 2.2 2.2
123 1935401906 abbccd \N 2012-11-02 00:00:00 1.62 6.2110 2.2 2.2
123 1935401906 aabbcd aabbcd 2012-11-03 00:00:00 29.00 24.1100 3.33 3.33
123 846480997 aabbcd aabbcd 2012-11-03 00:00:00 29.00 24.1100 3.33 3.33
123 1102020422 aabbcd aabbcd 2012-11-03 00:00:00 29.00 24.1100 3.33 3.33
123 1533442662 aabbcd aabbcd 2012-11-03 00:00:00 \N 24.1100 3.33 3.33
123 1935401906 aabbcd aabbcd 2012-11-03 00:00:00 29.00 24.1100 3.33 3.33
123 656473370 \N aabbcd 2012-11-03 00:00:00 29.00 24.1100 3.33 3.33
123 539384293 aabbcd aabbcd 2012-11-03 00:00:00 29.00 24.1100 3.33 3.33
\N \N aabbcd aabbcd 2012-11-03 00:00:00 29.00 24.1100 \N 3.33
\N \N abbccd abbccd 2012-12-01 00:00:00 221.70 11.1700 13822.2 13822.237
\N \N abbccd abbccd 2012-12-01 00:00:00 221.70 11.1700 13822.2 13822.237
\N \N abbccd abbccd 2012-12-01 00:00:00 221.70 11.1700 \N 13822.237
\N \N abbccd abbccd 2012-12-01 00:00:00 221.70 11.1700 13822.2 13822.237
\N \N abbccd abbccd 2012-12-01 00:00:00 221.70 11.1700 13822.2 13822.237
\N \N abbccd abbccd 2012-12-01 00:00:00 221.70 11.1700 13822.2 13822.237
\N \N abbccd abbccd 2012-12-01 00:00:00 221.70 11.1700 13822.2 13822.237
\N \N abbccd abbccd 2012-12-01 00:00:00 221.70 11.1700 13822.2 13822.237
\N \N aaccccd aaccccd 2012-12-02 00:00:00 3.78 37.3737 2.58 \N
\N \N aaccccd aaccccd 2012-12-02 00:00:00 \N 37.3737 2.58 2.58
\N \N aaccccd aaccccd 2012-12-02 00:00:00 3.78 37.3737 2.58 2.58
\N \N aaccccd aaccccd 2012-12-02 00:00:00 3.78 37.3737 2.58 2.58
\N \N aaccccd aaccccd 2012-12-02 00:00:00 3.78 37.3737 2.58 \N
\N \N aaccccd aaccccd \N 3.78 37.3737 2.58 2.58
\N \N aaccccd aaccccd 2012-12-02 00:00:00 3.78 37.3737 2.58 2.58
\N \N aaccccd aaccccd 2012-12-02 00:00:00 3.78 37.3737 2.58 2.58
\N \N abbccd abbccd 2013-11-12 00:00:00 87.10 1.8700 3.67233 3.672335
\N \N abbccd abbccd 2013-11-12 00:00:00 87.10 1.8700 3.67233 3.672335
\N \N abbccd abbccd 2013-11-12 00:00:00 87.10 1.8700 3.67233 3.672335
\N \N abbccd abbccd 2013-11-12 00:00:00 87.10 1.8700 3.67233 3.672335
\N \N abbccd abbccd 2013-11-12 00:00:00 87.10 1.8700 3.67233 3.672335
\N \N abbccd abbccd 2013-11-12 00:00:00 87.10 1.8700 3.67233 3.672335
\N \N abbccd abbccd 2013-11-12 00:00:00 87.10 1.8700 3.67233 3.672335
\N \N abbccd abbccd 2013-11-12 00:00:00 87.10 1.8700 3.67233 3.672335
\N \N acbccd acbccd 2012-11-01 00:00:00 5.10 131.1100 44.4 44.4
\N \N acbccd acbccd 2012-11-01 00:00:00 5.10 131.1100 44.4 44.4
\N \N acbccd acbccd 2012-11-01 00:00:00 5.10 131.1100 44.4 44.4
\N \N acbccd acbccd 2012-11-01 00:00:00 5.10 131.1100 44.4 44.4
\N \N acbccd acbccd 2012-11-01 00:00:00 5.10 131.1100 44.4 44.4
\N \N acbccd acbccd 2012-11-01 00:00:00 5.10 131.1100 44.4 44.4
\N \N acbccd acbccd 2012-11-01 00:00:00 5.10 131.1100 44.4 44.4
\N \N acbccd acbccd 2012-11-01 00:00:00 5.10 131.1100 44.4 44.4
\N \N aaccccd aaccccd 2012-12-02 00:00:00 3.78 37.3737 2.58 2.58
\N \N abbccd abbccd 2013-11-12 00:00:00 87.10 \N 3.67233 3.672335
\N \N aaccccd aaccccd 2012-12-02 00:00:00 3.78 37.3737 2.58 2.58
\N \N abbccd abbccd 2013-11-12 00:00:00 87.10 1.8700 3.67233 3.672335
\N \N aaccccd aaccccd 2012-12-02 00:00:00 3.78 37.3737 2.58 2.58
\N \N abbccd abbccd 2013-11-12 00:00:00 87.10 1.8700 3.67233 3.672335
\N \N aaccccd aaccccd 2012-12-02 00:00:00 3.78 37.3737 2.58 2.58
\N \N abbccd abbccd 2013-11-12 00:00:00 87.10 1.8700 3.67233 3.672335
\N \N aaccccd aaccccd 2012-12-02 00:00:00 3.78 37.3737 2.58 2.58
\N \N abbccd abbccd 2013-11-12 00:00:00 87.10 1.8700 3.67233 3.672335
\N \N aaccccd aaccccd 2012-12-02 00:00:00 3.78 37.3737 2.58 2.58
\N \N abbccd abbccd 2013-11-12 00:00:00 87.10 1.8700 3.67233 3.672335
\N \N aaccccd aaccccd 2012-12-02 00:00:00 3.78 37.3737 \N 2.58
\N \N abbccd abbccd 2013-11-12 00:00:00 87.10 1.8700 3.67233 3.672335
\N \N aaccccd aaccccd \N 3.78 37.3737 2.58 2.58
\N \N abbccd abbccd 2013-11-12 00:00:00 87.10 1.8700 3.67233 3.672335
\.
CREATE TABLE vector_expression_engine.VECTOR_EXPR_TABLE_03(
a int,
b int,
c int
) WITH (orientation = orc) tablespace hdfs_ts distribute by hash (a);
COPY VECTOR_EXPR_TABLE_03(a, b, c) FROM stdin;
1 1 1
1 1 2
1 1 3
1 1 4
1 2 1
1 2 2
1 2 3
2 1 1
2 1 2
2 1 3
2 1 4
2 2 1
2 2 2
2 2 3
2 2 4
2 1 3
2 3 2
2 3 3
2 3 4
3 1 1
3 1 2
3 1 3
3 1 4
3 2 3
3 2 1
4 0 0
\.
CREATE TABLE vector_expression_engine.VECTOR_EXPR_TABLE_04
(
a varchar
,b char(10)
,c varchar(10)
,d text
) with(orientation = orc) tablespace hdfs_ts;
COPY VECTOR_EXPR_TABLE_04(a, b, c, d) FROM stdin;
abc \N \N \N
\N 1 2.0 \N
\N \N 2.0 \N
\N \N \N \N
\N \N \N def
\N 2 \N \N
\.
CREATE TABLE vector_expression_engine.VECTOR_EXPR_TABLE_05
(
a bool
,b int
,c bool
) with (orientation = orc) tablespace hdfs_ts;
COPY VECTOR_EXPR_TABLE_05(a, b, c) FROM stdin;
1 1 1
1 1 0
1 0 1
1 0 0
0 1 1
0 1 0
0 0 1
0 0 0
\N 0 0
1 \N 0
\.
CREATE TABLE vector_expression_engine.VECTOR_EXPR_TABLE_06
(
a varchar
,b char(10)
,c text
) with(orientation = orc) tablespace hdfs_ts;
COPY VECTOR_EXPR_TABLE_06(a, b, c) FROM stdin;
abc abb \N
\N abb abc
abcdefgh \N abcdefgg
abc \N aabcdefg
\N \N \N
\.
CREATE TABLE vector_expression_engine.VECTOR_EXPR_TABLE_07
(
col_num numeric(5, 0)
,col_int int
,col_timestamptz timestamptz
,col_varchar varchar
,col_char char(2)
,col_interval interval
,col_timetz timetz
,col_tinterval tinterval
) with(orientation = orc) tablespace hdfs_ts;
COPY VECTOR_EXPR_TABLE_07(col_num, col_int, col_timestamptz, col_varchar, col_char, col_interval, col_timetz, col_tinterval) FROM stdin;
123 5 2017-09-09 19:45:37 2017-09-09 19:45:37 a 2 day 13:34:56 1984-2-6 01:00:30+8 ["Sep 4, 1983 23:59:12" "Oct 4, 1983 23:59:12"]
234 6 2017-10-09 19:45:37 2017-10-09 19:45:37 c 1 day 18:34:56 1986-2-6 03:00:30+8 ["May 10, 1947 23:59:12" "Jan 14, 1973 03:14:21"]
345 7 2017-11-09 19:45:37 2017-11-09 19:45:37 d 1 day 13:34:56 1987-2-6 08:00:30+8 ["epoch" "Mon May 1 00:30:30 1995"]
456 8 2017-12-09 19:45:37 2017-12-09 19:45:37 h 18 day 14:34:56 1989-2-6 06:00:30+8 ["Feb 15 1990 12:15:03" "2001-09-23 11:12:13"]
567 9 2018-01-09 19:45:37 2018-01-09 19:45:37 m 18 day 15:34:56 1990-2-6 12:00:30+8 \N
678 10 2018-02-09 19:45:37 2018-02-09 19:45:37 \N 7 day 16:34:56 2002-2-6 00:00:30+8 ["-infinity" "infinity"]
789 11 2018-03-09 19:45:37 2018-03-09 19:45:37 g 22 day 13:34:56 1984-2-6 00:00:30+8 ["Feb 10, 1947 23:59:12" "Jan 14, 1973 03:14:21"]
147 12 2018-04-09 19:45:37 2018-04-09 19:45:37 l \N 1984-2-7 00:00:30+8 ["Feb 10, 1947 23:59:12" "Jan 14, 1973 03:14:21"]
369 13 2018-05-09 19:45:37 2018-05-09 19:45:37 a 21 day 13:34:56 \N ["Feb 10, 1947 23:59:12" "Jan 14, 1973 03:14:21"]
\.
CREATE TABLE vector_expression_engine.VECTOR_EXPR_TABLE_08
(
col_num numeric(3,0)
,col_int int
)with(orientation = orc) tablespace hdfs_ts;
COPY VECTOR_EXPR_TABLE_08(col_num, col_int) FROM stdin;
1 1
\.
CREATE TABLE vector_expression_engine.VECTOR_EXPR_TABLE_09
(
col_num numeric(3,0)
,col_num2 numeric(10,0)
,col_varchar varchar
,col_text text
)with(orientation = orc) tablespace hdfs_ts;
COPY VECTOR_EXPR_TABLE_09(col_num, col_num2, col_varchar, col_text) FROM stdin;
1.23 56789 1234 1.23
1.23 102.45 abcd 1.23
\.
CREATE TABLE vector_expression_engine.VECTOR_EXPR_TABLE_10
(
col_int int
,col_dp double precision
,col_time time
,col_interval interval
) with (orientation = orc) tablespace hdfs_ts;
COPY VECTOR_EXPR_TABLE_10(col_int, col_dp, col_time, col_interval) FROM stdin;
1 10.1 02:15:01 4 day 13:24:56
2 20.2 16:00:52 1 day 17:52:09
3 -30.3 14:20:00 1 day 17:52:09
4 \N 11:00:10 \N
\.
CREATE TABLE vector_expression_engine.VECTOR_EXPR_TABLE_11
(
col_int int
,col_int2 int
,col_char char(10)
,col_varchar varchar
) with (orientation = orc) tablespace hdfs_ts;
COPY VECTOR_EXPR_TABLE_11(col_int, col_int2, col_char, col_varchar) FROM stdin;
1 1 test test
10 10 atest atest
2 \N atest atest
\N 3 atest atest
\N 3 \N atest
\N 3 atest \N
\N \N \N \N
12 13 12 13
12 13 123 13
\.
CREATE TABLE vector_expression_engine.ROW_EXPR_TABLE_12
(
i1 int,
i2 int,
i3 int8,
c1 char(1),
c2 char(6),
n1 numeric(15, 2),
n2 numeric(16, 2),
d1 date
)distribute by hash (i2);
INSERT INTO ROW_EXPR_TABLE_12 VALUES
(1, 2, 1, 'a', 'aabbcc', 1.0, 3.27, '1995-11-01 3:25 pm'),(2, 3, 3, 'b', 'xxbbcc', 1.0, 6.32, '1996-02-01 1:12 pm'),
(10, 11, 4, 'c', 'aacc', 1.0, 2.27, '1995-03-11 4:15 am'),(21, 6, 6, 'd', 'xxbbcc', 1.0, 1.11, '2005-01-21 3:25 pm'),
(21, 6, 6, 'd', 'xxbbcc', 1.0, 1.11, '2005-01-21 3:25 pm'),(21, 6, NULL, 'd', NULL, 1.0, 1.11, '2005-01-21 3:25 pm'),
(21, 5, NULL, 'd', NULL, 1.0, 1.11, '2005-01-21 3:25 pm');
insert into ROW_EXPR_TABLE_12 select * from ROW_EXPR_TABLE_12;
insert into ROW_EXPR_TABLE_12 select * from ROW_EXPR_TABLE_12;
insert into ROW_EXPR_TABLE_12 select * from ROW_EXPR_TABLE_12;
insert into ROW_EXPR_TABLE_12 select * from ROW_EXPR_TABLE_12;
insert into ROW_EXPR_TABLE_12 select * from ROW_EXPR_TABLE_12;
insert into ROW_EXPR_TABLE_12 select * from ROW_EXPR_TABLE_12;
insert into ROW_EXPR_TABLE_12 select * from ROW_EXPR_TABLE_12;
insert into ROW_EXPR_TABLE_12 select * from ROW_EXPR_TABLE_12;
insert into ROW_EXPR_TABLE_12 select * from ROW_EXPR_TABLE_12;
insert into ROW_EXPR_TABLE_12 select * from ROW_EXPR_TABLE_12;
insert into ROW_EXPR_TABLE_12 select * from ROW_EXPR_TABLE_12;
insert into ROW_EXPR_TABLE_12 select * from ROW_EXPR_TABLE_12;
INSERT INTO ROW_EXPR_TABLE_12 VALUES
(2, 3, 5, 'b', 'xxbbcc', 1.0, 6.32, '1995-01-01 3:25 pm'),(10, 11, 3, 'a', 'aacc', 1.0, 2.27, '1996-01-01 3:25 pm'),
(2, 3, 2, 'e', 'xxbbcc', 6.0, 2.32, '1996-01-01 3:25 pm'),(12, 6, 1, 'e', 'xxbbcc', 2.0, 1.21, '1996-01-01 4:25 pm');
CREATE TABLE vector_expression_engine.VECTOR_EXPR_TABLE_12
(
i1 int,
i2 int,
i3 int8,
c1 char(1),
c2 char(6),
n1 numeric(15, 2),
n2 numeric(16, 2),
d1 date
)with(orientation = orc) tablespace hdfs_ts distribute by hash (i2);
insert into VECTOR_EXPR_TABLE_12 select * from ROW_EXPR_TABLE_12;
insert into VECTOR_EXPR_TABLE_12 select * from ROW_EXPR_TABLE_12;
insert into ROW_EXPR_TABLE_12 select * from ROW_EXPR_TABLE_12;
insert into VECTOR_EXPR_TABLE_12 select * from ROW_EXPR_TABLE_12;
CREATE TABLE vector_expression_engine.VECTOR_EXPR_TABLE_13
(
col_int int
,col_date date
,col_num numeric(5,1)
)with(orientation = orc) tablespace hdfs_ts distribute by hash(col_int);
COPY VECTOR_EXPR_TABLE_13(col_int, col_date, col_num) FROM stdin;
1 2015-02-26 1.1
2 2015-02-26 2.3
3 2015-01-26 2.3
4 2015-02-26 10
4 2015-03-26 10
7 2015-04-26 3.6
8 \N 1.2
\N \N \N
\.
CREATE TABLE vector_expression_engine.VECTOR_EXPR_TABLE_14
(
a int
,b bpchar
,c text
)with(orientation = orc) tablespace hdfs_ts distribute by hash(a);
COPY VECTOR_EXPR_TABLE_14(a, b, c) FROM stdin;
1 1234 56358
3 12487 569
4 25 36
6 098 587
0 1234 45678
12 \N 782
15 123 \N
3 890 23
12 1245 6589
56 25 8912
6 89 569
\N \N \N
\N 452 \N
\.
CREATE TABLE vector_expression_engine.VECTOR_EXPR_TABLE_15
(
a INT,
b TIMESTAMP
)WITH(orientation = orc) tablespace hdfs_ts DISTRIBUTE BY HASH(a);
INSERT INTO VECTOR_EXPR_TABLE_15 VALUES(1, NULL);
INSERT INTO VECTOR_EXPR_TABLE_15 VALUES(2, '2015-03-10 20:37:10.473294'),(3, '2015-03-10 20:37:10.473294');
analyze vector_expr_table_01;
analyze vector_expr_table_02;
analyze vector_expr_table_03;
analyze vector_expr_table_04;
analyze vector_expr_table_05;
analyze vector_expr_table_06;
analyze vector_expr_table_07;
analyze vector_expr_table_08;
analyze vector_expr_table_09;
analyze vector_expr_table_10;
analyze vector_expr_table_11;
analyze vector_expr_table_12;
analyze vector_expr_table_13;
analyze vector_expr_table_14;
analyze vector_expr_table_15;
----
--- case 1: AND OR NOT
----
explain (verbose on, costs off) select a, b, a and b, a or b, not a from vector_expr_table_01;
select a, b, a and b, a or b, not a from vector_expr_table_01 order by 1, 2, 3, 4, 5;
--NULL Test
explain (verbose on, costs off) select * from vector_expr_table_01 where a is NULL order by 1, 2;
select * from vector_expr_table_01 where a is NULL order by 1, 2;
select * from vector_expr_table_01 where a is not NULL order by 1, 2;
select a from vector_expr_table_01 where a is NULL order by 1;
select a from vector_expr_table_01 where a is not NULL order by 1;
select * from vector_expr_table_01 where b is not NULL order by 1, 2;
select * from vector_expr_table_01 where a is NULL and b is not NULL order by 1, 2;
select * from vector_expr_table_01 where a is not NULL and b is NULL order by 1, 2;
select * from vector_expr_table_01 where a is not NULL and b is not NULL order by 1, 2;
select a is not NULL, a from vector_expr_table_01 order by 1, 2;
select a is NULL, a from vector_expr_table_01 order by 1, 2;
select a is not NULL, a from vector_expr_table_01 where a is not NULL order by 1, 2;
select a is NULL, a from vector_expr_table_01 where a is NULL order by 1, 2;
--Operation
explain (verbose on, costs off) select * from vector_expr_table_02 where col_int = 1;
select * from vector_expr_table_02 where col_int = 1;
select col_int, col_int2, col_int + col_int2 from vector_expr_table_02 where col_int = 1;
--Date
select col_date, sum(1) from vector_expr_table_02 where col_date between date '2012-11-02' and date '2012-12-20' group by col_date order by 1, 2;
select A.col_date, sum(1) s from vector_expr_table_02 A where extract(year from A.col_date) >= 2012 group by A.col_date order by A.col_date, s;
explain (verbose on, costs off) select A.col_date, extract(year from B.col_date) y from vector_expr_table_02 A join vector_expr_table_02 B on A.col_char=B.col_char group by A.col_date,extract(year from B.col_date) order by 1, y;
select A.col_date, extract(year from B.col_date) y from vector_expr_table_02 A join vector_expr_table_02 B on A.col_char=B.col_char group by A.col_date,extract(year from B.col_date) order by 1, y;
explain (verbose on, costs off) select A.col_date, substring(B.col_varchar, 1, 2) y from vector_expr_table_02 A join vector_expr_table_02 B on A.col_char = B.col_char group by A.col_date,substring(B.col_varchar, 1, 2) order by A.col_date, y;
select A.col_date, substring(B.col_varchar, 1, 2) y from vector_expr_table_02 A join vector_expr_table_02 B on A.col_char = B.col_char group by A.col_date,substring(B.col_varchar, 1, 2) order by A.col_date, y;
select A.col_date, sum(1) s from vector_expr_table_02 A where abs(-extract(year from A.col_date)) >= 2012 group by A.col_date order by A.col_date, s;
-- String ops does not require special plan, FIXME: IN-list is still not right)
select col_int, sum(1) from vector_expr_table_02 where col_char like '%cc%' group by col_int order by col_int;
select col_int, sum(1) from vector_expr_table_02 where col_varchar like '%cc%' group by col_int order by col_int;
select col_int, sum(1) from vector_expr_table_02 where col_char like 'ab%' group by col_int order by col_int;
select col_int, sum(1) from vector_expr_table_02 where col_varchar like 'ab%' group by col_int order by col_int;
select col_char, sum(1) from vector_expr_table_02 where col_char not like '%d' group by col_char order by col_char;
select col_varchar, sum(1) from vector_expr_table_02 where col_varchar not like '%d' group by col_varchar order by col_varchar;
select col_int, sum(1) from vector_expr_table_02 where col_char = 'aabccd' group by col_int order by col_int;
select col_int, sum(1) from vector_expr_table_02 where col_varchar = 'aabccd' group by col_int order by col_int;
select col_int, sum(1) from vector_expr_table_02 where col_char <> 'aabccd' group by col_int order by col_int;
select col_int, sum(1) from vector_expr_table_02 where col_varchar <> 'aabccd' group by col_int order by col_int;
select col_int, sum(1) from vector_expr_table_02 where substring(col_char from 1 for 2) <> 'aa' group by col_int order by col_int;
select col_int, sum(1) from vector_expr_table_02 where substring(col_char from 1 for 2) <> 'aa' group by col_int order by col_int;
select col_int, sum(1) from vector_expr_table_02 where substring(col_char, 1, 2) <> 'aa' group by col_int order by col_int;
select col_int, 'OkThisSoundsGood' from vector_expr_table_02 where substring(col_char from 1 for 2) <> 'aa' order by col_int;
--Float, Integer
select min(col_int),min(col_int2),min(col_char),min(col_varchar),min(col_date),min(col_num),min(col_num2),min(col_float),min(col_float2) from vector_expr_table_02;
select max(col_int),max(col_int2),max(col_char),max(col_varchar),max(col_date),max(col_num),max(col_num2),max(col_float),max(col_float2) from vector_expr_table_02;
select count(col_int),count(col_int2),count(col_char),count(col_varchar),count(col_date),count(col_num),count(col_num2),count(col_float),count(col_float2) from vector_expr_table_02;
select sum(col_int),sum(col_int2),sum(col_num),sum(col_num2),sum(col_float),sum(col_float2) from vector_expr_table_02;
select col_int,sum(col_int) from vector_expr_table_02 group by col_int order by col_int;
select col_int2,sum(col_int2) from vector_expr_table_02 group by col_int2 order by col_int2;
select col_num,sum(col_num) from vector_expr_table_02 group by col_num order by col_num;
select col_num2,sum(col_num2) from vector_expr_table_02 group by col_num2 order by col_num2;
select col_float,sum(col_float) from vector_expr_table_02 group by col_float order by col_float;
select col_float2,sum(col_float2) from vector_expr_table_02 group by col_float2 order by col_float2;
select col_int, col_int2, sum(abs(-col_int!)+abs(col_int-col_int2!)) as a from vector_expr_table_02 where col_int < 25 AND col_int > 2 AND col_int2 <= 1935401906 group by col_int, col_int2 order by col_int, col_int2;
select col_int, col_int2, sum(abs(-col_int)+width_bucket(5.35, 0.024, 10.06, col_int)) as a from vector_expr_table_02 where col_int < 25 AND col_int > 2 AND col_int2 <= 2036166893 group by col_int, col_int2 order by col_int, col_int2;
select col_int, col_int2, sum(abs(-col_int)+abs(-col_int2)) as a from vector_expr_table_02 where col_int < 25 AND col_int > 2 AND col_int2 <= 2036166893 group by col_int, col_int2 order by col_int, col_int2;
select col_int, col_int2, sum(width_bucket(5.35::float, 0.024::float, 10.06::float, col_int)) as a from vector_expr_table_02 where col_int < 25 AND col_int > 2 AND col_int2 <= 1935401906 group by col_int, col_int2 order by col_int, col_int2;
select col_float,avg(col_float) from vector_expr_table_02 group by col_float order by col_float;
select col_float2,avg(col_float2) from vector_expr_table_02 group by col_float2 order by col_float2;
select count(col_int) + 2, avg(col_num) - 3 from vector_expr_table_02;
select count(col_num2),min(col_char),max(col_varchar),sum(col_float),avg(col_num2) from vector_expr_table_02;
select count(col_num2),min(col_char),max(col_varchar),sum(col_float),avg(col_num2) from vector_expr_table_02 group by col_float2 order by col_float2;
select col_int, col_int2, substring(col_varchar, 1, 2), count(*) from vector_expr_table_02 where col_date > '2012-10-1' group by col_int, col_int2, substring(col_varchar, 1, 2) order by col_int, col_int2, 4;
----
--- test 2: Test Case Expression
----
explain (verbose on, costs off) select col_int2, sum(case when col_int in (1, 7, 229, 993, 81, 6) then 1 else 0 end) as a, 'myConstString' from vector_expr_table_02 group by col_int2 order by col_int2;
select col_int2, sum(case when col_int in (1, 7, 229, 993, 81, 6) then 1 else 0 end) as a from vector_expr_table_02 group by col_int2 order by col_int2;
select col_int2, sum(case when col_int < 17 or col_int > 37 then 1 else 0 end) as a from vector_expr_table_02 group by col_int2 order by col_int2;
explain (verbose on, costs off) select col_int, col_int2, sum(case when col_int < 17 AND col_int > 7 AND col_int2 <= 1935401906 then 1 else 0 end) as a from vector_expr_table_02 where col_int < 25 AND col_int > 2 AND col_int2 <= 2036973298 group by col_int, col_int2 order by col_int, col_int2;
explain (verbose on, costs off) select col_int, col_int2, sum(case when col_int < 17 OR (col_int > 37 AND col_int2 > 10) then 1 else 0 end) as a from vector_expr_table_02 where col_int < 19 OR (col_int > 37 AND col_int2 > 2) group by col_int, col_int2 order by col_int, col_int2;
explain (verbose on, costs off) select col_int, col_int2, sum(case when col_int < 17 OR NOT (col_int > 7 AND col_int2 > 2) then 1 else 0 end) as a from vector_expr_table_02 where col_int < 19 OR NOT (col_int > 2 AND col_int2 > 1) AND NOT (col_int > 10 AND col_int2 < 10) group by col_int2, col_int order by col_int, col_int2;
select col_int, col_int2, 'myConstString', sum(case when col_int < 17 AND col_int > 7 AND col_int2 <= 1935401906 then 1 else 0 end) as a, 'my2ndConstString' from vector_expr_table_02 where col_int < 25 AND col_int > 2 AND col_int2 <= 2036973298 group by col_int, col_int2 order by col_int, col_int2;
select col_int, col_int2, sum(case when col_int < 17 AND col_int > 7 AND col_int2 <= 1935401906 then 1 else 0 end) as a from vector_expr_table_02 where col_int < 25 AND col_int > 2 AND col_int2 <= 2036973298 group by col_int, col_int2 order by col_int, col_int2;
select col_int, col_int2, sum(case when col_int < 17 OR (col_int > 37 AND col_int2 > 10) then 1 else 0 end) as a from vector_expr_table_02 where col_int < 19 OR (col_int > 37 AND col_int2 > 2) group by col_int, col_int2 order by col_int, col_int2;
select col_int, col_int2, sum(case when col_int < 17 OR NOT (col_int > 7 AND col_int2 > 2) then 1 else 0 end) as a from vector_expr_table_02 where col_int < 19 OR NOT (col_int > 2 AND col_int2 > 1) AND NOT (col_int > 10 AND col_int2 < 10) group by col_int2, col_int order by col_int, col_int2;
select col_int, col_int2, sum(case when col_int < 17 OR NOT (col_int > 7 AND col_int2 > 2) then 1 else 0 end) as a from vector_expr_table_02 where col_int < 19 OR NOT (col_int > 2 AND col_int2 > 1) AND NOT (col_int > 10 AND col_int2 < 10) group by col_int2, col_int order by col_int, col_int2;
select col_int2, sum(case when col_int < 17 or col_int > 37 then 100*col_num + 10.0*col_num +col_num*col_num2-col_num*col_num2 when col_int > 17 and col_int < 37 then col_num2-col_num else 6 end), sum (col_num-col_num2+col_num/col_num2+10) as a from vector_expr_table_02 group by col_int2 order by col_int2;
select col_char, sum(1) from vector_expr_table_02 where col_char in ('aabccd', 'abccd', 'abbccd') group by col_char order by col_char;
select col_varchar, sum(1) from vector_expr_table_02 where col_varchar in ('aabccd', 'abccd', 'abbccd') group by col_varchar order by col_varchar;
select overlay(col_varchar placing 'test' from 2) from vector_expr_table_02 order by col_varchar limit 1;
----
--- test 3: Test Multi-Level Case Expression
----
--simple one level
explain (verbose on, costs off) select a, b, case
when a = 1 then '1X'
when a = 2 then '2X'
when a = 3 then '3X'
end
from vector_expr_table_03;
select a, b, case
when a = 1 then '1X'
when a = 2 then '2X'
when a = 3 then '3X'
end
from vector_expr_table_03 order by 1, 2;
--one level with default value
select a, b, case
when a = 1 then '1X'
when a = 2 then '2X'
when a = 3 then '3X'
else 'other'
end
from vector_expr_table_03 order by 1, 2;
--simple 2 level
explain (verbose on, costs off)
select a, b, case
when a = 1 then
case
when b = 1 then '11'
when b = 2 then '12'
when b = 3 then '13'
end
when a = 2 then
case
when b = 1 then '21'
when b = 2 then '22'
when b = 3 then '23'
end
end from vector_expr_table_03;
select a, b, case
when a = 1 then
case
when b = 1 then '11'
when b = 2 then '12'
when b = 3 then '13'
end
when a = 2 then
case
when b = 1 then '21'
when b = 2 then '22'
when b = 3 then '23'
end
end from vector_expr_table_03 order by 1, 2;
--2 level with default value
select a, b, case
when a = 1 then
case
when b = 1 then '11'
when b = 2 then '12'
when b = 3 then '13'
else '1X other'
end
when a = 2 then
case
when b = 1 then '21'
when b = 2 then '22'
when b = 3 then '23'
else '2X other'
end
else 'other'
end from vector_expr_table_03 order by 1, 2;
--3 level
select a, b, c, case
when a = 1 then
case
when b = 1 then case
when c = 1 then '111'
when c = 2 then '112'
end
when b = 2 then '12'
when b = 3 then case
when c = 1 then '131'
when c = 3 then '133'
else '13X other'
end
else '1X other'
end
when a = 2 then
case
when b = 1 then '21'
when b = 2 then case
when c = 2 then '222'
when c = 3 then '223'
else '22X other'
end
when b = 3 then '23'
else '2X other'
end
else 'other'
end from vector_expr_table_03 order by 1, 2, 3;
select a, b, case a when true then case b when true then '11' else '10' end else case b when true then '01' else '00' end end from vector_expr_table_05 order by 1, 2;
select a, b, c, case a > b
when true then
case b > ( case c when true then 1 when false then 0 end)
when true then 'a>b b>c'
when false then 'a>b b<=c'
end
when false then
case b > ( case c when true then 1 when false then 0 end)
when true then 'a<=b b>c'
when false then 'a<=b b<=c'
end
end
from vector_expr_table_05 order by 1, 2, 3;
select a, b, c, case a > b
when b > c then
case b > ( case c when true then 1 when false then 0 end)
when true then 'a>b == b>c == 1'
when false then 'a>b == b>c == 0'
end
when b <= c then
case a > ( case c when true then 1 when false then 0 end)
when true then 'a>b == b<=c a>c==1'
when false then 'a>b == b<=c a>c==0'
end
end
from vector_expr_table_05 order by 1, 2, 3;
select a, b, c, case a > b
when true then
case b > ( case c>'b' when true then '1' when false then '0' end)
when true then 'a>b b>c'
when false then 'a>b b<=c'
end
when false then
case b > ( case c <='b' when true then '1' when false then '0' end)
when true then 'a<=b b>c'
when false then 'a<=b b<=c'
end
end
from vector_expr_table_06 order by 1, 2, 3;
select a, b, c, case a > b
when b > c then
case b > ( case c when true then 1 when false then 0 end)
when true then 'a>b == b>c == 1'
when false then 'a>b == b>c == 0'
else 'a>b == b>c'
end
when b <= c then
case a > ( case c when true then 1 when false then 0 end)
when true then 'a>b == b<=c a>c==1'
when false then 'a>b == b<=c a>c==0'
else 'a>b ==b<=c'
end
else 'other'
end
from vector_expr_table_05 order by 1, 2, 3;
----
--- test 4: Scarlar Array OP( ANY & ALL)
----
--OP ANY
explain (verbose on, costs off) select col_int from vector_expr_table_02 where col_int = ANY(array[NULL]) order by 1;
select col_int from vector_expr_table_02 where col_int = ANY(array[NULL]) order by 1;
select col_int from vector_expr_table_02 where col_int = ANY(array[NULL, 0]) order by 1;
select col_int from vector_expr_table_02 where col_int = ANY(array[0, NULL]) order by 1;
select col_int from vector_expr_table_02 where col_int = ANY(array[NULL, 1]) order by 1;
select col_int from vector_expr_table_02 where col_int = ANY(array[1, NULL]) order by 1;
select col_int from vector_expr_table_02 where col_int > ANY(array[NULL]) order by 1;
select col_int from vector_expr_table_02 where col_int > ANY(array[NULL, 0]) order by 1;
select col_int from vector_expr_table_02 where col_int > ANY(array[0, NULL]) order by 1;
select col_int from vector_expr_table_02 where col_int > ANY(array[NULL, 1]) order by 1;
select col_int from vector_expr_table_02 where col_int > ANY(array[1, NULL]) order by 1;
select col_int from vector_expr_table_02 where col_int < ANY(array[NULL]) order by 1;
select col_int from vector_expr_table_02 where col_int < ANY(array[NULL, 0]) order by 1;
select col_int from vector_expr_table_02 where col_int < ANY(array[0, NULL]) order by 1;
select col_int from vector_expr_table_02 where col_int < ANY(array[NULL, 1]) order by 1;
select col_int from vector_expr_table_02 where col_int < ANY(array[1, NULL]) order by 1;
select col_int from vector_expr_table_02 where col_int = ANY(array[1, 2, 3]) order by 1;
select col_int from vector_expr_table_02 where col_int > ANY(array[-1, 2, 0]) order by 1;
select col_int from vector_expr_table_02 where col_int < ANY(array[8, -1, 0]) order by 1;
--OP ALL
select col_int from vector_expr_table_02 where col_int = ALL(array[NULL]) order by 1;
select col_int from vector_expr_table_02 where col_int = ALL(array[NULL, 0]) order by 1;
select col_int from vector_expr_table_02 where col_int = ALL(array[0, NULL]) order by 1;
select col_int from vector_expr_table_02 where col_int = ALL(array[NULL, 1]) order by 1;
select col_int from vector_expr_table_02 where col_int = ALL(array[1, NULL]) order by 1;
select col_int from vector_expr_table_02 where col_int > ALL(array[NULL]) order by 1;
select col_int from vector_expr_table_02 where col_int > ALL(array[NULL, 0]) order by 1;
select col_int from vector_expr_table_02 where col_int > ALL(array[0, NULL]) order by 1;
select col_int from vector_expr_table_02 where col_int > ALL(array[NULL, 1]) order by 1;
select col_int from vector_expr_table_02 where col_int > ALL(array[1, NULL]) order by 1;
select col_int from vector_expr_table_02 where col_int < ALL(array[NULL]) order by 1;
select col_int from vector_expr_table_02 where col_int < ALL(array[NULL, 0]) order by 1;
select col_int from vector_expr_table_02 where col_int < ALL(array[0, NULL]) order by 1;
select col_int from vector_expr_table_02 where col_int < ALL(array[NULL, 1]) order by 1;
select col_int from vector_expr_table_02 where col_int < ALL(array[1, NULL]) order by 1;
select col_int from vector_expr_table_02 where col_int = ALL(array[1, 2, 3]) order by 1;
select col_int from vector_expr_table_02 where col_int > ALL(array[-1, 2, 0]) order by 1;
select col_int from vector_expr_table_02 where col_int < ALL(array[8, -1, 0]) order by 1;
----
--- test 5: Coalesce Expression
----
select a, b, c, d, coalesce(a, b, c, d) abcd, coalesce(a, b, c) abc, coalesce(a, b) ab, coalesce(a, c) ac, coalesce(b, c) bc, coalesce(a) a, coalesce(b) b, coalesce(c) c, coalesce(d) d from vector_expr_table_04 order by 1, 2, 3, 4;
select a, b, c, coalesce(a, coalesce(a)), coalesce(a, coalesce(a, coalesce(a))), coalesce(a, coalesce(b, coalesce(c))), coalesce(a, coalesce(a, b, c)) from vector_expr_table_04 order by 1, 2, 3;
----
--- test 6: Boolean Expression
----
select a, a is true from vector_expr_table_05 order by a;
select a, a is true from vector_expr_table_05 where a is true order by a;
select a, a is true from vector_expr_table_05 where b is true order by a;
select a, a is not true from vector_expr_table_05 order by a;
select a, a is not true from vector_expr_table_05 where a is not true order by a;
select a, a is not true from vector_expr_table_05 where b is true order by a;
select a, a is false from vector_expr_table_05 order by a;
select a, a is false from vector_expr_table_05 where a is false order by a;
select a, a is false from vector_expr_table_05 where b is false order by a;
select a, a is not false from vector_expr_table_05 order by a;
select a, a is not false from vector_expr_table_05 where a is not false order by a;
select a, a is not false from vector_expr_table_05 where b is false order by a;
select a, a is unknown from vector_expr_table_05 order by a;
select a, a is unknown from vector_expr_table_05 where a is unknown order by a;
select a, a is unknown from vector_expr_table_05 where b is unknown order by a;
select a, a is not unknown from vector_expr_table_05 order by a;
select a, a is not unknown from vector_expr_table_05 where a is not unknown order by a;
select a, a is not unknown from vector_expr_table_05 where b is unknown order by a;
--nvl
select nvl(b, 0) from VECTOR_EXPR_TABLE_05 order by 1;
----
--- test 7: Min-Max Expression
----
select a, b, c, greatest(a::int, b), least(a::int, b), greatest(a, c), least(a, c), greatest(b::bool, c), least(b::bool, c), greatest(a::int, b, c::int), least(a::int, b, c::int) from vector_expr_table_05 order by 1, 2, 3;
select a, b, c, greatest(a, b), least(a, b), greatest(a, c), least(a, c), greatest(b, c), least(b, c), greatest(a, b, c), least(a, b, c) from vector_expr_table_06 order by 1, 2, 3;
SELECT a, GREATEST(CASE WHEN (a > '0') THEN a ELSE ('-1') END, '1') AS greatest FROM vector_expr_table_06 order by 1, 2;
select greatest(a::int, b), least(a::int, b) from vector_expr_table_05 where greatest(a::int, b)*2 > 0 and least(a::int, b)*2<10 order by 1,2;
----
--- test 8: CoerceViaIO Expression
----
select col_int::numeric from vector_expr_table_07 where col_int = 5;
select col_num::int from vector_expr_table_07 where col_int = 5;
select col_int::varchar from vector_expr_table_07 where col_int = 5;
select col_num::varchar from vector_expr_table_07 where col_int = 5;
select col_timestamptz::varchar from vector_expr_table_07 where col_int = 5;
select col_timestamptz::text from vector_expr_table_07 where col_int = 5;
select col_varchar::timestamp with time zone from vector_expr_table_07 where col_int = 5;
select col_char::text from vector_expr_table_07 order by 1;
select col_interval::text from vector_expr_table_07 order by 1;
select col_timetz::text from vector_expr_table_07 order by 1;
select col_tinterval::text from vector_expr_table_07 order by 1;
select (col_tinterval::text)::tinterval from vector_expr_table_07 order by 1;
select (col_timetz::text)::timetz from vector_expr_table_07 order by 1;
select (col_interval::varchar)::interval from vector_expr_table_07 order by 1;
delete from vector_expr_table_07 where col_varchar='2017-09-09 19:45:37';
insert into vector_expr_table_07 values (123, 5, '2017-09-09 19:45:37', '1');
set enable_hashjoin=off;
explain (verbose on, costs off) select * from (select substr(col_varchar, 0,1) col1 from vector_expr_table_07 ) table1 left join vector_expr_table_08 on table1.col1=vector_expr_table_08.col_num;
select * from (select substr(col_varchar, 0,1) col1 from vector_expr_table_07 ) table1 left join vector_expr_table_08 on table1.col1=vector_expr_table_08.col_num where col_num is not null;
reset enable_hashjoin;
----
--- test 9: SUBSTRING SUBSTR TRIM Expression
----
select substring(col_varchar, 0) from vector_expr_table_09 order by 1;
select substring(col_varchar, 0, 2) from vector_expr_table_09 order by 1;
select substr(col_varchar, 0) from vector_expr_table_09 order by 1;
select substr(col_varchar, 0, 2) from vector_expr_table_09 order by 1;
select substring(col_num2, 2) from vector_expr_table_09 order by 1;
select substring(col_num2, 2, 2) from vector_expr_table_09 order by 1;
select substr(col_num2, 2) from vector_expr_table_09 order by 1;
select substr(col_num2, 2, 2) from vector_expr_table_09 order by 1;
select distinct coalesce(trim(trailing '.' from col_text), '') from vector_expr_table_09 order by 1;
select distinct coalesce(trim(trailing '.' from col_num), '') from vector_expr_table_09 order by 1;
----
--- test 10: NULLIF Expression
----
SELECT '' AS Five, NULLIF(A.col_int, B.col_int) AS "NULLIF(A.I, B.I)", NULLIF(B.col_int, 4) AS "NULLIF(B.I,4)" FROM vector_expr_table_10 A, vector_expr_table_11 B ORDER BY 2, 3;
SELECT NULLIF(A.col_time, B.col_int) AS "NULLIF(A.T, B.I)", NULLIF(B.col_int, 4) AS "NULLIF(B.I,4)" FROM vector_expr_table_10 A, vector_expr_table_11 B ORDER BY 1, 2;
SELECT NULLIF(A.col_interval, B.col_int) AS "NULLIF(A.IN, B.I)", NULLIF(B.col_int, 4) AS "NULLIF(B.I,4)" FROM vector_expr_table_10 A, vector_expr_table_11 B ORDER BY 1, 2;
select nullif(col_int, col_int2) from vector_expr_table_11 order by 1;
select nullif(col_char, col_varchar) from vector_expr_table_11 order by 1;
select nullif(col_int,col_varchar) from vector_expr_table_11 where col_int > 10 order by 1;
select nullif(col_int,col_char) from vector_expr_table_11 where col_int > 10 order by 1;
select nullif(col_int2,col_varchar) from vector_expr_table_11 where col_int > 10 order by 1;
select * from vector_expr_table_11 where nullif(col_int,col_int2) > 1 and col_int > 10 order by 1,2,3,4;
select * from vector_expr_table_11 where nullif(col_int,col_char) > 1 and col_int > 10 order by 1,2,3,4;
select * from vector_expr_table_11 where nullif(col_int,col_char) is NULL and col_int > 10 order by 1,2,3,4;
select * from vector_expr_table_11 where nullif(col_int,col_char) is not NULL and col_int > 10 order by 1,2,3,4;
----
--- test 11: DISTINCT Expression
----
select * from vector_expr_table_11 where col_int is distinct from col_int2 order by 1, 2;
select * from vector_expr_table_11 where not(col_int is distinct from col_int2) order by 1, 2;
select * from vector_expr_table_11 where col_char is distinct from col_varchar order by 1, 2;
select * from vector_expr_table_11 t1 inner join vector_expr_table_11 t2 on t1.col_int = t2.col_int where t1.col_int is distinct from t1.col_int2 and t1.col_int > 5 order by 3, 7;
select * from vector_expr_table_11 t1 inner join vector_expr_table_11 t2 on t1.col_int = t2.col_int where t1.col_int is distinct from t2.col_int2 and t1.col_int > 5 order by 3, 7;
----
--- test 12: Agg + Case When
----
select c1, c2, count(i1) ci1, avg((n2 - 1)*n1), sum(n1+n2), sum(i2+2*i1), sum((2)*(n1+2)*(n2-1)), min(n1), max(n1+n2), sum(i3), avg (case
when i2 > 5 then 3.21+n1
when i1 > 9 then 2.1+n2+n1
when i1 > 2 then 1.2
else 2.22
end)
from vector_expr_table_12 where d1 > '1995-12-01'
group by c1, c2 order by ci1, c2;
select c1, c2, count(i1), avg((n2 - 1)*n1), sum(n1+n2), sum(i2+2*i1), sum(i3)
from vector_expr_table_12 where d1 > '1995-12-01'
group by c1, c2
having sum((2)*(n1+2)*(n2-1)) > 22.8
and sum((2)*(n1+2)*(n2-1)) < 2280
and avg (case
when i2 > 5 then 3.21+n1
when i1 > 9 then 2.1+n2+n1
when i1 > 2 then 1.2
else 2.22
end) > 2.3 order by c1;
select i1+i2, min(i1), max(i2+1), min(n1), max(n1+n2), sum(n2) from vector_expr_table_12 group by i1+i2 order by sum(n1), sum(n2);
select c1, count(*) from vector_expr_table_12 group by c1 having sum(n2) + sum(n1)> 16192 order by sum(i1), sum(i2);
select i3+sum(i1), sum(n2)/count(n2), sum(n1)/count(n1) from vector_expr_table_12 group by i3 order by sum(i2) + i3;
select case when i1+i2> 3 then 2 else 1 end, sum(n1)+sum(n2) from vector_expr_table_12 group by i1, i2 order by case when i1+i2> 3 then 2 else 1 end, sum(i1)+sum(i2);
select c1, c2, count(i1), sum(n1+n2), sum((n2-1)*n1) from vector_expr_table_12 group by c1, c2 having sum(n2) > 3 order by c1, c2;
----
--- test 13: tcol_inteq/ne/ge/gt/le/lt
----
explain (verbose on, costs off) SELECT col_int, col_date, col_num FROM vector_expr_table_13 WHERE (ctid != '(0,1)') and col_int < 4 and col_num > 5 order by 1,2,3;
SELECT col_int, col_date, col_num FROM vector_expr_table_13 WHERE (ctid != '(0,1)') and col_int < 4 and col_num > 5 order by 1,2,3;
SELECT col_int, col_date, col_num FROM vector_expr_table_13 WHERE (ctid != '(0,1)') order by 1,2,3;
SELECT col_int, col_date, col_num FROM vector_expr_table_13 WHERE (ctid = '(0,1)') and col_int < 4 and col_num > 5 order by 1,2,3;
SELECT col_int, col_date, col_num FROM vector_expr_table_13 WHERE (ctid = '(0,1)') order by 1,2,3;
SELECT col_int, col_date, col_num FROM vector_expr_table_13 WHERE ('(0,1)' = ctid) and col_int < 4 and col_num > 5 order by 1,2,3;
SELECT col_int, col_date, col_num FROM vector_expr_table_13 WHERE ('(0,1)' = ctid) order by 1,2,3;
explain (verbose on, costs off) SELECT col_int, col_date, col_num FROM vector_expr_table_13 WHERE (ctid >= '(0,1)') and col_int < 4 and col_num > 5 order by 1,2,3;
SELECT * FROM vector_expr_table_13 WHERE (ctid >= '(0,1)') and col_int < 4 and col_num > 5 order by 1,2,3;
SELECT * FROM vector_expr_table_13 WHERE (ctid >= '(0,1)') order by 1,2,3;
SELECT * FROM vector_expr_table_13 WHERE (ctid > '(0,1)') and col_int < 4 and col_num > 5 order by 1,2,3;
SELECT * FROM vector_expr_table_13 WHERE (ctid > '(0,1)') order by 1,2,3;
explain (verbose on, costs off) SELECT col_int, col_date, col_num FROM vector_expr_table_13 WHERE (ctid <= '(0,1)') and col_int < 4 and col_num > 5 order by 1,2,3;
SELECT * FROM vector_expr_table_13 WHERE (ctid <= '(0,1)') and col_int < 4 and col_num > 5 order by 1,2,3;
SELECT * FROM vector_expr_table_13 WHERE (ctid <= '(0,1)') order by 1,2,3;
SELECT * FROM vector_expr_table_13 WHERE (ctid < '(0,1)') and col_int < 4 and col_num > 5 order by 1,2,3;
SELECT * FROM vector_expr_table_13 WHERE (ctid < '(0,1)') order by 1,2,3;
----
--- test 14: lpad, bpcharlen, ltrim/rtrim/btrim
----
select * from vector_expr_table_14 A where lpad(A.b, 2) = '12' order by 1, 2, 3;
select * from vector_expr_table_14 A where A.a > 2 and lpad(A.b, 2) = '12' order by 1, 2, 3;
select * from vector_expr_table_14 A where A.a > 2 and length(A.b) = 1 order by 1, 2, 3;
select lpad(A.b, 15, 'ab') from vector_expr_table_14 A order by 1;
select lpad(A.b, 15, A.c) from vector_expr_table_14 A order by 1;
select lpad(A.b, NULL, A.c) is null from vector_expr_table_14 A order by 1;
select lpad(A.b, 0, A.c) is null from vector_expr_table_14 A order by 1;
select lpad(A.b, -100, A.c) is null from vector_expr_table_14 A order by 1;
select A.a, lpad(A.b, length(A.c), A.c) from vector_expr_table_14 A order by 1, 2;
select length(b) from vector_expr_table_14 order by 1;
select length(A.b) from vector_expr_table_14 A where A.a > 2 order by 1;
select ltrim(b) from vector_expr_table_14 order by 1;
select rtrim(b) from vector_expr_table_14 order by 1;
select btrim(c) from vector_expr_table_14 order by 1;
select trim(a1), trim(a2) from (select a || ' ' as a1, c || ' ' as a2 from vector_expr_table_14 order by 1, 2) order by 1, 2;
----
--- test 15: vtextne
----
SELECT a, b, DATE_TRUNC('day', b) <> a FROM vector_expr_table_15 ORDER BY 1;
SELECT a, b, DATE_TRUNC('day'::TEXT, b)::TEXT <> a::TEXT FROM vector_expr_table_15 ORDER BY 1;
----
--- case ICBC: Special Case
----
SELECT Agt_Num,Agt_Modif_Num, Party_id, Int_Org_Num, Curr_Cd, Open_Dt, avgbal
FROM
(SELECT
T1.Agt_Num
,T1.Agt_Modif_Num
,T1.Party_id
,CASE WHEN T1.Proc_Org_Num <> '' AND SUBSTR(T1.Proc_Org_Num,9,4) NOT IN ('0000','9999')
THEN T1.Proc_Org_Num
ELSE T1.Int_Org_Num
END AS Int_Org_Num
,T1.Curr_Cd
,T1.Open_Dt
,CAST(T1.Year_Dpsit_Accum/(TO_DATE('20140825', 'YYYYMMDD')-TO_DATE('20131231', 'YYYYMMDD')) AS DECIMAL(18,2)) AS avgbal
FROM dwSumData_act.C03_SEMI_CRDT_CARD_ACCT T1
WHERE T1.Data_Dt<=TO_DATE('20140825', 'YYYYMMDD')
AND T1.Data_Dt>=TO_DATE('20140101', 'YYYYMMDD')
AND T1.Party_Class_Cd=0
) A order by 1,2,3,4,5,6,7;
SELECT Agt_Num,Agt_Modif_Num, Party_id, Int_Org_Num, Curr_Cd, Open_Dt, avgbal
FROM
(SELECT
T1.Agt_Num
,T1.Agt_Modif_Num
,T1.Party_id
,CASE WHEN T1.Proc_Org_Num <> '' AND SUBSTR(T1.Proc_Org_Num,9,4) NOT IN ('0000','9999')
THEN T1.Proc_Org_Num
ELSE T1.Int_Org_Num
END AS Int_Org_Num
,T1.Curr_Cd
,T1.Open_Dt
,CAST(T1.Year_Dpsit_Accum/(TO_DATE('20140825', 'YYYYMMDD')-TO_DATE('20131231', 'YYYYMMDD')) AS DECIMAL(18,2)) AS avgbal
,ROW_NUMBER() OVER(PARTITION BY T1.Agt_Num,T1.Agt_Modif_Num ORDER BY T1.Data_Dt DESC) AS Agt_Num_ORDER
FROM dwSumData_act.C03_SEMI_CRDT_CARD_ACCT T1
WHERE T1.Data_Dt<=TO_DATE('20140825', 'YYYYMMDD')
AND T1.Data_Dt>=TO_DATE('20140101', 'YYYYMMDD')
AND T1.Party_Class_Cd=0
) A WHERE Agt_Num_ORDER = 1 order by 1,2,3,4,5,6,7;
create table tr_case(
rn bigint,
c1 character varying(60),
c2 character varying(60),
c3 date,
c4 character varying(60),
c5 date,
c6 character varying(60)
);
insert into tr_case values(299295,'2','99991231','2014-10-22','00000000000000001',null,'1');
insert into tr_case values(299296,'2','99991231','2014-10-22','00000000000000001',null,'1');
insert into tr_case values(299294,'2','99991231','2014-10-22','00000000000000001',null,'1');
insert into tr_case values(299290,'2','99991231','2014-10-22','00000000000000001',null,'1');
create table tc_case with (orientation = column) as select * from tr_case;
select case when
(case when c1 = '' then 0 else cast(c1 as decimal(20,0)) end = 2) and (case when c6 = '' then 0 else cast(c6 as decimal(20,0)) end = 1)
then c3
else '19000102' end from tc_case;
select rn, c1,c2,c3 ,c4,c5,c6,
case when (case when c1 = '' then 0 else cast(c1 as decimal(20,0)) end = 1 )
then cast(c2 as date)
when (case when c1 = '' then 0 else cast(c1 as decimal(20,0)) end = 2) and (case when c6 = '' then 0 else cast(c6 as decimal(20,0)) end = 1)
then c3 + case when c4 = '' then 0 else cast(c4 as decimal (17,0)) end
when (case when c1 = '' then 0 else cast(c1 as decimal(20,0)) end = 2 and case when c6 = '' then 0 else cast(c6 as decimal(20,0)) end = 2)
then coalesce(c5, cast('19000102' as date))
else cast('19000102' as date)
end
from tc_case order by 1;
select rn, c1,c2,c3 ,c4,c5,c6,
case when case when c1='' then 0 else cast(c1 as decimal(20,0)) end = 1 then cast(c2 as date)
when case when c1 = '' then 0 else cast(c1 as decimal(20,0)) end = 2 and case when c6 = '' then 0 else cast(c6 as decimal(20,0)) end = 1
then c3 + case when c4 = '' then 0 else cast(c4 as decimal (17,0)) end
when case when c1 = '' then 0 else cast(c1 as decimal(20,0)) end = 2 and case when c6 = '' then 0 else cast(c6 as decimal(20,0)) end = 2
then coalesce(c5, cast('19000102' as date))
else cast('19000102' as date)
end
from tc_case
minus all
select rn, c1,c2,c3 ,c4,c5,c6,
case when case when c1='' then 0 else cast(c1 as decimal(20,0)) end = 1 then cast(c2 as date)
when case when c1 = '' then 0 else cast(c1 as decimal(20,0)) end = 2 and case when c6 = '' then 0 else cast(c6 as decimal(20,0)) end = 1
then c3 + case when c4 = '' then 0 else cast(c4 as decimal (17,0)) end
when case when c1 = '' then 0 else cast(c1 as decimal(20,0)) end = 2 and case when c6 = '' then 0 else cast(c6 as decimal(20,0)) end = 2
then coalesce(c5, cast('19000102' as date))
else cast('19000102' as date)
end
from tr_case order by 1;
select case when
(case when c1 = '' then 0 else cast(c1 as decimal(20,0)) end = 2) and (case when c6 = '' then 0 else cast(c6 as decimal(20,0)) end = 1)
then c3
else '19000102' end from tc_case;
select rn, c1,c2,c3 ,c4,c5,c6,
case when (case when c1 = '' then 0 else cast(c1 as decimal(20,0)) end = 1 )
then cast(c2 as date)
when (case when c1 = '' then 0 else cast(c1 as decimal(20,0)) end = 2) and (case when c6 = '' then 0 else cast(c6 as decimal(20,0)) end = 1)
then c3 + case when c4 = '' then 0 else cast(c4 as decimal (17,0)) end
when (case when c1 = '' then 0 else cast(c1 as decimal(20,0)) end = 2 and case when c6 = '' then 0 else cast(c6 as decimal(20,0)) end = 2)
then coalesce(c5, cast('19000102' as date))
else cast('19000102' as date)
end
from tc_case order by 1;
select rn, c1,c2,c3 ,c4,c5,c6,
case when case when c1='' then 0 else cast(c1 as decimal(20,0)) end = 1 then cast(c2 as date)
when case when c1 = '' then 0 else cast(c1 as decimal(20,0)) end = 2 and case when c6 = '' then 0 else cast(c6 as decimal(20,0)) end = 1
then c3 + case when c4 = '' then 0 else cast(c4 as decimal (17,0)) end
when case when c1 = '' then 0 else cast(c1 as decimal(20,0)) end = 2 and case when c6 = '' then 0 else cast(c6 as decimal(20,0)) end = 2
then coalesce(c5, cast('19000102' as date))
else cast('19000102' as date)
end
from tc_case
minus all
select rn, c1,c2,c3 ,c4,c5,c6,
case when case when c1='' then 0 else cast(c1 as decimal(20,0)) end = 1 then cast(c2 as date)
when case when c1 = '' then 0 else cast(c1 as decimal(20,0)) end = 2 and case when c6 = '' then 0 else cast(c6 as decimal(20,0)) end = 1
then c3 + case when c4 = '' then 0 else cast(c4 as decimal (17,0)) end
when case when c1 = '' then 0 else cast(c1 as decimal(20,0)) end = 2 and case when c6 = '' then 0 else cast(c6 as decimal(20,0)) end = 2
then coalesce(c5, cast('19000102' as date))
else cast('19000102' as date)
end
from tr_case order by 1;
----
--- Clean Resource and Tables
----
CREATE TABLE t1_case_col
(
TRANSACTION_ID CHAR(6)
,AVG_CPU DECIMAL(12,4)
,TRANNUM DECIMAL(10)
,SUM_CPU DECIMAL(12,3)
,DATA_DT CHAR(8)
)
with(orientation = orc) tablespace hdfs_ts
DISTRIBUTE BY HASH (TRANSACTION_ID)
;
insert into t1_case_col values('999999', 0, 0, 0, '20150317');
SELECT (SUM( CASE WHEN TRANSACTION_ID = '999999'
THEN SUM_CPU
ELSE 0
END
)/
CASE WHEN
SUM( CASE WHEN TRANSACTION_ID <> '999999'
THEN TRANNUM
ELSE 0
END
) = 0
THEN 99999999999999999
ELSE SUM( CASE WHEN TRANSACTION_ID <> '999999'
THEN TRANNUM
ELSE 0
END
)
END ) AS WEIGHT
FROM t1_case_col;
drop table t1_case_col;
CREATE TABLE t1_hashConst_col(col_1 int, col_2 int) with(orientation = orc) tablespace hdfs_ts;
insert into t1_hashConst_col values(generate_series(1, 100), generate_series(1, 100));
select col_1, case when col_1 >= 10 then not col_2 when col_1 < 10 then not col_1 end from t1_hashConst_col order by 1;
drop table t1_hashConst_col;
create table t1_caseAnd_col(col_1 int, col_2 int, col_3 bool, col_4 bool)with(orientation = orc) tablespace hdfs_ts;
copy t1_caseAnd_col FROM stdin;
0 2 0 0
0 5 1 1
0 5 1 1
\.
select col_1, col_2, col_3, col_4, (case when (col_1 = 0 and col_2 = 5) then (col_3 and col_4) when (col_1 = 0 and col_2 = 2) then (col_3 and col_4) else 0::bool end) from t1_caseAnd_col order by 1, 2;
drop table t1_caseAnd_col;
create table vector_expr_table_23(a int, b varchar(10), c text)with(orientation = orc) tablespace hdfs_ts;
copy vector_expr_table_23 from stdin;
1 123 \N
1 123 456
1 2 28
\.
select * from vector_expr_table_23 where NULLIF(b, 3) < 9 OR Coalesce(c, '1') < 5000 order by 1,2,3;
execute direct on (datanode8) 'select concat(b,b), concat(c,c,c) from vector_expr_table_23 order by 1,2;';
drop schema vector_expression_engine cascade; | the_stack |
--
---- test interval partitioned global index
--
--drop table and index
drop index if exists ip_index_global;
drop index if exists ip_index_local;
drop table if exists gpi_partition_global_index_interval;
drop index if exists index_interval_partition_table_001;
drop table if exists interval_partition_table_001;
drop table if exists interval_partition_table_002;
drop table if exists interval_partition_table_003;
drop table if exists interval_partition_table_004;
create table gpi_partition_global_index_interval
(
c1 int,
c2 int,
logdate date not null
)
partition by range (logdate)
INTERVAL ('1 month')
(
PARTITION gpi_partition_global_index_interval_p0 VALUES LESS THAN ('2020-03-01'),
PARTITION gpi_partition_global_index_interval_p1 VALUES LESS THAN ('2020-04-01'),
PARTITION gpi_partition_global_index_interval_p2 VALUES LESS THAN ('2020-05-01')
);
--succeed
--to select all index object
select part.relname, part.parttype, part.rangenum, part.intervalnum, part.partstrategy, part.relallvisible, part.reltoastrelid, part.partkey, part.interval, part.boundaries
from pg_class class, pg_partition part, pg_index ind where class.relname = 'gpi_partition_global_index_interval' and ind.indrelid = class.oid and part.parentid = ind.indrelid
order by 1, 2, 3, 4, 5, 6, 7, 8, 9, 10;
select count(*) from pg_class class, pg_partition part, pg_index ind where class.relname = 'gpi_partition_global_index_interval' and ind.indrelid = class.oid and part.parentid = ind.indrelid;
create index ip_index_global on gpi_partition_global_index_interval(c1) global;
--succeed
--to select all index object
select part.relname, part.parttype, part.rangenum, part.intervalnum, part.partstrategy, part.relallvisible, part.reltoastrelid, part.partkey, part.interval, part.boundaries
from pg_class class, pg_partition part, pg_index ind where class.relname = 'gpi_partition_global_index_interval' and ind.indrelid = class.oid and part.parentid = ind.indrelid
order by 1, 2, 3, 4, 5, 6, 7, 8, 9, 10;
select count(*) from pg_class class, pg_partition part, pg_index ind where class.relname = 'gpi_partition_global_index_interval' and ind.indrelid = class.oid and part.parentid = ind.indrelid;
create index ip_index_local on gpi_partition_global_index_interval(c2) local;
--succeed
--to select all index object
select part.relname, part.parttype, part.rangenum, part.intervalnum, part.partstrategy, part.relallvisible, part.reltoastrelid, part.partkey, part.interval, part.boundaries
from pg_class class, pg_partition part, pg_index ind where class.relname = 'gpi_partition_global_index_interval' and ind.indrelid = class.oid and part.parentid = ind.indrelid
order by 1, 2, 3, 4, 5, 6, 7, 8, 9, 10;
select count(*) from pg_class class, pg_partition part, pg_index ind where class.relname = 'gpi_partition_global_index_interval' and ind.indrelid = class.oid and part.parentid = ind.indrelid;
--insert into table
insert into gpi_partition_global_index_interval values(7,2,'2020-03-01');
insert into gpi_partition_global_index_interval values(3,1,'2020-04-01');
insert into gpi_partition_global_index_interval values(5,3,'2020-05-01');
insert into gpi_partition_global_index_interval values(7,5,'2020-06-01');
insert into gpi_partition_global_index_interval values(1,4,'2020-07-01');
--succeed
explain (costs off) select * from gpi_partition_global_index_interval where c1 = 7 order by 1, 2;
select * from gpi_partition_global_index_interval where c1 = 7 order by 1, 2;
--to select all index object
select part.relname, part.parttype, part.rangenum, part.intervalnum, part.partstrategy, part.relallvisible, part.reltoastrelid, part.partkey, part.interval, part.boundaries
from pg_class class, pg_partition part, pg_index ind where class.relname = 'gpi_partition_global_index_interval' and ind.indrelid = class.oid and part.parentid = ind.indrelid
order by 1, 2, 3, 4, 5, 6, 7, 8, 9, 10;
select count(*) from pg_class class, pg_partition part, pg_index ind where class.relname = 'gpi_partition_global_index_interval' and ind.indrelid = class.oid and part.parentid = ind.indrelid;
--
---- test input for unique index
--
create table interval_partition_table_001
(
c1 int,
logdate date not null
)
partition by range (logdate)
INTERVAL ('1 month')
(
PARTITION interval_partition_table_001_p0 VALUES LESS THAN ('2020-03-01'),
PARTITION interval_partition_table_001_p1 VALUES LESS THAN ('2020-04-01'),
PARTITION interval_partition_table_001_p2 VALUES LESS THAN ('2020-05-01')
);
create unique index index_interval_partition_table_001 on interval_partition_table_001(logdate) global;
--fail: unique index
insert into interval_partition_table_001 values(10, '2020-06-01');
insert into interval_partition_table_001 values(10, '2020-06-01');
--
---- test with primary key
--
create table interval_partition_table_002
(
c1 int,
c2 int,
logdate date not null,
CONSTRAINT interval_partition_table_CONSTRAINT PRIMARY KEY(c2,logdate)
)
partition by range (logdate)
INTERVAL ('1 month')
(
PARTITION interval_partition_table_002_p0 VALUES LESS THAN ('2020-03-01'),
PARTITION interval_partition_table_002_p1 VALUES LESS THAN ('2020-04-01'),
PARTITION interval_partition_table_002_p2 VALUES LESS THAN ('2020-05-01')
);
insert into interval_partition_table_002 values(10, 10, '2020-06-01');
insert into interval_partition_table_002 values(10, 10, '2020-06-01');
analyze interval_partition_table_002;
--
---- test with btree index
--
create table interval_partition_table_003
(
c1 int,
c2 int,
logdate date not null,
PRIMARY KEY(c2,logdate)
)
partition by range (logdate)
INTERVAL ('1 month')
(
PARTITION interval_partition_table_003_p0 VALUES LESS THAN ('2020-03-01'),
PARTITION interval_partition_table_003_p1 VALUES LESS THAN ('2020-04-01'),
PARTITION interval_partition_table_003_p2 VALUES LESS THAN ('2020-05-01')
);
create index interval_partition_table_003_1 ON interval_partition_table_003 USING BTREE (logdate) global;
create index interval_partition_table_003_2 ON interval_partition_table_003 USING BTREE (c2) global;
create index interval_partition_table_003_3 ON interval_partition_table_003 USING BTREE (c1) global;
select relname from pg_class where relname like '%interval_partition_table_003%' order by 1;
select relname, parttype, partstrategy, boundaries from pg_partition
where parentid = (select oid from pg_class where relname = 'interval_partition_table_003')
order by relname;
insert into interval_partition_table_003 values(1,2,'2020-03-01');
insert into interval_partition_table_003 values(1,2,'2020-04-01');
insert into interval_partition_table_003 values(1,2,'2020-05-01');
insert into interval_partition_table_003 values(1,2,'2020-06-01');
insert into interval_partition_table_003 values(1,2,'2020-07-01');
alter table interval_partition_table_003 drop column C2;
insert into interval_partition_table_003 values(1,2,'2020-07-01');
insert into interval_partition_table_003 values(1,'2020-07-01');
select relname from pg_class where relname like '%interval_partition_table_003%' order by 1;
select relname, parttype, partstrategy, boundaries from pg_partition
where parentid = (select oid from pg_class where relname = 'interval_partition_table_003')
order by relname;
--
---- test partition BTREE index
--
create table interval_partition_table_004
(
c1 int,
c2 int,
logdate date not null,
PRIMARY KEY(c2,logdate)
)
partition by range (logdate)
INTERVAL ('1 month')
(
PARTITION interval_partition_table_004_p0 VALUES LESS THAN ('2020-03-01'),
PARTITION interval_partition_table_004_p1 VALUES LESS THAN ('2020-04-01'),
PARTITION interval_partition_table_004_p2 VALUES LESS THAN ('2020-05-01')
);
-- expression index
CREATE INDEX interval_partition_table_004_index_01 on interval_partition_table_004 using btree(c2) global;
CREATE INDEX interval_partition_table_004_index_02 on interval_partition_table_004 using btree(logdate) global;
CREATE INDEX interval_partition_table_004_index_03 on interval_partition_table_004 using btree(c1) global;
cluster interval_partition_table_004 using interval_partition_table_004_index_01;
insert into interval_partition_table_004 values(7,1,'2020-03-01');
insert into interval_partition_table_004 values(3,2,'2020-04-01');
insert into interval_partition_table_004 values(5,3,'2020-05-01');
insert into interval_partition_table_004 values(7,4,'2020-06-01');
insert into interval_partition_table_004 values(1,5,'2020-07-01');
insert into interval_partition_table_004 values(7,2,'2020-03-01');
insert into interval_partition_table_004 values(3,3,'2020-04-01');
insert into interval_partition_table_004 values(5,4,'2020-05-01');
insert into interval_partition_table_004 values(7,5,'2020-06-01');
insert into interval_partition_table_004 values(1,1,'2020-07-01');
insert into interval_partition_table_004 values(7,3,'2020-03-01');
insert into interval_partition_table_004 values(3,4,'2020-04-01');
insert into interval_partition_table_004 values(5,5,'2020-05-01');
insert into interval_partition_table_004 values(7,1,'2020-06-01');
insert into interval_partition_table_004 values(1,2,'2020-07-01');
insert into interval_partition_table_004 values(7,4,'2020-03-01');
insert into interval_partition_table_004 values(3,5,'2020-04-01');
insert into interval_partition_table_004 values(5,1,'2020-05-01');
insert into interval_partition_table_004 values(7,2,'2020-06-01');
insert into interval_partition_table_004 values(1,3,'2020-07-01');
explain (costs off) SELECT COUNT(*) FROM interval_partition_table_004 where c1 = 7;
SELECT COUNT(*) FROM interval_partition_table_004 where c1 = 7;
delete from interval_partition_table_004 where c1 = 1;
explain (costs off) SELECT COUNT(*) FROM interval_partition_table_004 where c1 = 7;
SELECT COUNT(*) FROM interval_partition_table_004 where c1 = 7;
update interval_partition_table_004 set c1 = 100 where c1 = 7;
explain (costs off) SELECT COUNT(*) FROM interval_partition_table_004 where c1 = 100;
SELECT COUNT(*) FROM interval_partition_table_004 where c1 = 100;
update interval_partition_table_004 set c1 = 7 where c1 = 100;
reindex table interval_partition_table_004;
cluster;
reindex table interval_partition_table_004;
cluster;
explain (costs off) SELECT COUNT(*) FROM interval_partition_table_004 where c1 = 7;
SELECT COUNT(*) FROM interval_partition_table_004 where c1 = 7;
start transaction;
insert into interval_partition_table_004 values (generate_series(1,10), generate_series(1,10), generate_series(TO_DATE('2000-01-01', 'YYYY-MM-DD'),TO_DATE('2019-12-01', 'YYYY-MM-DD'),'1 day'));
SELECT COUNT(*) FROM interval_partition_table_004 where c1 = 7;
commit;
SELECT COUNT(*) FROM interval_partition_table_004 where c1 = 7;
delete from interval_partition_table_004;
\parallel on
insert into interval_partition_table_004 values (generate_series(1,10), generate_series(1,10), generate_series(TO_DATE('1990-01-01', 'YYYY-MM-DD'),TO_DATE('2020-12-01', 'YYYY-MM-DD'),'1 day'));
select true from (SELECT COUNT(*) FROM interval_partition_table_004 where c1 = 7) where count = 0 or count = 11293;
select true from (SELECT COUNT(*) FROM interval_partition_table_004 where c1 = 7) where count = 0 or count = 11293;
select true from (SELECT COUNT(*) FROM interval_partition_table_004 where c1 = 7) where count = 0 or count = 11293;
select true from (SELECT COUNT(*) FROM interval_partition_table_004 where c1 = 7) where count = 0 or count = 11293;
select true from (SELECT COUNT(*) FROM interval_partition_table_004 where c1 = 7) where count = 0 or count = 11293;
\parallel off
SELECT COUNT(*) FROM interval_partition_table_004 where c1 = 7;
\parallel on
DELETE from interval_partition_table_004 where c1 = 1;
VACUUM analyze interval_partition_table_004;
DELETE from interval_partition_table_004 where c1 = 2;
VACUUM interval_partition_table_004;
DELETE from interval_partition_table_004 where c1 = 3;
ANALYZE interval_partition_table_004;
DELETE from interval_partition_table_004 where c1 = 4;
VACUUM analyze interval_partition_table_004;
DELETE from interval_partition_table_004 where c1 = 5;
VACUUM interval_partition_table_004;
DELETE from interval_partition_table_004 where c1 = 6;
ANALYZE interval_partition_table_004;
\parallel off
explain (costs off) SELECT COUNT(*) FROM interval_partition_table_004 where c1 <= 7;
SELECT COUNT(*) FROM interval_partition_table_004 where c1 <= 7;
VACUUM full interval_partition_table_004;
explain (costs off) SELECT COUNT(*) FROM interval_partition_table_004 where c1 <= 7;
SELECT COUNT(*) FROM interval_partition_table_004 where c1 <= 7;
--drop table and index
drop index if exists ip_index_global;
drop index if exists ip_index_local;
drop table if exists gpi_partition_global_index_interval;
drop index if exists index_interval_partition_table_001;
drop table if exists interval_partition_table_001;
drop table if exists interval_partition_table_002;
drop table if exists interval_partition_table_003;
drop table if exists interval_partition_table_004; | the_stack |
SET FOREIGN_KEY_CHECKS=0;
-- ----------------------------
-- Table structure for db_auth
-- ----------------------------
DROP TABLE IF EXISTS `db_auth`;
CREATE TABLE `db_auth` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`authority_id` varchar(20) DEFAULT NULL,
`authority_name` varchar(48) DEFAULT NULL COMMENT '权限名称',
`authority_type` int(11) DEFAULT NULL COMMENT '权限类型: 0:菜单(默认0),1:操作和功能',
`authority_url` varchar(128) DEFAULT NULL COMMENT '权限标识',
`authority_sort` int(11) DEFAULT NULL,
`parent_id` varchar(20) DEFAULT '0',
`parent_name` varchar(48) DEFAULT NULL,
`desc` varchar(128) DEFAULT NULL COMMENT '权限描述',
`create_user` int(11) DEFAULT NULL,
`update_user` int(11) DEFAULT NULL,
`delete_user` int(11) DEFAULT NULL,
`delete_time` datetime DEFAULT NULL,
`flag` int(11) DEFAULT '1' COMMENT '状态: 0:删除,1:可用(默认为1)',
`createdAt` datetime NOT NULL,
`updatedAt` datetime NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=44 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
-- ----------------------------
-- Records of db_auth
-- ----------------------------
INSERT INTO `db_auth` VALUES ('1', 'R6zw8Hly', '仪表盘', '0', 'dashboard', '1', '0', '', '仪表盘', null, '1', null, '2020-07-01 16:45:47', '1', '2020-07-01 16:46:57', '2020-07-08 15:18:06');
INSERT INTO `db_auth` VALUES ('2', 'R6AhD4Jw', '主题设置', '0', 'config', '2', '0', null, '平台管理', null, '1', null, '2020-07-01 16:48:51', '1', '2020-07-01 16:48:55', '2020-07-22 17:00:12');
INSERT INTO `db_auth` VALUES ('3', 'R6Cip4M3', '系统设置', '0', 'systemSetting', '3', '0', null, '系统设置', null, null, null, '2020-07-01 16:58:27', '1', '2020-07-01 16:58:31', '2020-07-01 16:58:33');
INSERT INTO `db_auth` VALUES ('4', 'R6Ej09A1', '权限设置', '0', 'authority', '0', 'R6Cip4M3', '系统设置', '权限设置', null, null, null, '2020-07-01 17:00:27', '1', '2020-07-01 17:00:35', '2020-07-07 21:40:15');
INSERT INTO `db_auth` VALUES ('5', 'R6Fjw3Q4', '角色管理', '0', 'role', '1', 'R6Cip4M3', '系统设置', '角色管理', null, null, null, '2020-07-01 17:01:29', '1', '2020-07-01 17:01:35', '2020-07-01 17:01:37');
INSERT INTO `db_auth` VALUES ('6', 'R6FP04jv', '系统日志', '0', 'log', '4', 'R6Cip4M3', '系统设置', '角色管理', null, '1', null, '2020-07-01 17:02:30', '1', '2020-07-01 17:02:36', '2020-07-17 15:56:08');
INSERT INTO `db_auth` VALUES ('7', 'R6IlvZRb', '用户管理', '0', 'user', '2', 'R6Cip4M3', '系统设置', '用户设置', null, '1', null, '2020-07-01 17:46:36', '1', '2020-07-01 17:46:45', '2020-07-10 14:59:20');
INSERT INTO `db_auth` VALUES ('8', 'R6LCSXn8', '权限列表', '1', '/api/auth/getList', '0', 'R6Ej09A1', '权限列表', 'type,0菜单权限,1操作功能', null, null, null, '2020-07-03 15:13:21', '1', '2020-07-03 15:13:28', '2020-07-03 15:13:31');
INSERT INTO `db_auth` VALUES ('9', 'R6NT1Syx', '新增权限', '1', '/api/auth/create', '1', 'R6Ej09A1', '权限设置', '新增权限', null, '1', null, '2020-07-03 15:15:39', '1', '2020-07-03 15:15:45', '2020-07-22 17:01:30');
INSERT INTO `db_auth` VALUES ('10', 'R6O8RN67', '删除权限', '1', '/api/auth/delete', '2', 'R6Ej09A1', '更新权限', '删除权限', null, '1', null, '2020-07-03 15:17:10', '1', '2020-07-03 15:17:12', '2020-07-22 17:01:21');
INSERT INTO `db_auth` VALUES ('11', 'R6O8RN6', '更新权限', '1', '/api/auth/update', '3', 'R6Ej09A1', '更新权限', '更新权限', null, '1', null, '2020-07-03 15:18:45', '1', '2020-07-03 15:18:47', '2020-07-22 17:01:41');
INSERT INTO `db_auth` VALUES ('12', 'R6O8RN1', '测试', '1', 'test', '1', '0', '测试', null, null, null, null, '2020-07-03 15:33:27', '0', '2020-07-03 15:33:30', '2020-07-03 15:33:33');
INSERT INTO `db_auth` VALUES ('13', 'o1A0GCIxG', '系统日志列表', '1', '/api/log/getList', '0', 'R6FP04jv', '', '系统日志列表', '1', null, '1', '2020-07-08 15:37:58', '0', '2020-07-07 17:32:21', '2020-07-08 15:37:58');
INSERT INTO `db_auth` VALUES ('14', 'ZVR1c_mIA', '测试', '0', 'testtess', '5', '0', null, '开的测试', '1', '1', '1', '2020-07-08 15:47:30', '0', '2020-07-07 19:55:35', '2020-07-08 15:47:30');
INSERT INTO `db_auth` VALUES ('15', 'vm1RYcPlo', '首页设置', '0', 'homePage', '2', 'R6Cip4M3', '系统设置', '首页设置', '1', null, '1', '2020-07-15 15:52:27', '0', '2020-07-07 21:37:20', '2020-07-15 15:52:27');
INSERT INTO `db_auth` VALUES ('16', 'nYf2OlmGy', '获取用户列表', '1', '/api/user/getList', '0', 'R6IlvZRb', '管理员设置', '获取用户列表', '1', '1', null, '2020-07-07 21:38:49', '1', '2020-07-07 21:38:49', '2020-07-15 15:53:41');
INSERT INTO `db_auth` VALUES ('17', 'W6bm46M8T', '轮播图', '0', 'slideshow', '4', 'vm1RYcPlo', '首页设置', '轮播图', '1', null, '1', '2020-07-08 15:48:00', '0', '2020-07-08 10:46:05', '2020-07-08 15:48:00');
INSERT INTO `db_auth` VALUES ('18', 'j-1fD9YEl', '背景', '0', 'background', '1', 'R6AhD4Jw', '平台管理', '系统设置', '1', '1', null, '2020-07-08 10:46:23', '1', '2020-07-08 10:46:23', '2020-07-17 14:54:06');
INSERT INTO `db_auth` VALUES ('19', 'zD5_5LJUQ', '人员管理', '0', 'userManage', '4', '0', null, '人员管理', '1', null, null, '2020-07-08 16:02:26', '1', '2020-07-08 16:02:26', '2020-07-08 16:02:26');
INSERT INTO `db_auth` VALUES ('20', 'CVKN01q8r', '人员列表', '0', 'pepoleList', '0', 'zD5_5LJUQ', '人员管理', '人员列表', '1', null, null, '2020-07-08 16:03:23', '1', '2020-07-08 16:03:23', '2020-07-08 16:03:23');
INSERT INTO `db_auth` VALUES ('21', '8dsJ-8Fmq', '人员权限配置', '0', 'pepoleRole', '0', 'zD5_5LJUQ', '人员管理', null, '1', null, null, '2020-07-08 16:04:05', '1', '2020-07-08 16:04:05', '2020-07-08 16:04:05');
INSERT INTO `db_auth` VALUES ('22', 'z3Kl73yJP', '工作台', '0', 'workplace', '1', 'R6zw8Hly', '仪表盘', '工作台', '1', '1', null, '2020-07-08 16:05:16', '1', '2020-07-08 16:05:16', '2020-07-17 14:56:49');
INSERT INTO `db_auth` VALUES ('23', 'YPwdzlvSi', '分析页面', '0', 'analysis', '1', 'R6zw8Hly', '仪表盘', null, '1', '1', null, '2020-07-08 16:05:58', '1', '2020-07-08 16:05:58', '2020-07-17 14:54:26');
INSERT INTO `db_auth` VALUES ('24', 'SMaog6p8a', '开始', '0', 'begin', '4', 'R6AhD4Jw', '平台管理', '开始', '1', '1', null, '2020-07-08 16:06:25', '1', '2020-07-08 16:06:25', '2020-07-22 17:00:36');
INSERT INTO `db_auth` VALUES ('25', '9Ln1Vy_-p', '111444', '0', '11333', '11', 'R6AhD4Jw', '平台管理', '333', '1', '1', '1', '2020-07-09 11:35:23', '0', '2020-07-08 16:06:38', '2020-07-09 11:35:23');
INSERT INTO `db_auth` VALUES ('26', 'Kzhd4u-y3', '333', '0', '33', '33', 'R6AhD4Jw', '平台管理', '333', '1', null, '1', '2020-07-09 11:35:21', '0', '2020-07-08 16:06:46', '2020-07-09 11:35:21');
INSERT INTO `db_auth` VALUES ('27', 'rbk783aI9', '44', '0', '44', '4', 'R6AhD4Jw', '平台管理', '444', '1', null, '1', '2020-07-09 11:35:17', '0', '2020-07-08 16:06:58', '2020-07-09 11:35:17');
INSERT INTO `db_auth` VALUES ('28', 'W4Cs_302x', '44', '0', '55', '55', 'R6AhD4Jw', '平台管理', '55', '1', null, '1', '2020-07-09 11:35:14', '0', '2020-07-08 16:07:06', '2020-07-09 11:35:14');
INSERT INTO `db_auth` VALUES ('29', 'lekneZO0h', '555', '0', '555', '55', 'R6AhD4Jw', '平台管理', '5', '1', null, '1', '2020-07-09 11:35:13', '0', '2020-07-08 16:07:15', '2020-07-09 11:35:13');
INSERT INTO `db_auth` VALUES ('30', 'u7dJFXAng', '获取角色列表', '1', '/api/role/getAll', '1', 'R6Fjw3Q4', '角色管理', '获取角色列表', '1', null, null, '2020-07-15 15:49:31', '1', '2020-07-15 15:49:31', '2020-07-15 15:49:31');
INSERT INTO `db_auth` VALUES ('31', '5V9hBAwry', '删除角色', '1', '/api/role/delete', null, 'R6Fjw3Q4', '角色管理', null, '1', null, null, '2020-07-15 15:50:11', '1', '2020-07-15 15:50:11', '2020-07-15 15:50:11');
INSERT INTO `db_auth` VALUES ('32', 'Xb8IG-aGm', '创建角色', '1', '/api/role/created', null, 'R6Fjw3Q4', '角色管理', null, '1', null, null, '2020-07-15 15:50:32', '1', '2020-07-15 15:50:32', '2020-07-15 15:50:32');
INSERT INTO `db_auth` VALUES ('33', '2X8BvHUTN', '角色设置权限', '1', '/api/role/addAuth', null, 'R6Fjw3Q4', '角色管理', null, '1', null, null, '2020-07-15 15:51:09', '1', '2020-07-15 15:51:09', '2020-07-15 15:51:09');
INSERT INTO `db_auth` VALUES ('34', 'unh2To0Bx', '获取日志', '1', '/api/log/getAll', null, 'R6FP04jv', '系统日志', null, '1', null, null, '2020-07-15 15:51:50', '1', '2020-07-15 15:51:50', '2020-07-15 15:51:50');
INSERT INTO `db_auth` VALUES ('35', 'uqu7Z_TPq', '删除日志', '1', '/api/log/delete', null, 'R6FP04jv', '系统日志', null, '1', null, null, '2020-07-15 15:52:20', '1', '2020-07-15 15:52:20', '2020-07-15 15:52:20');
INSERT INTO `db_auth` VALUES ('36', 'Rz_Ue0mSy', '注册用户', '1', '/api/user/registered', '1', 'R6IlvZRb', '用户管理', null, '1', null, null, '2020-07-15 15:54:15', '1', '2020-07-15 15:54:15', '2020-07-15 15:54:15');
INSERT INTO `db_auth` VALUES ('37', 'NFY0anjdT', '更新用户', '1', '/api/user/update', null, 'R6IlvZRb', '用户管理', null, '1', null, null, '2020-07-15 15:54:43', '1', '2020-07-15 15:54:43', '2020-07-15 15:54:43');
INSERT INTO `db_auth` VALUES ('38', 'pLTJHvegw', '删除用户', '1', '/api/user/delete', null, 'R6IlvZRb', '用户管理', null, '1', null, null, '2020-07-15 15:55:36', '1', '2020-07-15 15:55:36', '2020-07-15 15:55:36');
INSERT INTO `db_auth` VALUES ('39', '56rjUo_2K', '获取全部权限列表', '1', '/api/auth/getAll', null, 'R6Ej09A1', '权限设置', null, '1', null, null, '2020-07-16 17:37:20', '1', '2020-07-16 17:37:20', '2020-07-16 17:37:20');
INSERT INTO `db_auth` VALUES ('40', 'AQ4tjqUVl', 'www', '0', '2222', null, '0', null, null, '1', null, '1', '2020-07-17 14:36:37', '0', '2020-07-16 17:40:39', '2020-07-17 14:36:37');
INSERT INTO `db_auth` VALUES ('41', 'PRAKl_Jbz', '颜色', '0', 'colour', '3', 'R6AhD4Jw', '平台管理', null, '1', '1', null, '2020-07-17 14:28:09', '1', '2020-07-17 14:28:09', '2020-07-17 14:54:15');
INSERT INTO `db_auth` VALUES ('42', 'bOvZ_X83z', '个人设置', '0', 'personal', '5', 'R6AhD4Jw', '平台管理', null, '1', '1', null, '2020-07-17 14:28:37', '1', '2020-07-17 14:28:37', '2020-07-18 22:22:41');
INSERT INTO `db_auth` VALUES ('43', 'hJl97ee5R', '任务栏', '0', 'taskbar', '4', 'R6AhD4Jw', '平台管理', null, '1', null, null, '2020-07-17 15:00:39', '1', '2020-07-17 15:00:39', '2020-07-17 15:00:39');
-- ----------------------------
-- Table structure for db_log
-- ----------------------------
DROP TABLE IF EXISTS `db_log`;
CREATE TABLE `db_log` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`origin` int(11) DEFAULT NULL COMMENT '日志来源: 0: 手机 1: 官网 2: 管理平台',
`type` int(11) DEFAULT NULL COMMENT '日志类型: 1.用户登录 2. 用户登出 3. 菜单访问 4.功能操作',
`title` varchar(128) DEFAULT NULL COMMENT '日志标题',
`desc` varchar(128) DEFAULT NULL COMMENT '日志描述',
`ip` varchar(48) DEFAULT NULL COMMENT '日志描述访问IP',
`create_user` varchar(20) DEFAULT NULL,
`createdAt` datetime NOT NULL,
`updatedAt` datetime NOT NULL,
`create_name` varchar(100) DEFAULT NULL,
`flag` int(11) DEFAULT '1' COMMENT '状态: 0:删除,1:可用(默认为1)',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
-- ----------------------------
-- Records of db_log
-- ----------------------------
INSERT INTO `db_log` VALUES ('1', '1', '4', '注册用户', '', '::ffff:10.7.253.134', '1', '2020-07-07 16:20:19', '2020-07-07 16:20:19', null, '1');
INSERT INTO `db_log` VALUES ('2', null, '4', '注册用户', '', '::1', '1', '2020-07-10 10:35:21', '2020-07-10 10:35:21', null, '1');
INSERT INTO `db_log` VALUES ('3', '1', '4', '注册用户', '', '::1', '1', '2020-07-10 10:37:30', '2020-07-15 16:49:53', null, '0');
INSERT INTO `db_log` VALUES ('4', '1', '4', '注册用户', '', '::1', '1', '2020-07-10 15:27:05', '2020-07-10 17:07:34', null, '0');
INSERT INTO `db_log` VALUES ('5', null, '4', '注册用户', '', '::ffff:127.0.0.1', '0FU5D5rg1', '2020-07-15 17:15:03', '2020-07-15 17:15:03', '', '1');
INSERT INTO `db_log` VALUES ('6', null, '4', '注册用户', '', '::ffff:10.7.253.134', '1', '2020-07-15 18:01:21', '2020-07-15 18:01:21', '超级管理员', '1');
INSERT INTO `db_log` VALUES ('7', null, '4', '注册用户', '', '::ffff:10.7.253.134', '1', '2020-07-15 18:04:08', '2020-07-15 18:04:08', '超级管理员', '1');
INSERT INTO `db_log` VALUES ('8', null, '4', '注册用户', '', '::1', '1', '2020-07-15 18:04:22', '2020-07-15 18:04:22', '超级管理员', '1');
INSERT INTO `db_log` VALUES ('9', null, '4', '注册用户', '', '::1', 'ZZ_fn-1Rd', '2020-07-16 11:14:34', '2020-07-18 13:11:16', '管理员', '0');
-- ----------------------------
-- Table structure for db_role
-- ----------------------------
DROP TABLE IF EXISTS `db_role`;
CREATE TABLE `db_role` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`role_id` varchar(20) DEFAULT NULL COMMENT '权限ID',
`name` varchar(24) DEFAULT NULL COMMENT '角色名称',
`desc` varchar(128) DEFAULT NULL COMMENT '角色描述',
`auth_ids` longtext COMMENT '角色权限id列表',
`create_user` int(11) DEFAULT NULL,
`update_user` int(11) DEFAULT NULL,
`delete_user` int(11) DEFAULT NULL,
`delete_time` datetime DEFAULT NULL,
`flag` int(11) DEFAULT '1' COMMENT '状态: 0:删除,1:可用(默认为1)',
`createdAt` datetime NOT NULL,
`updatedAt` datetime NOT NULL,
`half_checked` longtext COMMENT '半选中角色权限id列表',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
-- ----------------------------
-- Records of db_role
-- ----------------------------
INSERT INTO `db_role` VALUES ('2', 'Fr4iC6gVO', '超级管理员', '拥有全部权限的角色', 'R6zw8Hly,z3Kl73yJP,YPwdzlvSi,j-1fD9YEl,PRAKl_Jbz,bOvZ_X83z,R6Cip4M3,R6Ej09A1,R6LCSXn8,R6NT1Syx,R6O8RN67,R6O8RN6,56rjUo_2K,R6Fjw3Q4,u7dJFXAng,5V9hBAwry,Xb8IG-aGm,2X8BvHUTN,R6FP04jv,unh2To0Bx,uqu7Z_TPq,R6IlvZRb,nYf2OlmGy,Rz_Ue0mSy,NFY0anjdT,pLTJHvegw,zD5_5LJUQ,CVKN01q8r,8dsJ-8Fmq,R6AhD4Jw', '1', '1', '1', '2020-07-09 11:29:54', '1', '2020-07-09 11:16:16', '2020-07-22 17:01:58', 'R6AhD4Jw');
INSERT INTO `db_role` VALUES ('3', 'e8Ry49OEC', '管理员', '一般管理员权限1', 'R6zw8Hly,z3Kl73yJP,YPwdzlvSi,R6AhD4Jw,j-1fD9YEl,SMaog6p8a,PRAKl_Jbz,bOvZ_X83z,hJl97ee5R,R6Ej09A1,R6LCSXn8,R6NT1Syx,R6O8RN67,R6O8RN6,56rjUo_2K,R6Fjw3Q4,u7dJFXAng,5V9hBAwry,Xb8IG-aGm,2X8BvHUTN,R6FP04jv,unh2To0Bx,uqu7Z_TPq,zD5_5LJUQ,CVKN01q8r,8dsJ-8Fmq,R6Cip4M3', '1', '1', null, '2020-07-09 11:32:51', '1', '2020-07-09 11:32:51', '2020-07-20 14:51:48', 'R6Cip4M3');
INSERT INTO `db_role` VALUES ('4', '0FU5D5rg1', '前端开发人员', '前端开发人员', 'R6zw8Hly,z3Kl73yJP,YPwdzlvSi,R6AhD4Jw,j-1fD9YEl,SMaog6p8a,PRAKl_Jbz,bOvZ_X83z,hJl97ee5R', '1', '1', null, '2020-07-09 11:33:27', '1', '2020-07-09 11:33:27', '2020-07-18 12:50:48', null);
INSERT INTO `db_role` VALUES ('5', '73lVBH71v', '后端开发人员', '后端开发人员', 'R6LCSXn8,R6O8RN67,R6O8RN6,56rjUo_2K,u7dJFXAng,5V9hBAwry,2X8BvHUTN,R6FP04jv,unh2To0Bx,uqu7Z_TPq,R6IlvZRb,nYf2OlmGy,Rz_Ue0mSy,NFY0anjdT,pLTJHvegw,R6Cip4M3,R6Ej09A1,R6Fjw3Q4', '1', '1', '1', '2020-07-18 22:08:33', '0', '2020-07-09 11:33:44', '2020-07-18 22:08:33', 'R6Cip4M3,R6Ej09A1,R6Fjw3Q4');
INSERT INTO `db_role` VALUES ('6', '75NMnsfuk', '测试人员', '测试xx', 'Rz_Ue0mSy,zD5_5LJUQ,CVKN01q8r,8dsJ-8Fmq,R6Cip4M3,R6IlvZRb', '1', '1', '2', '2020-07-18 13:10:59', '0', '2020-07-09 11:34:49', '2020-07-18 13:10:59', 'R6Cip4M3,R6IlvZRb');
INSERT INTO `db_role` VALUES ('7', 'lJpUs7bz8', 'cece', 'cece', null, '2', null, '1', '2020-07-16 11:16:50', '0', '2020-07-15 16:50:05', '2020-07-16 11:16:50', null);
-- ----------------------------
-- Table structure for db_token
-- ----------------------------
DROP TABLE IF EXISTS `db_token`;
CREATE TABLE `db_token` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`user_id` varchar(20) DEFAULT NULL,
`admin_token` varchar(1024) DEFAULT NULL,
`phone_token` varchar(1024) DEFAULT NULL,
`user_token` varchar(1024) DEFAULT NULL,
`admin_addr` varchar(1024) DEFAULT NULL,
`phone_addr` varchar(1024) DEFAULT NULL,
`user_addr` varchar(1024) DEFAULT NULL,
`admin_ip` varchar(1024) DEFAULT NULL,
`phone_ip` varchar(1024) DEFAULT NULL,
`user_ip` varchar(1024) DEFAULT NULL,
`admin_expire_time` datetime DEFAULT NULL,
`phone_expire_time` datetime DEFAULT NULL,
`user_expire_time` datetime DEFAULT NULL,
`flag` int(11) DEFAULT '1' COMMENT '状态: 0:删除,1:可用(默认为1)',
`createdAt` datetime NOT NULL,
`updatedAt` datetime NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
-- ----------------------------
-- Records of db_token
-- ----------------------------
INSERT INTO `db_token` VALUES ('7', 'kuDvmHxc1', 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MiwidXNlcl9pZCI6Imt1RHZtSHhjMSIsInJvbGVfaWQiOiJlOFJ5NDlPRUMiLCJyb2xlX25hbWUiOiLnrqHnkIblkZgiLCJhY2NvdW50IjoiYWRtaW4iLCJuYW1lIjoiYWRtaW4iLCJwYXNzd29yZCI6IjAxOTIwMjNhN2JiZDczMjUwNTE2ZjA2OWRmMThiNTAwIiwidHlwZSI6ImFkbWluIiwic2V4IjoxLCJwaG9uZSI6IjE3NjIxNjUyMDEyIiwic3RhdHVzIjoxLCJjcmVhdGVfdXNlciI6IjNzaTlZTDZFOSIsInVwZGF0ZV91c2VyIjoiWlpfZm4tMVJkIiwiZmxhZyI6MSwiY3JlYXRlZEF0IjoiMjAyMC0wNy0xNVQxMDowNDoyMi4wMDBaIiwidXBkYXRlZEF0IjoiMjAyMC0wNy0xN1QwOToyNDoxNy4wMDBaIiwiYWRtaW5fZXhwaXJlX3RpbWUiOiIyMDIwLTA3LTIxVDA2OjUyOjA2LjMzMloiLCJpYXQiOjE1OTUyMjc5MjZ9.JAcPyF2bk6kUP2zxFq6LY-9KEwpDLcU-OTIgiRo7zi0', null, null, null, null, null, '::1', null, null, '2020-07-21 14:52:06', '2020-07-17 17:21:12', '2020-07-17 17:21:12', '1', '2020-07-17 17:21:12', '2020-07-20 14:52:06');
INSERT INTO `db_token` VALUES ('9', 'ZZ_fn-1Rd', 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MSwidXNlcl9pZCI6IlpaX2ZuLTFSZCIsInJvbGVfaWQiOiJGcjRpQzZnVk8iLCJyb2xlX25hbWUiOiLotoXnuqfnrqHnkIblkZgiLCJhY2NvdW50Ijoicm9vdCIsIm5hbWUiOiJyb290IiwicGFzc3dvcmQiOiI2M2E5ZjBlYTdiYjk4MDUwNzk2YjY0OWU4NTQ4MTg0NSIsInR5cGUiOiJhZG1pbiIsInNleCI6MiwicGhvbmUiOiIxODc3MDkxOTA4MCIsInN0YXR1cyI6MSwiY3JlYXRlX3VzZXIiOiIwRlU1RDVyZzEiLCJ1cGRhdGVfdXNlciI6IlpaX2ZuLTFSZCIsImZsYWciOjEsImNyZWF0ZWRBdCI6IjIwMjAtMDctMTVUMDk6MTU6MDMuMDAwWiIsInVwZGF0ZWRBdCI6IjIwMjAtMDctMThUMTA6NTQ6NTQuMDAwWiIsImFkbWluX2V4cGlyZV90aW1lIjoiMjAyMC0wNy0yMlQxMzowOTozNy4yMDhaIiwiaWF0IjoxNTk1MzM2OTc3fQ.1kwxnnmzF8Nl1R_rXZvHYIgy75ARqZOnZ5O9raYcteQ', null, null, null, null, null, '::1', null, null, '2020-07-22 21:09:37', '2020-07-18 18:25:58', '2020-07-18 18:25:58', '1', '2020-07-18 18:25:58', '2020-07-21 21:09:37');
-- ----------------------------
-- Table structure for db_user
-- ----------------------------
DROP TABLE IF EXISTS `db_user`;
CREATE TABLE `db_user` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`role_id` varchar(20) DEFAULT NULL,
`account` varchar(100) DEFAULT NULL,
`name` varchar(100) DEFAULT NULL,
`password` varchar(32) DEFAULT NULL,
`type` int(11) DEFAULT '1' COMMENT '用户类型: 0: 系统注册 1: 管理平台添加 2:导入',
`sex` int(11) DEFAULT NULL,
`avatar` varchar(128) DEFAULT NULL COMMENT '头像',
`phone` varchar(12) DEFAULT NULL,
`status` int(11) DEFAULT '1' COMMENT '状态: 0:停用,1:启用(默认为1)',
`create_user` varchar(20) DEFAULT NULL,
`update_user` varchar(128) DEFAULT NULL,
`delete_user` varchar(128) DEFAULT NULL,
`delete_time` datetime DEFAULT NULL,
`flag` int(11) DEFAULT '1' COMMENT '状态: 0:删除,1:可用(默认为1)',
`createdAt` datetime NOT NULL,
`updatedAt` datetime NOT NULL,
`role_name` varchar(24) DEFAULT NULL,
`user_id` varchar(20) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
-- ----------------------------
-- Records of db_user
-- ----------------------------
INSERT INTO `db_user` VALUES ('1', 'Fr4iC6gVO', 'root', 'root', '63a9f0ea7bb98050796b649e85481845', '1', '2', null, '18770919080', '1', '0FU5D5rg1', 'ZZ_fn-1Rd', null, null, '1', '2020-07-15 17:15:03', '2020-07-18 18:54:54', '超级管理员', 'ZZ_fn-1Rd');
INSERT INTO `db_user` VALUES ('2', 'e8Ry49OEC', 'admin', 'admin', '0192023a7bbd73250516f069df18b500', '1', '1', null, '17621652012', '1', '3si9YL6E9', 'ZZ_fn-1Rd', null, null, '1', '2020-07-15 18:04:22', '2020-07-17 17:24:17', '管理员', 'kuDvmHxc1');
INSERT INTO `db_user` VALUES ('10', '75NMnsfuk', 'test', 'test', 'cc03e747a6afbbcbf8be7668acfebee5', '1', '1', null, '17621652012', '1', 'ZZ_fn-1Rd', 'ZZ_fn-1Rd', '1', '2020-07-16 11:18:14', '0', '2020-07-16 11:14:34', '2020-07-16 11:18:14', '测试人员', 'H5LJihoPx'); | the_stack |
Changes in 1.5.0
+ Added new parameter that allows to filter the results by specific partition number (@partitionNumber)
+ Added new parameter for the searching precise name of the object (@preciseSearch)
+ Expanded search of the schema to include the pattern search with @preciseSearch = 0
Changes in 1.5.1
+ Added new parameter for specifying the name of the database, where the Columnstore Indexes should be located (@dbName)
*/
--------------------------------------------------------------------------------------------------------------------
declare @SQLServerVersion nvarchar(128) = cast(SERVERPROPERTY('ProductVersion') as NVARCHAR(128)),
@SQLServerEdition nvarchar(128) = cast(SERVERPROPERTY('Edition') as NVARCHAR(128)),
@SQLServerBuild smallint = NULL;
declare @errorMessage nvarchar(512);
-- Ensure that we are running SQL Server 2017
if substring(@SQLServerVersion,1,CHARINDEX('.',@SQLServerVersion)-1) <> N'14'
begin
set @errorMessage = (N'You are not running a SQL Server 2017. Your SQL Server version is ' + @SQLServerVersion);
Throw 51000, @errorMessage, 1;
end
GO
--------------------------------------------------------------------------------------------------------------------
/*
Columnstore Indexes Scripts Library for SQL Server 2017:
Dictionaries Analysis - Shows detailed information about the Columnstore Dictionaries
Version: 1.5.1, September 2017
*/
create or alter procedure dbo.cstore_GetDictionaries(
-- Params --
@dbName SYSNAME = NULL, -- Identifies the Database to run the stored procedure against. If this parameter is left to be NULL, then the current database is used
@showDetails bit = 1, -- Enables showing the details of all Dictionaries
@showWarningsOnly bit = 0, -- Enables to filter out the dictionaries based on the Dictionary Size (@warningDictionarySizeInMB) and Entry Count (@warningEntryCount)
@warningDictionarySizeInMB Decimal(8,2) = 6., -- The size of the dictionary, after which the dictionary should be selected. The value is in Megabytes
@warningEntryCount Int = 1000000, -- Enables selecting of dictionaries with more than this number
@showAllTextDictionaries bit = 0, -- Enables selecting all textual dictionaries indepentantly from their warning status
@showDictionaryType nvarchar(10) = NULL, -- Enables to filter out dictionaries by type with possible values ''Local'', ''Global'' or NULL for both
@objectId int = NULL, -- Allows to idenitfy a table thorugh the ObjectId
@schemaName nvarchar(256) = NULL, -- Allows to show data filtered down to the specified schema
@tableName nvarchar(256) = NULL, -- Allows to show data filtered down to 1 particular table
@preciseSearch bit = 0, -- Defines if the schema and data search with the parameters @schemaName & @tableName will be precise or pattern-like
@partitionNumber int = 0, -- Allows to filter data on a specific partion. Works only if @showPartitionDetails is set = 1
@columnName nvarchar(256) = NULL, -- Allows to filter out data base on 1 particular column name
@indexLocation varchar(15) = NULL, -- Allows to filter Columnstore Indexes based on their location: Disk-Based & In-Memory
@indexType char(2) = NULL -- Allows to filter Columnstore Indexes by their type, with possible values (CC for ''Clustered'', NC for ''Nonclustered'' or NULL for both)
-- end of --
) as
begin
SET NOCOUNT ON;
IF @dbName IS NULL
SET @dbName = DB_NAME(DB_ID());
DECLARE @dbId INT = DB_ID(@dbName);
DECLARE @sql NVARCHAR(MAX);
IF NOT EXISTS (SELECT 1 FROM sys.databases WHERE name = @dbName)
BEGIN
DECLARE @errorMessage NVARCHAR(500) = 'The Database ''' + @dbName + ''' does not exist on this SQL Server Instance!';
THROW 51000, @errorMessage, 1;
END
declare @table_object_id int = NULL;
if (@tableName is not NULL )
set @table_object_id = isnull(object_id(@tableName),-1);
else
set @table_object_id = NULL;
SET @sql = N'
SELECT QuoteName(object_schema_name(i.object_id, @dbId)) + ''.'' + QuoteName(object_name(i.object_id, @dbId)) as ''TableName'',
case i.type when 5 then ''Clustered'' when 6 then ''Nonclustered'' end as ''Type'',
case i.data_space_id when 0 then ''In-Memory'' else ''Disk-Based'' end as [Location],
p.partition_number as ''Partition'',
(select count(rg.row_group_id) from ' + QUOTENAME(@dbName) + N'.sys.column_store_row_groups rg
where rg.object_id = i.object_id and rg.partition_number = p.partition_number
and rg.state = 3 ) as ''RowGroups'',
count(csd.column_id) as ''Dictionaries'',
sum(csd.entry_count) as ''EntriesCount'',
(select sum(isnull(rg.total_rows,0) - isnull(rg.deleted_rows,0)) from ' + QUOTENAME(@dbName) + N'.sys.column_store_row_groups rg
where rg.object_id = i.object_id and rg.partition_number = p.partition_number
and rg.state = 3 ) as ''Rows Serving'',
cast( SUM(csd.on_disk_size)/(1024.0*1024.0) as Decimal(8,3)) as ''Total Size in MB'',
cast( MAX(case dictionary_id when 0 then csd.on_disk_size else 0 end)/(1024.0*1024.0) as Decimal(8,3)) as ''Max Global Size in MB'',
cast( MAX(case dictionary_id when 0 then 0 else csd.on_disk_size end)/(1024.0*1024.0) as Decimal(8,3)) as ''Max Local Size in MB''
FROM ' + QUOTENAME(@dbName) + N'.sys.indexes AS i
inner join ' + QUOTENAME(@dbName) + N'.sys.partitions AS p
on i.object_id = p.object_id
inner join ' + QUOTENAME(@dbName) + N'.sys.column_store_dictionaries AS csd
on csd.hobt_id = p.hobt_id and csd.partition_id = p.partition_id
where i.type in (5,6)
AND (@preciseSearch = 0 AND (@tableName is null or object_name (i.object_id, @dbId) like ''%'' + @tableName + ''%'')
OR @preciseSearch = 1 AND (@tableName is null or object_name (i.object_id, @dbId) = @tableName) )
AND (@preciseSearch = 0 AND (@schemaName is null or object_schema_name( i.object_id, @dbId ) like ''%'' + @schemaName + ''%'')
OR @preciseSearch = 1 AND (@schemaName is null or object_schema_name( i.object_id, @dbId ) = @schemaName))
AND (ISNULL(@objectId,i.object_id) = i.object_id)
AND partition_number = case @partitionNumber when 0 then partition_number else @partitionNumber end
and i.data_space_id = isnull( case @indexLocation when ''In-Memory'' then 0 when ''Disk-Based'' then 1 else i.data_space_id end, i.data_space_id )
and case @indexType when ''CC'' then 5 when ''NC'' then 6 else i.type end = i.type
group by object_schema_name(i.object_id, @dbId) + ''.'' + object_name(i.object_id, @dbId), i.object_id, i.data_space_id, i.type, p.partition_number
union all';
SET @sql += N'
SELECT QuoteName(object_schema_name(i.object_id,db_id(''tempdb''))) + ''.'' + QuoteName(object_name(i.object_id,db_id(''tempdb''))) as ''TableName'',
case i.type when 5 then ''Clustered'' when 6 then ''Nonclustered'' end as ''Type'',
case i.data_space_id when 0 then ''In-Memory'' else ''Disk-Based'' end as [Location],
p.partition_number as ''Partition'',
(select count(rg.row_group_id) from tempdb.sys.column_store_row_groups rg
where rg.object_id = i.object_id and rg.partition_number = p.partition_number
and rg.state = 3 ) as ''RowGroups'',
count(csd.column_id) as ''Dictionaries'',
sum(csd.entry_count) as ''EntriesCount'',
min(p.rows) as ''Rows Serving'',
cast( SUM(csd.on_disk_size)/(1024.0*1024.0) as Decimal(8,3)) as ''Total Size in MB'',
cast( MAX(case dictionary_id when 0 then csd.on_disk_size else 0 end)/(1024.0*1024.0) as Decimal(8,3)) as ''Max Global Size in MB'',
cast( MAX(case dictionary_id when 0 then 0 else csd.on_disk_size end)/(1024.0*1024.0) as Decimal(8,3)) as ''Max Local Size in MB''
FROM tempdb.sys.indexes AS i
inner join tempdb.sys.partitions AS p
on i.object_id = p.object_id
inner join tempdb.sys.column_store_dictionaries AS csd
on csd.hobt_id = p.hobt_id and csd.partition_id = p.partition_id
where i.type in (5,6)
AND (@preciseSearch = 0 AND (@tableName is null or object_name (p.object_id,db_id(''tempdb'')) like ''%'' + @tableName + ''%'')
OR @preciseSearch = 1 AND (@tableName is null or object_name (p.object_id,db_id(''tempdb'')) = @tableName) )
AND (@preciseSearch = 0 AND (@schemaName is null or object_schema_name( p.object_id,db_id(''tempdb'') ) like ''%'' + @schemaName + ''%'')
OR @preciseSearch = 1 AND (@schemaName is null or object_schema_name( p.object_id,db_id(''tempdb'') ) = @schemaName))
AND (ISNULL(@objectId,p.object_id) = p.object_id)
AND partition_number = case @partitionNumber when 0 then partition_number else @partitionNumber end
and i.data_space_id = isnull( case @indexLocation when ''In-Memory'' then 0 when ''Disk-Based'' then 1 else i.data_space_id end, i.data_space_id )
and case @indexType when ''CC'' then 5 when ''NC'' then 6 else i.type end = i.type
group by object_schema_name(i.object_id,db_id(''tempdb'')) + ''.'' + object_name(i.object_id,db_id(''tempdb'')), i.object_id, i.type, i.data_space_id, p.partition_number;';
DECLARE @paramDefinition NVARCHAR(1000) = '@showDetails BIT,
@showWarningsOnly BIT,
@warningDictionarySizeInMB Decimal(8,2),
@warningEntryCount INT,
@showAllTextDictionaries BIT,
@showDictionaryType nvarchar(10),
@indexType char(2),
@indexLocation varchar(15),
@preciseSearch bit,
@tableName nvarchar(256),
@schemaName nvarchar(256),
@objectId int,
@partitionNumber int,
@columnName nvarchar(256),
@dbId int';
EXEC sp_executesql @sql, @paramDefinition, @showDetails = @showDetails, @showWarningsOnly = @showWarningsOnly,
@warningDictionarySizeInMB = @warningDictionarySizeInMB,
@warningEntryCount = @warningEntryCount,
@showAllTextDictionaries = @showAllTextDictionaries,
@showDictionaryType = @showDictionaryType,
@indexType = @indexType, @indexLocation = @indexLocation,
@preciseSearch = @preciseSearch, @tableName = @tableName,
@schemaName = @schemaName, @objectId = @objectId,
@partitionNumber = @partitionNumber,
@columnName = @columnName,
@dbId = @dbId;
if @showDetails = 1
BEGIN
SET @sql = N'
select QuoteName(object_schema_name(part.object_id, @dbId)) + ''.'' + QuoteName(object_name(part.object_id, @dbId)) as ''TableName'',
ind.name COLLATE DATABASE_DEFAULT as ''IndexName'',
part.partition_number as ''Partition'',
cols.name COLLATE DATABASE_DEFAULT as ColumnName,
dict.column_id as ColumnId,
dict.dictionary_id as ''DictionaryId'',
tp.name COLLATE DATABASE_DEFAULT as ColumnType,
case dictionary_id when 0 then ''Global'' else ''Local'' end as ''Type'',
(select sum(isnull(rg.total_rows,0) - isnull(rg.deleted_rows,0)) from ' + QUOTENAME(@dbName) + N'.sys.column_store_row_groups rg
where rg.object_id = part.object_id and rg.partition_number = part.partition_number
and rg.state = 3 ) as ''Rows Serving'',
entry_count as ''Entry Count'',
cast( on_disk_size / 1024. / 1024. as Decimal(8,2)) ''SizeInMb''
from ' + QUOTENAME(@dbName) + N'.sys.column_store_dictionaries dict
inner join ' + QUOTENAME(@dbName) + N'.sys.partitions part
ON dict.partition_id = part.partition_id and dict.partition_id = part.partition_id
inner join ' + QUOTENAME(@dbName) + N'.sys.indexes ind
on part.object_id = ind.object_id and part.index_id = ind.index_id
inner join ' + QUOTENAME(@dbName) + N'.sys.columns cols
on part.object_id = cols.object_id and dict.column_id = cols.column_id
inner join ' + QUOTENAME(@dbName) + N'.sys.types tp
on cols.system_type_id = tp.system_type_id and cols.user_type_id = tp.user_type_id
where
(( @showWarningsOnly = 1
AND
( cast( on_disk_size / 1024. / 1024. as Decimal(8,2)) > @warningDictionarySizeInMB OR
entry_count > @warningEntryCount
)
) OR @showWarningsOnly = 0 )
AND
(( @showAllTextDictionaries = 1
AND
case tp.name
when ''char'' then 1
when ''nchar'' then 1
when ''varchar'' then 1
when ''nvarchar'' then 1
when ''sysname'' then 1
end = 1
) OR @showAllTextDictionaries = 0 )
AND (@preciseSearch = 0 AND (@tableName is null or object_name (part.object_id) like ''%'' + @tableName + ''%'')
OR @preciseSearch = 1 AND (@tableName is null or object_name (part.object_id) = @tableName) )
and (@preciseSearch = 0 AND (@schemaName is null or object_schema_name( part.object_id ) like ''%'' + @schemaName + ''%'')
OR @preciseSearch = 1 AND (@schemaName is null or object_schema_name( part.object_id ) = @schemaName))
AND (ISNULL(@objectId,part.object_id) = part.object_id)
AND partition_number = case @partitionNumber when 0 then partition_number else @partitionNumber end
and cols.name = isnull(@columnName,cols.name)
and case dictionary_id when 0 then ''Global'' else ''Local'' end = isnull(@showDictionaryType, case dictionary_id when 0 then ''Global'' else ''Local'' end)
and ind.data_space_id = isnull( case @indexLocation when ''In-Memory'' then 0 when ''Disk-Based'' then 1 else ind.data_space_id end, ind.data_space_id )
and case @indexType when ''CC'' then 5 when ''NC'' then 6 else ind.type end = ind.type';
SET @sql += N'
union all
select QuoteName(object_schema_name(part.object_id,db_id(''tempdb''))) + ''.'' + QuoteName(object_name(part.object_id,db_id(''tempdb''))) as ''TableName'',
ind.name as ''IndexName'',
part.partition_number as ''Partition'',
cols.name as ColumnName,
dict.column_id as ColumnId,
dict.dictionary_id as ''DictionaryId'',
tp.name as ColumnType,
case dictionary_id when 0 then ''Global'' else ''Local'' end as ''Type'',
(select sum(isnull(rg.total_rows,0) - isnull(rg.deleted_rows,0)) from sys.column_store_row_groups rg
where rg.object_id = part.object_id and rg.partition_number = part.partition_number
and rg.state = 3 ) as ''Rows Serving'',
entry_count as ''Entry Count'',
cast( on_disk_size / 1024. / 1024. as Decimal(8,2)) ''SizeInMb''
from tempdb.sys.column_store_dictionaries dict
inner join tempdb.sys.partitions part
ON dict.hobt_id = part.hobt_id and dict.partition_id = part.partition_id
inner join tempdb.sys.indexes ind
on part.object_id = ind.object_id and part.index_id = ind.index_id
inner join tempdb.sys.columns cols
on part.object_id = cols.object_id and dict.column_id = cols.column_id
inner join tempdb.sys.types tp
on cols.system_type_id = tp.system_type_id and cols.user_type_id = tp.user_type_id
where
(( @showWarningsOnly = 1
AND
( cast( on_disk_size / 1024. / 1024. as Decimal(8,2)) > @warningDictionarySizeInMB OR
entry_count > @warningEntryCount
)
) OR @showWarningsOnly = 0 )
AND
(( @showAllTextDictionaries = 1
AND
case tp.name
when ''char'' then 1
when ''nchar'' then 1
when ''varchar'' then 1
when ''nvarchar'' then 1
when ''sysname'' then 1
end = 1
) OR @showAllTextDictionaries = 0 )
AND (@preciseSearch = 0 AND (@tableName is null or object_name (part.object_id,db_id(''tempdb'')) like ''%'' + @tableName + ''%'')
OR @preciseSearch = 1 AND (@tableName is null or object_name (part.object_id,db_id(''tempdb'')) = @tableName) )
AND (@preciseSearch = 0 AND (@schemaName is null or object_schema_name( part.object_id,db_id(''tempdb'') ) like ''%'' + @schemaName + ''%'')
OR @preciseSearch = 1 AND (@schemaName is null or object_schema_name( part.object_id,db_id(''tempdb'') ) = @schemaName))
AND (ISNULL(@objectId,part.object_id) = part.object_id)
AND partition_number = case @partitionNumber when 0 then partition_number else @partitionNumber end and cols.name = isnull(@columnName,cols.name)
and case dictionary_id when 0 then ''Global'' else ''Local'' end = isnull(@showDictionaryType, case dictionary_id when 0 then ''Global'' else ''Local'' end)
and ind.data_space_id = isnull( case @indexLocation when ''In-Memory'' then 0 when ''Disk-Based'' then 1 else ind.data_space_id end, ind.data_space_id )
and case @indexType when ''CC'' then 5 when ''NC'' then 6 else ind.type end = ind.type
order by TableName, IndexName, part.partition_number, dict.column_id;';
SET @paramDefinition = '@showDetails BIT,
@showWarningsOnly BIT,
@warningDictionarySizeInMB Decimal(8,2),
@warningEntryCount INT,
@showAllTextDictionaries BIT,
@showDictionaryType nvarchar(10),
@indexType char(2),
@indexLocation varchar(15),
@preciseSearch bit,
@tableName nvarchar(256),
@schemaName nvarchar(256),
@objectId int,
@partitionNumber int,
@columnName nvarchar(256),
@dbId int';
EXEC sp_executesql @sql, @paramDefinition, @showDetails = @showDetails, @showWarningsOnly = @showWarningsOnly,
@warningDictionarySizeInMB = @warningDictionarySizeInMB,
@warningEntryCount = @warningEntryCount,
@showAllTextDictionaries = @showAllTextDictionaries,
@showDictionaryType = @showDictionaryType,
@indexType = @indexType, @indexLocation = @indexLocation,
@preciseSearch = @preciseSearch, @tableName = @tableName,
@schemaName = @schemaName, @objectId = @objectId,
@partitionNumber = @partitionNumber,
@columnName = @columnName,
@dbId = @dbId;
END
end
GO | the_stack |
-- This file and its contents are licensed under the Apache License 2.0.
-- Please see the included NOTICE for copyright information and
-- LICENSE-APACHE for a copy of the license.
CREATE TABLE hyper (
time BIGINT NOT NULL,
device_id TEXT NOT NULL,
sensor_1 NUMERIC NULL DEFAULT 1
);
CREATE OR REPLACE FUNCTION test_trigger()
RETURNS TRIGGER LANGUAGE PLPGSQL AS
$BODY$
DECLARE
cnt INTEGER;
BEGIN
SELECT count(*) INTO cnt FROM hyper;
RAISE WARNING 'FIRING trigger when: % level: % op: % cnt: % trigger_name %',
tg_when, tg_level, tg_op, cnt, tg_name;
IF TG_OP = 'DELETE' THEN
RETURN OLD;
END IF;
RETURN NEW;
END
$BODY$;
-- row triggers: BEFORE
CREATE TRIGGER _0_test_trigger_insert
BEFORE INSERT ON hyper
FOR EACH ROW EXECUTE FUNCTION test_trigger();
CREATE TRIGGER _0_test_trigger_update
BEFORE UPDATE ON hyper
FOR EACH ROW EXECUTE FUNCTION test_trigger();
CREATE TRIGGER _0_test_trigger_delete
BEFORE delete ON hyper
FOR EACH ROW EXECUTE FUNCTION test_trigger();
CREATE TRIGGER z_test_trigger_all
BEFORE INSERT OR UPDATE OR DELETE ON hyper
FOR EACH ROW EXECUTE FUNCTION test_trigger();
-- row triggers: AFTER
CREATE TRIGGER _0_test_trigger_insert_after
AFTER INSERT ON hyper
FOR EACH ROW EXECUTE FUNCTION test_trigger();
CREATE TRIGGER _0_test_trigger_insert_after_when_dev1
AFTER INSERT ON hyper
FOR EACH ROW
WHEN (NEW.device_id = 'dev1')
EXECUTE FUNCTION test_trigger();
CREATE TRIGGER _0_test_trigger_update_after
AFTER UPDATE ON hyper
FOR EACH ROW EXECUTE FUNCTION test_trigger();
CREATE TRIGGER _0_test_trigger_delete_after
AFTER delete ON hyper
FOR EACH ROW EXECUTE FUNCTION test_trigger();
CREATE TRIGGER z_test_trigger_all_after
AFTER INSERT OR UPDATE OR DELETE ON hyper
FOR EACH ROW EXECUTE FUNCTION test_trigger();
-- statement triggers: BEFORE
CREATE TRIGGER _0_test_trigger_insert_s_before
BEFORE INSERT ON hyper
FOR EACH STATEMENT EXECUTE FUNCTION test_trigger();
CREATE TRIGGER _0_test_trigger_update_s_before
BEFORE UPDATE ON hyper
FOR EACH STATEMENT EXECUTE FUNCTION test_trigger();
CREATE TRIGGER _0_test_trigger_delete_s_before
BEFORE DELETE ON hyper
FOR EACH STATEMENT EXECUTE FUNCTION test_trigger();
-- statement triggers: AFTER
CREATE TRIGGER _0_test_trigger_insert_s_after
AFTER INSERT ON hyper
FOR EACH STATEMENT EXECUTE FUNCTION test_trigger();
CREATE TRIGGER _0_test_trigger_update_s_after
AFTER UPDATE ON hyper
FOR EACH STATEMENT EXECUTE FUNCTION test_trigger();
CREATE TRIGGER _0_test_trigger_delete_s_after
AFTER DELETE ON hyper
FOR EACH STATEMENT EXECUTE FUNCTION test_trigger();
-- CONSTRAINT TRIGGER
CREATE CONSTRAINT TRIGGER _0_test_trigger_constraint_insert
AFTER INSERT ON hyper FOR EACH ROW EXECUTE FUNCTION test_trigger();
CREATE CONSTRAINT TRIGGER _0_test_trigger_constraint_update
AFTER UPDATE ON hyper FOR EACH ROW EXECUTE FUNCTION test_trigger();
CREATE CONSTRAINT TRIGGER _0_test_trigger_constraint_delete
AFTER DELETE ON hyper FOR EACH ROW EXECUTE FUNCTION test_trigger();
SELECT * FROM create_hypertable('hyper', 'time', chunk_time_interval => 10);
--test triggers before create_hypertable
INSERT INTO hyper(time, device_id,sensor_1) VALUES
(1257987600000000000, 'dev1', 1);
INSERT INTO hyper(time, device_id,sensor_1) VALUES
(1257987700000000000, 'dev2', 1), (1257987800000000000, 'dev2', 1);
UPDATE hyper SET sensor_1 = 2;
DELETE FROM hyper;
--test drop trigger
DROP TRIGGER _0_test_trigger_insert ON hyper;
DROP TRIGGER _0_test_trigger_insert_s_before ON hyper;
DROP TRIGGER _0_test_trigger_insert_after ON hyper;
DROP TRIGGER _0_test_trigger_insert_s_after ON hyper;
INSERT INTO hyper(time, device_id,sensor_1) VALUES
(1257987600000000000, 'dev1', 1);
INSERT INTO hyper(time, device_id,sensor_1) VALUES
(1257987700000000000, 'dev2', 1), (1257987800000000000, 'dev2', 1);
DROP TRIGGER _0_test_trigger_update ON hyper;
DROP TRIGGER _0_test_trigger_update_s_before ON hyper;
DROP TRIGGER _0_test_trigger_update_after ON hyper;
DROP TRIGGER _0_test_trigger_update_s_after ON hyper;
UPDATE hyper SET sensor_1 = 2;
DROP TRIGGER _0_test_trigger_delete ON hyper;
DROP TRIGGER _0_test_trigger_delete_s_before ON hyper;
DROP TRIGGER _0_test_trigger_delete_after ON hyper;
DROP TRIGGER _0_test_trigger_delete_s_after ON hyper;
DELETE FROM hyper;
DROP TRIGGER z_test_trigger_all ON hyper;
DROP TRIGGER z_test_trigger_all_after ON hyper;
--test create trigger on hypertable
-- row triggers: BEFORE
CREATE TRIGGER _0_test_trigger_insert
BEFORE INSERT ON hyper
FOR EACH ROW EXECUTE FUNCTION test_trigger();
CREATE TRIGGER _0_test_trigger_update
BEFORE UPDATE ON hyper
FOR EACH ROW EXECUTE FUNCTION test_trigger();
CREATE TRIGGER _0_test_trigger_delete
BEFORE delete ON hyper
FOR EACH ROW EXECUTE FUNCTION test_trigger();
CREATE TRIGGER z_test_trigger_all
BEFORE INSERT OR UPDATE OR DELETE ON hyper
FOR EACH ROW EXECUTE FUNCTION test_trigger();
-- row triggers: AFTER
CREATE TRIGGER _0_test_trigger_insert_after
AFTER INSERT ON hyper
FOR EACH ROW EXECUTE FUNCTION test_trigger();
CREATE TRIGGER _0_test_trigger_update_after
AFTER UPDATE ON hyper
FOR EACH ROW EXECUTE FUNCTION test_trigger();
CREATE TRIGGER _0_test_trigger_delete_after
AFTER delete ON hyper
FOR EACH ROW EXECUTE FUNCTION test_trigger();
CREATE TRIGGER z_test_trigger_all_after
AFTER INSERT OR UPDATE OR DELETE ON hyper
FOR EACH ROW EXECUTE FUNCTION test_trigger();
-- statement triggers: BEFORE
CREATE TRIGGER _0_test_trigger_insert_s_before
BEFORE INSERT ON hyper
FOR EACH STATEMENT EXECUTE FUNCTION test_trigger();
CREATE TRIGGER _0_test_trigger_update_s_before
BEFORE UPDATE ON hyper
FOR EACH STATEMENT EXECUTE FUNCTION test_trigger();
CREATE TRIGGER _0_test_trigger_delete_s_before
BEFORE DELETE ON hyper
FOR EACH STATEMENT EXECUTE FUNCTION test_trigger();
-- statement triggers: AFTER
CREATE TRIGGER _0_test_trigger_insert_s_after
AFTER INSERT ON hyper
FOR EACH STATEMENT EXECUTE FUNCTION test_trigger();
CREATE TRIGGER _0_test_trigger_update_s_after
AFTER UPDATE ON hyper
FOR EACH STATEMENT EXECUTE FUNCTION test_trigger();
CREATE TRIGGER _0_test_trigger_delete_s_after
AFTER DELETE ON hyper
FOR EACH STATEMENT EXECUTE FUNCTION test_trigger();
INSERT INTO hyper(time, device_id,sensor_1) VALUES
(1257987600000000000, 'dev1', 1);
INSERT INTO hyper(time, device_id,sensor_1) VALUES
(1257987700000000000, 'dev2', 1), (1257987800000000000, 'dev2', 1);
UPDATE hyper SET sensor_1 = 2;
DELETE FROM hyper;
CREATE TABLE vehicles (
vehicle_id INTEGER PRIMARY KEY,
vin_number CHAR(17),
last_checkup TIMESTAMP
);
CREATE TABLE color (
color_id INTEGER PRIMARY KEY,
notes text
);
CREATE TABLE location (
time TIMESTAMP NOT NULL,
vehicle_id INTEGER REFERENCES vehicles (vehicle_id),
color_id INTEGER, --no reference since gonna populate a hypertable
latitude FLOAT,
longitude FLOAT
);
CREATE OR REPLACE FUNCTION create_vehicle_trigger_fn()
RETURNS TRIGGER LANGUAGE PLPGSQL AS
$BODY$
BEGIN
INSERT INTO vehicles VALUES(NEW.vehicle_id, NULL, NULL) ON CONFLICT DO NOTHING;
RETURN NEW;
END
$BODY$;
CREATE OR REPLACE FUNCTION create_color_trigger_fn()
RETURNS TRIGGER LANGUAGE PLPGSQL AS
$BODY$
BEGIN
--test subtxns within triggers
BEGIN
INSERT INTO color VALUES(NEW.color_id, 'n/a');
EXCEPTION WHEN unique_violation THEN
-- Nothing to do, just continue
END;
RETURN NEW;
END
$BODY$;
CREATE TRIGGER create_color_trigger
BEFORE INSERT OR UPDATE ON location
FOR EACH ROW EXECUTE FUNCTION create_color_trigger_fn();
SELECT create_hypertable('location', 'time');
--make color also a hypertable
SELECT create_hypertable('color', 'color_id', chunk_time_interval=>10);
-- Test that we can create and use triggers with another user
GRANT TRIGGER, INSERT, SELECT, UPDATE ON location TO :ROLE_DEFAULT_PERM_USER_2;
GRANT SELECT, INSERT, UPDATE ON color TO :ROLE_DEFAULT_PERM_USER_2;
GRANT SELECT, INSERT, UPDATE ON vehicles TO :ROLE_DEFAULT_PERM_USER_2;
\c :TEST_DBNAME :ROLE_DEFAULT_PERM_USER_2;
CREATE TRIGGER create_vehicle_trigger
BEFORE INSERT OR UPDATE ON location
FOR EACH ROW EXECUTE FUNCTION create_vehicle_trigger_fn();
INSERT INTO location VALUES('2017-01-01 01:02:03', 1, 1, 40.7493226,-73.9771259);
INSERT INTO location VALUES('2017-01-01 01:02:04', 1, 20, 24.7493226,-73.9771259);
INSERT INTO location VALUES('2017-01-01 01:02:03', 23, 1, 40.7493226,-73.9771269);
INSERT INTO location VALUES('2017-01-01 01:02:03', 53, 20, 40.7493226,-73.9771269);
UPDATE location SET vehicle_id = 52 WHERE vehicle_id = 53;
SELECT * FROM location;
SELECT * FROM vehicles;
SELECT * FROM color;
-- switch back to default user to run some dropping tests
\c :TEST_DBNAME :ROLE_DEFAULT_PERM_USER;
\set ON_ERROR_STOP 0
-- test that disable trigger is disallowed
ALTER TABLE location DISABLE TRIGGER create_vehicle_trigger;
\set ON_ERROR_STOP 1
-- test that drop trigger works
DROP TRIGGER create_color_trigger ON location;
DROP TRIGGER create_vehicle_trigger ON location;
-- test that drop trigger doesn't cause leftovers that mean that dropping chunks or hypertables no longer works
SELECT count(1) FROM pg_depend d WHERE d.classid = 'pg_trigger'::regclass AND NOT EXISTS (SELECT 1 FROM pg_trigger WHERE oid = d.objid);
DROP TABLE location;
-- test triggers with transition tables
-- test creating hypertable from table with triggers with transition tables
CREATE TABLE transition_test(time timestamptz NOT NULL);
CREATE TRIGGER t1 AFTER INSERT ON transition_test REFERENCING NEW TABLE AS new_trans FOR EACH STATEMENT EXECUTE FUNCTION test_trigger();
\set ON_ERROR_STOP 0
SELECT create_hypertable('transition_test','time');
\set ON_ERROR_STOP 1
DROP TRIGGER t1 ON transition_test;
SELECT create_hypertable('transition_test','time');
-- test creating trigger with transition tables on existing hypertable
\set ON_ERROR_STOP 0
CREATE TRIGGER t2 AFTER INSERT ON transition_test REFERENCING NEW TABLE AS new_trans FOR EACH STATEMENT EXECUTE FUNCTION test_trigger();
CREATE TRIGGER t3 AFTER UPDATE ON transition_test REFERENCING NEW TABLE AS new_trans OLD TABLE AS old_trans FOR EACH STATEMENT EXECUTE FUNCTION test_trigger();
CREATE TRIGGER t4 AFTER DELETE ON transition_test REFERENCING OLD TABLE AS old_trans FOR EACH STATEMENT EXECUTE FUNCTION test_trigger();
CREATE TRIGGER t2 AFTER INSERT ON transition_test REFERENCING NEW TABLE AS new_trans FOR EACH ROW EXECUTE FUNCTION test_trigger();
CREATE TRIGGER t3 AFTER UPDATE ON transition_test REFERENCING NEW TABLE AS new_trans OLD TABLE AS old_trans FOR EACH ROW EXECUTE FUNCTION test_trigger();
CREATE TRIGGER t4 AFTER DELETE ON transition_test REFERENCING OLD TABLE AS old_trans FOR EACH ROW EXECUTE FUNCTION test_trigger();
\set ON_ERROR_STOP 1 | the_stack |
-------------------------------------------------------------------------------
-- (c) Copyright IBM Corp. 2008 All rights reserved.
--
-- The following sample of source code ("Sample") is owned by International
-- Business Machines Corporation or one of its subsidiaries ("IBM") and is
-- copyrighted and licensed, not sold. You may use, copy, modify, and
-- distribute the Sample in any form without payment to IBM, for the purpose of
-- assisting you in the development of your applications.
--
-- The Sample code is provided to you on an "AS IS" basis, without warranty of
-- any kind. IBM HEREBY EXPRESSLY DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR
-- IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-- MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. Some jurisdictions do
-- not allow for the exclusion or limitation of implied warranties, so the above
-- limitations or exclusions may not apply to you. IBM shall not be liable for
-- any damages you suffer as a result of using, copying, modifying or
-- distributing the Sample, even if IBM has been advised of the possibility of
-- such damages.
-------------------------------------------------------------------------------
--
-- SOURCE FILE NAME: xmlpartition.db2
--
-- SAMPLE:
-- The sample demonstrates the use of XML in
-- partitioned database environment, MDC and partitioned tables.
--
-- PREREQUISITE:
-- 1)Sample database is setup on the machine.
--
-- Note: Use following command to execute the sample:
-- db2 -td@ -vf xmlpartition.db2
--
--
-- USAGE SCENARIO:
-- The Scenario is for an Book Store that has two types of customers,
-- retail customers and corporate customers. Corporate customers do
-- bulk purchases of books for their company libraries. The store has
-- a DBA for maintaining the database; the store manager runs queries
-- on different tables to view the book sales and to deliver the purchase
-- orders.
--
-- The store manger, to expand his business, opens more branches in
-- different countries.
-- The store manager complains to the DBA about the degrading
-- response time of different queries like:
-- 1) Checks for sales for a particular country every quarter.
-- 2) Checks for sales on different modes of purchase
-- (online OR offline).
-- 3) Retrieve all purchase orders that are to be delivered to the
-- customers.
--
-- In order to increase the response time of the queries and speed up
-- the process, DBA decides to partition the table 'Purchase_Orders'
-- by 'OrderDate' as range. Because of increasing sales, DBA creates
-- the tables 'Purchase_Order' and 'Customers' in database partitioned
-- environment so that data required for delivering a purchase order
-- like customer and purchase order details from 'Purchase_Orders' and
-- 'Customers' can be fetched quickly. He also organizes the table based
-- on dimensions, country and modeOfPurchase, so that details about the
-- sales for a country / mode of purchase can be fetched quickly.
-- As the year progresses, store DBA ATTACHes a partition the PurchaseOrder
-- table for every quarter to store the huge volume of data.
--
--
-- SQL STATEMENTS USED:
-- 1) CREATE TABLE with DISTRIBUTE BY HASH, PARTITION BY RANGE and
-- ORGANIZE BY DIMENSIONS clause.
-- 2) INSERT
-- 3) SELECT
-- 4) ALTER TABLE ... ATTACH
-- 5) CREATE INDEX
--
-------------------------------------------------------------------------------
-- Connect to sample database
CONNECT TO sample@
-- For the year 2008, the retail store decides to create a table which is
-- partitioned for every quarter to store the orders placed by the customer.
-- Each partition will be placed in a separate table space.
-- Four table spaces ('Tbspace1', 'Tbspace2', 'Tbspace3' and 'Tbspace4') are
-- created to contain relational data from the new 'purchaseOrder_Details' table.
-- Four table spaces ('Ltbspace1', 'Ltbspace2', 'Ltbspace3' and 'Ltbspace4') are
-- created to contain long data from the new 'purchaseOrder_Details' table.
SET SCHEMA = store@
CREATE BUFFERPOOL common_Buffer IMMEDIATE SIZE 1000 AUTOMATIC PAGESIZE 4K@
CREATE TABLESPACE Tbspace1 PAGESIZE 4K MANAGED BY DATABASE
USING (FILE 'cont1' 10000)
PREFETCHSIZE 4K BUFFERPOOL common_Buffer@
CREATE TABLESPACE Tbspace2 PAGESIZE 4K MANAGED BY DATABASE
USING (FILE 'cont2' 10000)
PREFETCHSIZE 4K BUFFERPOOL common_Buffer@
CREATE TABLESPACE Tbspace3 PAGESIZE 4K MANAGED BY DATABASE
USING (FILE 'cont3' 10000)
PREFETCHSIZE 4K BUFFERPOOL common_Buffer@
CREATE TABLESPACE Tbspace4 PAGESIZE 4K MANAGED BY DATABASE
USING (FILE 'cont4' 10000)
PREFETCHSIZE 4K BUFFERPOOL common_Buffer@
-- The purchase order information is an XML document. To store XML
-- data, a large tablespace will be used.
-- Therefore four, large table spaces are created to store XML data for these
-- partition.
CREATE TABLESPACE Ltbspace1 PAGESIZE 4K MANAGED BY DATABASE
USING (FILE 'Lcont1' 20000)
PREFETCHSIZE 4K BUFFERPOOL common_Buffer@
CREATE TABLESPACE Ltbspace2 PAGESIZE 4K MANAGED BY DATABASE
USING (FILE 'Lcont2' 20000)
PREFETCHSIZE 4K BUFFERPOOL common_Buffer@
CREATE TABLESPACE Ltbspace3 PAGESIZE 4K MANAGED BY DATABASE
USING (FILE 'Lcont3' 20000)
PREFETCHSIZE 4K BUFFERPOOL common_Buffer@
CREATE TABLESPACE Ltbspace4 PAGESIZE 4K MANAGED BY DATABASE
USING (FILE 'Lcont4' 20000)
PREFETCHSIZE 4K BUFFERPOOL common_Buffer@
-- A tablespace 'Global_IndTbspace' is created to store all
-- the index data.
CREATE TABLESPACE Global_IndTbspace MANAGED BY DATABASE
USING (FILE 'cont_globalInd' 10000)@
-- Create tables 'Customers' and 'Purchase_Orders' which stores information
-- about customers and purchase orders placed by them.
CREATE TABLE Customers (id INT NOT NULL PRIMARY KEY,
name VARCHAR(20),
country VARCHAR(20),
contactNumber VARCHAR(15),
type VARCHAR(15),
address XML)
DISTRIBUTE BY HASH (ID)@
CREATE TABLE Purchase_Orders
(id INT NOT NULL PRIMARY KEY,
status VARCHAR(10),
custID INT REFERENCES Customers(id),
orderDate DATE,
country VARCHAR(20),
modeOfPurchase VARCHAR(10),
pOrder XML,
feedback XML)
DISTRIBUTE BY HASH (ID)
PARTITION BY RANGE (orderDate)
(PART Q1 STARTING FROM '2008-01-01' ENDING '2008-03-31' IN Tbspace1 LONG IN Ltbspace1,
PART Q2 ENDING '2008-06-30' IN Tbspace2 LONG IN Ltbspace2,
PART Q3 ENDING '2008-09-30' IN Tbspace3 LONG IN Ltbspace3,
PART Q4 ENDING '2008-12-31' IN Tbspace4 LONG IN Ltbspace4 )
ORGANIZE BY DIMENSIONS (country, modeOfPurchase)@
-- Insert data into 'Customers' table
INSERT INTO Customers VALUES (1000,'Joe','Canada','9008788889','Corporate',
'<Address>
<Street>1805 Back Street</Street>
<PostalCode>EC3M 4TD</PostalCode>
<City>Toronto</City>
<Country>Canada</Country>
</Address>')@
INSERT INTO Customers VALUES (1001,'Smith','US','9876721212','Corporate',
'<Address>
<Street>498 White Street</Street>
<City>Los Angeles</City>
<Country>US</Country>
</Address>')@
INSERT INTO Customers VALUES (1002,'Bob','US','9876654789','Retail',
'<Address>
<Street>98th Main Street</Street>
<PostalCode>100027</PostalCode>
<City>Chicago</City>
<Country>US</Country>
</Address>')@
INSERT INTO Customers VALUES (1003,'Patrick','Canada','9000087634','Retail',
'<Address>
<Street>Chruch Street</Street>
<City>Charlottetown</City>
<Country>Canada</Country>
</Address>')@
INSERT INTO Customers VALUES (1004,'William','Canada','9098765432','Corporate',
'<Address>
<Street>City Main</Street>
<City>Yellowknife</City>
<Country>Canada</Country>
</Address>')@
INSERT INTO Customers VALUES (1005,'Sue','India','9980808080','Corporate',
'<Address>
<POBox>98765</POBox>
<PostalCode>100027</PostalCode>
<City>Bangalore</City>
<Country>India</Country>
</Address>')@
-- Insert data into 'Purchase_Orders' table
INSERT INTO Purchase_Orders(id, status, custID, orderDate, country, modeOfPurchase, pOrder)
VALUES (5000,'Shipped',1000,'2008-03-21','Canada','Online',
'<?xml version="1.0" encoding="UTF-8" ?>
<PurchaseOrder PoNum="5000" OrderDate="2008-03-21" Status="shipped">
<Books Category="TextBooks">
<Book>
<partid>100</partid>
<name>DB2 understanding security</name>
<quantity>3</quantity>
<price>149.97</price>
</Book>
</Books>
<Books Category="Magazines">
<Book>
<partid>1000</partid>
<name>Cars</name>
<quantity>3</quantity>
<price>14.97</price>
</Book>
</Books>
</PurchaseOrder>')@
INSERT INTO Purchase_Orders(id, status, custID, orderDate, country, modeOfPurchase, pOrder)
VALUES (5001,'Shipped',1000,'2008-03-30','Canada','Online',
'<?xml version="1.0" encoding="UTF-8" ?>
<PurchaseOrder PoNum="5001" OrderDate="2008-03-30" Status="shipped">
<Books Category="TextBooks">
<Book>
<partid>100</partid>
<name>DB2 understanding security</name>
<quantity>3</quantity>
<price>149.97</price>
</Book>
</Books>
<Books Category="Magazines">
<Book>
<partid>1001</partid>
<name>The week</name>
<quantity>3</quantity>
<price>8.97</price>
</Book>
</Books>
</PurchaseOrder>')@
INSERT INTO Purchase_Orders(id, status, custID, orderDate, country, modeOfPurchase, pOrder)
VALUES (5002,'Shipped',1000,'2008-04-21','Canada','Offline',
'<?xml version="1.0" encoding="UTF-8" ?>
<PurchaseOrder PoNum="5002" OrderDate="2008-04-21" Status="shipped">
<Books Category="TextBooks">
<Book>
<partid>100</partid>
<name>DB2 understanding security</name>
<quantity>3</quantity>
<price>149.97</price>
</Book>
<Book>
<partid>101</partid>
<name>PHP Power Programming</name>
<quantity>2</quantity>
<price>59.98</price>
</Book>
</Books>
</PurchaseOrder>')@
INSERT INTO Purchase_Orders(id, status, custID, orderDate, country, modeOfPurchase, pOrder)
VALUES (5003,'Shipped',1000,'2008-05-21','Canada','Online',
'<?xml version="1.0" encoding="UTF-8" ?>
<PurchaseOrder PoNum="5003" OrderDate="2008-05-21" Status="shipped">
<Books Category="TextBooks">
<Book>
<partid>102</partid>
<name>PHP Pear Programming</name>
<quantity>1</quantity>
<price>29.99</price>
</Book>
</Books>
<Books Category="Novels">
<Book>
<partid>2000</partid>
<name>7 habbits of success</name>
<quantity>2</quantity>
<price>29.98</price>
</Book>
</Books>
</PurchaseOrder>')@
INSERT INTO Purchase_Orders(id, status, custID, orderDate, country, modeOfPurchase, pOrder)
VALUES (5004,'Shipped',1000,'2008-05-22','Canada','Online',
'<?xml version="1.0" encoding="UTF-8" ?>
<PurchaseOrder PoNum="5004" OrderDate="2008-05-22" Status="shipped">
<Books Category="TextBooks">
<Book>
<partid>100</partid>
<name>DB2 understanding security</name>
<quantity>1</quantity>
<price>49.99</price>
</Book>
</Books>
<Books Category="Novels">
<Book>
<partid>2002</partid>
<name>Crisis</name>
<quantity>2</quantity>
<price>19.98</price>
</Book>
</Books>
</PurchaseOrder>')@
INSERT INTO Purchase_Orders(id, status, custID, orderDate, country, modeOfPurchase, pOrder)
VALUES (5005,'Shipped',1000,'2008-05-23','Canada','Offline',
'<?xml version="1.0" encoding="UTF-8" ?>
<PurchaseOrder PoNum="5005" OrderDate="2008-05-23" Status="shipped">
<Books Category="Magazines">
<Book>
<partid>1004</partid>
<name>Digit</name>
<quantity>2</quantity>
<price>9.98</price>
</Book>
</Books>
</PurchaseOrder>')@
INSERT INTO Purchase_Orders(id, status, custID, orderDate, country, modeOfPurchase, pOrder)
VALUES (5006,'Shipped',1000,'2008-05-24','Canada','Offline',
'<?xml version="1.0" encoding="UTF-8" ?>
<PurchaseOrder PoNum="5006" OrderDate="2008-05-24" Status="shipped">
<Books Category="TextBooks">
<Book>
<partid>100</partid>
<name>DB2 understanding security</name>
<quantity>3</quantity>
<price>149.97</price>
</Book>
</Books>
</PurchaseOrder>')@
INSERT INTO Purchase_Orders(id, status, custID, orderDate, country, modeOfPurchase, pOrder)
VALUES (5007,'Unshipped',1000,'2008-06-24','Canada','Online',
'<?xml version="1.0" encoding="UTF-8" ?>
<PurchaseOrder PoNum="5007" OrderDate="2008-06-24" Status="Unshipped">
<Books Category="TextBooks">
<Book>
<partid>100</partid>
<name>DB2 understanding security</name>
<quantity>3</quantity>
<price>149.97</price>
</Book>
</Books>
</PurchaseOrder>')@
INSERT INTO Purchase_Orders(id, status, custID, orderDate, country, modeOfPurchase, pOrder)
VALUES (5008,'Unshipped',1005,'2008-07-03','India','Online',
'<?xml version="1.0" encoding="UTF-8" ?>
<PurchaseOrder PoNum="5008" OrderDate="2008-07-03" Status="Unshipped">
<Books Category="TextBooks">
<Book>
<partid>100</partid>
<name>DB2 Partitioning techniques</name>
<quantity>2</quantity>
<price>59.98</price>
</Book>
</Books>
</PurchaseOrder>')@
-- Create an index on the items purchased by the customer.
-- This will help retrieve details about the purchase order faster.
-- The IN clause specifies the tablespace where the INDEX created will be placed.
-- This clause overrides the any INDEX IN clause, specified during the creation of the
-- table.
CREATE INDEX pIndex ON Purchase_Orders(pOrder)
GENERATE KEY USING XMLPATTERN '/PurchaseOrder/Books/Book/name' AS SQL VARCHAR(60) NOT PARTITIONED
IN Global_IndTbspace@
-- Statistics is collected on the table 'purchaseOrder_Details' by
-- executing RUNSTATS on it. With the new statistics obtained, DB2 uses
-- the index pIndex on the table for processing any further queries on
-- the table 'purchaseOrder_Details' which uses the predicate 'name' of
-- the XML document.
RUNSTATS ON TABLE store.Purchase_Orders FOR INDEXES ALL@
-- Select customer and purchase order details about the orders that are not shipped
SELECT p.custID, p.id, p.pOrder, c.name, c.contactNumber, c.address
FROM Purchase_Orders as p, Customers as c
WHERE c.id = p.custID and status = 'Unshipped' ORDER BY p.custID@
-- Find total online sales for canada in the second quarter
SELECT sum(X."Price") AS TotalSales
FROM
XMLTABLE ('db2-fn:xmlcolumn("PURCHASE_ORDERS.PORDER")/PurchaseOrder/Books/Book'
COLUMNS
"PoNum" BIGINT PATH './../../@PoNum',
"Price" DECFLOAT PATH './price') as X, purchase_orders as p
WHERE p.id = X."PoNum" and p.orderdate BETWEEN '2008-04-01' AND '2008-06-30'
AND country = 'Canada' AND modeOfPurchase = 'Online'@
-- Find total sales that has happened Online and Offline in the second quarter
WITH temp AS ( SELECT p.modeOfPurchase, p.orderDate, t.price
FROM Purchase_Orders AS p, XMLTABLE('$po/PurchaseOrder/Books/Book'
passing p.pOrder as "po"
COLUMNS price DECFLOAT path './price') AS t)
SELECT temp.modeOfPurchase, sum(temp.price) AS Total FROM temp
WHERE temp.orderDate BETWEEN '2008-04-01' AND '2008-06-30'
GROUP BY temp.modeOfPurchase@
-- As the year progress, store DBA adds new partition for every quarter.
ALTER TABLE Purchase_Orders ADD PARTITION part2009a
STARTING FROM '2009-01-01' ENDING '2009-03-31' INCLUSIVE IN Tbspace1 LONG IN Ltbspace1@
INSERT INTO Purchase_Orders(id, status, custID, orderDate, country, modeOfPurchase, pOrder)
VALUES (5009,'Unshipped',1005,'2009-01-03','India','Online',
'<?xml version="1.0" encoding="UTF-8" ?>
<PurchaseOrder PoNum="5009" OrderDate="2009-01-03" Status="Unshipped">
<Books Category="TextBooks">
<Book>
<partid>100</partid>
<name>DB2 Partitioning techniques</name>
<quantity>2</quantity>
<price>59.98</price>
</Book>
</Books>
</PurchaseOrder>')@
-- Select purchase orders that are not shipped for the first quarter of 2009
SELECT * FROM Purchase_Orders
where XMLEXISTS('$d/PurchaseOrder/Books/Book[name="DB2 Partitioning techniques"]' passing PORDER as "d") and status = 'Unshipped' and orderDate between '2009-01-01' and '2009-03-31'@
REORG TABLE Purchase_Orders@
REORG INDEX pIndex FOR TABLE Purchase_Orders ALLOW READ ACCESS CLEANUP ONLY@
REORG INDEXES ALL FOR TABLE Purchase_Orders ON DATA PARTITION Q1@
REORG INDEXES ALL FOR TABLE Purchase_Orders ON DATA PARTITION Q2@
REORG INDEXES ALL FOR TABLE Purchase_Orders ON DATA PARTITION Q3@
REORG INDEXES ALL FOR TABLE Purchase_Orders ON DATA PARTITION Q4@
REORG INDEXES ALL FOR TABLE Purchase_Orders ON DATA PARTITION part2009a@
-- Clean-Up Script
DROP INDEX pIndex@
DROP TABLE Purchase_Orders@
DROP TABLE Customers@
DROP TABLESPACE Tbspace1@
DROP TABLESPACE Tbspace2@
DROP TABLESPACE Tbspace3@
DROP TABLESPACE Tbspace4@
DROP TABLESPACE Ltbspace1@
DROP TABLESPACE Ltbspace2@
DROP TABLESPACE Ltbspace3@
DROP TABLESPACE Ltbspace4@
DROP TABLESPACE Global_IndTbspace@
DROP BUFFERPOOL common_Buffer@
-- Close connection to the sample database
CONNECT RESET@ | the_stack |
-- system table for various options, for now only version
create table hsdev (
option text,
value json
);
-- packages per package-db
create table package_dbs (
package_db text not null, -- global, user or path
package_name text not null,
package_version text not null
);
create index package_names_index on package_dbs (package_db, package_name);
-- same as `package_dbs`, but only latest version of package left
create view latest_packages (
package_db,
package_name,
package_version
) as
select package_db, package_name, max(package_version)
from package_dbs
group by package_db, package_name;
-- sandboxes
create table sandboxes (
type text not null, -- cabal/stack
path text not null, -- sandbox path, should include `.cabal-sandbox`/`.stack-work`
package_db_stack json -- list of package-db of sandbox
);
create unique index sandboxes_path_index on sandboxes (path);
-- source projects
create table projects (
id integer primary key autoincrement,
name text not null,
cabal text not null, -- path to `.cabal` file
version text,
build_tool text not null, -- cabal/stack
package_db_stack json -- list of package-db
);
create unique index projects_id_index on projects (id);
create unique index projects_cabal_index on projects (cabal);
-- project's library targets
create table libraries (
project_id integer not null,
modules json not null, -- list of modules
build_info_id integer not null
);
create unique index libraries_ids_index on libraries (project_id, build_info_id);
-- project's executables targets
create table executables (
project_id integer not null,
name text not null,
path text not null,
build_info_id integer not null
);
create unique index executables_ids_index on executables (project_id, build_info_id);
-- project's tests targets
create table tests (
project_id integer not null,
name text not null,
enabled integer not null,
main text,
build_info_id integer not null
);
create unique index tests_ids_index on tests (project_id, build_info_id);
-- map from project to build-info for all targets
create view targets (
project_id,
build_info_id
) as
select project_id, build_info_id from libraries
union
select project_id, build_info_id from executables
union
select project_id, build_info_id from tests;
-- target build-info
create table build_infos(
id integer primary key autoincrement,
depends json not null, -- list of dependencies
language text,
extensions json not null, -- list of extensions
ghc_options json not null, -- list of ghc-options
source_dirs json not null, -- list of source directories
other_modules json not null -- list of other modules
);
create unique index build_infos_id_index on build_infos (id);
-- project dependent packages
create view projects_deps (
cabal,
package_db,
package_name,
package_version
) as
select distinct p.cabal, ps.package_db, ps.package_name, ps.package_version
from projects as p, json_each(p.package_db_stack) as pdb_stack, build_infos as b, json_each(b.depends) as deps, targets as t, latest_packages as ps
where
(p.id == t.project_id) and
(b.id == t.build_info_id) and
(deps.value <> p.name) and
(ps.package_name == deps.value) and
(ps.package_db == pdb_stack.value);
-- packages in scope of project
-- `cabal` may be null for standalone files, in this case all 'user-db' is in scope
create view projects_modules_scope (
cabal,
module_id
) as
select pdbs.cabal, m.id
from projects_deps as pdbs, modules as m
where
(m.package_name == pdbs.package_name) and
(m.package_version == pdbs.package_version) and
m.exposed
union
select p.cabal, m.id
from projects as p, modules as m
where (m.cabal == p.cabal)
union
select null, m.id
from modules as m, latest_packages as ps
where
(m.package_name == ps.package_name) and
(m.package_version == ps.package_version) and
m.exposed and
(ps.package_db in ('user-db', 'global-db'));
-- symbols
create table symbols (
id integer primary key autoincrement,
name text not null,
module_id integer not null, -- definition module
docs text,
line integer, -- line of definition
column integer, -- column of definition
what text not null, -- kind of symbol: function, method, ...
type text, -- type of function/method/...
parent text, -- parent of selector/method/...
constructors json, -- list of constructors for selector
args json, -- list of arguments for types
context json, -- list of contexts for types
associate text, -- associates for families
pat_type text,
pat_constructor text
);
create unique index symbols_id_index on symbols (id);
create unique index symbols_index on symbols (module_id, name, what);
-- modules
create table modules (
id integer primary key autoincrement,
-- source module location
file text, -- source file
cabal text, -- related project's `.cabal`
-- installed module location
install_dirs json, -- list of paths
package_name text, -- package name of module
package_version text, -- package version
installed_name text, -- if not null, should be equal to name
exposed integer, -- is module exposed or hidden
-- some other location
other_location text, -- anything
name text,
docs text,
fixities json, -- list of fixities
tags json, -- dict of tags, value not used, tag is set if present; used by hsdev to mark if types was inferred or docs scanned
inspection_error text,
inspection_time real,
inspection_opts json -- list of flags
);
create unique index modules_id_index on modules (id);
create index modules_name_index on modules (name);
create unique index modules_file_index on modules (file) where file is not null;
create unique index modules_installed_index on modules (package_name, package_version, installed_name) where
package_name is not null and
package_version is not null and
installed_name is not null;
create unique index modules_other_locations_index on modules (other_location) where other_location is not null;
-- module import statements
create table imports (
module_id integer not null,
line integer not null, -- line number of import
column integer not null, -- column of impoty
module_name text not null, -- import module name
qualified integer not null, -- is import qualified
alias text, -- imported with `as`
hiding integer, -- is list hiding
import_list json, -- list of import specs, null if not specified
import_module_id -- `id` of imported module
);
create unique index imports_position_index on imports (module_id, line, column);
-- symbols bringed into scope by import, with qualifier
create view imported_scopes as
select i.*, q.value as qualifier, s.name as name, s.id as symbol_id
from imports as i, json_each(case when i.qualified then json_array(ifnull(i.alias, i.module_name)) else json_array(ifnull(i.alias, i.module_name), null) end) as q, symbols as s, exports as e
where
e.module_id == i.import_module_id and
e.symbol_id == s.id and
(i.import_list is null or (s.name in (select json_extract(import_list_item.value, '$.name') from json_each(i.import_list) as import_list_item) == not i.hiding));
-- module exports
create table exports (
module_id integer not null,
symbol_id integer not null
);
create index exports_module_id_index on exports (module_id);
-- source file module's symbols in scope
create table scopes (
module_id integer not null,
qualifier text,
name text not null,
symbol_id integer not null
);
create index scopes_name_index on scopes (module_id, name);
-- like `scopes`, but with column `completion` with fully qualified name
create view completions (
module_id,
completion,
qualifier,
symbol_id
) as
select id, (case when sc.qualifier is null then sc.name else sc.qualifier || '.' || sc.name end) as full_name, sc.qualifier, sc.symbol_id
from modules as m, scopes as sc
where (m.id == sc.module_id);
-- resolved names in module
create table names (
module_id integer not null,
qualifier text, -- name qualifier
name text not null, -- name
line integer not null, -- line of name
column integer not null, -- column of name
line_to integer not null, -- line of name end
column_to integer not null, -- column of name end
def_line integer, -- name definition line, for local names
def_column integer, -- name definition column, for local names
inferred_type text, -- inferred name type, set by hsdev
resolved_module text, -- resolved module name, for global and top-level names
resolved_name text, -- resolved name, for global and top-level names
resolved_what text, -- resolved symbol kind
resolve_error text,
symbol_id integer -- resolved symbol id
);
create unique index names_position_index on names (module_id, line, column, line_to, column_to);
create index names_name_index on names (module_id, name);
-- like `names`, but with definition position set for both local and global names
create view definitions (
module_id,
name,
line,
column,
line_to,
column_to,
def_module_id,
def_line,
def_column,
local
) as
select module_id, name, line, column, line_to, column_to, module_id, def_line, def_column, 1
from names
where def_line is not null and def_column is not null
union
select n.module_id, n.resolved_name, n.line, n.column, n.line_to, n.column_to, s.module_id, s.line, s.column, 0
from names as n, modules as srcm, modules as m, symbols as s
where
(n.module_id == srcm.id) and
(n.symbol_id == s.id) and
(m.name == n.resolved_module) and
(s.module_id == m.id) and
(s.name == n.resolved_name);
-- sources dependencies relations
create view sources_depends (
module_id,
module_file,
depends_id,
depends_file
) as
select m.id, m.file, im.id, im.file
from modules as im, imports as i, modules as m, projects_modules_scope as ps
where
(m.cabal is ps.cabal) and
(ps.module_id == im.id) and
(i.module_id == m.id) and
(im.name == i.module_name) and
(m.file is not null) and
(im.file is not null);
-- expressions types
create table types (
module_id integer not null,
line integer not null, -- line of expression
column integer not null, -- column of expression
line_to integer not null, -- line of expression end
column_to integer not null, -- column of expression end
expr text not null, -- expression contents
type text not null -- expression type
);
create unique index types_position_index on types (module_id, line, column, line_to, column_to);
-- modified file contents, hsdev will use it in commands whenever it is newer than file
create table file_contents (
file text not null, -- file path
contents text not null, -- file contents
mtime real not null -- posix modification time
);
create unique index file_contents_index on file_contents (file);
-- table with last time of loading module
create table load_times (
module_id integer not null, -- module affected
load_time real not null -- timestamp
);
create unique index load_times_module_id_index on load_times (module_id);
-- table with ghc warnings on file
-- sequential call to load module won't actually reload file and won't produce warnings
-- but we want to see them again
create table messages (
module_id integer not null,
line integer not null,
column integer not null,
line_to integer not null,
column_to integer not null,
severity text,
message text not null,
suggestion text
);
create index messages_module_id_index on messages (module_id); | the_stack |
-- 2019-03-19T16:22:31.638
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Element_Trl SET Name='Unterregister', PrintName='Unterregister',Updated=TO_TIMESTAMP('2019-03-19 16:22:31','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=576037 AND AD_Language='de_CH'
;
-- 2019-03-19T16:22:31.677
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
/* DDL */ select update_TRL_Tables_On_AD_Element_TRL_Update(576037,'de_CH')
;
-- 2019-03-19T16:22:35.474
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Element_Trl SET Name='Unterregister', PrintName='Unterregister',Updated=TO_TIMESTAMP('2019-03-19 16:22:35','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=576037 AND AD_Language='de_DE'
;
-- 2019-03-19T16:22:35.477
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
/* DDL */ select update_TRL_Tables_On_AD_Element_TRL_Update(576037,'de_DE')
;
-- 2019-03-19T16:22:35.487
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
/* DDL */ select update_ad_element_on_ad_element_trl_update(576037,'de_DE')
;
-- 2019-03-19T16:22:35.493
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Column SET ColumnName='DataEntry_SubGroup_ID', Name='Unterregister', Description=NULL, Help=NULL WHERE AD_Element_ID=576037
;
-- 2019-03-19T16:22:35.495
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Process_Para SET ColumnName='DataEntry_SubGroup_ID', Name='Unterregister', Description=NULL, Help=NULL, AD_Element_ID=576037 WHERE UPPER(ColumnName)='DATAENTRY_SUBGROUP_ID' AND IsCentrallyMaintained='Y' AND AD_Element_ID IS NULL
;
-- 2019-03-19T16:22:35.498
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Process_Para SET ColumnName='DataEntry_SubGroup_ID', Name='Unterregister', Description=NULL, Help=NULL WHERE AD_Element_ID=576037 AND IsCentrallyMaintained='Y'
;
-- 2019-03-19T16:22:35.500
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Field SET Name='Unterregister', Description=NULL, Help=NULL WHERE (AD_Column_ID IN (SELECT AD_Column_ID FROM AD_Column WHERE AD_Element_ID=576037) AND AD_Name_ID IS NULL ) OR (AD_Name_ID = 576037)
;
-- 2019-03-19T16:22:35.511
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_PrintFormatItem pi SET PrintName='Unterregister', Name='Unterregister' WHERE IsCentrallyMaintained='Y' AND EXISTS (SELECT * FROM AD_Column c WHERE c.AD_Column_ID=pi.AD_Column_ID AND c.AD_Element_ID=576037)
;
-- 2019-03-19T16:22:35.514
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Tab SET Name='Unterregister', Description=NULL, Help=NULL, CommitWarning = NULL WHERE AD_Element_ID = 576037
;
-- 2019-03-19T16:22:35.516
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_WINDOW SET Name='Unterregister', Description=NULL, Help=NULL WHERE AD_Element_ID = 576037
;
-- 2019-03-19T16:22:35.518
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Menu SET Name = 'Unterregister', Description = NULL, WEBUI_NameBrowse = NULL, WEBUI_NameNew = NULL, WEBUI_NameNewBreadcrumb = NULL WHERE AD_Element_ID = 576037
;
-- 2019-03-19T16:22:42.015
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Element_Trl SET Name='Subtab', PrintName='Subtab',Updated=TO_TIMESTAMP('2019-03-19 16:22:42','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=576037 AND AD_Language='en_US'
;
-- 2019-03-19T16:22:42.016
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
/* DDL */ select update_TRL_Tables_On_AD_Element_TRL_Update(576037,'en_US')
;
-- 2019-03-19T16:22:51.875
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Element_Trl SET Name='Subtab', PrintName='Subtab',Updated=TO_TIMESTAMP('2019-03-19 16:22:51','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=576037 AND AD_Language='nl_NL'
;
-- 2019-03-19T16:22:51.876
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
/* DDL */ select update_TRL_Tables_On_AD_Element_TRL_Update(576037,'nl_NL')
;
-- 2019-03-19T16:23:09.419
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Element_Trl SET Name='Register', PrintName='Register',Updated=TO_TIMESTAMP('2019-03-19 16:23:09','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=576047 AND AD_Language='de_CH'
;
-- 2019-03-19T16:23:09.422
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
/* DDL */ select update_TRL_Tables_On_AD_Element_TRL_Update(576047,'de_CH')
;
-- 2019-03-19T16:23:13.907
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Element_Trl SET Name='Register', PrintName='Register',Updated=TO_TIMESTAMP('2019-03-19 16:23:13','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=576047 AND AD_Language='de_DE'
;
-- 2019-03-19T16:23:13.908
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
/* DDL */ select update_TRL_Tables_On_AD_Element_TRL_Update(576047,'de_DE')
;
-- 2019-03-19T16:23:13.914
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
/* DDL */ select update_ad_element_on_ad_element_trl_update(576047,'de_DE')
;
-- 2019-03-19T16:23:13.916
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Column SET ColumnName=NULL, Name='Register', Description=NULL, Help=NULL WHERE AD_Element_ID=576047
;
-- 2019-03-19T16:23:13.918
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Process_Para SET ColumnName=NULL, Name='Register', Description=NULL, Help=NULL WHERE AD_Element_ID=576047 AND IsCentrallyMaintained='Y'
;
-- 2019-03-19T16:23:13.919
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Field SET Name='Register', Description=NULL, Help=NULL WHERE (AD_Column_ID IN (SELECT AD_Column_ID FROM AD_Column WHERE AD_Element_ID=576047) AND AD_Name_ID IS NULL ) OR (AD_Name_ID = 576047)
;
-- 2019-03-19T16:23:13.927
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_PrintFormatItem pi SET PrintName='Register', Name='Register' WHERE IsCentrallyMaintained='Y' AND EXISTS (SELECT * FROM AD_Column c WHERE c.AD_Column_ID=pi.AD_Column_ID AND c.AD_Element_ID=576047)
;
-- 2019-03-19T16:23:13.929
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Tab SET Name='Register', Description=NULL, Help=NULL, CommitWarning = NULL WHERE AD_Element_ID = 576047
;
-- 2019-03-19T16:23:13.931
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_WINDOW SET Name='Register', Description=NULL, Help=NULL WHERE AD_Element_ID = 576047
;
-- 2019-03-19T16:23:13.933
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Menu SET Name = 'Register', Description = NULL, WEBUI_NameBrowse = NULL, WEBUI_NameNew = NULL, WEBUI_NameNewBreadcrumb = NULL WHERE AD_Element_ID = 576047
;
-- 2019-03-19T16:23:21.480
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Element_Trl SET Name='Tab', PrintName='Tab',Updated=TO_TIMESTAMP('2019-03-19 16:23:21','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=576047 AND AD_Language='en_US'
;
-- 2019-03-19T16:23:21.482
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
/* DDL */ select update_TRL_Tables_On_AD_Element_TRL_Update(576047,'en_US')
;
-- 2019-03-19T16:23:27.727
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Element_Trl SET Name='Tab', PrintName='Tab',Updated=TO_TIMESTAMP('2019-03-19 16:23:27','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=576047 AND AD_Language='nl_NL'
;
-- 2019-03-19T16:23:27.730
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
/* DDL */ select update_TRL_Tables_On_AD_Element_TRL_Update(576047,'nl_NL')
;
-- 2019-03-19T16:24:28.521
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Element_Trl SET Name='Feldgruppe', PrintName='Feldgruppe',Updated=TO_TIMESTAMP('2019-03-19 16:24:28','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=576136 AND AD_Language='de_CH'
;
-- 2019-03-19T16:24:28.523
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
/* DDL */ select update_TRL_Tables_On_AD_Element_TRL_Update(576136,'de_CH')
;
-- 2019-03-19T16:24:42.264
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Element_Trl SET Description='Gruppierung/Sektion von Feldern innerhalb des selben Unterregisters', Name='Feldgruppe', PrintName='Feldgruppe',Updated=TO_TIMESTAMP('2019-03-19 16:24:42','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=576136 AND AD_Language='de_DE'
;
-- 2019-03-19T16:24:42.265
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
/* DDL */ select update_TRL_Tables_On_AD_Element_TRL_Update(576136,'de_DE')
;
-- 2019-03-19T16:24:42.271
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
/* DDL */ select update_ad_element_on_ad_element_trl_update(576136,'de_DE')
;
-- 2019-03-19T16:24:42.274
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Column SET ColumnName=NULL, Name='Feldgruppe', Description='Gruppierung/Sektion von Feldern innerhalb des selben Unterregisters', Help=NULL WHERE AD_Element_ID=576136
;
-- 2019-03-19T16:24:42.275
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Process_Para SET ColumnName=NULL, Name='Feldgruppe', Description='Gruppierung/Sektion von Feldern innerhalb des selben Unterregisters', Help=NULL WHERE AD_Element_ID=576136 AND IsCentrallyMaintained='Y'
;
-- 2019-03-19T16:24:42.276
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Field SET Name='Feldgruppe', Description='Gruppierung/Sektion von Feldern innerhalb des selben Unterregisters', Help=NULL WHERE (AD_Column_ID IN (SELECT AD_Column_ID FROM AD_Column WHERE AD_Element_ID=576136) AND AD_Name_ID IS NULL ) OR (AD_Name_ID = 576136)
;
-- 2019-03-19T16:24:42.284
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_PrintFormatItem pi SET PrintName='Feldgruppe', Name='Feldgruppe' WHERE IsCentrallyMaintained='Y' AND EXISTS (SELECT * FROM AD_Column c WHERE c.AD_Column_ID=pi.AD_Column_ID AND c.AD_Element_ID=576136)
;
-- 2019-03-19T16:24:42.286
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Tab SET Name='Feldgruppe', Description='Gruppierung/Sektion von Feldern innerhalb des selben Unterregisters', Help=NULL, CommitWarning = NULL WHERE AD_Element_ID = 576136
;
-- 2019-03-19T16:24:42.287
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_WINDOW SET Name='Feldgruppe', Description='Gruppierung/Sektion von Feldern innerhalb des selben Unterregisters', Help=NULL WHERE AD_Element_ID = 576136
;
-- 2019-03-19T16:24:42.289
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Menu SET Name = 'Feldgruppe', Description = 'Gruppierung/Sektion von Feldern innerhalb des selben Unterregisters', WEBUI_NameBrowse = NULL, WEBUI_NameNew = NULL, WEBUI_NameNewBreadcrumb = NULL WHERE AD_Element_ID = 576136
;
-- 2019-03-19T16:24:44.856
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Element_Trl SET Description='Gruppierung/Sektion von Feldern innerhalb des selben Unterregisters',Updated=TO_TIMESTAMP('2019-03-19 16:24:44','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=576136 AND AD_Language='de_CH'
;
-- 2019-03-19T16:24:44.858
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
/* DDL */ select update_TRL_Tables_On_AD_Element_TRL_Update(576136,'de_CH')
;
-- 2019-03-19T16:25:10.220
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Element_Trl SET Description='Grouping/section of fields within the same subtab', Name='Field group', PrintName='Field group',Updated=TO_TIMESTAMP('2019-03-19 16:25:10','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=576136 AND AD_Language='en_US'
;
-- 2019-03-19T16:25:10.222
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
/* DDL */ select update_TRL_Tables_On_AD_Element_TRL_Update(576136,'en_US')
;
----
-- 2019-03-20T12:16:57.753
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Element_Trl SET Name='Erweiterte Dateneingabe - Register', PrintName='Erweiterte Dateneingabe - Register',Updated=TO_TIMESTAMP('2019-03-20 12:16:57','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=576046 AND AD_Language='de_CH'
;
-- 2019-03-20T12:16:57.797
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
/* DDL */ select update_TRL_Tables_On_AD_Element_TRL_Update(576046,'de_CH')
;
-- 2019-03-20T12:17:02.686
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Element_Trl SET Name='Erweiterte Dateneingabe - Register', PrintName='Erweiterte Dateneingabe - Register',Updated=TO_TIMESTAMP('2019-03-20 12:17:02','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=576046 AND AD_Language='de_DE'
;
-- 2019-03-20T12:17:02.691
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
/* DDL */ select update_TRL_Tables_On_AD_Element_TRL_Update(576046,'de_DE')
;
-- 2019-03-20T12:17:02.701
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
/* DDL */ select update_ad_element_on_ad_element_trl_update(576046,'de_DE')
;
-- 2019-03-20T12:17:02.704
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Column SET ColumnName=NULL, Name='Erweiterte Dateneingabe - Register', Description=NULL, Help=NULL WHERE AD_Element_ID=576046
;
-- 2019-03-20T12:17:02.705
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Process_Para SET ColumnName=NULL, Name='Erweiterte Dateneingabe - Register', Description=NULL, Help=NULL WHERE AD_Element_ID=576046 AND IsCentrallyMaintained='Y'
;
-- 2019-03-20T12:17:02.707
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Field SET Name='Erweiterte Dateneingabe - Register', Description=NULL, Help=NULL WHERE (AD_Column_ID IN (SELECT AD_Column_ID FROM AD_Column WHERE AD_Element_ID=576046) AND AD_Name_ID IS NULL ) OR (AD_Name_ID = 576046)
;
-- 2019-03-20T12:17:02.718
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_PrintFormatItem pi SET PrintName='Erweiterte Dateneingabe - Register', Name='Erweiterte Dateneingabe - Register' WHERE IsCentrallyMaintained='Y' AND EXISTS (SELECT * FROM AD_Column c WHERE c.AD_Column_ID=pi.AD_Column_ID AND c.AD_Element_ID=576046)
;
-- 2019-03-20T12:17:02.721
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Tab SET Name='Erweiterte Dateneingabe - Register', Description=NULL, Help=NULL, CommitWarning = NULL WHERE AD_Element_ID = 576046
;
-- 2019-03-20T12:17:02.723
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_WINDOW SET Name='Erweiterte Dateneingabe - Register', Description=NULL, Help=NULL WHERE AD_Element_ID = 576046
;
-- 2019-03-20T12:17:02.727
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Menu SET Name = 'Erweiterte Dateneingabe - Register', Description = NULL, WEBUI_NameBrowse = NULL, WEBUI_NameNew = NULL, WEBUI_NameNewBreadcrumb = NULL WHERE AD_Element_ID = 576046
;
-- 2019-03-20T12:17:10.114
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Element_Trl SET Name='Custom data entry - tab', PrintName='Custom data entry - tab',Updated=TO_TIMESTAMP('2019-03-20 12:17:10','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=576046 AND AD_Language='en_US'
;
-- 2019-03-20T12:17:10.116
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
/* DDL */ select update_TRL_Tables_On_AD_Element_TRL_Update(576046,'en_US')
;
-- 2019-03-20T12:34:14.210
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Element_Trl SET Name='Descriptionn',Updated=TO_TIMESTAMP('2019-03-20 12:34:14','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=275 AND AD_Language='en_US'
;
-- 2019-03-20T12:34:14.215
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
/* DDL */ select update_TRL_Tables_On_AD_Element_TRL_Update(275,'en_US')
;
-- 2019-03-20T12:34:28.479
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Element_Trl SET Name='Description',Updated=TO_TIMESTAMP('2019-03-20 12:34:28','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=275 AND AD_Language='en_US'
;
-- 2019-03-20T12:34:28.481
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
/* DDL */ select update_TRL_Tables_On_AD_Element_TRL_Update(275,'en_US')
; | the_stack |
-- Copyright (C) from 2009 to Present EPAM Systems.
--
-- This file is part of Indigo toolkit.
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
set verify off
spool mango_package;
CREATE OR REPLACE PACKAGE MangoPackage IS
function Sub (target in VARCHAR2, query in VARCHAR2, indexctx IN sys.ODCIIndexCtx,
scanctx in out MangoIndex, scanflg IN NUMBER) return NUMBER;
function Sub (target in VARCHAR2, query in VARCHAR2, params in VARCHAR2, indexctx IN sys.ODCIIndexCtx,
scanctx in out MangoIndex, scanflg IN NUMBER) return NUMBER;
function Sub (target in VARCHAR2, query in CLOB, indexctx IN sys.ODCIIndexCtx,
scanctx in out MangoIndex, scanflg IN NUMBER) return NUMBER;
function Sub (target in VARCHAR2, query in CLOB, params in VARCHAR2, indexctx IN sys.ODCIIndexCtx,
scanctx in out MangoIndex, scanflg IN NUMBER) return NUMBER;
function Sub (target in CLOB, query in VARCHAR2, indexctx IN sys.ODCIIndexCtx,
scanctx in out MangoIndex, scanflg IN NUMBER) return NUMBER;
function Sub (target in CLOB, query in VARCHAR2, params in VARCHAR2, indexctx IN sys.ODCIIndexCtx,
scanctx in out MangoIndex, scanflg IN NUMBER) return NUMBER;
function Sub (target in CLOB, query in CLOB, indexctx IN sys.ODCIIndexCtx,
scanctx in out MangoIndex, scanflg IN NUMBER) return NUMBER;
function Sub (target in CLOB, query in CLOB, params in VARCHAR2, indexctx IN sys.ODCIIndexCtx,
scanctx in out MangoIndex, scanflg IN NUMBER) return NUMBER;
function Sub (target in BLOB, query in VARCHAR2, indexctx IN sys.ODCIIndexCtx,
scanctx in out MangoIndex, scanflg IN NUMBER) return NUMBER;
function Sub (target in BLOB, query in VARCHAR2, params in VARCHAR2, indexctx IN sys.ODCIIndexCtx,
scanctx in out MangoIndex, scanflg IN NUMBER) return NUMBER;
function Sub (target in BLOB, query in CLOB, indexctx IN sys.ODCIIndexCtx,
scanctx in out MangoIndex, scanflg IN NUMBER) return NUMBER;
function Sub (target in BLOB, query in CLOB, params in VARCHAR2, indexctx IN sys.ODCIIndexCtx,
scanctx in out MangoIndex, scanflg IN NUMBER) return NUMBER;
function SubHi (target in VARCHAR2, query in VARCHAR2, indexctx IN sys.ODCIIndexCtx,
scanctx in out MangoIndex, scanflg IN NUMBER) return CLOB;
function SubHi (target in VARCHAR2, query in VARCHAR2, params in VARCHAR2, indexctx IN sys.ODCIIndexCtx,
scanctx in out MangoIndex, scanflg IN NUMBER) return CLOB;
function SubHi (target in VARCHAR2, query in CLOB, indexctx IN sys.ODCIIndexCtx,
scanctx in out MangoIndex, scanflg IN NUMBER) return CLOB;
function SubHi (target in VARCHAR2, query in CLOB, params in VARCHAR2, indexctx IN sys.ODCIIndexCtx,
scanctx in out MangoIndex, scanflg IN NUMBER) return CLOB;
function SubHi (target in CLOB, query in VARCHAR2, indexctx IN sys.ODCIIndexCtx,
scanctx in out MangoIndex, scanflg IN NUMBER) return CLOB;
function SubHi (target in CLOB, query in VARCHAR2, params in VARCHAR2, indexctx IN sys.ODCIIndexCtx,
scanctx in out MangoIndex, scanflg IN NUMBER) return CLOB;
function SubHi (target in CLOB, query in CLOB, indexctx IN sys.ODCIIndexCtx,
scanctx in out MangoIndex, scanflg IN NUMBER) return CLOB;
function SubHi (target in CLOB, query in CLOB, params in VARCHAR2, indexctx IN sys.ODCIIndexCtx,
scanctx in out MangoIndex, scanflg IN NUMBER) return CLOB;
function SubHi (target in BLOB, query in VARCHAR2, indexctx IN sys.ODCIIndexCtx,
scanctx in out MangoIndex, scanflg IN NUMBER) return CLOB;
function SubHi (target in BLOB, query in VARCHAR2, params in VARCHAR2, indexctx IN sys.ODCIIndexCtx,
scanctx in out MangoIndex, scanflg IN NUMBER) return CLOB;
function SubHi (target in BLOB, query in CLOB, indexctx IN sys.ODCIIndexCtx,
scanctx in out MangoIndex, scanflg IN NUMBER) return CLOB;
function SubHi (target in BLOB, query in CLOB, params in VARCHAR2, indexctx IN sys.ODCIIndexCtx,
scanctx in out MangoIndex, scanflg IN NUMBER) return CLOB;
function Smarts (target in VARCHAR2, query in VARCHAR2, indexctx IN sys.ODCIIndexCtx,
scanctx in out MangoIndex, scanflg IN NUMBER) return NUMBER;
function Smarts (target in CLOB, query in VARCHAR2, indexctx IN sys.ODCIIndexCtx,
scanctx in out MangoIndex, scanflg IN NUMBER) return NUMBER;
function Smarts (target in BLOB, query in VARCHAR2, indexctx IN sys.ODCIIndexCtx,
scanctx in out MangoIndex, scanflg IN NUMBER) return NUMBER;
function SmartsHi (target in VARCHAR2, query in VARCHAR2, indexctx IN sys.ODCIIndexCtx,
scanctx in out MangoIndex, scanflg IN NUMBER) return CLOB;
function SmartsHi (target in CLOB, query in VARCHAR2, indexctx IN sys.ODCIIndexCtx,
scanctx in out MangoIndex, scanflg IN NUMBER) return CLOB;
function SmartsHi (target in BLOB, query in VARCHAR2, indexctx IN sys.ODCIIndexCtx,
scanctx in out MangoIndex, scanflg IN NUMBER) return CLOB;
function Exact (target in VARCHAR2, query in VARCHAR2, indexctx IN sys.ODCIIndexCtx,
scanctx in out MangoIndex, scanflg IN NUMBER) return NUMBER;
function Exact (target in VARCHAR2, query in VARCHAR2, params in VARCHAR2, indexctx IN sys.ODCIIndexCtx,
scanctx in out MangoIndex, scanflg IN NUMBER) return NUMBER;
function Exact (target in VARCHAR2, query in CLOB, indexctx IN sys.ODCIIndexCtx,
scanctx in out MangoIndex, scanflg IN NUMBER) return NUMBER;
function Exact (target in VARCHAR2, query in CLOB, params in VARCHAR2, indexctx IN sys.ODCIIndexCtx,
scanctx in out MangoIndex, scanflg IN NUMBER) return NUMBER;
function Exact (target in CLOB, query in VARCHAR2, indexctx IN sys.ODCIIndexCtx,
scanctx in out MangoIndex, scanflg IN NUMBER) return NUMBER;
function Exact (target in CLOB, query in VARCHAR2, params in VARCHAR2, indexctx IN sys.ODCIIndexCtx,
scanctx in out MangoIndex, scanflg IN NUMBER) return NUMBER;
function Exact (target in CLOB, query in CLOB, indexctx IN sys.ODCIIndexCtx,
scanctx in out MangoIndex, scanflg IN NUMBER) return NUMBER;
function Exact (target in CLOB, query in CLOB, params in VARCHAR2, indexctx IN sys.ODCIIndexCtx,
scanctx in out MangoIndex, scanflg IN NUMBER) return NUMBER;
function Exact (target in BLOB, query in VARCHAR2, indexctx IN sys.ODCIIndexCtx,
scanctx in out MangoIndex, scanflg IN NUMBER) return NUMBER;
function Exact (target in BLOB, query in VARCHAR2, params in VARCHAR2, indexctx IN sys.ODCIIndexCtx,
scanctx in out MangoIndex, scanflg IN NUMBER) return NUMBER;
function Exact (target in BLOB, query in CLOB, indexctx IN sys.ODCIIndexCtx,
scanctx in out MangoIndex, scanflg IN NUMBER) return NUMBER;
function Exact (target in BLOB, query in CLOB, params in VARCHAR2, indexctx IN sys.ODCIIndexCtx,
scanctx in out MangoIndex, scanflg IN NUMBER) return NUMBER;
function ExactHi (target in VARCHAR2, query in VARCHAR2, indexctx IN sys.ODCIIndexCtx,
scanctx in out MangoIndex, scanflg IN NUMBER) return CLOB;
function ExactHi (target in VARCHAR2, query in VARCHAR2, params in VARCHAR2, indexctx IN sys.ODCIIndexCtx,
scanctx in out MangoIndex, scanflg IN NUMBER) return CLOB;
function ExactHi (target in VARCHAR2, query in CLOB, indexctx IN sys.ODCIIndexCtx,
scanctx in out MangoIndex, scanflg IN NUMBER) return CLOB;
function ExactHi (target in VARCHAR2, query in CLOB, params in VARCHAR2, indexctx IN sys.ODCIIndexCtx,
scanctx in out MangoIndex, scanflg IN NUMBER) return CLOB;
function ExactHi (target in CLOB, query in VARCHAR2, indexctx IN sys.ODCIIndexCtx,
scanctx in out MangoIndex, scanflg IN NUMBER) return CLOB;
function ExactHi (target in CLOB, query in VARCHAR2, params in VARCHAR2, indexctx IN sys.ODCIIndexCtx,
scanctx in out MangoIndex, scanflg IN NUMBER) return CLOB;
function ExactHi (target in CLOB, query in CLOB, indexctx IN sys.ODCIIndexCtx,
scanctx in out MangoIndex, scanflg IN NUMBER) return CLOB;
function ExactHi (target in CLOB, query in CLOB, params in VARCHAR2, indexctx IN sys.ODCIIndexCtx,
scanctx in out MangoIndex, scanflg IN NUMBER) return CLOB;
function ExactHi (target in BLOB, query in VARCHAR2, indexctx IN sys.ODCIIndexCtx,
scanctx in out MangoIndex, scanflg IN NUMBER) return CLOB;
function ExactHi (target in BLOB, query in VARCHAR2, params in VARCHAR2, indexctx IN sys.ODCIIndexCtx,
scanctx in out MangoIndex, scanflg IN NUMBER) return CLOB;
function ExactHi (target in BLOB, query in CLOB, indexctx IN sys.ODCIIndexCtx,
scanctx in out MangoIndex, scanflg IN NUMBER) return CLOB;
function ExactHi (target in BLOB, query in CLOB, params in VARCHAR2, indexctx IN sys.ODCIIndexCtx,
scanctx in out MangoIndex, scanflg IN NUMBER) return CLOB;
function Sim (target in VARCHAR2, query in CLOB, indexctx IN sys.ODCIIndexCtx,
scanctx in out MangoIndex, scanflg IN NUMBER) return NUMBER;
function Sim (target in VARCHAR2, query in CLOB, params in VARCHAR2, indexctx IN sys.ODCIIndexCtx,
scanctx in out MangoIndex, scanflg IN NUMBER) return NUMBER;
function Sim (target in VARCHAR2, query in VARCHAR2, indexctx IN sys.ODCIIndexCtx,
scanctx in out MangoIndex, scanflg IN NUMBER) return NUMBER;
function Sim (target in VARCHAR2, query in VARCHAR2, params in VARCHAR2, indexctx IN sys.ODCIIndexCtx,
scanctx in out MangoIndex, scanflg IN NUMBER) return NUMBER;
function Sim (target in CLOB, query in CLOB, indexctx IN sys.ODCIIndexCtx,
scanctx in out MangoIndex, scanflg IN NUMBER) return NUMBER;
function Sim (target in CLOB, query in CLOB, params in VARCHAR2, indexctx IN sys.ODCIIndexCtx,
scanctx in out MangoIndex, scanflg IN NUMBER) return NUMBER;
function Sim (target in CLOB, query in VARCHAR2, indexctx IN sys.ODCIIndexCtx,
scanctx in out MangoIndex, scanflg IN NUMBER) return NUMBER;
function Sim (target in CLOB, query in VARCHAR2, params in VARCHAR2, indexctx IN sys.ODCIIndexCtx,
scanctx in out MangoIndex, scanflg IN NUMBER) return NUMBER;
function Sim (target in BLOB, query in CLOB, indexctx IN sys.ODCIIndexCtx,
scanctx in out MangoIndex, scanflg IN NUMBER) return NUMBER;
function Sim (target in BLOB, query in CLOB, params in VARCHAR2, indexctx IN sys.ODCIIndexCtx,
scanctx in out MangoIndex, scanflg IN NUMBER) return NUMBER;
function Sim (target in BLOB, query in VARCHAR2, indexctx IN sys.ODCIIndexCtx,
scanctx in out MangoIndex, scanflg IN NUMBER) return NUMBER;
function Sim (target in BLOB, query in VARCHAR2, params in VARCHAR2, indexctx IN sys.ODCIIndexCtx,
scanctx in out MangoIndex, scanflg IN NUMBER) return NUMBER;
function GrossCalc (target in VARCHAR2) return VARCHAR2;
function GrossCalc (target in CLOB) return VARCHAR2;
function GrossCalc (target in BLOB) return VARCHAR2;
function Gross (target in VARCHAR2, query in VARCHAR2, indexctx IN sys.ODCIIndexCtx,
scanctx in out MangoIndex, scanflg IN NUMBER) return NUMBER;
function Gross (target in CLOB, query in VARCHAR2, indexctx IN sys.ODCIIndexCtx,
scanctx in out MangoIndex, scanflg IN NUMBER) return NUMBER;
function Gross (target in BLOB, query in VARCHAR2, indexctx IN sys.ODCIIndexCtx,
scanctx in out MangoIndex, scanflg IN NUMBER) return NUMBER;
function Mass (target in VARCHAR2, indexctx IN sys.ODCIIndexCtx,
scanctx in out MangoIndex, scanflg IN NUMBER) return NUMBER;
function Mass (target in CLOB, indexctx IN sys.ODCIIndexCtx,
scanctx in out MangoIndex, scanflg IN NUMBER) return NUMBER;
function Mass (target in BLOB, indexctx IN sys.ODCIIndexCtx,
scanctx in out MangoIndex, scanflg IN NUMBER) return NUMBER;
function Mass (target in VARCHAR2, typee in VARCHAR2) return NUMBER;
function Mass (target in CLOB, typee in VARCHAR2) return NUMBER;
function Mass (target in BLOB, typee in VARCHAR2) return NUMBER;
function Molfile (target in VARCHAR2) return CLOB;
function Molfile (target in CLOB) return CLOB;
function Molfile (target in BLOB) return CLOB;
function Molfile (target in VARCHAR2, options in VARCHAR2) return CLOB;
function Molfile (target in CLOB, options in VARCHAR2) return CLOB;
function Molfile (target in BLOB, options in VARCHAR2) return CLOB;
function CML (target in VARCHAR2) return CLOB;
function CML (target in CLOB) return CLOB;
function CML (target in BLOB) return CLOB;
function SMILES (target in VARCHAR2) return VARCHAR2;
function SMILES (target in CLOB) return VARCHAR2;
function SMILES (target in BLOB) return VARCHAR2;
function SMILES (target in VARCHAR2, options in VARCHAR2) return VARCHAR2;
function SMILES (target in CLOB, options in VARCHAR2) return VARCHAR2;
function SMILES (target in BLOB, options in VARCHAR2) return VARCHAR2;
function CANSMILES (target in VARCHAR2) return VARCHAR2;
function CANSMILES (target in CLOB) return VARCHAR2;
function CANSMILES (target in BLOB) return VARCHAR2;
function InChI (target in VARCHAR2, options in VARCHAR2) return CLOB;
function InChI (target in CLOB, options in VARCHAR2) return CLOB;
function InChI (target in BLOB, options in VARCHAR2) return CLOB;
function InChIKey (inchi in VARCHAR2) return VARCHAR2;
function InChIKey (inchi in CLOB) return VARCHAR2;
function Fingerprint (target in VARCHAR2, options in VARCHAR2) return BLOB;
function Fingerprint (target in CLOB, options in VARCHAR2) return BLOB;
function Fingerprint (target in BLOB, options in VARCHAR2) return BLOB;
END MangoPackage;
/
CREATE OR REPLACE PACKAGE BODY MangoPackage IS
function Sub (target in VARCHAR2, query in VARCHAR2, indexctx IN sys.ODCIIndexCtx,
scanctx in out MangoIndex, scanflg IN NUMBER) return NUMBER IS
begin
return Sub(to_clob(target), to_clob(query), null, indexctx, scanctx, scanflg);
end Sub;
function Sub (target in VARCHAR2, query in VARCHAR2, params in VARCHAR2, indexctx IN sys.ODCIIndexCtx,
scanctx in out MangoIndex, scanflg IN NUMBER) return NUMBER IS
begin
return Sub(to_clob(target), to_clob(query), params, indexctx, scanctx, scanflg);
end Sub;
function Sub (target in VARCHAR2, query in CLOB, indexctx IN sys.ODCIIndexCtx,
scanctx in out MangoIndex, scanflg IN NUMBER) return NUMBER IS
begin
return Sub(to_clob(target), query, null, indexctx, scanctx, scanflg);
end Sub;
function Sub (target in VARCHAR2, query in CLOB, params in VARCHAR2, indexctx IN sys.ODCIIndexCtx,
scanctx in out MangoIndex, scanflg IN NUMBER) return NUMBER IS
begin
return Sub(to_clob(target), query, params, indexctx, scanctx, scanflg);
end Sub;
function Sub (target in CLOB, query in VARCHAR2, indexctx IN sys.ODCIIndexCtx,
scanctx in out MangoIndex, scanflg IN NUMBER) return NUMBER IS
begin
return Sub(target, to_clob(query), null, indexctx, scanctx, scanflg);
end Sub;
function Sub (target in CLOB, query in VARCHAR2, params in VARCHAR2, indexctx IN sys.ODCIIndexCtx,
scanctx in out MangoIndex, scanflg IN NUMBER) return NUMBER IS
begin
return Sub(target, to_clob(query), params, indexctx, scanctx, scanflg);
end Sub;
function Sub (target in CLOB, query in CLOB, indexctx IN sys.ODCIIndexCtx,
scanctx in out MangoIndex, scanflg IN NUMBER) return NUMBER IS
begin
return Sub(target, query, null, indexctx, scanctx, scanflg);
end Sub;
function Sub (target in CLOB, query in CLOB, params in VARCHAR2, indexctx IN sys.ODCIIndexCtx,
scanctx in out MangoIndex, scanflg IN NUMBER) return NUMBER IS
context_id binary_integer := 0;
begin
if indexctx.IndexInfo is not null then
context_id := BingoPackage.getContextID(indexctx.IndexInfo);
end if;
return Sub_clob(context_id, target, query, params);
end Sub;
function Sub (target in BLOB, query in VARCHAR2, indexctx IN sys.ODCIIndexCtx,
scanctx in out MangoIndex, scanflg IN NUMBER) return NUMBER IS
begin
return Sub(target, to_clob(query), null, indexctx, scanctx, scanflg);
end Sub;
function Sub (target in BLOB, query in VARCHAR2, params in VARCHAR2, indexctx IN sys.ODCIIndexCtx,
scanctx in out MangoIndex, scanflg IN NUMBER) return NUMBER IS
begin
return Sub(target, to_clob(query), params, indexctx, scanctx, scanflg);
end Sub;
function Sub (target in BLOB, query in CLOB, indexctx IN sys.ODCIIndexCtx,
scanctx in out MangoIndex, scanflg IN NUMBER) return NUMBER IS
begin
return Sub(target, query, null, indexctx, scanctx, scanflg);
end Sub;
function Sub (target in BLOB, query in CLOB, params in VARCHAR2, indexctx IN sys.ODCIIndexCtx,
scanctx in out MangoIndex, scanflg IN NUMBER) return NUMBER IS
context_id binary_integer := 0;
begin
if indexctx.IndexInfo is not null then
context_id := BingoPackage.getContextID(indexctx.IndexInfo);
end if;
return Sub_blob(context_id, target, query, params);
end Sub;
function SubHi (target in VARCHAR2, query in VARCHAR2, indexctx IN sys.ODCIIndexCtx,
scanctx in out MangoIndex, scanflg IN NUMBER) return CLOB IS
begin
return SubHi(to_clob(target), to_clob(query), null, indexctx, scanctx, scanflg);
end SubHi;
function SubHi (target in VARCHAR2, query in VARCHAR2, params in VARCHAR2, indexctx IN sys.ODCIIndexCtx,
scanctx in out MangoIndex, scanflg IN NUMBER) return CLOB IS
begin
return SubHi(to_clob(target), to_clob(query), params, indexctx, scanctx, scanflg);
end SubHi;
function SubHi (target in VARCHAR2, query in CLOB, indexctx IN sys.ODCIIndexCtx,
scanctx in out MangoIndex, scanflg IN NUMBER) return CLOB IS
begin
return SubHi(to_clob(target), query, null, indexctx, scanctx, scanflg);
end SubHi;
function SubHi (target in VARCHAR2, query in CLOB, params in VARCHAR2, indexctx IN sys.ODCIIndexCtx,
scanctx in out MangoIndex, scanflg IN NUMBER) return CLOB IS
begin
return SubHi(to_clob(target), query, params, indexctx, scanctx, scanflg);
end SubHi;
function SubHi (target in CLOB, query in VARCHAR2, indexctx IN sys.ODCIIndexCtx,
scanctx in out MangoIndex, scanflg IN NUMBER) return CLOB IS
begin
return SubHi(target, to_clob(query), null, indexctx, scanctx, scanflg);
end SubHi;
function SubHi (target in CLOB, query in VARCHAR2, params in VARCHAR2, indexctx IN sys.ODCIIndexCtx,
scanctx in out MangoIndex, scanflg IN NUMBER) return CLOB IS
begin
return SubHi(target, to_clob(query), params, indexctx, scanctx, scanflg);
end SubHi;
function SubHi (target in CLOB, query in CLOB, indexctx IN sys.ODCIIndexCtx,
scanctx in out MangoIndex, scanflg IN NUMBER) return CLOB IS
begin
return SubHi(target, query, null, indexctx, scanctx, scanflg);
end SubHi;
function SubHi (target in CLOB, query in CLOB, params in VARCHAR2, indexctx IN sys.ODCIIndexCtx,
scanctx in out MangoIndex, scanflg IN NUMBER) return CLOB IS
context_id binary_integer := 0;
begin
if indexctx.IndexInfo is not null then
context_id := BingoPackage.getContextID(indexctx.IndexInfo);
end if;
return SubHi_clob(context_id, target, query, params);
end SubHi;
function SubHi (target in BLOB, query in VARCHAR2, indexctx IN sys.ODCIIndexCtx,
scanctx in out MangoIndex, scanflg IN NUMBER) return CLOB IS
begin
return SubHi(target, to_clob(query), null, indexctx, scanctx, scanflg);
end SubHi;
function SubHi (target in BLOB, query in VARCHAR2, params in VARCHAR2, indexctx IN sys.ODCIIndexCtx,
scanctx in out MangoIndex, scanflg IN NUMBER) return CLOB IS
begin
return SubHi(target, to_clob(query), params, indexctx, scanctx, scanflg);
end SubHi;
function SubHi (target in BLOB, query in CLOB, indexctx IN sys.ODCIIndexCtx,
scanctx in out MangoIndex, scanflg IN NUMBER) return CLOB IS
begin
return SubHi(target, query, null, indexctx, scanctx, scanflg);
end SubHi;
function SubHi (target in BLOB, query in CLOB, params in VARCHAR2, indexctx IN sys.ODCIIndexCtx,
scanctx in out MangoIndex, scanflg IN NUMBER) return CLOB IS
context_id binary_integer := 0;
begin
if indexctx.IndexInfo is not null then
context_id := BingoPackage.getContextID(indexctx.IndexInfo);
end if;
return SubHi_blob(context_id, target, query, params);
end SubHi;
function Smarts (target in VARCHAR2, query in VARCHAR2, indexctx IN sys.ODCIIndexCtx,
scanctx in out MangoIndex, scanflg IN NUMBER) return NUMBER IS
context_id binary_integer := 0;
begin
return Smarts(to_clob(target), query, indexctx, scanctx, scanflg);
end Smarts;
function Smarts (target in CLOB, query in VARCHAR2, indexctx IN sys.ODCIIndexCtx,
scanctx in out MangoIndex, scanflg IN NUMBER) return NUMBER IS
context_id binary_integer := 0;
begin
if indexctx.IndexInfo is not null then
context_id := BingoPackage.getContextID(indexctx.IndexInfo);
end if;
return Smarts_clob(context_id, target, query);
end Smarts;
function Smarts (target in BLOB, query in VARCHAR2, indexctx IN sys.ODCIIndexCtx,
scanctx in out MangoIndex, scanflg IN NUMBER) return NUMBER IS
context_id binary_integer := 0;
begin
if indexctx.IndexInfo is not null then
context_id := BingoPackage.getContextID(indexctx.IndexInfo);
end if;
return Smarts_blob(context_id, target, query);
end Smarts;
function SmartsHi (target in VARCHAR2, query in VARCHAR2, indexctx IN sys.ODCIIndexCtx,
scanctx in out MangoIndex, scanflg IN NUMBER) return CLOB IS
context_id binary_integer := 0;
begin
if indexctx.IndexInfo is not null then
context_id := BingoPackage.getContextID(indexctx.IndexInfo);
end if;
return SmartsHi_clob(context_id, to_clob(target), query);
end SmartsHi;
function SmartsHi (target in CLOB, query in VARCHAR2, indexctx IN sys.ODCIIndexCtx,
scanctx in out MangoIndex, scanflg IN NUMBER) return CLOB IS
context_id binary_integer := 0;
begin
if indexctx.IndexInfo is not null then
context_id := BingoPackage.getContextID(indexctx.IndexInfo);
end if;
return SmartsHi_clob(context_id, target, query);
end SmartsHi;
function SmartsHi (target in BLOB, query in VARCHAR2, indexctx IN sys.ODCIIndexCtx,
scanctx in out MangoIndex, scanflg IN NUMBER) return CLOB IS
context_id binary_integer := 0;
begin
if indexctx.IndexInfo is not null then
context_id := BingoPackage.getContextID(indexctx.IndexInfo);
end if;
return SmartsHi_blob(context_id, target, query);
end SmartsHi;
function Exact (target in VARCHAR2, query in VARCHAR2, indexctx IN sys.ODCIIndexCtx,
scanctx in out MangoIndex, scanflg IN NUMBER) return NUMBER IS
begin
return Exact(to_clob(target), to_clob(query), null, indexctx, scanctx, scanflg);
end Exact;
function Exact (target in VARCHAR2, query in VARCHAR2, params in VARCHAR2, indexctx IN sys.ODCIIndexCtx,
scanctx in out MangoIndex, scanflg IN NUMBER) return NUMBER IS
begin
return Exact(to_clob(target), to_clob(query), params, indexctx, scanctx, scanflg);
end Exact;
function Exact (target in VARCHAR2, query in CLOB, indexctx IN sys.ODCIIndexCtx,
scanctx in out MangoIndex, scanflg IN NUMBER) return NUMBER IS
begin
return Exact(to_clob(target), query, null, indexctx, scanctx, scanflg);
end Exact;
function Exact (target in VARCHAR2, query in CLOB, params in VARCHAR2, indexctx IN sys.ODCIIndexCtx,
scanctx in out MangoIndex, scanflg IN NUMBER) return NUMBER IS
begin
return Exact(to_clob(target), query, params, indexctx, scanctx, scanflg);
end Exact;
function Exact (target in CLOB, query in VARCHAR2, indexctx IN sys.ODCIIndexCtx,
scanctx in out MangoIndex, scanflg IN NUMBER) return NUMBER IS
begin
return Exact(target, to_clob(query), null, indexctx, scanctx, scanflg);
end Exact;
function Exact (target in CLOB, query in VARCHAR2, params in VARCHAR2, indexctx IN sys.ODCIIndexCtx,
scanctx in out MangoIndex, scanflg IN NUMBER) return NUMBER IS
begin
return Exact(target, to_clob(query), params, indexctx, scanctx, scanflg);
end Exact;
function Exact (target in CLOB, query in CLOB, indexctx IN sys.ODCIIndexCtx,
scanctx in out MangoIndex, scanflg IN NUMBER) return NUMBER IS
begin
return Exact(target, query, null, indexctx, scanctx, scanflg);
end Exact;
function Exact (target in CLOB, query in CLOB, params in VARCHAR2, indexctx IN sys.ODCIIndexCtx,
scanctx in out MangoIndex, scanflg IN NUMBER) return NUMBER IS
context_id binary_integer := 0;
begin
if indexctx.IndexInfo is not null then
context_id := BingoPackage.getContextID(indexctx.IndexInfo);
end if;
return Exact_clob(context_id, target, query, params);
end Exact;
function Exact (target in BLOB, query in VARCHAR2, indexctx IN sys.ODCIIndexCtx,
scanctx in out MangoIndex, scanflg IN NUMBER) return NUMBER IS
begin
return Exact(target, to_clob(query), null, indexctx, scanctx, scanflg);
end Exact;
function Exact (target in BLOB, query in VARCHAR2, params in VARCHAR2,
indexctx IN sys.ODCIIndexCtx, scanctx in out MangoIndex, scanflg IN NUMBER) return NUMBER IS
begin
return Exact(target, to_clob(query), params, indexctx, scanctx, scanflg);
end Exact;
function Exact (target in BLOB, query in CLOB, indexctx IN sys.ODCIIndexCtx,
scanctx in out MangoIndex, scanflg IN NUMBER) return NUMBER IS
begin
return Exact(target, query, null, indexctx, scanctx, scanflg);
end Exact;
function Exact (target in BLOB, query in CLOB, params in VARCHAR2, indexctx IN sys.ODCIIndexCtx,
scanctx in out MangoIndex, scanflg IN NUMBER) return NUMBER IS
context_id binary_integer := 0;
begin
if indexctx.IndexInfo is not null then
context_id := BingoPackage.getContextID(indexctx.IndexInfo);
end if;
return Exact_blob(context_id, target, query, params);
end Exact;
function ExactHi (target in VARCHAR2, query in VARCHAR2, indexctx IN sys.ODCIIndexCtx,
scanctx in out MangoIndex, scanflg IN NUMBER) return CLOB IS
begin
return ExactHi(to_clob(target), to_clob(query), null, indexctx, scanctx, scanflg);
end ExactHi;
function ExactHi (target in VARCHAR2, query in VARCHAR2, params in VARCHAR2, indexctx IN sys.ODCIIndexCtx,
scanctx in out MangoIndex, scanflg IN NUMBER) return CLOB IS
begin
return ExactHi(to_clob(target), to_clob(query), params, indexctx, scanctx, scanflg);
end ExactHi;
function ExactHi (target in VARCHAR2, query in CLOB, indexctx IN sys.ODCIIndexCtx,
scanctx in out MangoIndex, scanflg IN NUMBER) return CLOB IS
begin
return ExactHi(to_clob(target), query, null, indexctx, scanctx, scanflg);
end ExactHi;
function ExactHi (target in VARCHAR2, query in CLOB, params in VARCHAR2, indexctx IN sys.ODCIIndexCtx,
scanctx in out MangoIndex, scanflg IN NUMBER) return CLOB IS
begin
return ExactHi(to_clob(target), query, params, indexctx, scanctx, scanflg);
end ExactHi;
function ExactHi (target in CLOB, query in VARCHAR2, indexctx IN sys.ODCIIndexCtx,
scanctx in out MangoIndex, scanflg IN NUMBER) return CLOB IS
begin
return ExactHi(target, to_clob(query), null, indexctx, scanctx, scanflg);
end ExactHi;
function ExactHi (target in CLOB, query in VARCHAR2, params in VARCHAR2, indexctx IN sys.ODCIIndexCtx,
scanctx in out MangoIndex, scanflg IN NUMBER) return CLOB IS
begin
return ExactHi(target, to_clob(query), params, indexctx, scanctx, scanflg);
end ExactHi;
function ExactHi (target in CLOB, query in CLOB, indexctx IN sys.ODCIIndexCtx,
scanctx in out MangoIndex, scanflg IN NUMBER) return CLOB IS
begin
return ExactHi(target, query, null, indexctx, scanctx, scanflg);
end ExactHi;
function ExactHi (target in CLOB, query in CLOB, params in VARCHAR2, indexctx IN sys.ODCIIndexCtx,
scanctx in out MangoIndex, scanflg IN NUMBER) return CLOB IS
context_id binary_integer := 0;
begin
if indexctx.IndexInfo is not null then
context_id := BingoPackage.getContextID(indexctx.IndexInfo);
end if;
return ExactHi_clob(context_id, target, query, params);
end ExactHi;
function ExactHi (target in BLOB, query in VARCHAR2, indexctx IN sys.ODCIIndexCtx,
scanctx in out MangoIndex, scanflg IN NUMBER) return CLOB IS
begin
return ExactHi(target, to_clob(query), null, indexctx, scanctx, scanflg);
end ExactHi;
function ExactHi (target in BLOB, query in VARCHAR2, params in VARCHAR2, indexctx IN sys.ODCIIndexCtx,
scanctx in out MangoIndex, scanflg IN NUMBER) return CLOB IS
begin
return ExactHi(target, to_clob(query), params, indexctx, scanctx, scanflg);
end ExactHi;
function ExactHi (target in BLOB, query in CLOB, indexctx IN sys.ODCIIndexCtx,
scanctx in out MangoIndex, scanflg IN NUMBER) return CLOB IS
begin
return ExactHi(target, query, null, indexctx, scanctx, scanflg);
end ExactHi;
function ExactHi (target in BLOB, query in CLOB, params in VARCHAR2, indexctx IN sys.ODCIIndexCtx,
scanctx in out MangoIndex, scanflg IN NUMBER) return CLOB IS
context_id binary_integer := 0;
begin
if indexctx.IndexInfo is not null then
context_id := BingoPackage.getContextID(indexctx.IndexInfo);
end if;
return ExactHi_blob(context_id, target, query, params);
end ExactHi;
function Sim (target in VARCHAR2, query in VARCHAR2, indexctx IN sys.ODCIIndexCtx,
scanctx in out MangoIndex, scanflg IN NUMBER) return NUMBER IS
begin
return Sim(to_clob(target), to_clob(query), null, indexctx, scanctx, scanflg);
end Sim;
function Sim (target in VARCHAR2, query in VARCHAR2, params in VARCHAR2, indexctx IN sys.ODCIIndexCtx,
scanctx in out MangoIndex, scanflg IN NUMBER) return NUMBER IS
begin
return Sim(to_clob(target), to_clob(query), params, indexctx, scanctx, scanflg);
end Sim;
function Sim (target in VARCHAR2, query in CLOB, indexctx IN sys.ODCIIndexCtx,
scanctx in out MangoIndex, scanflg IN NUMBER) return NUMBER IS
begin
return Sim(to_clob(target), query, null, indexctx, scanctx, scanflg);
end Sim;
function Sim (target in VARCHAR2, query in CLOB, params VARCHAR2, indexctx IN sys.ODCIIndexCtx,
scanctx in out MangoIndex, scanflg IN NUMBER) return NUMBER IS
begin
return Sim(to_clob(target), query, params, indexctx, scanctx, scanflg);
end Sim;
function Sim (target in CLOB, query in VARCHAR2, indexctx IN sys.ODCIIndexCtx,
scanctx in out MangoIndex, scanflg IN NUMBER) return NUMBER IS
begin
return Sim(target, to_clob(query), null, indexctx, scanctx, scanflg);
end Sim;
function Sim (target in CLOB, query in VARCHAR2, params in VARCHAR2, indexctx IN sys.ODCIIndexCtx,
scanctx in out MangoIndex, scanflg IN NUMBER) return NUMBER IS
begin
return Sim(target, to_clob(query), params, indexctx, scanctx, scanflg);
end Sim;
function Sim (target in CLOB, query in CLOB, indexctx IN sys.ODCIIndexCtx,
scanctx in out MangoIndex, scanflg IN NUMBER) return NUMBER IS
begin
return Sim(target, query, null, indexctx, scanctx, scanflg);
end Sim;
function Sim (target in CLOB, query in CLOB, params VARCHAR2, indexctx IN sys.ODCIIndexCtx,
scanctx in out MangoIndex, scanflg IN NUMBER) return NUMBER IS
context_id binary_integer := 0;
begin
if indexctx.IndexInfo is not null then
context_id := BingoPackage.getContextID(indexctx.IndexInfo);
end if;
return Sim_clob(context_id, target, query, params);
end Sim;
function Sim (target in BLOB, query in VARCHAR2, indexctx IN sys.ODCIIndexCtx,
scanctx in out MangoIndex, scanflg IN NUMBER) return NUMBER IS
begin
return Sim(target, to_clob(query), null, indexctx, scanctx, scanflg);
end Sim;
function Sim (target in BLOB, query in VARCHAR2, params in VARCHAR2, indexctx IN sys.ODCIIndexCtx,
scanctx in out MangoIndex, scanflg IN NUMBER) return NUMBER IS
begin
return Sim(target, to_clob(query), params, indexctx, scanctx, scanflg);
end Sim;
function Sim (target in BLOB, query in CLOB, indexctx IN sys.ODCIIndexCtx,
scanctx in out MangoIndex, scanflg IN NUMBER) return NUMBER IS
begin
return Sim(target, query, null, indexctx, scanctx, scanflg);
end Sim;
function Sim (target in BLOB, query in CLOB, params VARCHAR2, indexctx IN sys.ODCIIndexCtx,
scanctx in out MangoIndex, scanflg IN NUMBER) return NUMBER IS
context_id binary_integer := 0;
begin
if indexctx.IndexInfo is not null then
context_id := BingoPackage.getContextID(indexctx.IndexInfo);
end if;
return Sim_blob(context_id, target, query, params);
end Sim;
function GrossCalc (target in VARCHAR2) return VARCHAR2 IS
begin
return GrossCalc(to_clob(target));
end GrossCalc;
function GrossCalc (target in CLOB) return VARCHAR2 IS
begin
return GrossCalc_clob(target);
end GrossCalc;
function GrossCalc (target in BLOB) return VARCHAR2 IS
begin
return GrossCalc_blob(target);
end GrossCalc;
function Gross (target in VARCHAR2, query in VARCHAR2, indexctx IN sys.ODCIIndexCtx,
scanctx in out MangoIndex, scanflg IN NUMBER) return NUMBER is
begin
return Gross(to_clob(target), query, indexctx, scanctx, scanflg);
end Gross;
function Gross (target in CLOB, query in VARCHAR2, indexctx IN sys.ODCIIndexCtx,
scanctx in out MangoIndex, scanflg IN NUMBER) return NUMBER is
context_id binary_integer := 0;
begin
if indexctx.IndexInfo is not null then
context_id := BingoPackage.getContextID(indexctx.IndexInfo);
end if;
return Gross_clob(context_id, target, query);
end Gross;
function Gross (target in BLOB, query in VARCHAR2, indexctx IN sys.ODCIIndexCtx,
scanctx in out MangoIndex, scanflg IN NUMBER) return NUMBER is
context_id binary_integer := 0;
begin
if indexctx.IndexInfo is not null then
context_id := BingoPackage.getContextID(indexctx.IndexInfo);
end if;
return Gross_blob(context_id, target, query);
end Gross;
function Mass (target in VARCHAR2, indexctx IN sys.ODCIIndexCtx,
scanctx in out MangoIndex, scanflg IN NUMBER) return NUMBER is
begin
return Mass(to_clob(target), indexctx, scanctx, scanflg);
end Mass;
function Mass (target in CLOB, indexctx IN sys.ODCIIndexCtx,
scanctx in out MangoIndex, scanflg IN NUMBER) return NUMBER is
context_id binary_integer := 0;
begin
if indexctx.IndexInfo is not null then
context_id := BingoPackage.getContextID(indexctx.IndexInfo);
end if;
return Mass_clob(context_id, target, NULL);
end Mass;
function Mass (target in BLOB, indexctx IN sys.ODCIIndexCtx,
scanctx in out MangoIndex, scanflg IN NUMBER) return NUMBER is
context_id binary_integer := 0;
begin
if indexctx.IndexInfo is not null then
context_id := BingoPackage.getContextID(indexctx.IndexInfo);
end if;
return Mass_blob(context_id, target, NULL);
end Mass;
function Mass (target in VARCHAR2, typee in VARCHAR2) return NUMBER is
begin
return Mass(to_clob(target), typee);
end Mass;
function Mass (target in CLOB, typee in VARCHAR2) return NUMBER is
begin
return Mass_clob(0, target, typee);
end Mass;
function Mass (target in BLOB, typee in VARCHAR2) return NUMBER is
begin
return Mass_blob(0, target, typee);
end Mass;
function Molfile (target in VARCHAR2) return CLOB is
begin
return Molfile_clob(to_clob(target), NULL);
end Molfile;
function Molfile (target in CLOB) return CLOB is
begin
return Molfile_clob(target, NULL);
end Molfile;
function Molfile (target in BLOB) return CLOB is
begin
return Molfile_blob(target, NULL);
end Molfile;
function Molfile (target in VARCHAR2, options in VARCHAR2) return CLOB is
begin
return Molfile_clob(to_clob(target), options);
end Molfile;
function Molfile (target in CLOB, options in VARCHAR2) return CLOB is
begin
return Molfile_clob(target, options);
end Molfile;
function Molfile (target in BLOB, options in VARCHAR2) return CLOB is
begin
return Molfile_blob(target, options);
end Molfile;
function CML (target in VARCHAR2) return CLOB is
begin
return CML_clob(to_clob(target));
end CML;
function CML (target in CLOB) return CLOB is
begin
return CML_clob(target);
end CML;
function CML (target in BLOB) return CLOB is
begin
return CML_blob(target);
end CML;
function SMILES (target in VARCHAR2) return VARCHAR2 is
begin
return SMILES_clob(to_clob(target), NULL);
end SMILES;
function SMILES (target in CLOB) return VARCHAR2 is
begin
return SMILES_clob(target, NULL);
end SMILES;
function SMILES (target in BLOB) return VARCHAR2 is
begin
return SMILES_blob(target, NULL);
end SMILES;
function SMILES (target in VARCHAR2, options in VARCHAR2) return VARCHAR2 is
begin
return SMILES_clob(to_clob(target), options);
end SMILES;
function SMILES (target in CLOB, options in VARCHAR2) return VARCHAR2 is
begin
return SMILES_clob(target, options);
end SMILES;
function SMILES (target in BLOB, options in VARCHAR2) return VARCHAR2 is
begin
return SMILES_blob(target, options);
end SMILES;
function InChI (target in VARCHAR2, options in VARCHAR2) return CLOB is
begin
return InChI_clob(to_clob(target), options);
end InChI;
function InChI (target in CLOB, options in VARCHAR2) return CLOB is
begin
return InChI_clob(target, options);
end InChI;
function InChI (target in BLOB, options in VARCHAR2) return CLOB is
begin
return InChI_blob(target, options);
end InChI;
function InChIKey (inchi in VARCHAR2) return VARCHAR2 is
begin
return InChIKey_clob(to_clob(inchi));
end InChIKey;
function InChIKey (inchi in CLOB) return VARCHAR2 is
begin
return InChIKey_clob(inchi);
end InChIKey;
function Fingerprint (target in VARCHAR2, options in VARCHAR2) return BLOB is
begin
return Fingerprint_clob(to_clob(target), options);
end Fingerprint;
function Fingerprint (target in CLOB, options in VARCHAR2) return BLOB is
begin
return Fingerprint_clob(target, options);
end Fingerprint;
function Fingerprint (target in BLOB, options in VARCHAR2) return BLOB is
begin
return Fingerprint_blob(target, options);
end Fingerprint;
function CANSMILES (target in VARCHAR2) return VARCHAR2 is
begin
return CANSMILES_clob(to_clob(target));
end CANSMILES;
function CANSMILES (target in CLOB) return VARCHAR2 is
begin
return CANSMILES_clob(target);
end CANSMILES;
function CANSMILES (target in BLOB) return VARCHAR2 is
begin
return CANSMILES_blob(target);
end CANSMILES;
END MangoPackage;
/
-- necessary for Oracle 9 on Solaris
grant execute on mangopackage to public;
spool off; | the_stack |
--Order by random with stable marking gives us same order in a statement and different
-- orderings in different statements
CREATE OR REPLACE FUNCTION _prom_catalog.get_metrics_that_need_drop_chunk()
RETURNS SETOF _prom_catalog.metric
AS $$
BEGIN
IF NOT _prom_catalog.is_timescaledb_installed() THEN
-- no real shortcut to figure out if deletion needed, return all
RETURN QUERY
SELECT m.*
FROM _prom_catalog.metric m
WHERE is_view = FALSE
ORDER BY random();
RETURN;
END IF;
RETURN QUERY
SELECT m.*
FROM _prom_catalog.metric m
WHERE EXISTS (
SELECT 1 FROM
_prom_catalog.get_storage_hypertable_info(m.table_schema, m.table_name, m.is_view) hi
INNER JOIN public.show_chunks(hi.hypertable_relation,
older_than=>NOW() - _prom_catalog.get_metric_retention_period(m.table_schema, m.metric_name)) sc ON TRUE)
--random order also to prevent starvation
ORDER BY random();
RETURN;
END
$$
LANGUAGE PLPGSQL STABLE;
GRANT EXECUTE ON FUNCTION _prom_catalog.get_metrics_that_need_drop_chunk() TO prom_reader;
--drop chunks from metrics tables and delete the appropriate series.
CREATE OR REPLACE FUNCTION _prom_catalog.drop_metric_chunk_data(
schema_name TEXT, metric_name TEXT, older_than TIMESTAMPTZ
) RETURNS VOID AS $func$
DECLARE
metric_schema NAME;
metric_table NAME;
metric_view BOOLEAN;
_is_cagg BOOLEAN;
BEGIN
SELECT table_schema, table_name, is_view
INTO STRICT metric_schema, metric_table, metric_view
FROM _prom_catalog.get_metric_table_name_if_exists(schema_name, metric_name);
-- need to check for caggs when dealing with metric views
IF metric_view THEN
SELECT is_cagg, cagg_schema, cagg_name
INTO _is_cagg, metric_schema, metric_table
FROM _prom_catalog.get_cagg_info(schema_name, metric_name);
IF NOT _is_cagg THEN
RETURN;
END IF;
END IF;
IF _prom_catalog.is_timescaledb_installed() THEN
IF _prom_catalog.get_timescale_major_version() >= 2 THEN
PERFORM public.drop_chunks(
relation=>format('%I.%I', metric_schema, metric_table),
older_than=>older_than
);
ELSE
PERFORM public.drop_chunks(
table_name=>metric_table,
schema_name=> metric_schema,
older_than=>older_than,
cascade_to_materializations=>FALSE
);
END IF;
ELSE
EXECUTE format($$ DELETE FROM %I.%I WHERE time < %L $$, metric_schema, metric_table, older_than);
END IF;
END
$func$
LANGUAGE PLPGSQL VOLATILE
--security definer to add jobs as the logged-in user
SECURITY DEFINER
--search path must be set for security definer
SET search_path = pg_temp;
--redundant given schema settings but extra caution for security definers
REVOKE ALL ON FUNCTION _prom_catalog.drop_metric_chunk_data(text, text, timestamptz) FROM PUBLIC;
GRANT EXECUTE ON FUNCTION _prom_catalog.drop_metric_chunk_data(text, text, timestamptz) TO prom_maintenance;
--drop chunks from metrics tables and delete the appropriate series.
CREATE OR REPLACE PROCEDURE _prom_catalog.drop_metric_chunks(
schema_name TEXT, metric_name TEXT, older_than TIMESTAMPTZ, ran_at TIMESTAMPTZ = now(), log_verbose BOOLEAN = FALSE
) AS $func$
DECLARE
metric_id int;
metric_schema NAME;
metric_table NAME;
metric_series_table NAME;
is_metric_view BOOLEAN;
check_time TIMESTAMPTZ;
time_dimension_id INT;
last_updated TIMESTAMPTZ;
present_epoch BIGINT;
lastT TIMESTAMPTZ;
startT TIMESTAMPTZ;
BEGIN
SELECT id, table_schema, table_name, series_table, is_view
INTO STRICT metric_id, metric_schema, metric_table, metric_series_table, is_metric_view
FROM _prom_catalog.get_metric_table_name_if_exists(schema_name, metric_name);
SELECT older_than + INTERVAL '1 hour'
INTO check_time;
startT := clock_timestamp();
PERFORM _prom_catalog.set_app_name(format('promscale maintenance: data retention: metric %s', metric_name));
IF log_verbose THEN
RAISE LOG 'promscale maintenance: data retention: metric %: starting', metric_name;
END IF;
-- transaction 1
IF _prom_catalog.is_timescaledb_installed() THEN
--Get the time dimension id for the time dimension
SELECT d.id
INTO STRICT time_dimension_id
FROM _timescaledb_catalog.dimension d
INNER JOIN _prom_catalog.get_storage_hypertable_info(metric_schema, metric_table, is_metric_view) hi ON (hi.id = d.hypertable_id)
ORDER BY d.id ASC
LIMIT 1;
--Get a tight older_than (EXCLUSIVE) because we want to know the
--exact cut-off where things will be dropped
SELECT _timescaledb_internal.to_timestamp(range_end)
INTO older_than
FROM _timescaledb_catalog.chunk c
INNER JOIN _timescaledb_catalog.chunk_constraint cc ON (c.id = cc.chunk_id)
INNER JOIN _timescaledb_catalog.dimension_slice ds ON (ds.id = cc.dimension_slice_id)
--range_end is exclusive so this is everything < older_than (which is also exclusive)
WHERE ds.dimension_id = time_dimension_id AND ds.range_end <= _timescaledb_internal.to_unix_microseconds(older_than)
ORDER BY range_end DESC
LIMIT 1;
END IF;
-- end this txn so we're not holding any locks on the catalog
SELECT current_epoch, last_update_time INTO present_epoch, last_updated FROM
_prom_catalog.ids_epoch LIMIT 1;
COMMIT;
IF older_than IS NULL THEN
-- even though there are no new Ids in need of deletion,
-- we may still have old ones to delete
lastT := clock_timestamp();
PERFORM _prom_catalog.set_app_name(format('promscale maintenance: data retention: metric %s: delete expired series', metric_name));
PERFORM _prom_catalog.delete_expired_series(metric_schema, metric_table, metric_series_table, ran_at, present_epoch, last_updated);
IF log_verbose THEN
RAISE LOG 'promscale maintenance: data retention: metric %: done deleting expired series as only action in %', metric_name, clock_timestamp()-lastT;
RAISE LOG 'promscale maintenance: data retention: metric %: finished in %', metric_name, clock_timestamp()-startT;
END IF;
RETURN;
END IF;
-- transaction 2
lastT := clock_timestamp();
PERFORM _prom_catalog.set_app_name(format('promscale maintenance: data retention: metric %s: mark unused series', metric_name));
PERFORM _prom_catalog.mark_unused_series(metric_schema, metric_table, metric_series_table, older_than, check_time);
IF log_verbose THEN
RAISE LOG 'promscale maintenance: data retention: metric %: done marking unused series in %', metric_name, clock_timestamp()-lastT;
END IF;
COMMIT;
-- transaction 3
lastT := clock_timestamp();
PERFORM _prom_catalog.set_app_name( format('promscale maintenance: data retention: metric %s: drop chunks', metric_name));
PERFORM _prom_catalog.drop_metric_chunk_data(metric_schema, metric_name, older_than);
IF log_verbose THEN
RAISE LOG 'promscale maintenance: data retention: metric %: done dropping chunks in %', metric_name, clock_timestamp()-lastT;
END IF;
SELECT current_epoch, last_update_time INTO present_epoch, last_updated FROM
_prom_catalog.ids_epoch LIMIT 1;
COMMIT;
-- transaction 4
lastT := clock_timestamp();
PERFORM _prom_catalog.set_app_name( format('promscale maintenance: data retention: metric %s: delete expired series', metric_name));
PERFORM _prom_catalog.delete_expired_series(metric_schema, metric_table, metric_series_table, ran_at, present_epoch, last_updated);
IF log_verbose THEN
RAISE LOG 'promscale maintenance: data retention: metric %: done deleting expired series in %', metric_name, clock_timestamp()-lastT;
RAISE LOG 'promscale maintenance: data retention: metric %: finished in %', metric_name, clock_timestamp()-startT;
END IF;
RETURN;
END
$func$
LANGUAGE PLPGSQL;
GRANT EXECUTE ON PROCEDURE _prom_catalog.drop_metric_chunks(text, text, timestamptz, timestamptz, boolean) TO prom_maintenance;
CREATE OR REPLACE PROCEDURE _ps_trace.drop_span_chunks(_older_than timestamptz)
AS $func$
BEGIN
IF _prom_catalog.is_timescaledb_installed() THEN
IF _prom_catalog.get_timescale_major_version() >= 2 THEN
PERFORM public.drop_chunks(
relation=>'_ps_trace.span',
older_than=>_older_than
);
ELSE
PERFORM public.drop_chunks(
table_name=>'span',
schema_name=> '_ps_trace',
older_than=>_older_than,
cascade_to_materializations=>FALSE
);
END IF;
ELSE
DELETE FROM _ps_trace.span WHERE start_time < _older_than;
END IF;
END
$func$
LANGUAGE PLPGSQL
--security definer to add jobs as the logged-in user
SECURITY DEFINER
--search path must be set for security definer
SET search_path = pg_temp;
--redundant given schema settings but extra caution for security definers
REVOKE ALL ON PROCEDURE _ps_trace.drop_span_chunks(timestamptz) FROM PUBLIC;
GRANT EXECUTE ON PROCEDURE _ps_trace.drop_span_chunks(timestamptz) TO prom_maintenance;
CREATE OR REPLACE PROCEDURE _ps_trace.drop_link_chunks(_older_than timestamptz)
AS $func$
BEGIN
IF _prom_catalog.is_timescaledb_installed() THEN
IF _prom_catalog.get_timescale_major_version() >= 2 THEN
PERFORM public.drop_chunks(
relation=>'_ps_trace.link',
older_than=>_older_than
);
ELSE
PERFORM public.drop_chunks(
table_name=>'link',
schema_name=> '_ps_trace',
older_than=>_older_than,
cascade_to_materializations=>FALSE
);
END IF;
ELSE
DELETE FROM _ps_trace.link WHERE span_start_time < _older_than;
END IF;
END
$func$
LANGUAGE PLPGSQL
--security definer to add jobs as the logged-in user
SECURITY DEFINER
--search path must be set for security definer
SET search_path = pg_temp;
--redundant given schema settings but extra caution for security definers
REVOKE ALL ON PROCEDURE _ps_trace.drop_link_chunks(timestamptz) FROM PUBLIC;
GRANT EXECUTE ON PROCEDURE _ps_trace.drop_link_chunks(timestamptz) TO prom_maintenance;
CREATE OR REPLACE PROCEDURE _ps_trace.drop_event_chunks(_older_than timestamptz)
AS $func$
BEGIN
IF _prom_catalog.is_timescaledb_installed() THEN
IF _prom_catalog.get_timescale_major_version() >= 2 THEN
PERFORM public.drop_chunks(
relation=>'_ps_trace.event',
older_than=>_older_than
);
ELSE
PERFORM public.drop_chunks(
table_name=>'event',
schema_name=> '_ps_trace',
older_than=>_older_than,
cascade_to_materializations=>FALSE
);
END IF;
ELSE
DELETE FROM _ps_trace.event WHERE time < _older_than;
END IF;
END
$func$
LANGUAGE PLPGSQL
--security definer to add jobs as the logged-in user
SECURITY DEFINER
--search path must be set for security definer
SET search_path = pg_temp;
--redundant given schema settings but extra caution for security definers
REVOKE ALL ON PROCEDURE _ps_trace.drop_event_chunks(timestamptz) FROM PUBLIC;
GRANT EXECUTE ON PROCEDURE _ps_trace.drop_event_chunks(timestamptz) TO prom_maintenance;
CREATE OR REPLACE FUNCTION ps_trace.set_trace_retention_period(_trace_retention_period INTERVAL)
RETURNS BOOLEAN
AS $$
INSERT INTO _prom_catalog.default(key, value) VALUES ('trace_retention_period', _trace_retention_period::text)
ON CONFLICT (key) DO UPDATE SET value = EXCLUDED.value;
SELECT true;
$$
LANGUAGE SQL VOLATILE;
COMMENT ON FUNCTION ps_trace.set_trace_retention_period(INTERVAL)
IS 'set the retention period for trace data';
GRANT EXECUTE ON FUNCTION ps_trace.set_trace_retention_period(INTERVAL) TO prom_admin;
CREATE OR REPLACE FUNCTION ps_trace.get_trace_retention_period()
RETURNS INTERVAL
AS $$
SELECT value::interval
FROM _prom_catalog.default
WHERE key = 'trace_retention_period'
$$
LANGUAGE SQL STABLE;
COMMENT ON FUNCTION ps_trace.get_trace_retention_period()
IS 'get the retention period for trace data';
GRANT EXECUTE ON FUNCTION ps_trace.get_trace_retention_period() TO prom_reader;
CREATE OR REPLACE PROCEDURE _ps_trace.execute_data_retention_policy(log_verbose boolean)
AS $$
DECLARE
_trace_retention_period interval;
_older_than timestamptz;
_last timestamptz;
_start timestamptz;
_message_text text;
_pg_exception_detail text;
_pg_exception_hint text;
BEGIN
_start := clock_timestamp();
PERFORM _prom_catalog.set_app_name('promscale maintenance: data retention: tracing');
IF log_verbose THEN
RAISE LOG 'promscale maintenance: data retention: tracing: starting';
END IF;
_trace_retention_period = ps_trace.get_trace_retention_period();
IF _trace_retention_period is null THEN
RAISE EXCEPTION 'promscale maintenance: data retention: tracing: trace_retention_period is null.';
END IF;
_older_than = now() - _trace_retention_period;
IF _older_than >= now() THEN -- bail early. no need to continue
RAISE WARNING 'promscale maintenance: data retention: tracing: aborting. trace_retention_period set to zero or negative interval';
IF log_verbose THEN
RAISE LOG 'promscale maintenance: data retention: tracing: finished in %', clock_timestamp()-_start;
END IF;
RETURN;
END IF;
IF log_verbose THEN
RAISE LOG 'promscale maintenance: data retention: tracing: dropping trace chunks older than %s', _older_than;
END IF;
_last := clock_timestamp();
PERFORM _prom_catalog.set_app_name('promscale maintenance: data retention: tracing: deleting link data');
BEGIN
CALL _ps_trace.drop_link_chunks(_older_than);
IF log_verbose THEN
RAISE LOG 'promscale maintenance: data retention: tracing: done deleting link data in %', clock_timestamp()-_last;
END IF;
EXCEPTION WHEN OTHERS THEN
GET STACKED DIAGNOSTICS
_message_text = MESSAGE_TEXT,
_pg_exception_detail = PG_EXCEPTION_DETAIL,
_pg_exception_hint = PG_EXCEPTION_HINT;
RAISE WARNING 'promscale maintenance: data retention: tracing: failed to delete link data. % % % %',
_message_text, _pg_exception_detail, _pg_exception_hint, clock_timestamp()-_last;
END;
COMMIT;
_last := clock_timestamp();
PERFORM _prom_catalog.set_app_name('promscale maintenance: data retention: tracing: deleting event data');
BEGIN
CALL _ps_trace.drop_event_chunks(_older_than);
IF log_verbose THEN
RAISE LOG 'promscale maintenance: data retention: tracing: done deleting event data in %', clock_timestamp()-_last;
END IF;
EXCEPTION WHEN OTHERS THEN
GET STACKED DIAGNOSTICS
_message_text = MESSAGE_TEXT,
_pg_exception_detail = PG_EXCEPTION_DETAIL,
_pg_exception_hint = PG_EXCEPTION_HINT;
RAISE WARNING 'promscale maintenance: data retention: tracing: failed to delete event data. % % % %',
_message_text, _pg_exception_detail, _pg_exception_hint, clock_timestamp()-_last;
END;
COMMIT;
_last := clock_timestamp();
PERFORM _prom_catalog.set_app_name('promscale maintenance: data retention: tracing: deleting span data');
BEGIN
CALL _ps_trace.drop_span_chunks(_older_than);
IF log_verbose THEN
RAISE LOG 'promscale maintenance: data retention: tracing: done deleting span data in %', clock_timestamp()-_last;
END IF;
EXCEPTION WHEN OTHERS THEN
GET STACKED DIAGNOSTICS
_message_text = MESSAGE_TEXT,
_pg_exception_detail = PG_EXCEPTION_DETAIL,
_pg_exception_hint = PG_EXCEPTION_HINT;
RAISE WARNING 'promscale maintenance: data retention: tracing: failed to delete span data. % % % %',
_message_text, _pg_exception_detail, _pg_exception_hint, clock_timestamp()-_last;
END;
COMMIT;
IF log_verbose THEN
RAISE LOG 'promscale maintenance: data retention: tracing: finished in %', clock_timestamp()-_start;
END IF;
END;
$$ LANGUAGE PLPGSQL;
COMMENT ON PROCEDURE _ps_trace.execute_data_retention_policy(boolean)
IS 'drops old data according to the data retention policy. This procedure should be run regularly in a cron job';
GRANT EXECUTE ON PROCEDURE _ps_trace.execute_data_retention_policy(boolean) TO prom_maintenance;
CREATE OR REPLACE PROCEDURE _prom_catalog.execute_data_retention_policy(log_verbose boolean)
AS $$
DECLARE
r _prom_catalog.metric;
remaining_metrics _prom_catalog.metric[] DEFAULT '{}';
BEGIN
--Do one loop with metric that could be locked without waiting.
--This allows you to do everything you can while avoiding lock contention.
--Then come back for the metrics that would have needed to wait on the lock.
--Hopefully, that lock is now freed. The second loop waits for the lock
--to prevent starvation.
FOR r IN
SELECT *
FROM _prom_catalog.get_metrics_that_need_drop_chunk()
LOOP
IF NOT _prom_catalog.lock_metric_for_maintenance(r.id, wait=>false) THEN
remaining_metrics := remaining_metrics || r;
CONTINUE;
END IF;
CALL _prom_catalog.drop_metric_chunks(r.table_schema, r.metric_name, NOW() - _prom_catalog.get_metric_retention_period(r.table_schema, r.metric_name), log_verbose=>log_verbose);
PERFORM _prom_catalog.unlock_metric_for_maintenance(r.id);
COMMIT;
END LOOP;
IF log_verbose AND array_length(remaining_metrics, 1) > 0 THEN
RAISE LOG 'promscale maintenance: data retention: need to wait to grab locks on % metrics', array_length(remaining_metrics, 1);
END IF;
FOR r IN
SELECT *
FROM unnest(remaining_metrics)
LOOP
PERFORM _prom_catalog.set_app_name( format('promscale maintenance: data retention: metric %s: wait for lock', r.metric_name));
PERFORM _prom_catalog.lock_metric_for_maintenance(r.id);
CALL _prom_catalog.drop_metric_chunks(r.table_schema, r.metric_name, NOW() - _prom_catalog.get_metric_retention_period(r.table_schema, r.metric_name), log_verbose=>log_verbose);
PERFORM _prom_catalog.unlock_metric_for_maintenance(r.id);
COMMIT;
END LOOP;
END;
$$ LANGUAGE PLPGSQL;
COMMENT ON PROCEDURE _prom_catalog.execute_data_retention_policy(boolean)
IS 'drops old data according to the data retention policy. This procedure should be run regularly in a cron job';
GRANT EXECUTE ON PROCEDURE _prom_catalog.execute_data_retention_policy(boolean) TO prom_maintenance;
--public procedure to be called by cron
--right now just does data retention but name is generic so that
--we can add stuff later without needing people to change their cron scripts
--should be the last thing run in a session so that all session locks
--are guaranteed released on error.
CREATE OR REPLACE PROCEDURE prom_api.execute_maintenance(log_verbose boolean = false)
AS $$
DECLARE
startT TIMESTAMPTZ;
BEGIN
startT := clock_timestamp();
IF log_verbose THEN
RAISE LOG 'promscale maintenance: data retention: starting';
END IF;
PERFORM _prom_catalog.set_app_name( format('promscale maintenance: data retention'));
CALL _prom_catalog.execute_data_retention_policy(log_verbose=>log_verbose);
CALL _ps_trace.execute_data_retention_policy(log_verbose=>log_verbose);
IF NOT _prom_catalog.is_timescaledb_oss() AND _prom_catalog.get_timescale_major_version() >= 2 THEN
IF log_verbose THEN
RAISE LOG 'promscale maintenance: compression: starting';
END IF;
PERFORM _prom_catalog.set_app_name( format('promscale maintenance: compression'));
CALL _prom_catalog.execute_compression_policy(log_verbose=>log_verbose);
END IF;
IF log_verbose THEN
RAISE LOG 'promscale maintenance: finished in %', clock_timestamp()-startT;
END IF;
IF clock_timestamp()-startT > INTERVAL '12 hours' THEN
RAISE WARNING 'promscale maintenance jobs are taking too long (one run took %)', clock_timestamp()-startT
USING HINT = 'Please consider increasing the number of maintenance jobs using config_maintenance_jobs()';
END IF;
END;
$$ LANGUAGE PLPGSQL;
COMMENT ON PROCEDURE prom_api.execute_maintenance(boolean)
IS 'Execute maintenance tasks like dropping data according to retention policy. This procedure should be run regularly in a cron job';
GRANT EXECUTE ON PROCEDURE prom_api.execute_maintenance(boolean) TO prom_maintenance;
CREATE OR REPLACE PROCEDURE _prom_catalog.execute_maintenance_job(job_id int, config jsonb)
AS $$
DECLARE
log_verbose boolean;
ae_key text;
ae_value text;
ae_load boolean := FALSE;
BEGIN
log_verbose := coalesce(config->>'log_verbose', 'false')::boolean;
--if auto_explain enabled in config, turn it on in a best-effort way
--i.e. if it fails (most likely due to lack of superuser priviliges) move on anyway.
BEGIN
FOR ae_key, ae_value IN
SELECT * FROM jsonb_each_text(config->'auto_explain')
LOOP
IF NOT ae_load THEN
ae_load := true;
LOAD 'auto_explain';
END IF;
PERFORM set_config('auto_explain.'|| ae_key, ae_value, FALSE);
END LOOP;
EXCEPTION WHEN OTHERS THEN
RAISE WARNING 'could not set auto_explain options';
END;
CALL prom_api.execute_maintenance(log_verbose=>log_verbose);
END
$$ LANGUAGE PLPGSQL;
CREATE OR REPLACE FUNCTION prom_api.config_maintenance_jobs(number_jobs int, new_schedule_interval interval, new_config jsonb = NULL)
RETURNS BOOLEAN
AS $func$
DECLARE
cnt int;
log_verbose boolean;
BEGIN
--check format of config
log_verbose := coalesce(new_config->>'log_verbose', 'false')::boolean;
PERFORM public.delete_job(job_id)
FROM timescaledb_information.jobs
WHERE proc_schema = '_prom_catalog' AND proc_name = 'execute_maintenance_job' AND (schedule_interval != new_schedule_interval OR new_config IS DISTINCT FROM config) ;
SELECT count(*) INTO cnt
FROM timescaledb_information.jobs
WHERE proc_schema = '_prom_catalog' AND proc_name = 'execute_maintenance_job';
IF cnt < number_jobs THEN
PERFORM public.add_job('_prom_catalog.execute_maintenance_job', new_schedule_interval, config=>new_config)
FROM generate_series(1, number_jobs-cnt);
END IF;
IF cnt > number_jobs THEN
PERFORM public.delete_job(job_id)
FROM timescaledb_information.jobs
WHERE proc_schema = '_prom_catalog' AND proc_name = 'execute_maintenance_job'
LIMIT (cnt-number_jobs);
END IF;
RETURN TRUE;
END
$func$
LANGUAGE PLPGSQL VOLATILE
--security definer to add jobs as the logged-in user
SECURITY DEFINER
--search path must be set for security definer
SET search_path = pg_temp;
--redundant given schema settings but extra caution for security definers
REVOKE ALL ON FUNCTION prom_api.config_maintenance_jobs(int, interval, jsonb) FROM PUBLIC;
GRANT EXECUTE ON FUNCTION prom_api.config_maintenance_jobs(int, interval, jsonb) TO prom_admin;
COMMENT ON FUNCTION prom_api.config_maintenance_jobs(int, interval, jsonb)
IS 'Configure the number of maintence jobs run by the job scheduler, as well as their scheduled interval'; | the_stack |
-- Default users
INSERT INTO sysuser (sysuser_id, sysuser_apikey, sysuser_login, sysuser_group_id, sysuser_created, sysuser_updated)
VALUES ('ca19d4e7-92f0-42f6-926a-68413bbdafbc', 'FE868D4F-797C-4E60-B876-64E6FC2424AA', 'sys', '7c536b66-d292-4369-8f37-948b32229b83',
GETDATE(), GETDATE());
-- Default groups
INSERT INTO sysgroup (sysgroup_id, sysgroup_parent_id, sysgroup_name, sysgroup_description, sysgroup_created,
sysgroup_updated, sysgroup_created_by, sysgroup_updated_by)
VALUES ('7c536b66-d292-4369-8f37-948b32229b83', NULL, 'Systemadministrator', 'System administrator group with full permissions.',
GETDATE(), GETDATE(), 'ca19d4e7-92f0-42f6-926a-68413bbdafbc', 'ca19d4e7-92f0-42f6-926a-68413bbdafbc');
INSERT INTO sysgroup (sysgroup_id, sysgroup_parent_id, sysgroup_name, sysgroup_description, sysgroup_created,
sysgroup_updated, sysgroup_created_by, sysgroup_updated_by)
VALUES ('8940b41a-e3a9-44f3-b564-bfd281416141', '7c536b66-d292-4369-8f37-948b32229b83', 'Administrator',
'Web site administrator group.', GETDATE(), GETDATE(),
'ca19d4e7-92f0-42f6-926a-68413bbdafbc', 'ca19d4e7-92f0-42f6-926a-68413bbdafbc');
-- Default access
INSERT INTO sysaccess (sysaccess_id, sysaccess_group_id, sysaccess_function, sysaccess_description, sysaccess_locked,
sysaccess_created, sysaccess_updated, sysaccess_created_by, sysaccess_updated_by)
VALUES ('4fbdedb7-10ec-4a10-8f82-7d4c5cf61f2c', '8940b41a-e3a9-44f3-b564-bfd281416141', 'ADMIN',
'Access to login to the admin panel.', 1, GETDATE(), GETDATE(),
'ca19d4e7-92f0-42f6-926a-68413bbdafbc', 'ca19d4e7-92f0-42f6-926a-68413bbdafbc');
INSERT INTO sysaccess (sysaccess_id, sysaccess_group_id, sysaccess_function, sysaccess_description, sysaccess_locked,
sysaccess_created, sysaccess_updated, sysaccess_created_by, sysaccess_updated_by)
VALUES ('00074fd5-6c81-4181-8a09-ba6ef94f8364', '7c536b66-d292-4369-8f37-948b32229b83',
'ADMIN_PAGE_TEMPLATE', 'Access to add, update and delete page types.', 1, GETDATE(), GETDATE(),
'ca19d4e7-92f0-42f6-926a-68413bbdafbc', 'ca19d4e7-92f0-42f6-926a-68413bbdafbc');
INSERT INTO sysaccess (sysaccess_id, sysaccess_group_id, sysaccess_function, sysaccess_description, sysaccess_locked,
sysaccess_created, sysaccess_updated, sysaccess_created_by, sysaccess_updated_by)
VALUES ('ff296d65-d24d-446a-8f02-d93a7ab57086', '7c536b66-d292-4369-8f37-948b32229b83',
'ADMIN_POST_TEMPLATE', 'Access to add, update and delete post types.', 1, GETDATE(), GETDATE(),
'ca19d4e7-92f0-42f6-926a-68413bbdafbc', 'ca19d4e7-92f0-42f6-926a-68413bbdafbc');
INSERT INTO sysaccess (sysaccess_id, sysaccess_group_id, sysaccess_function, sysaccess_description, sysaccess_locked,
sysaccess_created, sysaccess_updated, sysaccess_created_by, sysaccess_updated_by)
VALUES ('0c19578a-d6c0-45f8-9ffd-bcffa5d84772', '7c536b66-d292-4369-8f37-948b32229b83',
'ADMIN_PARAM', 'Access to add, update and delete system parameters.', 1, GETDATE(), GETDATE(),
'ca19d4e7-92f0-42f6-926a-68413bbdafbc', 'ca19d4e7-92f0-42f6-926a-68413bbdafbc');
INSERT INTO sysaccess (sysaccess_id, sysaccess_group_id, sysaccess_function, sysaccess_description, sysaccess_locked,
sysaccess_created, sysaccess_updated, sysaccess_created_by, sysaccess_updated_by)
VALUES ('0f367b04-ef7b-4007-88bd-7d78cbdea64a', '7c536b66-d292-4369-8f37-948b32229b83',
'ADMIN_ACCESS', 'Access to add, update and delete access rules.', 1, GETDATE(), GETDATE(),
'ca19d4e7-92f0-42f6-926a-68413bbdafbc', 'ca19d4e7-92f0-42f6-926a-68413bbdafbc');
INSERT INTO sysaccess (sysaccess_id, sysaccess_group_id, sysaccess_function, sysaccess_description, sysaccess_locked,
sysaccess_created, sysaccess_updated, sysaccess_created_by, sysaccess_updated_by)
VALUES ('08d17dbf-cd1d-40a9-b558-0866210ac4ec', '8940b41a-e3a9-44f3-b564-bfd281416141',
'ADMIN_GROUP', 'Access to add, update and delete user groups.', 1, GETDATE(), GETDATE(),
'ca19d4e7-92f0-42f6-926a-68413bbdafbc', 'ca19d4e7-92f0-42f6-926a-68413bbdafbc');
INSERT INTO sysaccess (sysaccess_id, sysaccess_group_id, sysaccess_function, sysaccess_description, sysaccess_locked,
sysaccess_created, sysaccess_updated, sysaccess_created_by, sysaccess_updated_by)
VALUES ('36fbc1ad-4e17-4767-9fdc-af92802e5ebb', '8940b41a-e3a9-44f3-b564-bfd281416141',
'ADMIN_PAGE', 'Access to add and update pages.', 1, GETDATE(), GETDATE(),
'ca19d4e7-92f0-42f6-926a-68413bbdafbc', 'ca19d4e7-92f0-42f6-926a-68413bbdafbc');
INSERT INTO sysaccess (sysaccess_id, sysaccess_group_id, sysaccess_function, sysaccess_description, sysaccess_locked,
sysaccess_created, sysaccess_updated, sysaccess_created_by, sysaccess_updated_by)
VALUES ('c8b44826-d3e6-4add-b241-8ce95429a17e', '8940b41a-e3a9-44f3-b564-bfd281416141',
'ADMIN_POST', 'Access to add and update posts.', 1, GETDATE(), GETDATE(),
'ca19d4e7-92f0-42f6-926a-68413bbdafbc', 'ca19d4e7-92f0-42f6-926a-68413bbdafbc');
INSERT INTO sysaccess (sysaccess_id, sysaccess_group_id, sysaccess_function, sysaccess_description, sysaccess_locked,
sysaccess_created, sysaccess_updated, sysaccess_created_by, sysaccess_updated_by)
VALUES ('79ED0E9E-188C-4C5B-81BA-DB15BB9F8AD5', '8940b41a-e3a9-44f3-b564-bfd281416141',
'ADMIN_CATEGORY', 'Access to add, update and delete categories.', 1, GETDATE(), GETDATE(),
'ca19d4e7-92f0-42f6-926a-68413bbdafbc', 'ca19d4e7-92f0-42f6-926a-68413bbdafbc');
INSERT INTO sysaccess (sysaccess_id, sysaccess_group_id, sysaccess_function, sysaccess_description, sysaccess_locked,
sysaccess_created, sysaccess_updated, sysaccess_created_by, sysaccess_updated_by)
VALUES ('E08AE820-D438-4A38-B6E1-AC3ACA3CF933', '8940b41a-e3a9-44f3-b564-bfd281416141',
'ADMIN_CONTENT', 'Access to add and update images & documents.', 1, GETDATE(), GETDATE(),
'ca19d4e7-92f0-42f6-926a-68413bbdafbc', 'ca19d4e7-92f0-42f6-926a-68413bbdafbc');
INSERT INTO sysaccess (sysaccess_id, sysaccess_group_id, sysaccess_function, sysaccess_description, sysaccess_locked,
sysaccess_created, sysaccess_updated, sysaccess_created_by, sysaccess_updated_by)
VALUES ('8a4ca0f3-261b-4689-8c1f-98065b65f9ee', '8940b41a-e3a9-44f3-b564-bfd281416141',
'ADMIN_USER', 'Access to add, update and delete users.', 1, GETDATE(), GETDATE(),
'ca19d4e7-92f0-42f6-926a-68413bbdafbc', 'ca19d4e7-92f0-42f6-926a-68413bbdafbc');
INSERT INTO sysaccess (sysaccess_id, sysaccess_group_id, sysaccess_function, sysaccess_description, sysaccess_locked,
sysaccess_created, sysaccess_updated, sysaccess_created_by, sysaccess_updated_by)
VALUES ('f65bd7dd-6dfe-45b7-87e3-20a11e1f8d55', '8940b41a-e3a9-44f3-b564-bfd281416141', 'ADMIN_COMMENT',
'Access to administrate comments.', 1, GETDATE(), GETDATE(),
'ca19d4e7-92f0-42f6-926a-68413bbdafbc', 'ca19d4e7-92f0-42f6-926a-68413bbdafbc');
INSERT INTO sysaccess (sysaccess_id, sysaccess_group_id, sysaccess_function, sysaccess_description, sysaccess_locked,
sysaccess_created, sysaccess_updated, sysaccess_created_by, sysaccess_updated_by)
VALUES ('f71ca1b9-1276-4c3e-a090-5fba6c4980ce', '8940b41a-e3a9-44f3-b564-bfd281416141', 'ADMIN_SITETREE',
'Access to administrate site trees.', 1, GETDATE(), GETDATE(),
'ca19d4e7-92f0-42f6-926a-68413bbdafbc', 'ca19d4e7-92f0-42f6-926a-68413bbdafbc');
INSERT INTO sysaccess (sysaccess_id, sysaccess_group_id, sysaccess_function, sysaccess_description, sysaccess_locked,
sysaccess_created, sysaccess_updated, sysaccess_created_by, sysaccess_updated_by)
VALUES ('da291f10-5bb6-44a5-ae20-1c9932c870e9', '8940b41a-e3a9-44f3-b564-bfd281416141',
'ADMIN_PAGE_PUBLISH', 'Access to publish, depublish and delete pages.', 1, GETDATE(), GETDATE(),
'ca19d4e7-92f0-42f6-926a-68413bbdafbc', 'ca19d4e7-92f0-42f6-926a-68413bbdafbc');
INSERT INTO sysaccess (sysaccess_id, sysaccess_group_id, sysaccess_function, sysaccess_description, sysaccess_locked,
sysaccess_created, sysaccess_updated, sysaccess_created_by, sysaccess_updated_by)
VALUES ('1bb90c7d-f3dd-43fe-aff5-985368d316e6', '8940b41a-e3a9-44f3-b564-bfd281416141',
'ADMIN_POST_PUBLISH', 'Access to publish, depublish and delete posts.', 1, GETDATE(), GETDATE(),
'ca19d4e7-92f0-42f6-926a-68413bbdafbc', 'ca19d4e7-92f0-42f6-926a-68413bbdafbc');
INSERT INTO sysaccess (sysaccess_id, sysaccess_group_id, sysaccess_function, sysaccess_description, sysaccess_locked,
sysaccess_created, sysaccess_updated, sysaccess_created_by, sysaccess_updated_by)
VALUES ('222119de-a510-427f-92ff-3d357bdf0c2c', '8940b41a-e3a9-44f3-b564-bfd281416141',
'ADMIN_CONTENT_PUBLISH', 'Access to publish, depublish and delete images & documents.', 1, GETDATE(), GETDATE(),
'ca19d4e7-92f0-42f6-926a-68413bbdafbc', 'ca19d4e7-92f0-42f6-926a-68413bbdafbc');
-- Default params
INSERT INTO sysparam (sysparam_id, sysparam_name, sysparam_value, sysparam_description, sysparam_locked,
sysparam_created, sysparam_updated, sysparam_created_by, sysparam_updated_by)
VALUES ('9a14664f-806d-4a4f-9a72-e8368fb358d5', 'SITE_VERSION', '38', 'The currently installed version of Piranha.', 1,
GETDATE(), GETDATE(), 'ca19d4e7-92f0-42f6-926a-68413bbdafbc', 'ca19d4e7-92f0-42f6-926a-68413bbdafbc');
INSERT INTO sysparam (sysparam_id, sysparam_name, sysparam_value, sysparam_description, sysparam_locked,
sysparam_created, sysparam_updated, sysparam_created_by, sysparam_updated_by)
VALUES ('CF06BF4C-C426-4047-8E5E-6E0082AAF1BF', 'SITE_LAST_MODIFIED', GETDATE(), 'Global last modification date.', 1,
GETDATE(), GETDATE(), 'ca19d4e7-92f0-42f6-926a-68413bbdafbc', 'ca19d4e7-92f0-42f6-926a-68413bbdafbc');
INSERT INTO sysparam (sysparam_id, sysparam_name, sysparam_value, sysparam_description, sysparam_locked,
sysparam_created, sysparam_updated, sysparam_created_by, sysparam_updated_by)
VALUES ('C08B1891-ABA2-4E0D-AD61-2ABDFBA81A59', 'CACHE_PUBLIC_EXPIRES', 0, 'How many minutes browsers are allowed to cache public content.', 1,
GETDATE(), GETDATE(), 'ca19d4e7-92f0-42f6-926a-68413bbdafbc', 'ca19d4e7-92f0-42f6-926a-68413bbdafbc');
INSERT INTO sysparam (sysparam_id, sysparam_name, sysparam_value, sysparam_description, sysparam_locked,
sysparam_created, sysparam_updated, sysparam_created_by, sysparam_updated_by)
VALUES ('48BDF688-BA95-46B4-91C7-6A8430F387FF', 'CACHE_PUBLIC_MAXAGE', 0, 'How many minutes cached content is valid in the browser.', 1,
GETDATE(), GETDATE(), 'ca19d4e7-92f0-42f6-926a-68413bbdafbc', 'ca19d4e7-92f0-42f6-926a-68413bbdafbc');
INSERT INTO sysparam (sysparam_id, sysparam_name, sysparam_value, sysparam_description, sysparam_locked,
sysparam_created, sysparam_updated, sysparam_created_by, sysparam_updated_by)
VALUES ('08E8A582-7825-43B2-A12D-2522889F04BE', 'IMAGE_MAX_WIDTH', 940, 'Maximum width for uploaded images.', 1,
GETDATE(), GETDATE(), 'ca19d4e7-92f0-42f6-926a-68413bbdafbc', 'ca19d4e7-92f0-42f6-926a-68413bbdafbc');
INSERT INTO sysparam (sysparam_id, sysparam_name, sysparam_value, sysparam_description, sysparam_locked,
sysparam_created, sysparam_updated, sysparam_created_by, sysparam_updated_by)
VALUES ('095502DD-D655-4001-86F9-97D18222A548', 'SITEMAP_EXPANDED_LEVELS', '0', 'The number of pre-expanded levels in the manager panel for the page list.', 1,
GETDATE(), GETDATE(), 'ca19d4e7-92f0-42f6-926a-68413bbdafbc', 'ca19d4e7-92f0-42f6-926a-68413bbdafbc');
INSERT INTO sysparam (sysparam_id, sysparam_name, sysparam_value, sysparam_description, sysparam_locked,
sysparam_created, sysparam_updated, sysparam_created_by, sysparam_updated_by)
VALUES ('40230360-71CE-441E-A8DF-D50CFA79ACC2', 'RSS_NUM_POSTS', 10, 'The maximum number posts to be exported in a feed. For an infinite amount of posts, use the value 0.', 1,
GETDATE(), GETDATE(), 'ca19d4e7-92f0-42f6-926a-68413bbdafbc', 'ca19d4e7-92f0-42f6-926a-68413bbdafbc');
INSERT INTO sysparam (sysparam_id, sysparam_name, sysparam_value, sysparam_description, sysparam_locked,
sysparam_created, sysparam_updated, sysparam_created_by, sysparam_updated_by)
VALUES ('A64A8479-8125-47BA-9980-B30B36E744D3', 'RSS_USE_EXCERPT', '1', 'Weather to use an excerpt in the feeds or export the full content.', 1,
GETDATE(), GETDATE(), 'ca19d4e7-92f0-42f6-926a-68413bbdafbc', 'ca19d4e7-92f0-42f6-926a-68413bbdafbc');
INSERT INTO sysparam (sysparam_id, sysparam_name, sysparam_value, sysparam_description, sysparam_locked,
sysparam_created, sysparam_updated, sysparam_created_by, sysparam_updated_by)
VALUES ('5A0D6307-F041-41A1-B63A-563E712F3B8C', 'HIERARCHICAL_PERMALINKS', '0', 'Weather or not permalink generation should be hierarchical.', 1,
GETDATE(), GETDATE(), 'ca19d4e7-92f0-42f6-926a-68413bbdafbc', 'ca19d4e7-92f0-42f6-926a-68413bbdafbc');
INSERT INTO sysparam (sysparam_id, sysparam_name, sysparam_value, sysparam_description, sysparam_locked,
sysparam_created, sysparam_updated, sysparam_created_by, sysparam_updated_by)
VALUES ('4C694949-DEE0-465E-AB08-253927BDCBD8', 'SITE_PRIVATE_KEY', SUBSTRING(REPLACE(CAST(NEWID() AS NVARCHAR(38)), '-', ''), 1, 16), 'The private key used for public key encryption.', 1,
GETDATE(), GETDATE(), 'ca19d4e7-92f0-42f6-926a-68413bbdafbc', 'ca19d4e7-92f0-42f6-926a-68413bbdafbc');
-- Default templates
INSERT INTO pagetemplate (pagetemplate_id, pagetemplate_name, pagetemplate_description,
pagetemplate_preview, pagetemplate_created, pagetemplate_updated, pagetemplate_created_by, pagetemplate_updated_by)
VALUES ('906761ea-6c04-4f4b-9365-f2c350ff4372', 'Standard page', 'Standard page type.',
'<table class="template"><tr><td id="Content"></td></tr></table>', GETDATE(), GETDATE(),
'ca19d4e7-92f0-42f6-926a-68413bbdafbc', 'ca19d4e7-92f0-42f6-926a-68413bbdafbc');
INSERT INTO posttemplate (posttemplate_id, posttemplate_name, posttemplate_description, posttemplate_preview,
posttemplate_created, posttemplate_updated, posttemplate_created_by, posttemplate_updated_by)
VALUES ('5017dbe4-5685-4941-921b-ca922edc7a12', 'Standard post', 'Standard post type.',
'<table class="template"><tr><td></td></tr></table>', GETDATE(), GETDATE(),
'ca19d4e7-92f0-42f6-926a-68413bbdafbc', 'ca19d4e7-92f0-42f6-926a-68413bbdafbc');
INSERT INTO regiontemplate (regiontemplate_id, regiontemplate_template_id, regiontemplate_internal_id, regiontemplate_seqno,
regiontemplate_name, regiontemplate_type, regiontemplate_created, regiontemplate_updated,
regiontemplate_created_by, regiontemplate_updated_by)
VALUES ('96ADAC79-5DC5-453D-A0DE-A6871D74FD99', '906761ea-6c04-4f4b-9365-f2c350ff4372', 'Content', 1,
'Content', 'Piranha.Extend.Regions.HtmlRegion', GETDATE(), GETDATE(),
'ca19d4e7-92f0-42f6-926a-68413bbdafbc', 'ca19d4e7-92f0-42f6-926a-68413bbdafbc');
-- Default namespaces
INSERT INTO [namespace] ([namespace_id], [namespace_internal_id], [namespace_name], [namespace_description], [namespace_created], [namespace_updated],
[namespace_created_by], [namespace_updated_by])
VALUES ('8FF4A4B4-9B6C-4176-AAA2-DB031D75AC03', 'DEFAULT', 'Default namespace', 'This is the default namespace for all pages and posts.',
GETDATE(), GETDATE(), 'ca19d4e7-92f0-42f6-926a-68413bbdafbc', 'ca19d4e7-92f0-42f6-926a-68413bbdafbc');
INSERT INTO [namespace] ([namespace_id], [namespace_internal_id], [namespace_name], [namespace_description], [namespace_created], [namespace_updated],
[namespace_created_by], [namespace_updated_by])
VALUES ('AE46C4C4-20F7-4582-888D-DFC148FE9067', 'CATEGORY', 'Category namespace', 'This is the namespace for all categories.',
GETDATE(), GETDATE(), 'ca19d4e7-92f0-42f6-926a-68413bbdafbc', 'ca19d4e7-92f0-42f6-926a-68413bbdafbc');
INSERT INTO [namespace] ([namespace_id], [namespace_internal_id], [namespace_name], [namespace_description], [namespace_created], [namespace_updated],
[namespace_created_by], [namespace_updated_by])
VALUES ('C8342FB4-D38E-4EAF-BBC1-4EF3BDD7500C', 'ARCHIVE', 'Archive namespace', 'This is the archive namespace for all post types.',
GETDATE(), GETDATE(), 'ca19d4e7-92f0-42f6-926a-68413bbdafbc', 'ca19d4e7-92f0-42f6-926a-68413bbdafbc');
INSERT INTO [namespace] ([namespace_id], [namespace_internal_id], [namespace_name], [namespace_description], [namespace_created], [namespace_updated],
[namespace_created_by], [namespace_updated_by])
VALUES ('368249B1-7F9C-4974-B9E3-A55D068DD9B6', 'MEDIA', 'Media namespace', 'This is the media namespace for all images & documents.',
GETDATE(), GETDATE(), 'ca19d4e7-92f0-42f6-926a-68413bbdafbc', 'ca19d4e7-92f0-42f6-926a-68413bbdafbc');
-- Default site tree
INSERT INTO [sitetree] ([sitetree_id], [sitetree_namespace_id], [sitetree_internal_id], [sitetree_name], [sitetree_description], [sitetree_meta_title],
[sitetree_meta_description], [sitetree_created], [sitetree_updated], [sitetree_created_by], [sitetree_updated_by])
VALUES ('C2F87B2B-F585-4696-8A2B-3C9DF882701E', '8FF4A4B4-9B6C-4176-AAA2-DB031D75AC03', 'DEFAULT_SITE', 'Default site', 'This is the default site tree.',
'My site', 'Welcome the the template site', GETDATE(), GETDATE(), 'CA19D4E7-92F0-42F6-926A-68413BBDAFBC', 'CA19D4E7-92F0-42F6-926A-68413BBDAFBC');
-- Add site template and page for the default site
INSERT INTO pagetemplate (pagetemplate_id, pagetemplate_name, pagetemplate_site_template,
pagetemplate_created, pagetemplate_updated, pagetemplate_created_by, pagetemplate_updated_by)
VALUES ('C2F87B2B-F585-4696-8A2B-3C9DF882701E', 'C2F87B2B-F585-4696-8A2B-3C9DF882701E', 1,
GETDATE(), GETDATE(), 'ca19d4e7-92f0-42f6-926a-68413bbdafbc', 'ca19d4e7-92f0-42f6-926a-68413bbdafbc');
INSERT INTO permalink (permalink_id, permalink_namespace_id, permalink_type, permalink_name, permalink_created,
permalink_updated, permalink_created_by, permalink_updated_by)
VALUES ('2E168001-D113-4216-ACC5-03C61C2D0C21', '8FF4A4B4-9B6C-4176-AAA2-DB031D75AC03', 'SITE', 'C2F87B2B-F585-4696-8A2B-3C9DF882701E',
GETDATE(), GETDATE(), 'ca19d4e7-92f0-42f6-926a-68413bbdafbc', 'ca19d4e7-92f0-42f6-926a-68413bbdafbc');
INSERT INTO page (page_id, page_sitetree_id, page_draft, page_template_id, page_permalink_id, page_parent_id, page_seqno, page_title,
page_created, page_updated, page_published, page_last_published, page_created_by, page_updated_by)
VALUES ('94823A5C-1E29-4BDB-84E4-9B5F636CDDB5', 'C2F87B2B-F585-4696-8A2B-3C9DF882701E', 1, 'C2F87B2B-F585-4696-8A2B-3C9DF882701E', '2E168001-D113-4216-ACC5-03C61C2D0C21',
'C2F87B2B-F585-4696-8A2B-3C9DF882701E', 1, 'C2F87B2B-F585-4696-8A2B-3C9DF882701E', GETDATE(), GETDATE(), GETDATE(), GETDATE(),
'ca19d4e7-92f0-42f6-926a-68413bbdafbc', 'ca19d4e7-92f0-42f6-926a-68413bbdafbc');
INSERT INTO page (page_id, page_sitetree_id, page_draft, page_template_id, page_permalink_id, page_parent_id, page_seqno, page_title,
page_created, page_updated, page_published, page_last_published, page_created_by, page_updated_by)
VALUES ('94823A5C-1E29-4BDB-84E4-9B5F636CDDB5', 'C2F87B2B-F585-4696-8A2B-3C9DF882701E', 0, 'C2F87B2B-F585-4696-8A2B-3C9DF882701E', '2E168001-D113-4216-ACC5-03C61C2D0C21',
'C2F87B2B-F585-4696-8A2B-3C9DF882701E', 1, 'C2F87B2B-F585-4696-8A2B-3C9DF882701E', GETDATE(), GETDATE(), GETDATE(), GETDATE(),
'ca19d4e7-92f0-42f6-926a-68413bbdafbc', 'ca19d4e7-92f0-42f6-926a-68413bbdafbc');
-- Permalink
INSERT INTO permalink (permalink_id, permalink_namespace_id, permalink_type, permalink_name, permalink_created,
permalink_updated, permalink_created_by, permalink_updated_by)
VALUES ('1e64c1d4-e24f-4c7c-8f61-f3a75ad2e2fe', '8FF4A4B4-9B6C-4176-AAA2-DB031D75AC03', 'PAGE', 'start', GETDATE(), GETDATE(),
'ca19d4e7-92f0-42f6-926a-68413bbdafbc', 'ca19d4e7-92f0-42f6-926a-68413bbdafbc');
-- Default page
INSERT INTO page (page_id, page_sitetree_id, page_draft, page_template_id, page_permalink_id, page_seqno, page_title, page_keywords, page_description,
page_created, page_updated, page_published, page_last_published, page_last_modified, page_created_by, page_updated_by)
VALUES ('7849b6d6-dc43-43f6-8b5a-5770ab89fbcf', 'C2F87B2B-F585-4696-8A2B-3C9DF882701E', 1, '906761ea-6c04-4f4b-9365-f2c350ff4372', '1e64c1d4-e24f-4c7c-8f61-f3a75ad2e2fe',
1, 'Start', 'Piranha, Welcome', 'Welcome to Piranha', GETDATE(), GETDATE(), GETDATE(), GETDATE(), GETDATE(),
'ca19d4e7-92f0-42f6-926a-68413bbdafbc', 'ca19d4e7-92f0-42f6-926a-68413bbdafbc');
INSERT INTO page (page_id, page_sitetree_id, page_draft, page_template_id, page_permalink_id, page_seqno, page_title, page_keywords, page_description,
page_created, page_updated, page_published, page_last_published, page_last_modified, page_created_by, page_updated_by)
VALUES ('7849b6d6-dc43-43f6-8b5a-5770ab89fbcf', 'C2F87B2B-F585-4696-8A2B-3C9DF882701E', 0, '906761ea-6c04-4f4b-9365-f2c350ff4372', '1e64c1d4-e24f-4c7c-8f61-f3a75ad2e2fe',
1, 'Start', 'Piranha, Welcome', 'Welcome to Piranha', GETDATE(), GETDATE(), GETDATE(), GETDATE(), GETDATE(),
'ca19d4e7-92f0-42f6-926a-68413bbdafbc', 'ca19d4e7-92f0-42f6-926a-68413bbdafbc');
-- Region
INSERT INTO region (region_id, region_draft, region_page_id, region_page_draft, region_regiontemplate_id,
region_body, region_created, region_updated, region_created_by, region_updated_by)
VALUES ('87ec4dbd-c3ba-4a6b-af49-78421528c363', 1, '7849b6d6-dc43-43f6-8b5a-5770ab89fbcf', 1, '96ADAC79-5DC5-453D-A0DE-A6871D74FD99',
'<p>Welcome to Piranha - the fun, fast and lightweight framework for developing cms-based web applications with an extra bite.</p>', GETDATE(), GETDATE(),
'ca19d4e7-92f0-42f6-926a-68413bbdafbc', 'ca19d4e7-92f0-42f6-926a-68413bbdafbc');
INSERT INTO region (region_id, region_draft, region_page_id, region_page_draft, region_regiontemplate_id,
region_body, region_created, region_updated, region_created_by, region_updated_by)
VALUES ('87ec4dbd-c3ba-4a6b-af49-78421528c363', 0, '7849b6d6-dc43-43f6-8b5a-5770ab89fbcf', 0, '96ADAC79-5DC5-453D-A0DE-A6871D74FD99',
'<p>Welcome to Piranha - the fun, fast and lightweight framework for developing cms-based web applications with an extra bite.</p>', GETDATE(), GETDATE(),
'ca19d4e7-92f0-42f6-926a-68413bbdafbc', 'ca19d4e7-92f0-42f6-926a-68413bbdafbc'); | the_stack |
-- Licensed to the Apache Software Foundation (ASF) under one
-- or more contributor license agreements. See the NOTICE file
-- distributed with this work for additional information
-- regarding copyright ownership. The ASF licenses this file
-- to you under the Apache License, Version 2.0 (the
-- "License"); you may not use this file except in compliance
-- with the License. You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing,
-- software distributed under the License is distributed on an
-- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-- KIND, either express or implied. See the License for the
-- specific language governing permissions and limitations
-- under the License.
SET foreign_key_checks = 0;
--
-- Schema upgrade from 2.0 to 2.1
--
CREATE TABLE `cloud`.`cluster` (
`id` bigint unsigned NOT NULL UNIQUE AUTO_INCREMENT COMMENT 'id',
`name` varchar(255) NOT NULL COMMENT 'name for the cluster',
`pod_id` bigint unsigned NOT NULL COMMENT 'pod id',
`data_center_id` bigint unsigned NOT NULL COMMENT 'data center id',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `cloud`.`ext_lun_alloc` (
`id` bigint unsigned NOT NULL UNIQUE AUTO_INCREMENT COMMENT 'id',
`size` bigint unsigned NOT NULL COMMENT 'virtual size',
`portal` varchar(255) NOT NULL COMMENT 'ip or host name to the storage server',
`target_iqn` varchar(255) NOT NULL COMMENT 'target iqn',
`data_center_id` bigint unsigned NOT NULL COMMENT 'data center id this belongs to',
`lun` int NOT NULL COMMENT 'lun',
`taken` datetime COMMENT 'time occupied',
`volume_id` bigint unsigned COMMENT 'vm taking this lun',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `cloud`.`ext_lun_details` (
`id` bigint unsigned NOT NULL UNIQUE AUTO_INCREMENT COMMENT 'id',
`ext_lun_id` bigint unsigned NOT NULL COMMENT 'lun id',
`tag` varchar(255) COMMENT 'tags associated with this vm',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `cloud`.`storage_pool_details` (
`id` bigint unsigned UNIQUE NOT NULL AUTO_INCREMENT COMMENT 'id',
`pool_id` bigint unsigned NOT NULL COMMENT 'pool the detail is related to',
`name` varchar(255) NOT NULL COMMENT 'name of the detail',
`value` varchar(255) NOT NULL COMMENT 'value of the detail',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `cloud`.`network_group` (
`id` bigint unsigned NOT NULL auto_increment,
`name` varchar(255) NOT NULL,
`description` varchar(4096) NULL,
`domain_id` bigint unsigned NOT NULL,
`account_id` bigint unsigned NOT NULL,
`account_name` varchar(100) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `cloud`.`network_ingress_rule` (
`id` bigint unsigned NOT NULL auto_increment,
`network_group_id` bigint unsigned NOT NULL,
`start_port` varchar(10) default NULL,
`end_port` varchar(10) default NULL,
`protocol` varchar(16) NOT NULL default 'TCP',
`allowed_network_id` bigint unsigned,
`allowed_network_group` varchar(255) COMMENT 'data duplicated from network_group table to avoid lots of joins when listing rules (the name of the group should be displayed rather than just id)',
`allowed_net_grp_acct` varchar(100) COMMENT 'data duplicated from network_group table to avoid lots of joins when listing rules (the name of the group owner should be displayed)',
`allowed_ip_cidr` varchar(44),
`create_status` varchar(32) COMMENT 'rule creation status',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `cloud`.`network_group_vm_map` (
`id` bigint unsigned NOT NULL auto_increment,
`network_group_id` bigint unsigned NOT NULL,
`instance_id` bigint unsigned NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `cloud`.`op_nwgrp_work` (
`id` bigint unsigned UNIQUE NOT NULL AUTO_INCREMENT COMMENT 'id',
`instance_id` bigint unsigned NOT NULL COMMENT 'vm instance that needs rules to be synced.',
`mgmt_server_id` bigint unsigned COMMENT 'management server that has taken up the work of doing rule sync',
`created` datetime NOT NULL COMMENT 'time the entry was requested',
`taken` datetime COMMENT 'time it was taken by the management server',
`step` varchar(32) NOT NULL COMMENT 'Step in the work',
`seq_no` bigint unsigned COMMENT 'seq number to be sent to agent, uniquely identifies ruleset update',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `cloud`.`op_vm_ruleset_log` (
`id` bigint unsigned UNIQUE NOT NULL AUTO_INCREMENT COMMENT 'id',
`instance_id` bigint unsigned NOT NULL COMMENT 'vm instance that needs rules to be synced.',
`created` datetime NOT NULL COMMENT 'time the entry was requested',
`logsequence` bigint unsigned COMMENT 'seq number to be sent to agent, uniquely identifies ruleset update',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `cloud`.`account_vlan_map` (
`id` bigint unsigned NOT NULL UNIQUE AUTO_INCREMENT,
`account_id` bigint unsigned NOT NULL COMMENT 'account id. foreign key to account table',
`vlan_db_id` bigint unsigned NOT NULL COMMENT 'database id of vlan. foreign key to vlan table',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `cloud`.`op_dc_link_local_ip_address_alloc` (
`id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT 'primary key',
`ip_address` varchar(15) NOT NULL COMMENT 'ip address',
`data_center_id` bigint unsigned NOT NULL COMMENT 'data center it belongs to',
`pod_id` bigint unsigned NOT NULL COMMENT 'pod it belongs to',
`instance_id` bigint unsigned NULL COMMENT 'instance id',
`taken` datetime COMMENT 'Date taken',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
ALTER TABLE `cloud`.`op_lock` MODIFY COLUMN `key` varchar(128) NOT NULL UNIQUE; -- add UNIQUE constraint
ALTER TABLE `cloud`.`op_lock` MODIFY COLUMN `thread` varchar(255) NOT NULL; -- change from varchar(256) to varchar(255)
ALTER TABLE `cloud`.`volumes` DROP COLUMN `name_label`;
ALTER TABLE `cloud`.`volumes` DROP COLUMN `template_name`;
ALTER TABLE `cloud`.`volumes` ADD COLUMN `pool_type` varchar(64);
ALTER TABLE `cloud`.`volumes` ADD COLUMN `recreatable` tinyint(1) unsigned NOT NULL DEFAULT 0;
ALTER TABLE `cloud`.`volumes` ADD COLUMN `device_id` bigint unsigned NULL;
--
-- after we have data migrated, we can then enforce this at postprocess-20to21.sql
-- ALTER TABLE `cloud`.`volumes` MODIFY COLUMN `disk_offering_id` bigint unsigned NOT NULL; -- add NOT NULL constraint
ALTER TABLE `cloud`.`vlan` DROP COLUMN `vlan_name`;
ALTER TABLE `cloud`.`host` ADD COLUMN `cluster_id` bigint unsigned;
--
-- enforced in postporcess-20to21.sql
ALTER TABLE `cloud`.`host_pod_ref` ADD COLUMN `gateway` varchar(255); -- need to migrage data with user input
ALTER TABLE `cloud`.`service_offering` ADD COLUMN `recreatable` tinyint(1) unsigned NOT NULL DEFAULT 0;
ALTER TABLE `cloud`.`service_offering` ADD COLUMN `tags` varchar(255);
ALTER TABLE `cloud`.`user_vm` MODIFY COLUMN `domain_router_id` bigint unsigned; -- change from NOT NULL to NULL
ALTER TABLE `cloud`.`event` ADD COLUMN `state` varchar(32) NOT NULL DEFAULT 'Completed';
ALTER TABLE `cloud`.`event` ADD COLUMN `start_id` bigint unsigned NOT NULL DEFAULT 0;
ALTER TABLE `cloud`.`disk_offering` ADD COLUMN `tags` varchar(4096);
ALTER TABLE `cloud`.`disk_offering` ADD COLUMN `created` datetime; -- will fill it with the oldest time in old data base
ALTER TABLE `cloud`.`storage_pool` ADD COLUMN `cluster_id` bigint unsigned; -- need to setup default cluster for pods
ALTER TABLE `cloud`.`vm_instance` ADD COLUMN `last_host_id` bigint unsigned;
ALTER TABLE `cloud`.`console_proxy` MODIFY COLUMN `gateway` varchar(15); -- remove NOT NULL constraint
ALTER TABLE `cloud`.`console_proxy` MODIFY COLUMN `public_netmask` varchar(15); -- remove NOT NULL constraint
ALTER TABLE `cloud`.`console_proxy` ADD COLUMN `guest_mac_address` varchar(17); -- NOT NULL UNIQUE constraint will be added in postprocess
ALTER TABLE `cloud`.`console_proxy` ADD COLUMN `guest_ip_address` varchar(15);
ALTER TABLE `cloud`.`console_proxy` ADD COLUMN `guest_netmask` varchar(15);
ALTER TABLE `cloud`.`secondary_storage_vm` MODIFY COLUMN `gateway` varchar(15); -- remove NOT NULL constraint
ALTER TABLE `cloud`.`secondary_storage_vm` MODIFY COLUMN `public_netmask` varchar(15); -- remove NOT NULL constrait
ALTER TABLE `cloud`.`secondary_storage_vm` ADD COLUMN `guest_mac_address` varchar(17); -- NOT NULL unique constrait will be added in postprocess
ALTER TABLE `cloud`.`secondary_storage_vm` ADD COLUMN `guest_ip_address` varchar(15) UNIQUE;
ALTER TABLE `cloud`.`secondary_storage_vm` ADD COLUMN `guest_netmask` varchar(15);
CREATE TABLE `cloud`.`service_offering_21` (
`id` bigint unsigned NOT NULL,
`cpu` int(10) unsigned NOT NULL COMMENT '# of cores',
`speed` int(10) unsigned NOT NULL COMMENT 'speed per core in mhz',
`ram_size` bigint unsigned NOT NULL,
`nw_rate` smallint unsigned default 200 COMMENT 'network rate throttle mbits/s',
`mc_rate` smallint unsigned default 10 COMMENT 'mcast rate throttle mbits/s',
`ha_enabled` tinyint(1) unsigned NOT NULL DEFAULT 0 COMMENT 'Enable HA',
`guest_ip_type` varchar(255) NOT NULL DEFAULT 'Virtualized' COMMENT 'Type of guest network -- direct or virtualized',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `cloud`.`disk_offering_21` (
`id` bigint unsigned NOT NULL auto_increment,
`domain_id` bigint unsigned,
`name` varchar(255) NOT NULL,
`display_text` varchar(4096) NULL COMMENT 'Description text set by the admin for display purpose only',
`disk_size` bigint unsigned NOT NULL COMMENT 'disk space in mbs',
`mirrored` tinyint(1) unsigned NOT NULL DEFAULT 1 COMMENT 'Enable mirroring?',
`type` varchar(32) COMMENT 'inheritted by who?',
`tags` varchar(4096) COMMENT 'comma separated tags about the disk_offering',
`recreatable` tinyint(1) unsigned NOT NULL DEFAULT 0 COMMENT 'The root disk is always recreatable',
`use_local_storage` tinyint(1) unsigned NOT NULL DEFAULT 0 COMMENT 'Indicates whether local storage pools should be used',
`unique_name` varchar(32) UNIQUE COMMENT 'unique name',
`removed` datetime COMMENT 'date removed',
`created` datetime COMMENT 'date the disk offering was created',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8; | the_stack |
-- phpMyAdmin SQL Dump
-- version 4.8.2
-- https://www.phpmyadmin.net/
--
-- Host: localhost
-- Generation Time: 2019-08-31 06:26:28
-- 服务器版本: 5.7.15-log
-- PHP Version: 7.2.8
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
--
-- Database: `eacoophp`
--
-- --------------------------------------------------------
--
-- 表的结构 `eacoo_action`
--
CREATE TABLE `eacoo_action` (
`id` int(11) UNSIGNED NOT NULL COMMENT '主键',
`name` varchar(30) NOT NULL COMMENT '行为唯一标识(组合控制器名+操作名)',
`depend_type` tinyint(1) UNSIGNED NOT NULL DEFAULT '0' COMMENT '来源类型。0系统,1module,2plugin,3theme',
`depend_flag` varchar(16) NOT NULL DEFAULT '' COMMENT '所属模块名',
`title` varchar(80) NOT NULL DEFAULT '' COMMENT '行为说明',
`remark` varchar(140) NOT NULL DEFAULT '' COMMENT '行为描述',
`rule` varchar(255) NOT NULL DEFAULT '' COMMENT '行为规则',
`log` varchar(255) NOT NULL DEFAULT '' COMMENT '日志规则',
`action_type` tinyint(1) UNSIGNED NOT NULL DEFAULT '1' COMMENT '执行类型。1自定义操作,2记录操作',
`create_time` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '创建时间',
`update_time` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '修改时间',
`status` tinyint(1) NOT NULL DEFAULT '1' COMMENT '状态。0禁用,1启用'
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='系统行为表' ROW_FORMAT=DYNAMIC;
--
-- 转存表中的数据 `eacoo_action`
--
INSERT INTO `eacoo_action` (`id`, `name`, `depend_type`, `depend_flag`, `title`, `remark`, `rule`, `log`, `action_type`, `create_time`, `update_time`, `status`) VALUES
(1, 'login_index', 1, 'admin', '登录后台', '用户登录后台', '', '[user|get_nickname]在[time|time_format]登录了后台', 1, '2018-09-30 22:32:26', '2018-09-30 22:32:26', 1),
(2, 'update_config', 1, 'admin', '更新配置', '新增或修改或删除配置', '', '', 2, '2018-09-30 22:32:26', '2018-09-30 22:32:26', 1),
(3, 'update_channel', 1, 'admin', '更新导航', '新增或修改或删除导航', '', '', 2, '2018-09-30 22:32:26', '2018-09-30 22:32:26', 1),
(4, 'update_category', 1, 'admin', '更新分类', '新增或修改或删除分类', '', '', 2, '2018-09-30 22:32:26', '2018-09-30 22:32:26', 1),
(5, 'database_export', 1, 'admin', '数据库备份', '后台进行数据库备份操作', '', '', 1, '2018-09-30 22:32:26', '2018-09-30 22:32:26', 1),
(6, 'database_optimize', 1, 'admin', '数据表优化', '数据库管理-》数据表优化', '', '', 1, '2018-09-30 22:32:26', '2018-09-30 22:32:26', 1),
(7, 'database_repair', 1, 'admin', '数据表修复', '数据库管理-》数据表修复', '', '', 1, '2018-09-30 22:32:26', '2018-09-30 22:32:26', 1),
(8, 'database_delbackup', 1, 'admin', '备份文件删除', '数据库管理-》备份文件删除', '', '', 1, '2018-09-30 22:32:26', '2018-09-30 22:32:26', 1),
(9, 'database_import', 1, 'admin', '数据库完成', '数据库管理-》数据还原', '', '', 1, '2018-09-30 22:32:26', '2018-09-30 22:32:26', 1),
(10, 'delete_actionlog', 1, 'admin', '删除行为日志', '后台删除用户行为日志', '', '', 1, '2018-09-30 22:32:26', '2018-09-30 22:32:26', 1),
(11, 'user_register', 1, 'admin', '注册', '', '', '', 1, '2018-09-30 22:32:26', '2018-09-30 22:32:26', 1),
(12, 'action_add', 1, 'admin', '添加行为', '', '', '', 1, '2018-09-30 22:32:26', '2018-09-30 22:32:26', 1),
(13, 'action_edit', 1, 'admin', '编辑用户行为', '', '', '', 1, '2018-09-30 22:32:26', '2018-09-30 22:32:26', 1),
(14, 'action_dellog', 1, 'admin', '清空日志', '清空所有行为日志', '', '', 1, '2018-09-30 22:32:26', '2018-09-30 22:32:26', 1),
(15, 'setstatus', 1, 'admin', '改变数据状态', '通过列表改变了数据的status状态值', '', '', 1, '2018-09-30 22:32:26', '2018-09-30 22:32:26', 1),
(16, 'modules_delapp', 1, 'admin', '删除模块', '删除整个模块的时候记录', '', '', 2, '2018-09-30 22:32:26', '2018-09-30 22:32:26', 1);
-- --------------------------------------------------------
--
-- 表的结构 `eacoo_action_log`
--
CREATE TABLE `eacoo_action_log` (
`id` int(11) UNSIGNED NOT NULL COMMENT '主键',
`action_id` int(10) UNSIGNED NOT NULL COMMENT '行为ID',
`is_admin` tinyint(1) UNSIGNED NOT NULL DEFAULT '0' COMMENT '是否后台操作。0否,1是',
`uid` int(11) UNSIGNED NOT NULL DEFAULT '0' COMMENT '执行用户id(管理员用户)',
`nickname` varchar(60) NOT NULL DEFAULT '' COMMENT '用户名',
`request_method` varchar(20) NOT NULL DEFAULT '' COMMENT '请求类型',
`url` varchar(120) NOT NULL DEFAULT '' COMMENT '操作页面',
`data` varchar(300) NOT NULL DEFAULT '0' COMMENT '相关数据,json格式',
`ip` varchar(18) NOT NULL COMMENT 'IP',
`remark` varchar(255) NOT NULL DEFAULT '' COMMENT '日志备注',
`user_agent` varchar(360) NOT NULL DEFAULT '' COMMENT 'User-Agent',
`create_time` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '操作时间'
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='系统行为日志表' ROW_FORMAT=DYNAMIC;
-- --------------------------------------------------------
--
-- 表的结构 `eacoo_admin`
--
CREATE TABLE `eacoo_admin` (
`uid` mediumint(8) UNSIGNED NOT NULL COMMENT '管理员UID',
`username` varchar(32) NOT NULL DEFAULT '' COMMENT '用户名',
`password` char(32) NOT NULL DEFAULT '' COMMENT '登录密码',
`nickname` varchar(60) NOT NULL DEFAULT '' COMMENT '用户昵称',
`email` varchar(100) NOT NULL DEFAULT '' COMMENT '登录邮箱',
`mobile` varchar(20) NOT NULL DEFAULT '' COMMENT '手机号',
`avatar` varchar(150) NOT NULL DEFAULT '' COMMENT '用户头像,相对于uploads/avatar目录',
`sex` smallint(1) UNSIGNED NOT NULL DEFAULT '0' COMMENT '性别;0:保密,1:男;2:女',
`description` varchar(200) NOT NULL DEFAULT '' COMMENT '个人介绍',
`login_num` tinyint(1) UNSIGNED NOT NULL DEFAULT '0' COMMENT '登录次数',
`last_login_ip` varchar(16) NOT NULL DEFAULT '' COMMENT '最后登录ip',
`last_login_time` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '最后登录时间',
`activation_auth_sign` varchar(60) NOT NULL DEFAULT '' COMMENT '激活码',
`bind_uid` int(11) UNSIGNED NOT NULL DEFAULT '0' COMMENT '绑定前台用户ID(可选)',
`create_time` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '注册时间',
`update_time` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '更新时间',
`status` tinyint(1) UNSIGNED NOT NULL DEFAULT '2' COMMENT '用户状态 0:禁用; 1:正常 ;2:待验证'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='管理员用户表';
--
-- 转存表中的数据 `eacoo_admin`
--
INSERT INTO `eacoo_admin` (`uid`, `username`, `password`, `nickname`, `email`, `mobile`, `avatar`, `sex`, `description`, `login_num`, `last_login_ip`, `last_login_time`, `activation_auth_sign`, `bind_uid`, `create_time`, `update_time`, `status`) VALUES
(2, 'xiaoyun', '499a63d9b63653edaec9dca89e2b367b', '小美', '', '', '', 0, '一位漂亮的客服', 0, '127.0.0.1', '2019-08-31 10:24:31', 'd9b23f942a144a2492a3c3d7cdd0a1ca183d1852', 0, '2019-08-18 22:21:31', '2019-08-31 10:23:28', 1),
(3, 'faithful01', '031c9ffc4b280d3e78c750163d07d275', '忠实员工', '', '', '', 0, '', 0, '127.0.0.1', '0001-01-01 00:00:00', '', 0, '2019-08-18 22:54:44', '2019-08-31 10:52:49', 1),
(4, 'admin001', '031c9ffc4b280d3e78c750163d07d275', '管理员', '', '', '', 0, '', 0, '127.0.0.1', '0001-01-01 00:00:00', '', 0, '2019-08-18 22:55:48', '2019-08-18 22:55:48', 1);
-- --------------------------------------------------------
--
-- 表的结构 `eacoo_attachment`
--
CREATE TABLE `eacoo_attachment` (
`id` int(11) UNSIGNED NOT NULL COMMENT 'ID',
`is_admin` tinyint(1) UNSIGNED NOT NULL DEFAULT '0' COMMENT '是否后台用户上传',
`uid` int(11) UNSIGNED NOT NULL DEFAULT '0' COMMENT '用户ID',
`name` varchar(255) NOT NULL DEFAULT '' COMMENT '文件名',
`path` varchar(255) NOT NULL DEFAULT '' COMMENT '文件路径',
`url` varchar(255) NOT NULL DEFAULT '' COMMENT '文件链接(暂时无用)',
`location` varchar(15) NOT NULL DEFAULT '' COMMENT '文件存储位置(或驱动)',
`path_type` varchar(20) DEFAULT 'picture' COMMENT '路径类型,存储在uploads的哪个目录中',
`ext` char(4) NOT NULL DEFAULT '' COMMENT '文件类型',
`mime_type` varchar(60) NOT NULL DEFAULT '' COMMENT '文件mime类型',
`size` int(11) UNSIGNED NOT NULL DEFAULT '0' COMMENT '文件大小',
`alt` varchar(255) DEFAULT NULL COMMENT '替代文本图像alt',
`md5` char(32) NOT NULL DEFAULT '' COMMENT '文件md5',
`sha1` char(40) NOT NULL DEFAULT '' COMMENT '文件sha1编码',
`download` int(11) UNSIGNED NOT NULL DEFAULT '0' COMMENT '下载次数',
`create_time` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '上传时间',
`update_time` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '修改时间',
`sort` mediumint(8) UNSIGNED NOT NULL DEFAULT '99' COMMENT '排序,值越小越靠前',
`status` tinyint(1) NOT NULL DEFAULT '1' COMMENT '状态'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='附件表';
--
-- 转存表中的数据 `eacoo_attachment`
--
INSERT INTO `eacoo_attachment` (`id`, `is_admin`, `uid`, `name`, `path`, `url`, `location`, `path_type`, `ext`, `mime_type`, `size`, `alt`, `md5`, `sha1`, `download`, `create_time`, `update_time`, `sort`, `status`) VALUES
(1, 1, 1, 'preg_match_imgs.jpeg', '/uploads/Editor/Picture/2016-06-12/575d4bd8d0351.jpeg', '', 'local', 'editor', 'jpeg', '', 19513, '', '4cf157e42b44c95d579ee39b0a1a48a4', 'dee76e7b39f1afaad14c1e03cfac5f6031c3c511', 0, '2018-09-30 12:32:26', '2018-09-30 22:32:26', 99, 1),
(2, 1, 1, 'gerxiangimg200x200.jpg', '/uploads/Editor/Picture/2016-06-12/575d4bfb09961.jpg', '', 'local', 'editor', 'jpg', '', 5291, 'gerxiangimg200x200', '4db879c357c4ab80c77fce8055a0785f', '480eb2e097397856b99b373214fb28c2f717dacf', 0, '2018-09-30 13:32:26', '2018-09-30 22:32:26', 99, 1),
(3, 1, 1, 'oraclmysqlzjfblhere.jpg', '/uploads/Editor/Picture/2016-06-12/575d4c691e976.jpg', '', 'local', 'editor', 'jpg', '', 23866, 'mysql', '5a3a5a781a6d9b5f0089f6058572f850', 'a17bfe395b29ba06ae5784486bcf288b3b0adfdb', 0, '2018-09-30 14:32:26', '2018-09-30 22:32:26', 99, 1),
(4, 1, 1, 'logo.png', '/logo.png', '', 'local', 'picture', 'jpg', '', 40000, 'eacoophp-logo', '', '', 0, '2018-09-30 15:12:26', '2018-09-30 22:32:26', 99, 1),
(10, 1, 1, '苹果短信-三全音 - 铃声', '/uploads/file/2016-07-27/579857b5aca95.mp3', '', 'local', 'file', 'mp3', '', 19916, NULL, 'bab00edb8d6a5cf4de5444a2e5c05009', '73cda0fb4f947dcb496153d8b896478af1247935', 0, '2018-09-30 15:15:26', '2018-09-30 22:32:26', 99, -1),
(12, 1, 1, 'music', '/uploads/file/2016-07-28/57995fe9bf0da.mp3', '', 'local', 'file', 'mp3', '', 160545, NULL, '935cd1b8950f1fdcd23d47cf791831cf', '73c318221faa081544db321bb555148f04b61f00', 0, '2018-09-30 15:16:26', '2018-09-30 22:32:26', 99, 1),
(13, 1, 1, '7751775467283337', '/uploads/picture/2016-09-26/57e8dc9d29b01.jpg', '', 'local', 'picture', 'jpg', '', 70875, NULL, '3e3bfc950aa0b6ebb56654c15fe8e392', 'c75e70753eaf36aaee10efb3682fdbd8f766d32d', 0, '2018-09-30 15:17:26', '2018-09-30 22:32:26', 99, -1),
(14, 1, 1, '4366486814073822', '/uploads/picture/2016-09-26/57e8ddebaafff.jpg', '', 'local', 'picture', 'jpg', '', 302678, NULL, 'baf2dc5ea7b80a6d73b20a2c762aec1e', 'd73fe63f5c179135b2c2e7f174d6df36e05ab3d8', 0, '2018-09-30 15:18:26', '2018-09-30 22:32:26', 99, 1),
(15, 1, 1, 'wx1image_14751583274385', '/uploads/picture/2016-09-29/wx1image_14751583274385.jpg', '', 'local', 'picture', 'jpg', '', 311261, NULL, '', '', 0, '2018-09-30 15:19:26', '2018-09-30 22:32:26', 99, 1),
(17, 1, 1, 'wx1image_14751583287356', '/uploads/picture/2016-09-29/wx1image_14751583287356.jpg', '', 'local', 'picture', 'jpg', '', 43346, NULL, '', '', 0, '2018-09-30 15:20:26', '2018-09-30 22:32:26', 99, 1),
(18, 1, 1, 'wx1image_14751583293547', '/uploads/picture/2016-09-29/wx1image_14751583293547.jpg', '', 'local', 'picture', 'jpg', '', 150688, NULL, '', '', 0, '2018-09-30 15:21:26', '2018-09-30 22:32:26', 99, 1),
(19, 1, 1, 'wx1image_14751583298683', '/uploads/picture/2016-09-29/wx1image_14751583298683.jpg', '', 'local', 'picture', 'jpg', '', 79626, NULL, '', '', 0, '2018-09-30 15:22:26', '2018-09-30 22:32:26', 99, 1),
(20, 1, 1, 'wx1image_14751583294128', '/uploads/picture/2016-09-29/wx1image_14751583294128.jpg', '', 'local', 'picture', 'jpg', '', 61008, NULL, '', '', 0, '2018-09-30 15:23:26', '2018-09-30 22:32:26', 99, 1),
(21, 1, 1, 'wx1image_14751583302886', '/uploads/picture/2016-09-29/wx1image_14751583302886.jpg', '', 'local', 'picture', 'jpg', '', 20849, NULL, '', '', 0, '2018-09-30 15:16:26', '2018-09-30 22:32:26', 99, 1),
(22, 1, 1, 'wx1image_1475158330831', '/uploads/picture/2016-09-29/wx1image_1475158330831.jpg', '', 'local', 'picture', 'jpg', '', 56265, NULL, '', '', 0, '2018-09-30 16:12:26', '2018-09-30 22:32:26', 99, 1),
(23, 1, 1, 'wx1image_1475158330180', '/uploads/picture/2016-09-29/wx1image_1475158330180.jpg', '', 'local', 'picture', 'jpg', '', 121610, NULL, '', '', 0, '2018-09-30 17:12:26', '2018-09-30 22:32:26', 99, 1),
(24, 1, 1, 'wx1image_14751583318180', '/uploads/picture/2016-09-29/wx1image_14751583318180.jpg', '', 'local', 'picture', 'jpg', '', 35555, 'url', '', '', 0, '2018-09-30 22:32:26', '2018-10-01 15:23:24', 99, 1),
(25, 1, 1, 'wx1image_1475158332231', '/uploads/picture/2016-09-29/wx1image_1475158332231.jpg', '', 'local', 'picture', 'jpg', '', 32095, NULL, '', '', 0, '2018-09-30 22:32:26', '2018-09-30 22:32:26', 99, 1),
(26, 1, 1, 'wx1image_14751583325255', '/uploads/picture/2016-09-29/wx1image_14751583325255.jpg', '', 'local', 'picture', 'jpg', '', 70088, NULL, '', '', 0, '2018-09-30 22:32:26', '2018-09-30 22:32:26', 99, 1),
(27, 1, 1, 'wx1image_14751583331037', '/uploads/picture/2016-09-29/wx1image_14751583331037.jpg', '', 'local', 'picture', 'jpg', '', 37085, NULL, '', '', 0, '2018-09-30 22:32:26', '2018-09-30 22:32:26', 99, 1),
(28, 1, 1, 'wx1image_14751583343169', '/uploads/picture/2016-09-29/wx1image_14751583343169.jpg', '', 'local', 'picture', 'jpg', '', 65279, NULL, '', '', 0, '2018-09-30 22:32:26', '2018-09-30 22:32:26', 99, 1),
(29, 1, 1, 'wx1image_14751583344810', '/uploads/picture/2016-09-29/wx1image_14751583344810.jpg', '', 'local', 'picture', 'jpg', '', 83936, NULL, '', '', 0, '2018-09-30 22:32:26', '2018-09-30 22:32:26', 99, 1),
(30, 1, 1, 'wx1image_14751583356369', '/uploads/picture/2016-09-29/wx1image_14751583356369.jpg', '', 'local', 'picture', 'jpg', '', 20032, NULL, '', '', 0, '2018-09-30 22:32:26', '2018-09-30 22:32:26', 99, 1),
(31, 1, 1, 'wx1image_14751583359328', '/uploads/picture/2016-09-29/wx1image_14751583359328.jpg', '', 'local', 'picture', 'jpg', '', 53984, NULL, '', '', 0, '2018-09-30 22:32:26', '2018-09-30 22:32:26', 99, 1),
(32, 1, 1, 'wx1image_1475158335689', '/uploads/picture/2016-09-29/wx1image_1475158335689.jpg', '', 'local', 'picture', 'jpg', '', 50399, NULL, '', '', 0, '2018-09-30 22:32:26', '2018-09-30 22:32:26', 99, 1),
(33, 1, 1, 'wx1image_14751583361694', '/uploads/picture/2016-09-29/wx1image_14751583361694.jpg', '', 'local', 'picture', 'jpg', '', 128125, NULL, '', '', 0, '2018-09-30 22:32:26', '2018-09-30 22:32:26', 99, 1),
(34, 1, 1, 'wx1image_14751583371210', '/uploads/picture/2016-09-29/wx1image_14751583371210.jpg', '', 'local', 'picture', 'jpg', '', 35090, NULL, '', '', 0, '2018-09-30 22:32:26', '2018-09-30 22:32:26', 99, 1),
(36, 1, 1, 'wx1image_14751583393940', '/uploads/picture/2016-09-29/wx1image_14751583393940.jpg', '', 'local', 'picture', 'jpg', '', 74827, NULL, '', '', 0, '2018-09-30 22:32:26', '2018-09-30 22:32:26', 99, 1),
(38, 1, 1, 'wx1image_14751587991531', '/uploads/picture/2016-09-29/wx1image_14751587991531.jpg', '', 'local', 'picture', 'jpg', '', 154175, NULL, '', '', 0, '2018-09-30 22:32:26', '2018-09-30 22:32:26', 99, 1),
(39, 1, 1, 'wx1image_14751587997094.png', '/uploads/picture/2016-09-29/wx1image_14751587997094.png', '', 'local', 'picture', 'jpg', '', 26583, NULL, '', '', 0, '2018-09-30 22:32:26', '2018-09-30 22:32:26', 99, 1),
(40, 1, 1, 'wx1image_14751587995130', '/uploads/picture/2016-09-29/wx1image_14751587995130.jpg', '', 'local', 'picture', 'jpg', '', 23625, NULL, '', '', 0, '2018-09-30 22:32:26', '2018-09-30 22:32:26', 99, 1),
(41, 1, 1, 'wx1image_14751587995676', '/uploads/picture/2016-09-29/wx1image_14751587995676.jpg', '', 'local', 'picture', 'jpg', '', 67232, NULL, '', '', 0, '2018-09-30 22:32:26', '2018-09-30 22:32:26', 99, 1),
(43, 1, 1, 'wx1image_14751588004786', '/uploads/picture/2016-09-29/wx1image_14751588004786.jpg', '', 'local', 'picture', 'jpg', '', 26779, NULL, '', '', 0, '2018-09-30 22:32:26', '2018-09-30 22:32:26', 99, 1),
(44, 1, 1, 'wx1image_14751588009825', '/uploads/picture/2016-09-29/wx1image_14751588009825.jpg', '', 'local', 'picture', 'jpg', '', 7546, NULL, '', '', 0, '2018-09-30 22:32:26', '2018-09-30 22:32:26', 99, 1),
(45, 1, 1, 'wx1image_1475158800631', '/uploads/picture/2016-09-29/wx1image_1475158800631.jpg', '', 'local', 'picture', 'jpg', '', 10713, NULL, '', '', 0, '2018-09-30 22:32:26', '2018-09-30 22:32:26', 99, 1),
(46, 1, 1, 'wx1image_14751588008193', '/uploads/picture/2016-09-29/wx1image_14751588008193.jpg', '', 'local', 'picture', 'jpg', '', 94825, NULL, '', '', 0, '2018-09-30 22:32:26', '2018-09-30 22:32:26', 99, 1),
(47, 1, 1, 'wx1image_14751588004666', '/uploads/picture/2016-09-29/wx1image_14751588004666.jpg', '', 'local', 'picture', 'jpg', '', 39592, NULL, '', '', 0, '2018-09-30 22:32:26', '2018-09-30 22:32:26', 99, 1),
(48, 1, 1, 'wx1image_14751588008768.png', '/uploads/picture/2016-09-29/wx1image_14751588008768.png', '', 'local', 'picture', 'jpg', '', 50732, NULL, '', '', 0, '2018-09-30 22:32:26', '2018-09-30 22:32:26', 99, 1),
(50, 1, 1, 'wx1image_1475158801542.png', '/uploads/picture/2016-09-29/wx1image_1475158801542.png', '', 'local', 'picture', 'jpg', '', 19383, NULL, '', '', 0, '2018-09-30 22:32:26', '2018-09-30 22:32:26', 99, 1),
(51, 1, 1, 'wx1image_14751588012312.png', '/uploads/picture/2016-09-29/wx1image_14751588012312.png', '', 'local', 'picture', 'jpg', '', 45798, NULL, '', '', 0, '2018-09-30 22:32:26', '2018-09-30 22:32:26', 99, 1),
(52, 1, 1, 'wx1image_14751588058806', '/uploads/picture/2016-09-29/wx1image_14751588058806.jpg', '', 'local', 'picture', 'jpg', '', 24855, NULL, '', '', 0, '2018-09-30 22:32:26', '2018-09-30 22:32:26', 99, 1),
(53, 1, 1, 'wx1image_14751588067284', '/uploads/picture/2016-09-29/wx1image_14751588067284.jpg', '', 'local', 'picture', 'jpg', '', 14851, NULL, '', '', 0, '2018-09-30 22:32:26', '2018-09-30 22:32:26', 99, 1),
(54, 1, 1, 'wx1image_14751588091783.png', '/uploads/picture/2016-09-29/wx1image_14751588091783.png', '', 'local', 'picture', 'jpg', '', 68781, NULL, '', '', 0, '2018-09-30 22:32:26', '2018-09-30 22:32:26', 99, 1),
(55, 1, 1, 'wx1image_14751588108673.png', '/uploads/picture/2016-09-29/wx1image_14751588108673.png', '', 'local', 'picture', 'jpg', '', 13649, NULL, '', '', 0, '2018-09-30 22:32:26', '2018-09-30 22:32:26', 99, 1),
(56, 1, 1, 'wx1image_14751588114626.png', '/uploads/picture/2016-09-29/wx1image_14751588114626.png', '', 'local', 'picture', 'jpg', '', 10724, NULL, '', '', 0, '2018-09-30 22:32:26', '2018-09-30 22:32:26', 99, 1),
(57, 1, 1, 'wx1image_14751588116216.png', '/uploads/picture/2016-09-29/wx1image_14751588116216.png', '', 'local', 'picture', 'jpg', '', 18955, NULL, '', '', 0, '2018-09-30 22:32:26', '2018-09-30 22:32:26', 99, 1),
(58, 1, 1, 'wx1image_14751588117971', '/uploads/picture/2016-09-29/wx1image_14751588117971.jpg', '', 'local', 'picture', 'jpg', '', 34171, NULL, '', '', 0, '2018-09-30 22:31:10', '2018-09-30 22:32:26', 99, 1),
(59, 1, 1, 'wx1image_14751588113400', '/uploads/picture/2016-09-29/wx1image_14751588113400.jpg', '', 'local', 'picture', 'jpg', '', 16445, NULL, '', '', 0, '2018-09-30 22:31:11', '2018-09-30 22:32:26', 99, 1),
(60, 1, 1, 'wx1image_14751588113547', '/uploads/picture/2016-09-29/wx1image_14751588113547.jpg', '', 'local', 'picture', 'jpg', '', 7062, NULL, '', '', 0, '2018-09-30 22:31:12', '2018-09-30 22:32:26', 99, 1),
(61, 1, 1, 'wx1image_14751588111003', '/uploads/picture/2016-09-29/wx1image_14751588111003.jpg', '', 'local', 'picture', 'jpg', '', 7982, NULL, '', '', 0, '2018-09-30 22:31:13', '2018-09-30 22:32:26', 99, 1),
(62, 1, 1, 'wx1image_14751588185564.png', '/uploads/picture/2016-09-29/wx1image_14751588185564.png', '', 'local', 'picture', 'jpg', '', 163203, NULL, '', '', 0, '2018-09-30 22:31:14', '2018-09-30 22:32:26', 99, 1),
(63, 1, 1, 'wx1image_14751588213497.png', '/uploads/picture/2016-09-29/wx1image_14751588213497.png', '', 'local', 'picture', 'jpg', '', 14153, NULL, '', '', 0, '2018-09-30 22:31:15', '2018-09-30 22:32:26', 99, 1),
(64, 1, 1, 'wx1image_14751588212612.png', '/uploads/picture/2016-09-29/wx1image_14751588212612.png', '', 'local', 'picture', 'jpg', '', 15962, NULL, '', '', 0, '2018-09-30 22:31:16', '2018-09-30 22:32:26', 99, 1),
(65, 1, 1, 'wx1image_14751588215121.png', '/uploads/picture/2016-09-29/wx1image_14751588215121.png', '', 'local', 'picture', 'jpg', '', 22820, NULL, '', '', 0, '2018-09-30 22:31:17', '2018-09-30 22:32:26', 99, 1),
(67, 1, 1, 'wx1image_14751588223870', '/uploads/picture/2016-09-29/wx1image_14751588223870.jpg', '', 'local', 'picture', 'jpg', '', 31690, NULL, '', '', 0, '2018-09-30 22:31:18', '2018-09-30 22:32:26', 99, 1),
(68, 1, 1, 'wx1image_14751588235543.png', '/uploads/picture/2016-09-29/wx1image_14751588235543.png', '', 'local', 'picture', 'jpg', '', 32383, NULL, '', '', 0, '2018-09-30 22:31:19', '2018-09-30 22:32:26', 99, 1),
(69, 1, 1, 'wx1image_14751588233114.png', '/uploads/picture/2016-09-29/wx1image_14751588233114.png', '', 'local', 'picture', 'jpg', '', 16871, NULL, '', '', 0, '2018-09-30 22:31:20', '2018-09-30 22:32:26', 99, 1),
(70, 1, 1, 'wx1image_14751588247501.png', '/uploads/picture/2016-09-29/wx1image_14751588247501.png', '', 'local', 'picture', 'jpg', '', 48306, '', '', '', 0, '2018-09-30 22:31:21', '2018-09-30 22:32:26', 99, 1),
(73, 1, 1, 'wx1image_1475158835506', '/uploads/picture/2016-09-29/wx1image_1475158835506.jpg', '', 'local', 'picture', 'jpg', '', 12805, NULL, '', '', 0, '2018-09-30 22:31:22', '2018-09-30 22:32:26', 99, 1),
(74, 1, 1, 'wx1image_14751588359605.png', '/uploads/picture/2016-09-29/wx1image_14751588359605.png', '', 'local', 'picture', 'jpg', '', 42306, NULL, '', '', 0, '2018-09-30 22:31:23', '2018-09-30 22:32:26', 99, 1),
(75, 1, 1, 'wx1image_14751588351768.png', '/uploads/picture/2016-09-29/wx1image_14751588351768.png', '', 'local', 'picture', 'jpg', '', 13828, NULL, '', '', 0, '2018-09-30 22:31:24', '2018-09-30 22:32:26', 99, 1),
(76, 1, 1, 'wx1image_14751588383783.png', '/uploads/picture/2016-09-29/wx1image_14751588383783.png', '', 'local', 'picture', 'jpg', '', 39390, NULL, '', '', 0, '2018-09-30 22:31:25', '2018-09-30 22:32:26', 99, 1),
(78, 1, 1, 'wx1image_14751588393130.png', '/uploads/picture/2016-09-29/wx1image_14751588393130.png', '', 'local', 'picture', 'jpg', '', 10686, NULL, '', '', 0, '2018-09-30 22:31:26', '2018-09-30 22:32:26', 99, 1),
(79, 1, 1, 'wx1image_1475158843730.png', '/uploads/picture/2016-09-29/wx1image_1475158843730.png', '', 'local', 'picture', 'jpg', '', 77934, NULL, '', '', 0, '2018-09-30 22:32:09', '2018-09-30 22:32:26', 99, 1),
(80, 1, 1, 'wx1image_14751588431771.png', '/uploads/picture/2016-09-29/wx1image_14751588431771.png', '', 'local', 'picture', 'jpg', '', 38682, NULL, '', '', 0, '2018-09-30 22:32:10', '2018-09-30 22:32:26', 99, 1),
(81, 1, 1, 'wx1image_14751588432055.png', '/uploads/picture/2016-09-29/wx1image_14751588432055.png', '', 'local', 'picture', 'jpg', '', 54928, NULL, '', '', 0, '2018-09-30 22:32:11', '2018-09-30 22:32:26', 99, 1),
(82, 1, 1, 'wx1image_14751588441630.png', '/uploads/picture/2016-09-29/wx1image_14751588441630.png', '', 'local', 'picture', 'jpg', '', 22413, NULL, '', '', 0, '2018-09-30 22:32:12', '2018-09-30 22:32:26', 99, 1),
(83, 1, 1, 'wx1image_14751588456818.png', '/uploads/picture/2016-09-29/wx1image_14751588456818.png', '', 'local', 'picture', 'jpg', '', 12567, NULL, '', '', 0, '2018-09-30 22:32:13', '2018-09-30 22:32:26', 99, 1),
(84, 1, 1, 'wx1image_14751588548752.png', '/uploads/picture/2016-09-29/wx1image_14751588548752.png', '', 'local', 'picture', 'jpg', '', 86619, NULL, '', '', 0, '2018-09-30 22:32:14', '2018-09-30 22:32:26', 99, 1),
(85, 1, 1, 'wx1image_14751588549711', '/uploads/picture/2016-09-29/wx1image_14751588549711.jpg', '', 'local', 'picture', 'jpg', '', 11863, NULL, '', '', 0, '2018-09-30 22:32:15', '2018-09-30 22:32:26', 99, 1),
(87, 1, 1, 'wx1image_14751588668519', '/uploads/picture/2016-09-29/wx1image_14751588668519.jpg', '', 'local', 'picture', 'jpg', '', 27712, NULL, '', '', 0, '2018-09-30 22:32:16', '2018-09-30 22:32:26', 99, 1),
(88, 1, 1, 'wx1image_14751588684053', '/uploads/picture/2016-09-29/wx1image_14751588684053.jpg', '', 'local', 'picture', 'jpg', '', 101186, NULL, '', '', 0, '2018-09-30 22:32:17', '2018-09-30 22:32:26', 99, 1),
(89, 1, 1, 'wx1image_14751588703441', '/uploads/picture/2016-09-29/wx1image_14751588703441.jpg', '', 'local', 'picture', 'jpg', '', 155125, NULL, '', '', 0, '2018-09-30 22:32:18', '2018-09-30 22:32:26', 99, 1),
(90, 1, 1, 'wx1image_14751588708117', '/uploads/picture/2016-09-29/wx1image_14751588708117.jpg', '', 'local', 'picture', 'jpg', '', 24226, NULL, '', '', 0, '2018-09-30 22:32:19', '2018-09-30 22:32:26', 99, 1),
(92, 1, 1, '57e0a9c03a61b', '/uploads/picture/2016-10-03/57f2076c4e997.jpg', '', 'local', 'picture', 'jpg', '', 110032, '', 'e3694c361707487802476e81709c863f', 'd5381f24235ee72d9fd8dfe2bb2e3d128217c8ce', 0, '2018-09-30 22:32:21', '2018-09-30 22:32:26', 99, 1),
(93, 1, 1, '9812496129086622', '/uploads/picture/2016-10-06/57f6136b5bd4e.jpg', '', 'local', 'picture', 'jpg', '', 164177, '9812496129086622', '983944832c987b160ae409f71acc7933', 'bce6147f4070989fc0349798acf6383938e5563a', 0, '2018-09-30 22:32:22', '2018-09-30 22:32:26', 99, 1),
(94, 1, 1, 'eacoophp-watermark-banner-1', 'http://cdn.eacoophp.com/static/demo-eacoophp/eacoophp-watermark-banner-1.jpg', 'http://cdn.eacoophp.com/static/demo-eacoophp/eacoophp-watermark-banner-1.jpg', 'link', 'picture', 'jpg', 'image', 171045, 'eacoophp-watermark-banner-1', '', '', 0, '2018-09-30 22:32:23', '2018-09-30 22:32:26', 99, 1),
(95, 1, 1, 'eacoophp-banner-3', 'http://cdn.eacoophp.com/static/demo-eacoophp/eacoophp-banner-3.jpg', 'http://cdn.eacoophp.com/static/demo-eacoophp/eacoophp-banner-3.jpg', 'link', 'picture', 'jpg', 'image', 356040, 'eacoophp-banner-3', '', '', 0, '2018-09-30 22:32:24', '2018-09-30 22:32:26', 99, 1),
(96, 1, 1, 'eacoophp-watermark-banner-2', 'http://cdn.eacoophp.com/static/demo-eacoophp/eacoophp-watermark-banner-2.jpg', 'http://cdn.eacoophp.com/static/demo-eacoophp/eacoophp-watermark-banner-2.jpg', 'link', 'picture', 'jpg', 'image', 356040, 'eacoophp-watermark-banner-2', '', '', 0, '2018-09-30 22:32:25', '2018-09-30 22:32:26', 99, 1),
(97, 1, 1, '150217753092666', '/uploads/picture/2018-04-12/5acec2ffee8a4.jpg', '/uploads/picture/2018-04-12/5acec2ffee8a4.jpg', 'local', 'picture', 'jpg', 'image', 67406, '150217753092666', '82a25ea71fd7db1a2180894086790ea9', '87a03fe9161c0d3b4b757e999160355f9ce0ee75', 0, '2018-09-30 22:32:26', '2018-09-30 22:32:26', 99, 1);
-- --------------------------------------------------------
--
-- 表的结构 `eacoo_auth_group`
--
CREATE TABLE `eacoo_auth_group` (
`id` mediumint(8) UNSIGNED NOT NULL,
`title` char(100) NOT NULL DEFAULT '' COMMENT '用户组中文名称',
`description` varchar(80) DEFAULT NULL COMMENT '描述信息',
`rules` varchar(500) NOT NULL DEFAULT '',
`status` tinyint(1) NOT NULL DEFAULT '1' COMMENT '状态。1启用,0禁用'
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='用户组表';
--
-- 转存表中的数据 `eacoo_auth_group`
--
INSERT INTO `eacoo_auth_group` (`id`, `title`, `description`, `rules`, `status`) VALUES
(1, '超级管理员', '拥有网站的最高权限', '1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74', 1),
(2, '管理员', '授权管理员', '1,2,6,7,8,47,48,49,50,51,52,53,54,61,62,63,64,65,66,67,68,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,102,103,104,105,106,107,108,109', 1),
(3, '普通用户', '这是普通用户的权限', '1,47', 1),
(4, '客服', '客服处理客户问题', '102,103,104,105,109,1,1,53,61,65,81,82,85,88,98', 1);
-- --------------------------------------------------------
--
-- 表的结构 `eacoo_auth_group_access`
--
CREATE TABLE `eacoo_auth_group_access` (
`uid` int(11) UNSIGNED NOT NULL COMMENT '管理员用户ID',
`group_id` mediumint(8) UNSIGNED NOT NULL,
`status` tinyint(1) NOT NULL DEFAULT '1' COMMENT '是否审核 2:未审核,1:启用,0:禁用,-1:删除'
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='用户组明细表';
--
-- 转存表中的数据 `eacoo_auth_group_access`
--
INSERT INTO `eacoo_auth_group_access` (`uid`, `group_id`, `status`) VALUES
(4, 2, 1),
(1, 1, 1),
(2, 4, 1),
(3, 3, 1);
-- --------------------------------------------------------
--
-- 表的结构 `eacoo_auth_rule`
--
CREATE TABLE `eacoo_auth_rule` (
`id` smallint(6) NOT NULL,
`name` char(80) NOT NULL DEFAULT '' COMMENT '导航链接',
`title` char(20) NOT NULL DEFAULT '' COMMENT '导航名字',
`depend_type` tinyint(1) UNSIGNED NOT NULL DEFAULT '0' COMMENT '来源类型。1module,2plugin,3theme',
`depend_flag` varchar(30) NOT NULL DEFAULT '' COMMENT '来源标记。如:模块或插件标识',
`type` tinyint(1) DEFAULT '1' COMMENT '是否支持规则表达式',
`pid` smallint(6) UNSIGNED DEFAULT '0' COMMENT '上级id',
`icon` varchar(50) DEFAULT '' COMMENT '图标',
`condition` char(200) DEFAULT '',
`is_menu` tinyint(1) NOT NULL DEFAULT '1' COMMENT '是否菜单',
`position` varchar(20) DEFAULT 'admin' COMMENT '菜单显示位置。如果是插件就写模块名',
`developer` tinyint(1) NOT NULL DEFAULT '0' COMMENT '开发者',
`sort` smallint(6) UNSIGNED DEFAULT '99' COMMENT '排序,值越小越靠前',
`update_time` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '更新时间',
`create_time` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '创建时间',
`status` tinyint(1) NOT NULL DEFAULT '1' COMMENT '是否有效(0:无效,1:有效)'
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='规则表(后台菜单)';
--
-- 转存表中的数据 `eacoo_auth_rule`
--
INSERT INTO `eacoo_auth_rule` (`id`, `name`, `title`, `depend_type`, `depend_flag`, `type`, `pid`, `icon`, `condition`, `is_menu`, `position`, `developer`, `sort`, `update_time`, `create_time`, `status`) VALUES
(1, 'admin/dashboard/index', '仪表盘', 1, 'admin', 1, 0, 'fa fa-tachometer', NULL, 1, 'admin', 0, 3, '2018-09-30 22:32:26', '2018-09-30 22:32:26', 1),
(2, 'admin/manage', '系统管理', 1, 'admin', 1, 0, 'fa fa-cog', NULL, 1, 'admin', 0, 7, '2018-12-03 00:47:34', '2018-09-30 22:32:26', 1),
(3, 'admin/config/index', '配置管理', 1, 'admin', 1, 2, '', NULL, 1, 'admin', 1, 34, '2018-09-30 22:32:26', '2018-09-30 22:32:26', 1),
(4, 'admin/config/edit', '配置编辑或添加', 1, 'admin', 1, 3, '', NULL, 0, 'admin', 0, 27, '2018-12-02 22:56:27', '2018-09-30 22:32:26', 1),
(5, 'admin/config/setstatus', '配置删除', 1, 'admin', 1, 3, '', '', 0, 'admin', 0, 99, '2019-08-24 09:38:26', '2019-08-24 09:38:26', 1),
(6, 'admin/config/group', '系统设置', 1, 'admin', 1, 2, '', NULL, 1, 'admin', 0, 8, '2018-09-30 22:32:26', '2018-09-30 22:32:26', 1),
(7, 'admin/config/groupsave', '系统设置修改', 1, 'admin', 1, 2, '', '', 0, 'admin', 0, 99, '2019-08-24 09:38:26', '2019-08-24 09:38:26', 1),
(8, 'admin/config/website', '网站设置', 1, 'admin', 1, 0, 'fa fa-connectdevelop', NULL, 1, 'admin', 0, 6, '2019-08-24 09:16:44', '2018-09-30 22:32:26', 1),
(9, 'admin/config/moveGroup', '移动配置分组', 1, 'admin', 1, 3, '', NULL, 0, 'admin', 0, 6, '2019-08-24 09:16:44', '2018-09-30 22:32:26', 1),
(10, 'admin/menu/index', '后台菜单管理', 1, 'admin', 1, 2, 'fa fa-inbox', NULL, 1, 'admin', 1, 31, '2018-09-30 22:32:26', '2018-09-30 22:32:26', 1),
(11, 'admin/menu/edit', '后台菜单编辑或添加', 1, 'admin', 1, 10, '', '', 0, 'admin', 0, 99, '2019-08-24 09:38:26', '2019-08-24 09:38:26', 1),
(12, 'admin/menu/setstatus', '后台菜单状态[启用/禁用/回收/删除]', 1, 'admin', 1, 10, '', '', 0, 'admin', 0, 99, '2019-08-24 09:38:26', '2019-08-24 09:38:26', 1),
(13, 'admin/menu/sort', '后台菜单排序', 1, 'admin', 1, 10, '', '', 0, 'admin', 0, 99, '2019-08-24 09:38:26', '2019-08-24 09:38:26', 1),
(14, 'admin/menu/markerMenu', '后台菜单标记', 1, 'admin', 1, 10, '', '', 0, 'admin', 0, 99, '2019-08-24 09:38:26', '2019-08-24 09:38:26', 1),
(15, 'admin/menu/moveModule', '移动菜单所属模块', 1, 'admin', 1, 10, '', '', 0, 'admin', 0, 99, '2019-08-24 09:38:26', '2019-08-24 09:38:26', 1),
(16, 'admin/menu/moveMenusPosition', '移动菜单位置', 1, 'admin', 1, 10, '', '', 0, 'admin', 0, 99, '2019-08-24 09:38:26', '2019-08-24 09:38:26', 1),
(17, 'admin/extend/index', '应用中心', 1, 'admin', 1, 0, 'fa fa-cloud', NULL, 1, 'admin', 0, 30, '2018-09-30 22:32:26', '2018-09-30 22:32:26', 1),
(18, 'admin/themes/index', '主题', 1, 'admin', 1, 17, 'fa fa-cloud', NULL, 1, 'admin', 0, 22, '2018-09-30 22:32:26', '2018-09-30 22:32:26', 1),
(19, 'admin/themes/install', '主题安装', 1, 'admin', 1, 18, 'fa fa-cloud', NULL, 0, 'admin', 0, 2, '2018-09-30 22:32:26', '2018-09-30 22:32:26', 1),
(20, 'admin/themes/uninstall', '主题卸载', 1, 'admin', 1, 18, 'fa fa-cloud', NULL, 0, 'admin', 0, 2, '2018-09-30 22:32:26', '2018-09-30 22:32:26', 1),
(21, 'admin/themes/updateInfo', '主题更新信息', 1, 'admin', 1, 18, 'fa fa-cloud', NULL, 0, 'admin', 0, 2, '2018-09-30 22:32:26', '2018-09-30 22:32:26', 1),
(22, 'admin/themes/setCurrent', '切换主题', 1, 'admin', 1, 18, 'fa fa-cloud', NULL, 0, 'admin', 0, 2, '2018-09-30 22:32:26', '2018-09-30 22:32:26', 1),
(23, 'admin/themes/cancel', '取消主题', 1, 'admin', 1, 18, 'fa fa-cloud', NULL, 0, 'admin', 0, 2, '2018-09-30 22:32:26', '2018-09-30 22:32:26', 1),
(24, 'admin/themes/del', '主题删除', 1, 'admin', 1, 18, 'fa fa-cloud', NULL, 0, 'admin', 0, 2, '2018-09-30 22:32:26', '2018-09-30 22:32:26', 1),
(25, 'admin/themes/sort', '主题排序', 1, 'admin', 1, 18, 'fa fa-cloud', NULL, 0, 'admin', 0, 2, '2018-09-30 22:32:26', '2018-09-30 22:32:26', 1),
(26, 'admin/themes/setstatus', '主题状态[启用/禁用/回收/删除]', 1, 'admin', 1, 18, '', '', 0, 'admin', 0, 99, '2019-08-24 09:38:26', '2019-08-24 09:38:26', 1),
(27, 'admin/plugins/index', '插件', 1, 'admin', 1, 17, 'fa fa-cloud', NULL, 1, 'admin', 0, 20, '2018-09-30 22:32:26', '2018-09-30 22:32:26', 1),
(28, 'admin/plugins/config', '插件配置', 1, 'admin', 1, 27, 'fa fa-cloud', NULL, 0, 'admin', 0, 2, '2018-09-30 22:32:26', '2018-09-30 22:32:26', 1),
(29, 'admin/plugins/install', '插件安装', 1, 'admin', 1, 27, 'fa fa-cloud', NULL, 0, 'admin', 0, 2, '2018-09-30 22:32:26', '2018-09-30 22:32:26', 1),
(30, 'admin/plugins/uninstall', '插件卸载', 1, 'admin', 1, 27, 'fa fa-cloud', NULL, 0, 'admin', 0, 2, '2018-09-30 22:32:26', '2018-09-30 22:32:26', 1),
(31, 'admin/plugins/updateInfo', '插件更新信息', 1, 'admin', 1, 27, 'fa fa-cloud', NULL, 0, 'admin', 0, 2, '2018-09-30 22:32:26', '2018-09-30 22:32:26', 1),
(32, 'admin/plugins/delPlugin', '插件删除', 1, 'admin', 1, 27, 'fa fa-cloud', NULL, 0, 'admin', 0, 2, '2018-09-30 22:32:26', '2018-09-30 22:32:26', 1),
(33, 'admin/plugins/sort', '插件排序', 1, 'admin', 1, 27, 'fa fa-cloud', NULL, 0, 'admin', 0, 2, '2018-09-30 22:32:26', '2018-09-30 22:32:26', 1),
(34, 'admin/plugins/setstatus', '插件状态[启用/禁用/回收/删除]', 1, 'admin', 1, 27, '', '', 0, 'admin', 0, 99, '2019-08-24 09:38:26', '2019-08-24 09:38:26', 1),
(35, 'admin/modules/index', '模块', 1, 'admin', 1, 17, 'fa fa-cloud', NULL, 1, 'admin', 0, 2, '2018-09-30 22:32:26', '2018-09-30 22:32:26', 1),
(36, 'admin/modules/config', '模块配置', 1, 'admin', 1, 35, 'fa fa-cloud', NULL, 0, 'admin', 0, 2, '2018-09-30 22:32:26', '2018-09-30 22:32:26', 1),
(37, 'admin/modules/install', '模块安装', 1, 'admin', 1, 35, 'fa fa-cloud', NULL, 0, 'admin', 0, 2, '2018-09-30 22:32:26', '2018-09-30 22:32:26', 1),
(38, 'admin/modules/uninstall', '模块卸载', 1, 'admin', 1, 35, 'fa fa-cloud', NULL, 0, 'admin', 0, 2, '2018-09-30 22:32:26', '2018-09-30 22:32:26', 1),
(39, 'admin/modules/updateInfo', '模块更新信息', 1, 'admin', 1, 35, 'fa fa-cloud', NULL, 0, 'admin', 0, 2, '2018-09-30 22:32:26', '2018-09-30 22:32:26', 1),
(40, 'admin/modules/delapp', '模块删除', 1, 'admin', 1, 35, 'fa fa-cloud', NULL, 0, 'admin', 0, 2, '2018-09-30 22:32:26', '2018-09-30 22:32:26', 1),
(41, 'admin/modules/sort', '模块排序', 1, 'admin', 1, 35, 'fa fa-cloud', NULL, 0, 'admin', 0, 2, '2018-09-30 22:32:26', '2018-09-30 22:32:26', 1),
(42, 'admin/modules/setstatus', '模块状态[启用/禁用/回收/删除]', 1, 'admin', 1, 35, '', '', 0, 'admin', 0, 99, '2019-08-24 09:38:26', '2019-08-24 09:38:26', 1),
(43, 'admin/plugins/hooks', '钩子管理', 1, 'admin', 1, 17, '', NULL, 0, 'admin', 1, 12, '2018-09-30 22:32:26', '2018-09-30 22:32:26', 1),
(44, 'admin/hook/edit', '钩子编辑或新增', 1, 'admin', 1, 43, '', NULL, 0, 'admin', 1, 12, '2018-09-30 22:32:26', '2018-09-30 22:32:26', 1),
(45, 'admin/hook/del', '钩子删除', 1, 'admin', 1, 43, '', NULL, 0, 'admin', 1, 12, '2018-09-30 22:32:26', '2018-09-30 22:32:26', 1),
(46, 'admin/hook/setstatus', '钩子状态[启用/禁用/回收/删除]', 1, 'admin', 1, 43, '', '', 0, 'admin', 0, 99, '2019-08-24 09:38:26', '2019-08-24 09:38:26', 1),
(47, 'admin/navigation/index', '前台导航', 1, 'admin', 1, 0, 'fa fa-leaf', NULL, 1, 'admin', 0, 25, '2018-09-30 22:32:26', '2018-09-30 22:32:26', 1),
(48, 'admin/navigation/edit', '导航编辑或添加', 1, 'admin', 1, 47, '', NULL, 0, 'admin', 0, 5, '2018-09-30 22:32:26', '2018-09-30 22:32:26', 1),
(49, 'admin/navigation/moveMenusPosition', '导航位置移动', 1, 'admin', 1, 47, '', NULL, 0, 'admin', 0, 5, '2018-09-30 22:32:26', '2018-09-30 22:32:26', 1),
(50, 'admin/navigation/setstatus', '导航状态[启用/禁用/回收/删除]', 1, 'admin', 1, 47, '', '', 0, 'admin', 0, 99, '2019-08-24 09:38:26', '2019-08-24 09:38:26', 1),
(51, 'admin/navigation/sort', '导航排序', 1, 'admin', 1, 47, '', '', 0, 'admin', 0, 99, '2019-08-24 09:38:26', '2019-08-24 09:38:26', 1),
(52, 'tools', '工具', 1, 'admin', 1, 0, 'fa fa-gavel', NULL, 1, 'admin', 1, 29, '2018-09-30 22:32:26', '2018-09-30 22:32:26', 1),
(53, 'admin/mailer/template', '邮件模板', 1, 'admin', 1, 52, NULL, NULL, 1, 'admin', 0, 24, '2018-09-30 22:32:26', '2018-09-30 22:32:26', 1),
(54, 'admin/database', '安全', 1, 'admin', 1, 52, 'fa fa-database', NULL, 0, 'admin', 0, 32, '2018-09-30 22:32:26', '2018-09-30 22:32:26', 1),
(55, 'admin/database/index', '数据库管理', 1, 'admin', 1, 52, 'fa fa-database', NULL, 1, 'admin', 0, 33, '2018-09-30 22:32:26', '2018-09-30 22:32:26', 1),
(56, 'admin/database/optimize', '数据库优化表', 1, 'admin', 1, 55, 'fa fa-database', NULL, 0, 'admin', 0, 33, '2018-09-30 22:32:26', '2018-09-30 22:32:26', 1),
(57, 'admin/database/repair', '数据库修复表', 1, 'admin', 1, 55, 'fa fa-database', NULL, 0, 'admin', 0, 33, '2018-09-30 22:32:26', '2018-09-30 22:32:26', 1),
(58, 'admin/database/export', '数据库备份', 1, 'admin', 1, 55, 'fa fa-database', NULL, 0, 'admin', 0, 33, '2018-09-30 22:32:26', '2018-09-30 22:32:26', 1),
(59, 'admin/database/import', '数据库还原', 1, 'admin', 1, 55, 'fa fa-database', NULL, 0, 'admin', 0, 33, '2018-09-30 22:32:26', '2018-09-30 22:32:26', 1),
(60, 'admin/database/delBackup', '数据库删除备份', 1, 'admin', 1, 55, 'fa fa-database', NULL, 0, 'admin', 0, 33, '2018-09-30 22:32:26', '2018-09-30 22:32:26', 1),
(61, 'admin/link/index', '友情链接', 1, 'admin', 1, 52, '', NULL, 1, 'admin', 0, 26, '2018-09-30 22:32:26', '2018-09-30 22:32:26', 1),
(62, 'admin/link/edit', '友情链接编辑', 1, 'admin', 1, 61, '', NULL, 0, 'admin', 0, 4, '2018-09-30 22:32:26', '2018-09-30 22:32:26', 1),
(63, 'admin/link/setstatus', '友情链接状态[启用/禁用/回收/删除]', 1, 'admin', 1, 61, '', '', 0, 'admin', 0, 99, '2019-08-24 09:38:26', '2019-08-24 09:38:26', 1),
(64, 'admin/link/sort', '友情链接排序', 1, 'admin', 1, 61, '', '', 0, 'admin', 0, 99, '2019-08-24 09:38:26', '2019-08-24 09:38:26', 1),
(65, 'admin/AdminUser/index', '后台用户', 1, 'admin', 1, 0, 'fa fa-users', '', 1, 'admin', 0, 9, '2019-08-24 22:32:26', '2018-09-30 22:32:26', 1),
(66, 'admin/AdminUser/edit', '后台用户编辑或添加', 1, 'admin', 1, 65, '', '', 0, 'admin', 0, 9, '2019-08-24 22:32:26', '2018-09-30 22:32:26', 1),
(67, 'admin/AdminUser/resetPassword', '后台用户重置密码', 1, 'admin', 1, 65, '', '', 0, 'admin', 0, 9, '2019-08-24 22:32:26', '2019-08-24 22:32:26', 1),
(68, 'admin/AdminUser/setstatus', '后台用户状态[启用/禁用/回收/删除]', 1, 'admin', 1, 65, '', '', 0, 'admin', 0, 99, '2019-08-24 09:38:26', '2019-08-24 09:38:26', 1),
(69, 'user/auth', '权限管理', 1, 'user', 1, 0, 'fa fa-sun-o', NULL, 1, 'user', 0, 25, '2018-09-30 22:32:26', '2018-09-30 22:32:26', 0),
(70, 'admin/auth/index', '规则管理', 1, 'admin', 1, 70, 'fa fa-500px', NULL, 1, 'admin', 0, 19, '2018-09-30 22:32:26', '2018-09-30 22:32:26', 1),
(71, 'admin/auth/edit', '规则编辑或添加', 1, 'admin', 1, 70, '', NULL, 1, 'admin', 0, 19, '2019-08-24 09:38:26', '2019-08-24 09:38:26', 1),
(72, 'admin/auth/setstatus', '规则状态[启用/禁用/回收/删除]', 1, 'admin', 1, 70, '', '', 1, 'admin', 0, 99, '2019-08-24 09:38:26', '2019-08-24 09:38:26', 1),
(73, 'admin/auth/sort', '规则排序', 1, 'admin', 1, 70, '', '', 1, 'admin', 0, 99, '2019-08-24 09:38:26', '2019-08-24 09:38:26', 1),
(74, 'admin/AuthGroup/index', '角色组', 1, 'admin', 1, 0, 'fa fa-user-secret', NULL, 1, 'admin', 0, 10, '2019-08-24 09:17:50', '2018-09-30 22:32:26', 1),
(75, 'admin/AuthGroup/edit', '角色组编辑或添加', 1, 'admin', 1, 74, 'fa fa-user-secret', NULL, 0, 'admin', 0, 10, '2019-08-24 09:17:50', '2018-09-30 22:32:26', 1),
(76, 'admin/AuthGroup/setstatus', '角色组状态[启用/禁用/回收/删除]', 1, 'admin', 1, 74, '', '', 0, 'admin', 0, 99, '2019-08-24 09:38:26', '2019-08-24 09:38:26', 1),
(77, 'admin/AuthGroup/access', '权限分配', 1, 'admin', 1, 74, 'fa fa-user-secret', NULL, 0, 'admin', 0, 10, '2019-08-24 09:17:50', '2018-09-30 22:32:26', 1),
(78, 'admin/AuthGroup/accessUser', '成员授权', 1, 'admin', 1, 74, 'fa fa-user-secret', NULL, 0, 'admin', 0, 10, '2019-08-24 09:17:50', '2018-09-30 22:32:26', 1),
(79, 'admin/AuthGroup/addtogroup', '成员授权-添加', 1, 'admin', 1, 74, '', NULL, 0, 'admin', 0, 10, '2019-08-24 09:17:50', '2018-09-30 22:32:26', 1),
(80, 'admin/AuthGroup/removefromgroup', '成员授权-解除', 1, 'admin', 1, 74, '', NULL, 0, 'admin', 0, 10, '2019-08-24 09:17:50', '2018-09-30 22:32:26', 1),
(81, 'admin/action', '行为管理', 1, 'admin', 1, 0, 'fa fa-list-alt', NULL, 1, 'admin', 0, 23, '2018-12-03 00:10:26', '2018-09-30 22:32:26', 1),
(82, 'admin/action/index', '用户行为', 1, 'admin', 1, 81, '', NULL, 1, 'admin', 0, 11, '2018-12-03 00:08:20', '2018-09-30 22:32:26', 1),
(83, 'admin/action/edit', '用户行为编辑或添加', 1, 'admin', 1, 81, '', NULL, 0, 'admin', 0, 11, '2018-12-03 00:08:20', '2018-09-30 22:32:26', 1),
(84, 'admin/action/setstatus', '用户行为状态[启用/禁用/回收/删除]', 1, 'admin', 1, 81, '', '', 0, 'admin', 0, 99, '2019-08-24 09:38:26', '2019-08-24 09:38:26', 1),
(85, 'admin/action/log', '行为日志', 1, 'admin', 1, 81, 'fa fa-address-book-o', NULL, 1, 'admin', 0, 21, '2018-12-03 00:08:30', '2018-09-30 22:32:26', 1),
(86, 'admin/action/clearlog', '清空行为日志', 1, 'admin', 1, 81, '', NULL, 0, 'admin', 0, 21, '2018-12-03 00:08:30', '2018-09-30 22:32:26', 1),
(87, 'admin/action/dellog', '删除行为日志', 1, 'admin', 1, 81, '', NULL, 0, 'admin', 0, 21, '2018-12-03 00:08:30', '2018-09-30 22:32:26', 1),
(88, 'admin/attachment/index', '附件空间', 1, 'admin', 1, 0, 'fa fa-picture-o', NULL, 1, 'admin', 0, 28, '2018-09-30 22:32:26', '2018-09-30 22:32:26', 1),
(89, 'admin/attachment/setstatus', '附件状态[启用/禁用/回收/删除]', 1, 'admin', 1, 88, '', '', 0, 'admin', 0, 99, '2019-08-24 09:38:26', '2019-08-24 09:38:26', 1),
(90, 'admin/attachment/setting', '附件设置', 1, 'admin', 1, 88, '', NULL, 0, 'admin', 0, 1, '2018-09-30 22:32:26', '2018-09-30 22:32:26', 1),
(91, 'admin/attachment/category', '附件分类', 1, 'admin', 1, 88, NULL, NULL, 0, 'admin', 0, 13, '2018-09-30 22:32:26', '2018-09-30 22:32:26', 1),
(92, 'admin/attachment/categoryEdit', '附件分类编辑或添加', 1, 'admin', 1, 88, NULL, NULL, 0, 'admin', 0, 13, '2018-09-30 22:32:26', '2018-09-30 22:32:26', 1),
(93, 'admin/attachment/moveCategory', '附件分类移动', 1, 'admin', 1, 88, NULL, NULL, 0, 'admin', 0, 13, '2018-09-30 22:32:26', '2018-09-30 22:32:26', 1),
(94, 'admin/attachment/categorysetstatus', '附件分类状态[启用/禁用/回收/删除]', 1, 'admin', 1, 88, '', '', 0, 'admin', 0, 99, '2019-08-24 09:38:26', '2019-08-24 09:38:26', 1),
(95, 'admin/Upload/upload', '文件上传', 1, 'admin', 1, 88, NULL, NULL, 0, 'admin', 0, 14, '2018-09-30 22:32:26', '2018-09-30 22:32:26', 1),
(96, 'admin/Upload/upload?type=picture', '上传图片', 1, 'admin', 1, 88, NULL, NULL, 0, 'admin', 0, 15, '2018-09-30 22:32:26', '2018-09-30 22:32:26', 1),
(97, 'admin/attachment/upload_onlinefile', '添加外链附件', 1, 'admin', 1, 88, NULL, NULL, 0, 'admin', 0, 16, '2018-09-30 22:32:26', '2018-09-30 22:32:26', 1),
(98, 'admin/attachment/attachmentInfo', '附件详情', 1, 'admin', 1, 88, NULL, NULL, 0, 'admin', 0, 17, '2018-09-30 22:32:26', '2018-09-30 22:32:26', 1),
(99, 'admin/attachment/uploadAvatar', '上传头像', 1, 'admin', 1, 88, NULL, NULL, 0, 'admin', 0, 18, '2018-09-30 22:32:26', '2018-09-30 22:32:26', 1),
(100, 'admin/attachment/del', '附件删除', 1, 'admin', 1, 88, NULL, NULL, 0, 'admin', 0, 18, '2018-09-30 22:32:26', '2018-09-30 22:32:26', 1),
(101, 'user/user/', '会员管理', 1, 'user', 1, 0, 'fa fa-users', NULL, 1, 'user', 0, 28, '2018-09-30 22:32:26', '2018-09-30 22:32:26', 0),
(102, 'user/user/index', '用户列表', 1, 'user', 1, 0, 'fa fa-user', NULL, 1, 'user', 0, 4, '2019-07-31 06:43:27', '2018-09-30 22:32:26', 1),
(103, 'user/user/edit', '用户编辑或添加', 1, 'user', 1, 102, '', '', 0, 'user', 0, 99, '2019-08-23 14:32:26', '2019-08-23 14:32:26', 1),
(104, 'user/user/resetPassword', '重置原始密码', 1, 'user', 1, 102, '', '', 0, 'user', 0, 40, '2018-09-30 22:32:26', '2018-09-30 22:32:26', 1),
(105, 'user/user/setstatus', '用户状态[启用/禁用/回收/删除]', 1, 'user', 1, 102, '', '', 0, 'user', 0, 99, '2019-08-23 14:32:26', '2019-08-23 14:32:26', 1),
(106, 'user/UserLevel/index', '用户头衔', 1, 'user', 1, 0, 'fa fa-user', NULL, 1, 'user', 0, 4, '2019-07-31 06:43:27', '2018-09-30 22:32:26', 1),
(107, 'user/UserLevel/edit', '用户头衔编辑或添加', 1, 'user', 1, 106, '', '', 0, 'user', 0, 99, '2019-08-23 14:32:26', '2019-08-23 14:32:26', 1),
(108, 'user/UserLevel/setstatus', '用户头衔状态[启用/禁用/回收/删除]', 1, 'user', 1, 106, '', '', 0, 'user', 0, 99, '2019-08-23 14:32:26', '2019-08-23 14:32:26', 1),
(109, 'user/tongji/analyze', '会员统计', 1, 'user', 1, 0, '', NULL, 1, 'user', 0, 27, '2018-09-30 22:32:26', '2018-09-30 22:32:26', 1);
-- --------------------------------------------------------
--
-- 表的结构 `eacoo_config`
--
CREATE TABLE `eacoo_config` (
`id` int(10) UNSIGNED NOT NULL COMMENT '配置ID',
`name` varchar(100) NOT NULL DEFAULT '' COMMENT '配置名称',
`title` varchar(50) NOT NULL COMMENT '配置说明',
`value` text NOT NULL COMMENT '配置值',
`options` varchar(255) NOT NULL COMMENT '配置额外值',
`group` tinyint(3) UNSIGNED NOT NULL DEFAULT '0' COMMENT '配置分组',
`sub_group` tinyint(3) DEFAULT '0' COMMENT '子分组,子分组需要自己定义',
`type` varchar(16) NOT NULL DEFAULT '' COMMENT '配置类型',
`remark` varchar(500) NOT NULL COMMENT '配置说明',
`create_time` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '创建时间',
`update_time` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '更新时间',
`sort` tinyint(3) UNSIGNED NOT NULL DEFAULT '99' COMMENT '排序,值越小越靠前',
`status` tinyint(1) NOT NULL DEFAULT '1' COMMENT '状态'
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='配置表';
--
-- 转存表中的数据 `eacoo_config`
--
INSERT INTO `eacoo_config` (`id`, `name`, `title`, `value`, `options`, `group`, `sub_group`, `type`, `remark`, `create_time`, `update_time`, `sort`, `status`) VALUES
(1, 'toggle_web_site', '站点开关', '1', '0:关闭\r\n1:开启', 1, 0, 'select', '站点关闭后将提示网站已关闭,不能正常访问', '2018-09-30 22:32:26', '2018-09-30 22:32:26', 1, 1),
(2, 'web_site_title', '网站标题', 'EacooPHP', '', 6, 0, 'text', '网站标题前台显示标题', '2018-09-30 22:32:26', '2018-09-30 22:32:26', 2, 1),
(4, 'web_site_logo', '网站LOGO', '4', '', 6, 0, 'picture', '网站LOGO', '2018-09-30 22:32:26', '2018-09-30 22:32:26', 4, 1),
(5, 'web_site_description', 'SEO描述', 'EacooPHP框架基于统一核心的通用互联网+信息化服务解决方案,追求简单、高效、卓越。可轻松实现支持多终端的WEB产品快速搭建、部署、上线。系统功能采用模块化、组件化、插件化等开放化低耦合设计,应用商城拥有丰富的功能模块、插件、主题,便于用户灵活扩展和二次开发。', '', 6, 1, 'textarea', '网站搜索引擎描述', '2018-09-30 22:32:26', '2018-09-30 22:32:26', 6, 1),
(6, 'web_site_keyword', 'SEO关键字', '开源框架 EacooPHP ThinkPHP', '', 6, 1, 'textarea', '网站搜索引擎关键字', '2018-09-30 22:32:26', '2018-09-30 22:32:26', 4, 1),
(7, 'web_site_copyright', '版权信息', 'Copyright © ******有限公司 All rights reserved.', '', 1, 0, 'text', '设置在网站底部显示的版权信息', '2018-09-30 22:32:26', '2018-09-30 22:32:26', 7, 1),
(8, 'web_site_icp', '网站备案号', '豫ICP备14003306号', '', 6, 0, 'text', '设置在网站底部显示的备案号,如“苏ICP备1502009-2号\"', '2018-09-30 22:32:26', '2018-09-30 22:32:26', 8, 1),
(9, 'web_site_statistics', '站点统计', '', '', 1, 0, 'textarea', '支持百度、Google、cnzz等所有Javascript的统计代码', '2018-09-30 22:32:26', '2018-09-30 22:32:26', 9, 1),
(10, 'index_url', '首页地址', 'https://www.eacoophp.com', '', 2, 0, 'text', '可以通过配置此项自定义系统首页的地址,比如:http://www.xxx.com', '2018-09-30 22:32:26', '2018-09-30 22:32:26', 0, 1),
(13, 'admin_tags', '后台多标签', '1', '0:关闭\r\n1:开启', 2, 0, 'radio', '', '2018-09-30 22:32:26', '2018-12-02 23:00:29', 99, 1),
(14, 'admin_page_size', '后台分页数量', '12', '', 2, 0, 'number', '后台列表分页时每页的记录数', '2018-09-30 22:32:26', '2018-12-02 23:01:12', 99, 1),
(15, 'admin_theme', '后台主题', 'default', 'default:默认主题\r\nblue:蓝色理想\r\ngreen:绿色生活', 2, 0, 'select', '后台界面主题', '2018-09-30 22:32:26', '2018-12-02 23:00:44', 98, 1),
(16, 'develop_mode', '开发模式', '1', '1:开启\r\n0:关闭', 3, 0, 'select', '开发模式下会显示菜单管理、配置管理、数据字典等开发者工具', '2018-09-30 22:32:26', '2018-09-30 22:32:26', 1, 1),
(17, 'app_trace', '是否显示页面Trace', '0', '1:开启\r\n0:关闭', 3, 0, 'select', '是否显示页面Trace信息', '2018-09-30 22:32:26', '2018-09-30 22:32:26', 2, 1),
(18, 'auth_key', '系统加密KEY', 'vzxI=vf[=xV)?a^XihbLKx?pYPw$;Mi^R*<mV;yJh$wy(~~E?<.JA&ANdIZ#QhPq', '', 3, 0, 'textarea', '轻易不要修改此项,否则容易造成用户无法登录;如要修改,务必备份原key', '2018-09-30 22:32:26', '2018-09-30 22:32:26', 3, 1),
(19, 'only_auth_rule', '权限仅验证规则表', '1', '1:开启\n0:关闭', 4, 0, 'radio', '开启此项,则后台验证授权只验证规则表存在的规则', '2018-09-30 22:32:26', '2018-09-30 22:32:26', 0, 1),
(20, 'static_domain', '静态文件独立域名', '', '', 3, 0, 'text', '静态文件独立域名一般用于在用户无感知的情况下平和的将网站图片自动存储到腾讯万象优图、又拍云等第三方服务。', '2018-09-30 22:32:26', '2018-09-30 22:32:26', 3, 1),
(21, 'config_group_list', '配置分组', '1:基本\r\n2:系统\r\n3:开发\r\n4:安全\r\n5:数据库\r\n6:网站设置\r\n7:用户\r\n8:邮箱\r\n9:高级', '', 3, 0, 'array', '配置分组的键值对不要轻易改变', '2018-09-30 22:32:26', '2018-09-30 22:32:26', 5, 1),
(25, 'form_item_type', '表单项目类型', 'hidden:隐藏\r\nreadonly:仅读文本\r\nnumber:数字\r\ntext:单行文本\r\ntextarea:多行文本\r\narray:数组\r\npassword:密码\r\nradio:单选框\r\ncheckbox:复选框\r\nselect:下拉框\r\nicon:字体图标\r\ndate:日期\r\ndatetime:时间\r\npicture:单张图片\r\npictures:多张图片\r\nfile:单个文件\r\nfiles:多个文件\r\nwangeditor:wangEditor编辑器\r\nueditor:百度富文本编辑器\r\neditormd:Markdown编辑器\r\ntags:标签\nselect2:高级下拉框\r\njson:JSON\r\nboard:拖', '', 3, 0, 'array', '专为配置管理设定\r\n', '2018-09-30 22:32:26', '2018-09-30 22:32:26', 0, 1),
(26, 'term_taxonomy', '分类法', 'post_category:分类目录\r\npost_tag:标签\r\nmedia_cat:多媒体分类', '', 3, 0, 'array', '', '2018-09-30 22:32:26', '2018-09-30 22:32:26', 0, 1),
(27, 'data_backup_path', '数据库备份根路径', '../data/backup', '', 5, 0, 'text', '', '2018-09-30 22:32:26', '2018-09-30 22:32:26', 0, 1),
(28, 'data_backup_part_size', '数据库备份卷大小', '20971520', '', 5, 0, 'number', '', '2018-09-30 22:32:26', '2018-09-30 22:32:26', 0, 1),
(29, 'data_backup_compress_level', '数据库备份文件压缩级别', '4', '1:普通\r\n4:一般\r\n9:最高', 5, 0, 'radio', '', '2018-09-30 22:32:26', '2018-09-30 22:32:26', 0, 1),
(30, 'data_backup_compress', '数据库备份文件压缩', '1', '0:不压缩\r\n1:启用压缩', 5, 0, 'radio', '', '2018-09-30 22:32:26', '2018-09-30 22:32:26', 0, 1),
(31, 'hooks_type', '钩子的类型', '1:视图\r\n2:控制器', '', 3, 0, 'array', '', '2018-09-30 22:32:26', '2018-09-30 22:32:26', 0, 1),
(33, 'action_type', '行为类型', '1:系统\r\n2:用户', '1:系统\r\n2:用户', 7, 0, 'array', '配置说明', '2018-09-30 22:32:26', '2018-09-30 22:32:26', 0, 1),
(34, 'website_group', '网站信息子分组', '0:基本信息\r\n1:SEO设置\r\n3:其它', '', 6, 0, 'array', '作为网站信息配置的子分组配置,每个大分组可设置子分组作为tab切换', '2018-09-30 22:32:26', '2018-09-30 22:32:26', 20, 1),
(36, 'mail_reg_active_template', '注册激活邮件模板', '{\"active\":\"0\",\"subject\":\"\\u6ce8\\u518c\\u6fc0\\u6d3b\\u901a\\u77e5\"}', '', 8, 0, 'json', 'JSON格式保存除了模板内容的属性', '2018-09-30 22:32:26', '2018-09-30 22:32:26', 0, 1),
(37, 'mail_captcha_template', '验证码邮件模板', '{\"active\":\"0\",\"subject\":\"\\u90ae\\u7bb1\\u9a8c\\u8bc1\\u7801\\u901a\\u77e5\"}', '', 8, 0, 'json', 'JSON格式保存除了模板内容的属性', '2018-09-30 22:32:26', '2018-09-30 22:32:26', 0, 1),
(38, 'mail_reg_active_template_content', '注册激活邮件模板内容', '<p><span style=\"font-family: 微软雅黑; font-size: 14px;\"></span><span style=\"font-family: 微软雅黑; font-size: 14px;\">您在{$title}的激活链接为</span><a href=\"{$url}\" target=\"_blank\" style=\"font-family: 微软雅黑; font-size: 14px; white-space: normal;\">激活</a><span style=\"font-family: 微软雅黑; font-size: 14px;\">,或者请复制链接:{$url}到浏览器打开。</span></p>', '', 8, 0, 'textarea', '注册激活模板邮件内容部分,模板内容单独存放', '2018-09-30 22:32:26', '2018-09-30 22:32:26', 0, 1),
(39, 'mail_captcha_template_content', '验证码邮件模板内容', '<p><span style=\"font-family: 微软雅黑; font-size: 14px;\">您的验证码为{$verify}验证码,账号为{$account}。</span></p>', '', 8, 0, 'textarea', '验证码邮件模板内容部分', '2018-09-30 22:32:26', '2018-09-30 22:32:26', 0, 1),
(40, 'attachment_options', '附件配置选项', '{\"driver\":\"local\",\"file_max_size\":\"2097152\",\"file_exts\":\"doc,docx,xls,xlsx,ppt,pptx,pdf,wps,txt,zip,rar,gz,bz2,7z\",\"file_save_name\":\"uniqid\",\"image_max_size\":\"2097152\",\"image_exts\":\"gif,jpg,jpeg,bmp,png\",\"image_save_name\":\"uniqid\",\"page_number\":\"24\",\"widget_show_type\":\"0\",\"cut\":\"1\",\"small_size\":{\"width\":\"150\",\"height\":\"150\"},\"medium_size\":{\"width\":\"320\",\"height\":\"280\"},\"large_size\":{\"width\":\"560\",\"height\":\"430\"},\"watermark_scene\":\"2\",\"watermark_type\":\"1\",\"water_position\":\"9\",\"water_img\":\"\\/logo.png\",\"water_opacity\":\"80\"}', '', 9, 0, 'json', '以JSON格式保存', '2018-09-30 22:32:26', '2018-09-30 22:32:26', 0, 1),
(42, 'user_deny_username', '保留用户名和昵称', '管理员,测试,admin,垃圾', '', 7, 0, 'textarea', '禁止注册用户名和昵称,包含这些即无法注册,用" , "号隔开,用户只能是英文,下划线_,数字等', '2018-09-30 22:32:26', '2018-09-30 22:32:26', 0, 1),
(43, 'captcha_open', '验证码配置', 'reg,login,reset', 'reg:注册显示\r\nlogin:登陆显示\r\nreset:密码重置', 4, 0, 'checkbox', '验证码开启配置', '2018-09-30 22:32:26', '2018-09-30 22:32:26', 0, 1),
(44, 'captcha_type', '验证码类型', '4', '1:中文\r\n2:英文\r\n3:数字\r\n4:英文+数字', 4, 0, 'select', '验证码类型', '2018-09-30 22:32:26', '2018-09-30 22:32:26', 0, 1),
(45, 'web_site_subtitle', '网站副标题', '基于ThinkPHP5的开发框架', '', 6, 0, 'textarea', '用简洁的文字描述本站点(网站口号、宣传标语、一句话介绍)', '2018-09-30 22:32:26', '2018-09-30 22:32:26', 2, 1),
(46, 'cache', '缓存配置', '{\"type\":\"File\",\"path\":\"\\/Library\\/WebServer\\/Documents\\/EacooPHP\\/runtime\\/cache\\/\",\"prefix\":\"\",\"expire\":\"0\"}', '', 9, 0, 'json', '以JSON格式保存', '2018-09-30 22:32:26', '2018-09-30 22:32:26', 0, 1),
(47, 'session', 'Session配置', '{\"type\":\"\",\"prefix\":\"eacoophp_\",\"auto_start\":\"1\"}', '', 9, 0, 'json', '以JSON格式保存', '2018-09-30 22:32:26', '2018-09-30 22:32:26', 99, 1),
(48, 'cookie', 'Cookie配置', '{\"path\":\"\\/\",\"prefix\":\"eacoophp_\",\"expire\":\"0\",\"domain\":\"\",\"secure\":\"0\",\"httponly\":\"\",\"setcookie\":\"1\"}', '', 9, 0, 'json', '以JSON格式保存', '2018-09-30 22:32:26', '2018-09-30 22:32:26', 99, 1),
(49, 'reg_default_roleid', '注册默认角色', '4', '', 7, 0, 'select', '', '2018-09-30 22:32:26', '2018-09-30 22:32:26', 0, 1),
(50, 'open_register', '开放注册', '0', '1:是\r\n0:否', 7, 0, 'radio', '', '2018-09-30 22:32:26', '2018-09-30 22:32:26', 0, 1),
(56, 'meanwhile_user_online', '允许同时登录', '1', '1:是\r\n0:否', 7, 0, 'radio', '是否允许同一帐号在不同地方同时登录', '2018-09-30 22:32:26', '2018-09-30 22:32:26', 0, 1),
(57, 'admin_collect_menus', '后台收藏菜单', '[]', '', 2, 0, 'json', '在后台顶部菜单栏展示,可以方便快速菜单入口', '2018-09-30 22:32:26', '2018-09-30 22:32:26', 99, 1),
(58, 'minify_status', '开启minify', '1', '1:开启\r\n0:关闭', 2, 0, 'radio', '开启minify会压缩合并js、css文件,可以减少资源请求次数,如果不支持minify,可关闭', '2018-09-30 22:32:26', '2018-09-30 22:32:26', 99, 1),
(59, 'admin_allow_login_many', '同账号多人登录后台', '0', '0:不允许\r\n1:允许', 4, 0, 'radio', '允许多个人使用同一个账号登录后台。默认:不允许', '2018-09-30 22:32:26', '2018-09-30 22:32:26', 99, 1),
(60, 'admin_allow_ip', '仅限登录后台IP', '', '', 4, 0, 'textarea', '填写IP地址,多个IP用英文逗号隔开。默认为空,允许所有IP', '2018-09-30 22:32:26', '2018-09-30 22:32:26', 99, 1),
(61, 'redis', 'Redis配置', '{\"host\":\"127.0.0.1\",\"port\":\"6979\"}', '', 9, 0, 'json', '以JSON格式保存', '2018-09-30 22:32:26', '2018-09-30 22:32:26', 99, 1),
(62, 'memcache', 'Memcache配置', '{\"host\":\"127.0.0.1\",\"port\":\"11211\"}', '', 9, 0, 'json', '以JSON格式保存', '2018-09-30 22:32:26', '2018-09-30 22:32:26', 99, 1),
(63, 'admin_menus_mode', '后台菜单模式', '2', '1:全局模式\r\n2:模块模式', 2, 0, 'radio', '全局模式:所有菜单都显示在后台左侧。\r\n模式模式:菜单根据模式的方式显示在顶部加载。', '2018-12-02 22:59:47', '2018-12-03 00:57:51', 20, 0);
-- --------------------------------------------------------
--
-- 表的结构 `eacoo_hooks`
--
CREATE TABLE `eacoo_hooks` (
`id` int(10) UNSIGNED NOT NULL COMMENT '钩子ID',
`name` varchar(32) NOT NULL DEFAULT '' COMMENT '钩子名称',
`description` varchar(300) NOT NULL DEFAULT '' COMMENT '描述',
`type` tinyint(4) UNSIGNED NOT NULL DEFAULT '1' COMMENT '类型。1视图,2控制器',
`create_time` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '创建时间',
`update_time` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '更新时间',
`status` tinyint(1) NOT NULL DEFAULT '1' COMMENT '状态。1启用,0禁用'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='钩子表';
--
-- 转存表中的数据 `eacoo_hooks`
--
INSERT INTO `eacoo_hooks` (`id`, `name`, `description`, `type`, `create_time`, `update_time`, `status`) VALUES
(1, 'AdminIndex', '后台首页小工具', 1, '2018-09-30 22:32:26', '2018-09-30 22:32:26', 1),
(2, 'FormBuilderExtend', 'FormBuilder类型扩展Builder', 1, '2018-09-30 22:32:26', '2018-09-30 22:32:26', 1),
(3, 'UploadFile', '上传文件钩子', 1, '2018-09-30 22:32:26', '2018-09-30 22:32:26', 1),
(4, 'PageHeader', '页面header钩子,一般用于加载插件CSS文件和代码', 1, '2018-09-30 22:32:26', '2018-09-30 22:32:26', 1),
(5, 'PageFooter', '页面footer钩子,一般用于加载插件CSS文件和代码', 1, '2018-09-30 22:32:26', '2018-09-30 22:32:26', 1),
(6, 'LoginUser', '用户登录钩子', 1, '2018-09-30 22:32:26', '2018-09-30 22:32:26', 1),
(7, 'SendMessage', '发送消息钩子,用于消息发送途径的扩展', 2, '2018-09-30 22:32:26', '2018-09-30 22:32:26', 1),
(8, 'sms', '短信插件钩子', 2, '2018-09-30 22:32:26', '2018-09-30 22:32:26', 1),
(9, 'RegisterUser', '用户注册钩子', 2, '2018-09-30 22:32:26', '2018-09-30 22:32:26', 1),
(10, 'ImageGallery', '图片轮播钩子', 1, '2018-09-30 22:32:26', '2018-09-30 22:32:26', 1),
(11, 'JChinaCity', '每个系统都需要的一个中国省市区三级联动插件。', 1, '2018-09-30 22:32:26', '2018-09-30 22:32:26', 1),
(13, 'editor', '内容编辑器钩子', 1, '2018-09-30 22:32:26', '2018-09-30 22:32:26', 1),
(14, 'adminEditor', '后台内容编辑页编辑器', 1, '2018-09-30 22:32:26', '2018-09-30 22:32:26', 1),
(15, 'ThirdLogin', '集成第三方授权登录,包括微博、QQ、微信、码云', 1, '2018-09-30 22:32:26', '2018-09-30 22:32:26', 1),
(16, 'comment', '实现本地评论功能,支持评论点赞', 1, '2018-09-30 22:32:26', '2018-09-30 22:32:26', 1),
(17, 'uploadPicture', '实现阿里云OSS对象存储,管理附件', 1, '2018-09-30 22:32:26', '2018-09-30 22:32:26', 1),
(18, 'MicroTopicsUserPost', '微话题,专注实时热点、个人兴趣、网友讨论等,包含用户等级机制,权限机制。', 1, '2019-01-06 19:08:38', '2019-01-06 19:08:38', 1);
-- --------------------------------------------------------
--
-- 表的结构 `eacoo_hooks_extra`
--
CREATE TABLE `eacoo_hooks_extra` (
`id` int(11) UNSIGNED NOT NULL,
`hook_id` int(10) UNSIGNED NOT NULL DEFAULT '0' COMMENT '钩子ID',
`depend_type` tinyint(1) UNSIGNED NOT NULL DEFAULT '0' COMMENT '应用类型。1module,2plugin,3theme',
`depend_flag` varchar(30) NOT NULL DEFAULT '' COMMENT '应用标记。如:模块或插件标识',
`sort` smallint(6) UNSIGNED NOT NULL DEFAULT '99' COMMENT '排序,值越小越靠前',
`create_time` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '创建时间',
`update_time` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '更新时间',
`status` tinyint(1) NOT NULL DEFAULT '1' COMMENT '状态。0禁用,1正常'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='钩子应用依赖表';
-- --------------------------------------------------------
--
-- 表的结构 `eacoo_links`
--
CREATE TABLE `eacoo_links` (
`id` int(11) UNSIGNED NOT NULL COMMENT 'ID',
`title` varchar(255) NOT NULL DEFAULT '' COMMENT '标题',
`image` int(11) UNSIGNED NOT NULL DEFAULT '0' COMMENT '图标',
`url` varchar(150) NOT NULL DEFAULT '' COMMENT '链接',
`target` varchar(25) NOT NULL DEFAULT '_blank' COMMENT '打开方式',
`type` tinyint(3) UNSIGNED NOT NULL DEFAULT '0' COMMENT '类型',
`rating` int(11) UNSIGNED NOT NULL COMMENT '评级',
`create_time` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '创建时间',
`update_time` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '修改时间',
`sort` tinyint(3) UNSIGNED NOT NULL DEFAULT '99' COMMENT '排序,值越小越靠前',
`status` tinyint(1) NOT NULL DEFAULT '1' COMMENT '状态,1启用,0禁用'
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='友情链接表';
--
-- 转存表中的数据 `eacoo_links`
--
INSERT INTO `eacoo_links` (`id`, `title`, `image`, `url`, `target`, `type`, `rating`, `create_time`, `update_time`, `sort`, `status`) VALUES
(1, 'EacooPHP官网', 96, 'https://www.eacoophp.com', '_blank', 2, 8, '2018-09-30 22:32:26', '2018-09-30 22:32:26', 2, 1),
(2, '社区', 89, 'https://forum.eacoophp.com', '_blank', 1, 9, '2018-09-30 22:32:26', '2018-09-30 22:32:26', 1, 1);
-- --------------------------------------------------------
--
-- 表的结构 `eacoo_modules`
--
CREATE TABLE `eacoo_modules` (
`id` int(11) UNSIGNED NOT NULL COMMENT 'ID',
`name` varchar(31) NOT NULL DEFAULT '' COMMENT '名称',
`title` varchar(63) NOT NULL DEFAULT '' COMMENT '标题',
`description` varchar(127) NOT NULL DEFAULT '' COMMENT '描述',
`author` varchar(31) NOT NULL DEFAULT '' COMMENT '开发者',
`icon` varchar(120) NOT NULL DEFAULT '' COMMENT '图标',
`version` varchar(7) NOT NULL DEFAULT '' COMMENT '版本',
`config` text NOT NULL COMMENT '配置',
`is_system` tinyint(1) UNSIGNED NOT NULL DEFAULT '0' COMMENT '是否允许卸载',
`url` varchar(120) NOT NULL DEFAULT '' COMMENT '站点',
`admin_manage_into` varchar(60) DEFAULT '' COMMENT '后台管理入口',
`create_time` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '创建时间',
`update_time` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '更新时间',
`sort` tinyint(3) UNSIGNED NOT NULL DEFAULT '99' COMMENT '排序,值越小越靠前',
`status` tinyint(1) NOT NULL DEFAULT '1' COMMENT '状态。0禁用,1启用'
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='模块功能表';
--
-- 转存表中的数据 `eacoo_modules`
--
INSERT INTO `eacoo_modules` (`id`, `name`, `title`, `description`, `author`, `icon`, `version`, `config`, `is_system`, `url`, `admin_manage_into`, `create_time`, `update_time`, `sort`, `status`) VALUES
(1, 'admin', '系统', '后台系统模块', '心云间、凝听', 'fa fa-home', '1.0.0', '', 1, '', '', '2018-12-02 22:32:26', '2018-12-02 22:32:26', 99, 1),
(2, 'home', 'Home模块', '一款基础前台Home模块', '心云间、凝听', 'fa fa-home', '1.0.0', '', 1, '', '', '2018-09-30 22:32:26', '2018-09-30 22:32:26', 99, 1),
(3, 'user', '用户中心', '用户模块,系统核心模块,不可卸载', '心云间、凝听', 'fa fa-users', '1.0.2', '', 1, 'https://www.eacoophp.com', '', '2018-09-30 22:32:26', '2018-09-30 22:32:26', 99, 1);
-- --------------------------------------------------------
--
-- 表的结构 `eacoo_nav`
--
CREATE TABLE `eacoo_nav` (
`id` smallint(6) UNSIGNED NOT NULL,
`title` varchar(60) NOT NULL DEFAULT '' COMMENT '标题',
`value` varchar(120) DEFAULT '' COMMENT 'url地址',
`pid` smallint(6) UNSIGNED NOT NULL DEFAULT '0' COMMENT '父级',
`position` varchar(20) NOT NULL DEFAULT '' COMMENT '位置。头部:header,我的:my',
`target` varchar(15) DEFAULT '_self' COMMENT '打开方式。',
`depend_type` tinyint(1) UNSIGNED NOT NULL DEFAULT '0' COMMENT '来源类型。0普通外链http,1模块扩展,2插件扩展,3主题扩展',
`depend_flag` varchar(30) NOT NULL DEFAULT '' COMMENT '来源标记。如:模块或插件标识',
`icon` varchar(120) NOT NULL DEFAULT '' COMMENT '图标',
`sort` tinyint(3) UNSIGNED NOT NULL DEFAULT '99' COMMENT '排序,值越小越靠前',
`update_time` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '更新时间',
`create_time` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '创建时间',
`status` tinyint(1) UNSIGNED NOT NULL DEFAULT '1' COMMENT '状态。0禁用,1启用'
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='前台导航';
--
-- 转存表中的数据 `eacoo_nav`
--
INSERT INTO `eacoo_nav` (`id`, `title`, `value`, `pid`, `position`, `target`, `depend_type`, `depend_flag`, `icon`, `sort`, `update_time`, `create_time`, `status`) VALUES
(1, '主页', '/', 0, 'header', '_self', 1, 'home', 'fa fa-home', 10, '2018-09-30 22:32:26', '2018-09-30 22:32:26', 1),
(2, '会员', 'user/index/index', 0, 'header', '_self', 1, 'user', '', 99, '2018-09-30 22:32:26', '2018-09-30 22:32:26', 1),
(3, '下载', 'https://gitee.com/ZhaoJunfeng/EacooPHP/attach_files', 0, 'header', '_blank', 0, '', '', 99, '2018-09-30 22:32:26', '2018-09-30 22:32:26', 1),
(4, '社区', 'https://forum.eacoophp.com', 0, 'header', '_blank', 0, '', '', 99, '2018-09-30 22:32:26', '2018-09-30 22:32:26', 1),
(5, '文档', 'https://www.kancloud.cn/youpzt/eacoo', 0, 'header', '_blank', 0, '', '', 99, '2018-09-30 22:32:26', '2018-09-30 22:32:26', 1);
-- --------------------------------------------------------
--
-- 表的结构 `eacoo_plugins`
--
CREATE TABLE `eacoo_plugins` (
`id` int(11) UNSIGNED NOT NULL COMMENT '主键',
`name` varchar(32) NOT NULL DEFAULT '' COMMENT '插件名或标识',
`title` varchar(32) NOT NULL DEFAULT '' COMMENT '中文名',
`description` text NOT NULL COMMENT '插件描述',
`config` text COMMENT '配置',
`author` varchar(32) NOT NULL DEFAULT '' COMMENT '作者',
`version` varchar(8) NOT NULL DEFAULT '' COMMENT '版本号',
`admin_manage_into` varchar(60) DEFAULT '0' COMMENT '后台管理入口',
`type` tinyint(1) UNSIGNED NOT NULL DEFAULT '1' COMMENT '插件类型',
`create_time` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '安装时间',
`update_time` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '修改时间',
`sort` tinyint(3) UNSIGNED NOT NULL DEFAULT '99' COMMENT '排序,值越小越靠前',
`status` tinyint(1) NOT NULL DEFAULT '1' COMMENT '状态'
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='插件表';
-- --------------------------------------------------------
--
-- 表的结构 `eacoo_rewrite`
--
CREATE TABLE `eacoo_rewrite` (
`id` int(10) UNSIGNED NOT NULL COMMENT '主键id自增',
`rule` varchar(255) NOT NULL DEFAULT '' COMMENT '规则',
`url` varchar(255) NOT NULL DEFAULT '' COMMENT 'url',
`create_time` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '创建时间',
`update_time` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '更新时间',
`status` tinyint(1) UNSIGNED NOT NULL DEFAULT '1' COMMENT '状态:0禁用,1启用'
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='伪静态表';
-- --------------------------------------------------------
--
-- 表的结构 `eacoo_terms`
--
CREATE TABLE `eacoo_terms` (
`term_id` int(10) UNSIGNED NOT NULL COMMENT '主键',
`name` varchar(100) NOT NULL COMMENT '分类名称',
`slug` varchar(100) DEFAULT '' COMMENT '分类别名',
`taxonomy` varchar(32) DEFAULT '' COMMENT '分类类型',
`pid` int(10) UNSIGNED DEFAULT '0' COMMENT '上级ID',
`seo_title` varchar(128) DEFAULT '' COMMENT 'seo标题',
`seo_keywords` varchar(255) DEFAULT '' COMMENT 'seo 关键词',
`seo_description` varchar(255) DEFAULT '' COMMENT 'seo描述',
`create_time` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '创建时间',
`update_time` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '更新时间',
`sort` mediumint(8) UNSIGNED DEFAULT '99' COMMENT '排序,值越小越靠前',
`status` tinyint(1) DEFAULT '1' COMMENT '状态,1发布,0不发布'
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='分类';
--
-- 转存表中的数据 `eacoo_terms`
--
INSERT INTO `eacoo_terms` (`term_id`, `name`, `slug`, `taxonomy`, `pid`, `seo_title`, `seo_keywords`, `seo_description`, `create_time`, `update_time`, `sort`, `status`) VALUES
(1, '未分类', 'nocat', 'post_category', 0, '未分类', '', '自定义分类描述', '2018-09-30 22:32:26', '2018-09-30 22:32:26', 99, 1),
(4, '大数据', 'tag_dashuju', 'post_tag', 0, '大数据', '', '这是标签描述', '2018-09-30 22:32:26', '2018-09-30 22:32:26', 99, -1),
(5, '技术类', 'technology', 'post_category', 0, '技术类', '关键词', '自定义分类描述', '2018-09-30 22:32:26', '2018-09-30 22:32:26', 99, -1),
(7, '运营', 'yunying', 'post_tag', 0, '运营', '关键字', '自定义标签描述', '2018-09-30 22:32:26', '2018-09-30 22:32:26', 99, 1),
(9, '人物', 'renwu', 'media_cat', 0, '人物', '', '聚集多为人物显示的分类', '2018-09-30 22:32:26', '2018-09-30 22:32:26', 99, 1),
(10, '美食', 'meishi', 'media_cat', 0, '美食', '', '', '2018-09-30 22:32:26', '2018-09-30 22:32:26', 99, 1),
(11, '图标素材', 'icons', 'media_cat', 0, '图标素材', '', '', '2018-09-30 22:32:26', '2018-09-30 22:32:26', 99, 1),
(12, '风景', 'fengjin', 'media_cat', 0, '风景', '风景', '', '2018-09-30 22:32:26', '2018-09-30 22:32:26', 99, 1),
(13, '其它', 'others', 'media_cat', 0, '其它', '', '', '2018-09-30 22:32:26', '2018-09-30 22:32:26', 99, 1);
-- --------------------------------------------------------
--
-- 表的结构 `eacoo_term_relationships`
--
CREATE TABLE `eacoo_term_relationships` (
`id` bigint(20) NOT NULL,
`object_id` bigint(20) UNSIGNED NOT NULL DEFAULT '0' COMMENT 'posts表里文章id',
`term_id` bigint(20) UNSIGNED NOT NULL DEFAULT '0' COMMENT '分类id',
`table` varchar(60) NOT NULL COMMENT '数据表',
`uid` int(11) UNSIGNED DEFAULT '0' COMMENT '分类与用户关系',
`create_time` datetime DEFAULT '0001-01-01 00:00:00' COMMENT '创建时间',
`sort` int(10) UNSIGNED NOT NULL DEFAULT '99' COMMENT '排序,值越小越靠前',
`status` tinyint(1) UNSIGNED NOT NULL DEFAULT '1' COMMENT '状态,1发布,0不发布'
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='对象分类对应表';
--
-- 转存表中的数据 `eacoo_term_relationships`
--
INSERT INTO `eacoo_term_relationships` (`id`, `object_id`, `term_id`, `table`, `uid`, `create_time`, `sort`, `status`) VALUES
(1, 95, 9, 'attachment', 1, '2018-09-30 22:32:26', 99, 1),
(2, 94, 13, 'attachment', 1, '2018-09-30 22:32:26', 99, 1),
(3, 116, 12, 'attachment', 1, '2018-09-30 22:32:26', 99, 1),
(4, 92, 12, 'attachment', 1, '2018-09-30 22:32:26', 99, 1),
(5, 70, 12, 'attachment', 1, '2018-09-30 22:32:26', 9, 1),
(6, 93, 11, 'attachment', 1, '2018-09-30 22:32:26', 99, 1),
(7, 96, 12, 'attachment', 1, '2018-09-30 22:32:26', 99, 1);
-- --------------------------------------------------------
--
-- 表的结构 `eacoo_themes`
--
CREATE TABLE `eacoo_themes` (
`id` int(11) UNSIGNED NOT NULL COMMENT 'ID',
`name` varchar(32) NOT NULL DEFAULT '' COMMENT '名称',
`title` varchar(64) NOT NULL DEFAULT '' COMMENT '标题',
`description` varchar(127) NOT NULL DEFAULT '' COMMENT '描述',
`author` varchar(32) NOT NULL DEFAULT '' COMMENT '开发者',
`version` varchar(8) NOT NULL DEFAULT '' COMMENT '版本',
`config` text COMMENT '主题配置',
`current` tinyint(1) UNSIGNED NOT NULL DEFAULT '0' COMMENT '当前主题类型,1PC端,2手机端。默认0',
`website` varchar(120) DEFAULT '' COMMENT '站点',
`sort` tinyint(4) UNSIGNED NOT NULL DEFAULT '99' COMMENT '排序,值越小越靠前',
`create_time` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '创建时间',
`update_time` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '更新时间',
`status` tinyint(3) NOT NULL DEFAULT '1' COMMENT '状态'
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='前台主题表';
--
-- 转存表中的数据 `eacoo_themes`
--
INSERT INTO `eacoo_themes` (`id`, `name`, `title`, `description`, `author`, `version`, `config`, `current`, `website`, `sort`, `create_time`, `update_time`, `status`) VALUES
(1, 'default', '默认主题', '内置于系统中,是其它主题的基础主题', '心云间、凝听', '1.0.3', '', 1, 'https://www.eacoophp.com', 99, '2018-09-30 22:32:26', '2019-08-31 14:22:04', 1),
(2, 'default-mobile', '默认主题-手机端', '内置于系统中,是系统的默认主题。手机端', '心云间、凝听', '1.0.1', '', 2, '', 99, '2019-08-31 14:24:16', '2019-08-31 14:24:26', 1);
-- --------------------------------------------------------
--
-- 表的结构 `eacoo_users`
--
CREATE TABLE `eacoo_users` (
`uid` int(11) UNSIGNED NOT NULL COMMENT '前台用户ID',
`username` varchar(32) NOT NULL DEFAULT '' COMMENT '用户名',
`number` char(10) NOT NULL DEFAULT '' COMMENT '会员编号',
`password` char(32) NOT NULL DEFAULT '' COMMENT '登录密码',
`nickname` varchar(60) NOT NULL DEFAULT '' COMMENT '用户昵称',
`email` varchar(100) NOT NULL DEFAULT '' COMMENT '登录邮箱',
`mobile` varchar(20) NOT NULL DEFAULT '' COMMENT '手机号',
`avatar` varchar(150) NOT NULL DEFAULT '' COMMENT '用户头像,相对于uploads/avatar目录',
`sex` smallint(1) UNSIGNED NOT NULL DEFAULT '0' COMMENT '性别;0:保密,1:男;2:女',
`birthday` date NOT NULL DEFAULT '0000-00-00' COMMENT '生日',
`description` varchar(200) NOT NULL DEFAULT '' COMMENT '个人描述',
`register_ip` varchar(16) NOT NULL DEFAULT '' COMMENT '注册IP',
`login_num` tinyint(1) UNSIGNED NOT NULL DEFAULT '0' COMMENT '登录次数',
`last_login_ip` varchar(16) NOT NULL DEFAULT '' COMMENT '最后登录ip',
`last_login_time` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '最后登录时间',
`activation_auth_sign` varchar(60) NOT NULL DEFAULT '' COMMENT '激活码',
`url` varchar(100) NOT NULL DEFAULT '' COMMENT '用户个人站点',
`score` int(11) UNSIGNED NOT NULL DEFAULT '0' COMMENT '用户积分',
`money` decimal(10,2) UNSIGNED NOT NULL DEFAULT '0.00' COMMENT '金额',
`freeze_money` decimal(10,2) UNSIGNED NOT NULL DEFAULT '0.00' COMMENT '冻结金额,和金币相同换算',
`pay_pwd` char(32) NOT NULL DEFAULT '' COMMENT '支付密码',
`reg_from` tinyint(1) UNSIGNED NOT NULL DEFAULT '0' COMMENT '注册来源。1PC端,2WAP端,3微信端,4APP端,5后台添加',
`reg_method` varchar(30) NOT NULL DEFAULT '' COMMENT '注册方式。wechat,sina,等',
`level` tinyint(3) UNSIGNED NOT NULL DEFAULT '0' COMMENT '等级,关联表user_level主键',
`p_uid` int(11) UNSIGNED NOT NULL DEFAULT '0' COMMENT '推荐人会员ID',
`is_lock` tinyint(1) UNSIGNED NOT NULL DEFAULT '0' COMMENT '是否锁定。0否,1是',
`actived` tinyint(1) UNSIGNED NOT NULL DEFAULT '0' COMMENT '是否激活,0否,1是',
`reg_time` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '注册时间',
`update_time` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '更新时间',
`status` tinyint(1) UNSIGNED NOT NULL DEFAULT '1' COMMENT '用户状态 0:禁用; 1:正常 ;'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='用户会员表';
--
-- 转存表中的数据 `eacoo_users`
--
INSERT INTO `eacoo_users` (`uid`, `username`, `number`, `password`, `nickname`, `email`, `mobile`, `avatar`, `sex`, `birthday`, `description`, `register_ip`, `login_num`, `last_login_ip`, `last_login_time`, `activation_auth_sign`, `url`, `score`, `money`, `freeze_money`, `pay_pwd`, `reg_from`, `reg_method`, `level`, `p_uid`, `is_lock`, `actived`, `reg_time`, `update_time`, `status`) VALUES
(1, 'admin', '5257975351', '031c9ffc4b280d3e78c750163d07d275', '站长', '981142336@qq.com', '15530000252', 'http://cdn.eacoo.xin/attachment/static/assets/img/default-avatar.png', 1, '0000-00-00', '网站创始人和超级管理员。1', '', 0, '127.0.0.1', '2018-10-30 23:37:51', 'e2847283eb09508cfe0db793e5a90ad53b1b570b', 'https://www.eacoophp.com', 100, '100.00', '0.00', 'eba6095468eb32492d20d5db6a85aa5d', 0, '', 0, 0, 0, 1, '2018-09-30 22:32:26', '2018-09-30 22:32:26', 1),
(3, 'U1471610993', '9948511005', '031c9ffc4b280d3e78c750163d07d275', '陈婧', '', '', '/static/assets/img/avatar-woman.png', 2, '1970-01-01', '', '', 0, '127.0.0.1', '2018-09-30 22:32:26', 'a525c9259ff2e51af1b6e629dd47766f99f26c69', '', 0, '2.00', '0.00', '', 0, '', 2, 0, 0, 0, '2018-09-30 22:32:26', '2018-09-30 22:32:26', 1),
(4, 'U1472438063', '9752985498', '031c9ffc4b280d3e78c750163d07d275', '妍冰', '', '', '/static/assets/img/avatar-woman.png', 2, '0000-00-00', '承接大型商业演出和传统文化学习班', '', 0, '', '2018-09-30 22:32:26', 'ed587cf103c3f100be20f7b8fdc7b5a8e2fda264', '', 0, '0.00', '0.00', '', 0, '', 0, 0, 0, 1, '2018-09-30 22:32:26', '2018-09-30 22:32:26', 0),
(5, 'U1472522409', '9849571025', '031c9ffc4b280d3e78c750163d07d275', '久柳', '', '', '/static/assets/img/avatar-man.png', 1, '0000-00-00', '', '', 0, '', '2018-09-30 22:32:26', '5e542dc0c77b3749f2270cb3ec1d91acc895edc8', '', 0, '0.00', '0.00', '', 0, '', 0, 0, 0, 1, '2018-09-30 22:32:26', '2018-09-30 22:32:26', 1),
(6, 'U1472739566', '5051101100', '031c9ffc4b280d3e78c750163d07d275', 'Ray', '', '', '/uploads/avatar/6/5a8ada8f72ac0.jpg', 1, '0000-00-00', '', '', 0, '', '2018-09-30 22:32:26', '6321b4d8ecb1ce1049eab2be70c44335856c840d', '', 0, '0.00', '0.00', '', 0, '', 0, 0, 0, 0, '2018-09-30 22:32:26', '2018-09-30 22:32:26', 1),
(8, 'U1472877421', '5497481009', '031c9ffc4b280d3e78c750163d07d275', '印文博律师', '', '', '/static/assets/img/avatar-man.png', 1, '0000-00-00', '', '', 0, '', '2018-09-30 22:32:26', 'e99521af40a282e84718f759ab6b1b4a989d8eb1', '', 0, '0.00', '0.00', '', 0, '', 0, 0, 0, 0, '2018-09-30 22:32:26', '2018-09-30 22:32:26', 0),
(9, 'U1472966655', '1004810149', '031c9ffc4b280d3e78c750163d07d275', '嘉伟', '', '', '/static/assets/img/avatar-man.png', 1, '0000-00-00', '', '', 0, '', '2018-09-30 22:32:26', 'f1075223be5f53b9c2c1abea8288258545365d96', '', 0, '0.00', '0.00', '', 0, '', 0, 0, 0, 1, '2018-09-30 22:32:26', '2018-09-30 22:32:26', 1),
(10, 'U1473304718', '9852101101', '031c9ffc4b280d3e78c750163d07d275', '鬼谷学猛虎流', '', '15801182191', '/static/assets/img/avatar-man.png', 1, '0000-00-00', '', '', 0, '', '2018-09-30 22:32:26', '039fc7a3f9366adf55ee9e707c371a2459c17bd7', '', 0, '0.00', '0.00', '', 0, '', 0, 0, 0, 1, '2018-09-30 22:32:26', '2018-09-30 22:32:26', 1),
(11, 'U1473391063', '1004810150', '031c9ffc4b280d3e78c750163d07d275', '@Gyb.', '', '', '/uploads/avatar/11/59e32aa3a75a2.jpg', 1, '0000-00-00', '', '', 0, '', '2018-09-30 22:32:26', '70d80a9f7599c81270a986abaea73e63101b3ecb', '', 0, '0.00', '0.00', '', 0, '', 0, 0, 0, 0, '2018-09-30 22:32:26', '2018-09-30 22:32:26', 1),
(12, 'U1473396778', '5310148501', '031c9ffc4b280d3e78c750163d07d275', '董超楠', '', '', '/static/assets/img/avatar-woman.png', 2, '0000-00-00', '', '', 0, '', '2018-09-30 22:32:26', '8bbf5242300e5e8e4917b287a31efcb0c9feedfd', '', 0, '0.00', '0.00', '', 0, '', 0, 0, 0, 1, '2018-09-30 22:32:26', '2018-09-30 22:32:26', 1),
(14, 'U1473396839', '4853979757', '031c9ffc4b280d3e78c750163d07d275', '求真实者', '', '', '/static/assets/img/default-avatar.png', 0, '0000-00-00', '', '', 0, '', '2018-09-30 22:32:26', '8f7579a85981e1c1f726704b0865320dfadbef2e', '', 0, '0.00', '0.00', '', 0, '', 0, 0, 0, 0, '2018-09-30 22:32:26', '2018-09-30 22:32:26', 1),
(15, 'U1473397391', '9810148101', '031c9ffc4b280d3e78c750163d07d275', 'peter', '', '', '/uploads/avatar/15/5a9d1473d4c91.png', 2, '0000-00-00', '', '', 0, '', '2018-09-30 22:32:26', 'c66d3a0e16a81a13173756a2832ba424b34a095c', '', 0, '0.00', '0.00', '', 0, '', 0, 0, 0, 1, '2018-09-30 22:32:26', '2018-09-30 22:32:26', 1),
(16, 'U1473397426', '1015057995', '031c9ffc4b280d3e78c750163d07d275', '随风而去的心情', '', '15801182190', '/static/assets/img/avatar-man.png', 1, '0000-00-00', '大师傅', '', 0, '', '2018-09-30 22:32:26', '14855b00775de46b451c8255e6a73a5c044fc188', '', 0, '0.00', '0.00', '', 0, '', 0, 0, 0, 0, '2018-09-30 22:32:26', '2018-09-30 22:32:26', 1),
(17, 'U1474181145', '5551564851', '031c9ffc4b280d3e78c750163d07d275', '班鱼先生', '', '', '/static/assets/img/avatar-man.png', 1, '0000-00-00', '', '', 0, '', '2018-09-30 22:32:26', '86d19a7b1f15db4fd25e0b64bfc17870a70f67e2', '', 0, '0.00', '0.00', '', 0, '', 0, 0, 0, 0, '2018-09-30 22:32:26', '2018-09-30 22:32:26', 1);
-- --------------------------------------------------------
--
-- 表的结构 `eacoo_user_level`
--
CREATE TABLE `eacoo_user_level` (
`id` smallint(6) UNSIGNED NOT NULL,
`title` varchar(60) NOT NULL DEFAULT '' COMMENT '等级名称',
`description` varchar(300) NOT NULL DEFAULT '' COMMENT '描述',
`status` tinyint(1) NOT NULL DEFAULT '0' COMMENT '状态。0禁用,1启用'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='用户等级表(头衔)';
--
-- 转存表中的数据 `eacoo_user_level`
--
INSERT INTO `eacoo_user_level` (`id`, `title`, `description`, `status`) VALUES
(1, 'VIP0', '初级会员', 1),
(2, 'VIP1', '一级会员', 1),
(3, 'VIP2', '二级会员', 1),
(4, 'VIP3', '三级会员', 1);
--
-- Indexes for dumped tables
--
--
-- Indexes for table `eacoo_action`
--
ALTER TABLE `eacoo_action`
ADD PRIMARY KEY (`id`),
ADD KEY `idx_name` (`name`);
--
-- Indexes for table `eacoo_action_log`
--
ALTER TABLE `eacoo_action_log`
ADD PRIMARY KEY (`id`),
ADD KEY `idx_uid` (`uid`);
--
-- Indexes for table `eacoo_admin`
--
ALTER TABLE `eacoo_admin`
ADD PRIMARY KEY (`uid`),
ADD UNIQUE KEY `uniq_username` (`username`),
ADD KEY `idx_email` (`email`);
--
-- Indexes for table `eacoo_attachment`
--
ALTER TABLE `eacoo_attachment`
ADD PRIMARY KEY (`id`),
ADD KEY `idx_paty_type` (`path_type`);
--
-- Indexes for table `eacoo_auth_group`
--
ALTER TABLE `eacoo_auth_group`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `eacoo_auth_group_access`
--
ALTER TABLE `eacoo_auth_group_access`
ADD KEY `uid` (`uid`);
--
-- Indexes for table `eacoo_auth_rule`
--
ALTER TABLE `eacoo_auth_rule`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `uniq_name` (`name`);
--
-- Indexes for table `eacoo_config`
--
ALTER TABLE `eacoo_config`
ADD PRIMARY KEY (`id`),
ADD KEY `idx_name` (`name`);
--
-- Indexes for table `eacoo_hooks`
--
ALTER TABLE `eacoo_hooks`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `eacoo_hooks_extra`
--
ALTER TABLE `eacoo_hooks_extra`
ADD PRIMARY KEY (`id`),
ADD KEY `idx_hookid_depend` (`hook_id`,`depend_flag`);
--
-- Indexes for table `eacoo_links`
--
ALTER TABLE `eacoo_links`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `eacoo_modules`
--
ALTER TABLE `eacoo_modules`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `eacoo_nav`
--
ALTER TABLE `eacoo_nav`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `eacoo_plugins`
--
ALTER TABLE `eacoo_plugins`
ADD PRIMARY KEY (`id`),
ADD KEY `idx_name` (`name`);
--
-- Indexes for table `eacoo_rewrite`
--
ALTER TABLE `eacoo_rewrite`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `eacoo_terms`
--
ALTER TABLE `eacoo_terms`
ADD PRIMARY KEY (`term_id`),
ADD KEY `idx_taxonomy` (`taxonomy`);
--
-- Indexes for table `eacoo_term_relationships`
--
ALTER TABLE `eacoo_term_relationships`
ADD PRIMARY KEY (`id`),
ADD KEY `idx_term_id` (`term_id`),
ADD KEY `idx_object_id` (`object_id`);
--
-- Indexes for table `eacoo_themes`
--
ALTER TABLE `eacoo_themes`
ADD PRIMARY KEY (`id`),
ADD KEY `name` (`name`);
--
-- Indexes for table `eacoo_users`
--
ALTER TABLE `eacoo_users`
ADD PRIMARY KEY (`uid`),
ADD UNIQUE KEY `uniq_number` (`number`),
ADD KEY `idx_username` (`username`),
ADD KEY `idx_email` (`email`);
--
-- Indexes for table `eacoo_user_level`
--
ALTER TABLE `eacoo_user_level`
ADD PRIMARY KEY (`id`);
--
-- 在导出的表使用AUTO_INCREMENT
--
--
-- 使用表AUTO_INCREMENT `eacoo_action`
--
ALTER TABLE `eacoo_action`
MODIFY `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '主键', AUTO_INCREMENT=17;
--
-- 使用表AUTO_INCREMENT `eacoo_action_log`
--
ALTER TABLE `eacoo_action_log`
MODIFY `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '主键';
--
-- 使用表AUTO_INCREMENT `eacoo_admin`
--
ALTER TABLE `eacoo_admin`
MODIFY `uid` mediumint(8) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '管理员UID', AUTO_INCREMENT=5;
--
-- 使用表AUTO_INCREMENT `eacoo_attachment`
--
ALTER TABLE `eacoo_attachment`
MODIFY `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT 'ID', AUTO_INCREMENT=98;
--
-- 使用表AUTO_INCREMENT `eacoo_auth_group`
--
ALTER TABLE `eacoo_auth_group`
MODIFY `id` mediumint(8) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;
--
-- 使用表AUTO_INCREMENT `eacoo_auth_rule`
--
ALTER TABLE `eacoo_auth_rule`
MODIFY `id` smallint(6) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=110;
--
-- 使用表AUTO_INCREMENT `eacoo_config`
--
ALTER TABLE `eacoo_config`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '配置ID', AUTO_INCREMENT=64;
--
-- 使用表AUTO_INCREMENT `eacoo_hooks`
--
ALTER TABLE `eacoo_hooks`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '钩子ID', AUTO_INCREMENT=19;
--
-- 使用表AUTO_INCREMENT `eacoo_hooks_extra`
--
ALTER TABLE `eacoo_hooks_extra`
MODIFY `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT;
--
-- 使用表AUTO_INCREMENT `eacoo_links`
--
ALTER TABLE `eacoo_links`
MODIFY `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT 'ID', AUTO_INCREMENT=3;
--
-- 使用表AUTO_INCREMENT `eacoo_modules`
--
ALTER TABLE `eacoo_modules`
MODIFY `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT 'ID', AUTO_INCREMENT=4;
--
-- 使用表AUTO_INCREMENT `eacoo_nav`
--
ALTER TABLE `eacoo_nav`
MODIFY `id` smallint(6) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6;
--
-- 使用表AUTO_INCREMENT `eacoo_plugins`
--
ALTER TABLE `eacoo_plugins`
MODIFY `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '主键';
--
-- 使用表AUTO_INCREMENT `eacoo_rewrite`
--
ALTER TABLE `eacoo_rewrite`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '主键id自增';
--
-- 使用表AUTO_INCREMENT `eacoo_terms`
--
ALTER TABLE `eacoo_terms`
MODIFY `term_id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '主键', AUTO_INCREMENT=14;
--
-- 使用表AUTO_INCREMENT `eacoo_term_relationships`
--
ALTER TABLE `eacoo_term_relationships`
MODIFY `id` bigint(20) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=8;
--
-- 使用表AUTO_INCREMENT `eacoo_themes`
--
ALTER TABLE `eacoo_themes`
MODIFY `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT 'ID', AUTO_INCREMENT=3;
--
-- 使用表AUTO_INCREMENT `eacoo_users`
--
ALTER TABLE `eacoo_users`
MODIFY `uid` int(11) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '前台用户ID', AUTO_INCREMENT=18;
--
-- 使用表AUTO_INCREMENT `eacoo_user_level`
--
ALTER TABLE `eacoo_user_level`
MODIFY `id` smallint(6) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5; | the_stack |
-- PREVIEW TABLE
-- preview first 10 rows with all fields, quick way to verify everything is setup correctly
SELECT * from vpcflow
LIMIT 10;
-- PARTITION TESTS
/* NOTE: if there are no constraints a partition (account, region, or date) then by default ALL data will be scanned
this could lead to costly query, always consider using at least one partition constraint.
Note that this is the case even if you have other constraints in a query (e.g. sourceaddress = '192.0.2.1'),
only constraints using partition fields (date_partition, region_partition, account_partition)
will limit the amount of data scanned.
*/
-- preview first 10 rows with all fields, limited to a single account
SELECT * from vpcflow
WHERE account_partition = '111122223333'
LIMIT 10;
-- preview first 10 rows with all fields, limited to multiple accounts
SELECT * from vpcflow
WHERE account_partition in ('111122223333','444455556666','123456789012')
LIMIT 10;
-- preview first 10 rows with all fields, limited to a single region
SELECT * from vpcflow
WHERE region_partition = 'us-east-1'
LIMIT 10;
-- preview first 10 rows with all fields, limited to multiple regions
SELECT * from vpcflow
WHERE region_partition in ('us-east-1','us-east-2','us-west-2')
LIMIT 10;
-- NOTE: date_partition format is 'YYYY/MM/DD' as a string
-- preview first 10 rows with all fields, limited to a certain date range
SELECT * from vpcflow
WHERE date_partition >= '2020/07/01'
AND date_partition <= '2020/07/31'
LIMIT 10;
-- preview first 10 rows with all fields, limited to the past 30 days (relative)
SELECT * from vpcflow
WHERE date_partition >= date_format(date_add('day',-30,current_timestamp), '%Y/%m/%d')
LIMIT 10;
-- preview first 10 rows with all fields, limited by a combination partition constraints
-- NOTE: narrowing the scope of the query as much as possible will improve performance and minimize cost
SELECT * from vpcflow
WHERE date_partition >= '2020/07/01'
AND date_partition <= '2020/07/31'
AND account_partition = '111122223333'
AND region_partition in ('us-east-1','us-east-2','us-west-2', 'us-west-2')
LIMIT 10;
-- ANALYSIS EXAMPLES
-- NOTE: default partition constraints have been provided for each query,
-- be sure to add the appropriate partition constraints to the WHERE clause as shown above
/*
DEFAULT partition constraints:
WHERE date_partition >= '2020/07/01'
AND date_partition <= '2020/07/31'
AND account_partition = '111122223333'
AND region_partition in ('us-east-1','us-east-2','us-west-2', 'us-west-2')
Be sure to modify or remove these to fit the scope of your intended analysis
*/
-- Get list source/destination IP pairs ordered by the number of records
SELECT region, instanceid, sourceaddress, destinationaddress, count(*) as record_count FROM vpcflow
WHERE date_partition >= '2020/07/01'
AND date_partition <= '2020/07/31'
AND account_partition = '111122223333'
AND region_partition in ('us-east-1','us-east-2','us-west-2', 'us-west-2')
GROUP BY region, instanceid, sourceaddress, destinationaddress
ORDER BY record_count DESC
-- Get a summary of records between a given source/destination IP pair, ordered by the total number of bytes
SELECT region, instanceid, sourceaddress, destinationaddress, sum(numbytes) as byte_count FROM vpcflow
WHERE (sourceaddress = '192.0.2.1' OR destinationaddress = '192.0.2.1')
AND (sourceaddress = '203.0.113.2' OR destinationaddress = '203.0.113.2')
AND date_partition >= '2020/07/01'
AND date_partition <= '2020/07/31'
AND account_partition = '111122223333'
AND region_partition in ('us-east-1','us-east-2','us-west-2', 'us-west-2')
GROUP BY region, instanceid, sourceaddress, destinationaddress
ORDER BY byte_count DESC
-- Get a summary of the number of bytes sent from port 443 limited to a single instance
-- NOTE: for remote IPs this represents the amount data downloaded from port 443 by the instance,
-- for instance IPs this represents the amount data downloaded by remost hosts from the instance on port 443
SELECT region, instanceid, sourceaddress, sourceport, destinationaddress, sum(numbytes) as byte_count FROM vpcflow
WHERE instanceid = 'i-000000000000000'
AND sourceport = 443
AND date_partition >= '2020/07/01'
AND date_partition <= '2020/07/31'
AND account_partition = '111122223333'
AND region_partition in ('us-east-1','us-east-2','us-west-2', 'us-west-2')
GROUP BY region, instanceid, sourceaddress, sourceport, destinationaddress
ORDER BY byte_count DESC
-- Get a summary of the number of bytes sent to port 443 limited to a single instance
-- NOTE: for remote IPs this represents the amount data uploaded to port 443 by the instance,
-- for instance IPs this represents the amount data uploaded by remost hosts to the instance on port 443
SELECT region, instanceid, sourceaddress, destinationaddress, destinationport, sum(numbytes) as byte_count FROM vpcflow
WHERE instanceid = 'i-000000000000000'
AND destinationport = 443
AND date_partition >= '2020/07/01'
AND date_partition <= '2020/07/31'
AND account_partition = '111122223333'
AND region_partition in ('us-east-1','us-east-2','us-west-2', 'us-west-2')
GROUP BY region, instanceid, sourceaddress, destinationaddress, destinationport
ORDER BY byte_count DESC
-- Get a summary with the number of bytes for each src_ip,src_port,dst_ip,dst_port quad across all records to or from a specific IP
SELECT sourceaddress, destinationaddress, sourceport, destinationport, sum(numbytes) as byte_count FROM vpcflow
WHERE (sourceaddress = '192.0.2.1' OR destinationaddress = '192.0.2.1')
AND date_partition >= '2020/07/01'
AND date_partition <= '2020/07/31'
AND account_partition = '111122223333'
AND region_partition in ('us-east-1','us-east-2','us-west-2', 'us-west-2')
GROUP BY sourceaddress, destinationaddress, sourceport, destinationport
ORDER BY byte_count DESC
-- Get all flow records between two IPs showing flow_direction (requires v5 flow-direction field to be enabled)
SELECT from_unixtime(starttime) AS start_time,
from_unixtime(endtime) AS end_time,
interfaceid,
sourceaddress,
destinationaddress,
sourceport,
destinationport,
numpackets,
numbytes,
flow_direction,
action
FROM vpcflow
WHERE (sourceaddress = '192.0.2.1'
AND destinationaddress = '192.0.2.254')
OR (sourceaddress = '192.0.2.254'
AND destinationaddress = '192.0.2.1')
ORDER BY starttime ASC
-- List when source ips were first seen / last seen with a summary of destination ip/instances/ports
SELECT sourceaddress,
min(starttime) AS first_seen,
max(endtime) AS last_seen,
array_agg(DISTINCT(destinationaddress)),
array_agg(DISTINCT(instanceid)),
array_agg(DISTINCT(destinationport))
FROM vpcflow
WHERE destinationport < 32768 -- skip ephemeral ports, since we're looking for inbound connections to service ports
AND date_partition >= '2020/07/01'
AND date_partition <= '2020/07/31'
AND account_partition = '111122223333'
AND region_partition in ('us-east-1','us-east-2','us-west-2', 'us-west-2')
GROUP BY sourceaddress
ORDER by first_seen ASC
-- Daily Transfer Report on Top 10 Internal IPs with large transfers, limited to source addresses in network 192.0.2.0/24
SELECT vpcflow.event_date, vpcflow.sourceaddress, vpcflow.destinationaddress, sum(vpcflow.numbytes) as byte_count
FROM vpcflow
INNER JOIN (SELECT sourceaddress, sum(numbytes) as byte_count FROM vpcflow
WHERE sourceaddress like '192.0.2.%'
AND date_partition >= '2020/07/01'
AND date_partition <= '2020/07/31'
AND account_partition = '111122223333'
AND region_partition in ('us-east-1','us-east-2','us-west-2', 'us-west-2')
GROUP BY region, instanceid, sourceaddress, destinationaddress, destinationport
ORDER BY byte_count DESC
LIMIT 10) as top_n
ON top_n.sourceaddress = vpcflow.sourceaddress
WHERE date_partition >= '2020/07/01'
AND date_partition <= '2020/07/31'
AND account_partition = '111122223333'
AND region_partition in ('us-east-1','us-east-2','us-west-2', 'us-west-2')
GROUP BY vpcflow.event_date, vpcflow.sourceaddress, vpcflow.destinationaddress
ORDER BY vpcflow.event_date ASC, vpcflow.sourceaddress ASC, vpcflow.destinationaddress ASC, byte_count DESC
-- Search for traffic between a private (RFC1918) IP address and a public (non-RFC1918) IP address
-- NOTE: this is an example of using the new IPADDRESS data type, as string a string comparison would correctly compare IP addresses
SELECT *
FROM vpcflow
WHERE (sourceaddress <> '-' AND destinationaddress <> '-')
AND ( (
NOT ( (CAST(sourceaddress AS IPADDRESS) > IPADDRESS '10.0.0.0'
AND CAST(sourceaddress AS IPADDRESS) < IPADDRESS '10.255.255.255')
OR (CAST(sourceaddress AS IPADDRESS) > IPADDRESS '172.16.0.0'
AND CAST(sourceaddress AS IPADDRESS) < IPADDRESS '172.31.255.255')
OR (CAST(sourceaddress AS IPADDRESS) > IPADDRESS '192.168.0.0'
AND CAST(sourceaddress AS IPADDRESS) < IPADDRESS '192.168.255.255'))
AND ( (CAST(destinationaddress AS IPADDRESS) > IPADDRESS '10.0.0.0'
AND CAST(destinationaddress AS IPADDRESS) < IPADDRESS '10.255.255.255')
OR (CAST(destinationaddress AS IPADDRESS) > IPADDRESS '172.16.0.0'
AND CAST(destinationaddress AS IPADDRESS) < IPADDRESS '172.31.255.255')
OR (CAST(destinationaddress AS IPADDRESS) > IPADDRESS '192.168.0.0'
AND CAST(destinationaddress AS IPADDRESS) < IPADDRESS '192.168.255.255'))
)
OR (
NOT ( (CAST(destinationaddress AS IPADDRESS) > IPADDRESS '10.0.0.0'
AND CAST(destinationaddress AS IPADDRESS) < IPADDRESS '10.255.255.255')
OR (CAST(destinationaddress AS IPADDRESS) > IPADDRESS '172.16.0.0'
AND CAST(destinationaddress AS IPADDRESS) < IPADDRESS '172.31.255.255')
OR (CAST(destinationaddress AS IPADDRESS) > IPADDRESS '192.168.0.0'
AND CAST(destinationaddress AS IPADDRESS) < IPADDRESS '192.168.255.255'))
AND ( (CAST(sourceaddress AS IPADDRESS) > IPADDRESS '10.0.0.0'
AND CAST(sourceaddress AS IPADDRESS) < IPADDRESS '10.255.255.255')
OR (CAST(sourceaddress AS IPADDRESS) > IPADDRESS '172.16.0.0'
AND CAST(sourceaddress AS IPADDRESS) < IPADDRESS '172.31.255.255')
OR (CAST(sourceaddress AS IPADDRESS) > IPADDRESS '192.168.0.0'
AND CAST(sourceaddress AS IPADDRESS) < IPADDRESS '192.168.255.255'))
)
)
AND date_partition >= '2020/07/01'
AND date_partition <= '2020/07/31'
AND account_partition = '111122223333'
AND region_partition in ('us-east-1','us-east-2','us-west-2', 'us-west-2') | the_stack |
create schema plan_hint;
set current_schema = plan_hint;
create table src(a int);
insert into src values(1);
create table hint_t1(a int, b int, c int);
insert into hint_t1 select generate_series(1, 2000), generate_series(1, 1000), generate_series(1, 500) from src;
create table hint_t2(a int, b int, c int);
insert into hint_t2 select generate_series(1, 1000), generate_series(1, 500), generate_series(1, 100) from src;
create table hint_t3(a int, b int, c int);
insert into hint_t3 select generate_series(1, 100), generate_series(1, 50), generate_series(1, 25) from src;
create table hint_t4(a int, b int, c int);
insert into hint_t4 select generate_series(1, 10), generate_series(1, 5), generate_series(1, 2) from src;
create table hint_t5(a int, b int, c int);
insert into hint_t5 select generate_series(1, 5), generate_series(1, 5), generate_series(1, 2) from src;
analyze hint_t1;
analyze hint_t2;
analyze hint_t3;
analyze hint_t4;
analyze hint_t5;
--leading hint error
--table num < 2
explain(costs off) select /*+ leading() */ * from hint_t1 join hint_t2 on (1 = 1);
explain(costs off) select /*+ leading(hint_t1) */ * from hint_t1 join hint_t2 on (1 = 1);
--more than one leading, they will all discard
explain(costs off) select /*+ leading(hint_t1 hint_t2) leading(hint_t2 hint_t3) */ * from hint_t1 join hint_t2 on (1 = 1) join hint_t3 on(1 = 1);
--inner outer, syntax error
explain (costs off)select /*+ leading((hint_t1 hint_t2) hint_t3)*/ * from hint_t1 join hint_t2 on (1 = 1) join hint_t3 on(1 = 1);
--outer inner couple
explain(costs off) select /*+ leading((hint_t1 hint_t2 hint_t3))*/ * from hint_t1 join hint_t2 on (1 = 1) join hint_t3 on(1 = 1);
explain(costs off) select /*+ leading((hint_t1))*/ * from hint_t1 join hint_t2 on (1 = 1) join hint_t3 on(1 = 1);
explain(costs off) select /*+ leading(((hint_t1) (hint_t2)))*/ * from hint_t1 join hint_t2 on (1 = 1) join hint_t3 on(1 = 1);
--join hint error
--table num < 2
explain(costs off) select /*+ nestloop()*/ * from hint_t1 join hint_t2 on (1 = 1) join hint_t3 on(1 = 1);
explain(costs off) select /*+ nestloop(hint_t1)*/ * from hint_t1 join hint_t2 on (1 = 1) join hint_t3 on(1 = 1);
--rows hint error
--table num < 2
explain(costs off) select /*+ rows()*/ * from hint_t1 join hint_t2 on (1 = 1) join hint_t3 on(1 = 1);
explain(costs off) select /*+ rows(hint_t1)*/ * from hint_t1 join hint_t2 on (1 = 1) join hint_t3 on(1 = 1);
--support type '#' '+' '-' '*'
explain(costs off) select /*+ rows(hint_t1 hint_t2 10)*/ * from hint_t1 join hint_t2 on (1 = 1) join hint_t3 on(1 = 1);
explain(costs off) select /*+ rows(hint_t1 hint_t2 @10)*/ * from hint_t1 join hint_t2 on (1 = 1) join hint_t3 on(1 = 1);
--last one need num
explain(costs off) select /*+ rows(hint_t1 hint_t2 #1jk)*/ * from hint_t1 join hint_t2 on (1 = 1) join hint_t3 on (1 = 1);
--duplicate rows hint
explain (costs off)select /*+ rows(hint_t1 hint_t2 +100) rows(hint_t1 hint_t2 +100)*/ * from hint_t1 join hint_t2 on (1 = 1) join hint_t3 on(1 = 1);
explain (costs off)select /*+ rows(hint_t1 hint_t2 +100) rows(hint_t1 hint_t2 #100)*/ * from hint_t1 join hint_t2 on (1 = 1) join hint_t3 on(1 = 1);
explain (costs off)select /*+ rows(hint_t1 hint_t2 +100) rows(hint_t1 hint_t2 +100) rows(hint_t1 hint_t2 #100)*/
* from hint_t1 join hint_t2
on (1 = 1) join hint_t3
on(1 = 1);
explain (costs off)select /*+ rows(hint_t1 hint_t2 +100) rows(hint_t1 +10) rows(hint_t1 hint_t2 +100) rows(hint_t1 *10)
rows(hint_t1 hint_t2 #100) rows(hint_t2 #100) rows(hint_t1 #10) rows(hint_t2 #100)*/
* from hint_t1 join hint_t2
on (1 = 1) join hint_t3
on(1 = 1);
--stream hint error
--table num >= 1
explain(costs off) select * from hint_t1 join hint_t2 on (1 = 1) join hint_t3 on(1 = 1);
explain(costs off) select * from hint_t1 join hint_t2 on (1 = 1) join hint_t3 on(1 = 1);
--table name not exists
explain (costs off) select /*+ nestloop(t10 t20) leading(t100 t200) rows(t1000 t2000 #100) */
* from hint_t1 as t1 join hint_t2 as t2 on (1 = 1) join hint_t3 as t3 on(1 = 1);
--hint can not include duplicate rel name
explain (costs off) select /*+ nestloop(hint_t1 hint_t1) leading(hint_t2 hint_t2) rows(hint_t2 hint_t2 #10) */
* from hint_t1 join hint_t2 on (1 = 1) join hint_t3 on(1 = 1);
--drop duplicate hint
explain (costs off)select /*+ nestloop(hint_t1 hint_t2) nestloop(hint_t1 hint_t2)
rows(hint_t1 hint_t2 #100) rows(hint_t1 hint_t2 +100) */
* from hint_t1 join hint_t2 on (1 = 1) join hint_t3 on(1 = 1);
--join hint
explain (costs off)
select
/*+ nestloop(t1 t2)*/
*
from hint_t1 as t1
join hint_t2 as t2
on(t1.a = t2.b)
join hint_t3 as t3
on (t2.a = t3.b);
--can not generate t1 join t3 path, because t1, t3 havr not join qual.
--(join_search_one_level)
explain (costs off)
select /*+ nestloop(t1 t3)*/
*
from hint_t1 as t1
join hint_t2 as t2
on(t1.a = t2.b)
join hint_t3 as t3
on (t2.a = t3.b);
explain (costs off)
select /*+ nestloop(t2 t3)*/
*
from hint_t1 as t1
join hint_t2 as t2
on(t1.a = t2.b)
join hint_t3 as t3
on (t2.a = t3.b);
explain (costs off)
select
/*+ mergejoin(t1 t2)*/
*
from hint_t1 as t1
join hint_t2 as t2
on(t1.a = t2.b)
join hint_t3 as t3
on (t2.a = t3.b);
explain (costs off)
select /*+ mergejoin(t2 t3)*/
*
from hint_t1 as t1
join hint_t2 as t2
on(t1.a = t2.b)
join hint_t3 as t3
on (t2.a = t3.b);
explain (costs off)
select
/*+ hashjoin(t1 t2)*/
*
from hint_t1 as t1
join hint_t2 as t2
on(t1.a = t2.b)
join hint_t3 as t3
on (t2.a = t3.b);
explain (costs off)
select /*+ hashjoin(t2 t3)*/
*
from hint_t1 as t1
join hint_t2 as t2
on(t1.a = t2.b)
join hint_t3 as t3
on (t2.a = t3.b);
explain (costs off)
select /*+ no hashjoin(t2 t3)*/
*
from hint_t1 as t1
join hint_t2 as t2
on(t1.a = t2.b)
join hint_t3 as t3
on (t2.a = t3.b);
explain (costs off)
select /*+ no hashjoin(t2 t3) no mergejoin(t2 t3)*/
*
from hint_t1 as t1
join hint_t2 as t2
on(t1.a = t2.b)
join hint_t3 as t3
on (t2.a = t3.b);
explain (costs off)
select /*+ nestloop(t1 t2 t3)*/
*
from hint_t1 as t1
join hint_t2 as t2
on(t1.a = t2.b)
join hint_t3 as t3
on (t2.a = t3.b);
explain (costs off)
select /*+ mergejoin(t1 t2 t3)*/
*
from hint_t1 as t1
join hint_t2 as t2
on(t1.a = t2.b)
join hint_t3 as t3
on (t2.a = t3.b);
explain (costs off)
select /*+ hashjoin(t1 t2 t3)*/
*
from hint_t1 as t1
join hint_t2 as t2
on(t1.a = t2.b)
join hint_t3 as t3
on (t2.a = t3.b);
explain (costs off)
select /*+ hashjoin(T1 "T2" t3)*/
*
from hint_t1 as T1
join hint_t2 as "T2"
on(t1.a = "T2".b)
join hint_t3 as t3
on ("T2".a = t3.b);
explain (costs off)
select /*+ hashjoin(t1 t2) mergejoin (t1 t2 t3) nestloop(t1 t2 t3 t4)*/
*
from hint_t1 as t1
join hint_t2 as t2
on(t1.a = t2.b)
join hint_t3 as t3
on (t2.a = t3.b)
join hint_t4 as t4
on (t4.c = t3.c);
--leading hint
explain (costs off)
select /*+ leading(t1 t2)*/
*
from hint_t1 as t1
join hint_t2 as t2
on(t1.a = t2.b)
join hint_t3 as t3
on (t2.a = t3.b);
--can not generate t1 join t3 path, because t1, t3 have not join qual
--(join_search_one_level)
explain (costs off) select /*+ leading(t1 t3)*/
*
from hint_t1 t1
join hint_t2 t2
on(t1.a = t2.b)
join hint_t3 t3
on (t2.a = t3.b);
explain (costs off)
select /*+ leading(t2 t3)*/
*
from hint_t1 as t1
join hint_t2 as t2
on(t1.a = t2.b)
join hint_t3 as t3
on (t2.a = t3.b);
explain (costs off) select
/*+ leading(t2 t3 t4)*/
*
from hint_t1 as t1
join hint_t2 as t2
on(t1.a = t2.b)
join hint_t3 as t3
on (t2.a = t3.b)
join hint_t4 as t4
on (t4.c = t3.c);
explain (costs off)
select /*+ leading((((t1 t2) t3) t4)) */
*
from hint_t1 as t1
join hint_t2 as t2
on(t1.a = t2.b)
join hint_t3 as t3
on (t2.a = t3.b)
join hint_t4 as t4
on (t4.c = t3.c);
explain (costs off)
select /*+ leading(((t1 t2) (t3 t4))) */
*
from hint_t1 as t1
join hint_t2 as t2
on(t1.a = t2.b)
join hint_t3 as t3
on (t2.a = t3.b)
join hint_t4 as t4
on (t4.c = t3.c);
--row hint
set explain_perf_mode = pretty;
explain select
*
from hint_t1 as t1
join hint_t2 as t2
on(t1.a = t2.b)
join hint_t3 as t3
on (t2.a = t3.b);
explain
select /*+ rows(t2 t3 #230)*/
*
from hint_t1 as t1
join hint_t2 as t2
on(t1.a = t2.b)
join hint_t3 as t3
on (t2.a = t3.b);
explain select /*+ rows(t2 t3 +100)*/
*
from hint_t1 as t1
join hint_t2 as t2
on(t1.a = t2.b)
join hint_t3 as t3
on (t2.a = t3.b);
explain select /*+ rows(t2 t3 +10.5)*/
*
from hint_t1 as t1
join hint_t2 as t2
on(t1.a = t2.b)
join hint_t3 as t3
on (t2.a = t3.b);
explain select /*+ rows(t2 t3 -10)*/
*
from hint_t1 as t1
join hint_t2 as t2
on(t1.a = t2.b)
join hint_t3 as t3
on (t2.a = t3.b);
explain select /*+ rows(t1 t2 *10) rows(t2 t3 *10)*/
*
from hint_t1 as t1
join hint_t2 as t2
on(t1.a = t2.b)
join hint_t3 as t3
on (t2.a = t3.b);
explain select /*+ rows(t1 t2 t3 *10)*/
*
from hint_t1 as t1
join hint_t2 as t2
on(t1.a = t2.b)
join hint_t3 as t3
on (t2.a = t3.b);
explain select /*+ rows(t1 t2 t3 *0.5)*/
*
from hint_t1 as t1
join hint_t2 as t2
on(t1.a = t2.b)
join hint_t3 as t3
on (t2.a = t3.b);
reset explain_perf_mode;
--stream hint
explain (costs off)
select
*
from hint_t1 as t1
join hint_t2 as t2
on(t1.a = t2.b);
explain (costs off)
select
*
from hint_t1 as t1
join hint_t2 as t2
on(t1.a = t2.b)
join hint_t3 as t3
on (t2.a = t3.b);
explain (costs off)
select
*
from hint_t1 as t1
join hint_t2 as t2
on(t1.a = t2.b)
join hint_t3 as t3
on (t2.a = t3.b);
explain (costs off)
select
* from hint_t1 as t1
join (select sum(a) as a, b from hint_t2 as t2 group by b) as AA
on(t1.b = AA.a);
explain (costs off)
select /*+ hashjoin(t1 t2) mergejoin (t1 t2 t3) nestloop(t1 t2 t3 t4) */
*
from hint_t1 as t1
join hint_t2 as t2
on(t1.a = t2.b)
join hint_t3 as t3
on (t2.a = t3.b)
join hint_t4 as t4
on (t4.c = t3.c);
--leading join hint
explain (costs off)
select /*+ leading(t1 t2) no hashjoin(t1 t2)*/
*
from hint_t1 as t1
join hint_t2 as t2
on(t1.a = t2.b)
join hint_t3 as t3
on (t2.a = t3.b);
explain (costs off)
select /*+ leading(t1 t2) mergejoin(t1 t2)*/
*
from hint_t1 as t1
join hint_t2 as t2
on(t1.a = t2.b)
join hint_t3 as t3
on (t2.a = t3.b);
explain (costs off)
select /*+ leading((t2 t1)) mergejoin(t1 t2)*/
*
from hint_t1 as t1
join hint_t2 as t2
on(t1.a = t2.b)
join hint_t3 as t3
on (t2.a = t3.b);
explain (costs off)
select /*+ leading((t2 t1)) nestloop(t1 t2)*/
*
from hint_t1 as t1
join hint_t2 as t2
on(t1.a = t2.b)
join hint_t3 as t3
on (t2.a = t3.b);
explain (costs off)
select /*+ leading((t2 t1)) hashjoin(t1 t2)*/
*
from hint_t1 as t1
join hint_t2 as t2
on(t1.a = t2.b)
join hint_t3 as t3
on (t2.a = t3.b);
explain (costs off)
select /*+ leading(t2 t3) no hashjoin(t2 t3)*/
*
from hint_t1 as t1
join hint_t2 as t2
on(t1.a = t2.b)
join hint_t3 as t3
on (t2.a = t3.b);
explain (costs off)
select /*+ leading(t2 t3) mergejoin(t2 t3)*/
*
from hint_t1 as t1
join hint_t2 as t2
on(t1.a = t2.b)
join hint_t3 as t3
on (t2.a = t3.b);
explain(costs off) select /*+ nestloop(t1 t2) mergejoin(t1 t2) leading((t2 t1)) leading((t1 t2))*/ *
from hint_t1 as t1 join hint_t2 as t2
on (t1.a = t2.a)
join hint_t3 as t3
on (t2.b = t3.b);
--subquery include hint
--subquery pull up
explain (costs off)
select 1 from hint_t1 as t1 join (select /*+ mergejoin(t2 t3) */ t2.a from hint_t2 as t2 join hint_t3 as t3 on (t2.a = t3.a)) as AA on(t1.a = AA.a);
explain (costs off)
select /*+ leading(t1 aa) hashjoin(t1 aa)*/ 1 from hint_t1 as t1 join (select /*+ leading((t3 t2)) mergejoin(t2 t3) */
t2.a from hint_t2 as t2 join hint_t3 as t3
on (t2.a = t3.a)) as AA on(t1.a = AA.a);
--subquey can not pull up
explain (costs off)
select /*+ nestloop(t1 aa)*/ 1 from hint_t1 as t1 join
(select /*+ leading((t3 t2)) mergejoin(t2 t3) */ sum(t2.a) as a from hint_t2 as t2 join hint_t3 as t3
on (t2.a = t3.a)) as AA on(t1.a = AA.a);
explain (costs off)
select /*+ mergejoin(t1 aa)*/ 1 from hint_t1 as t1 join
(select sum(t2.a) as a from hint_t2 as t2 join hint_t3 as t3
on (t2.a = t3.a)) as AA on(t1.a = AA.a);
explain (costs off)
select /*+ mergejoin(t1 aa)*/ 1 from hint_t1 as t1 join
(select /*+ mergejoin(t2 t3)*/ sum(t2.a) as a from hint_t2 as t2 join hint_t3 as t3
on (t2.a = t3.a)) as AA on(t1.a = AA.a);
--sublink
explain (costs off)
select 1 from hint_t1 as t1 where t1.a =
(select /*+ mergejoin(t2 t3)*/ sum(t2.a) as a from hint_t2 as t2 join hint_t3 as t3
on (t2.a = t3.a));
explain (costs off)
select 1 from hint_t1 as t1 where t1.a =
(select /*+ leading((t3 t2)) mergejoin(t2 t3)*/ sum(t2.a) as a from hint_t2 as t2 join hint_t3 as t3
on (t2.a = t3.a) where t1.b = t2.b);
explain (costs off)
select 1 from hint_t1 as t1 where t1.a =
(select /*+ nestloop(t2 t3)*/ sum(t2.a) as a from hint_t2 as t2 join hint_t3 as t3
on (t2.a = t3.a) where t1.b = t2.b);
explain (costs off)
select 1 from hint_t1 as t1 where t1.a in
(select /*+ nestloop(t2 t3)*/ t2.a as a from hint_t2 as t2 join hint_t3 as t3
on (t2.a = t3.a));
explain (costs off)
select 1 from hint_t1 as t1 where t1.a in
(select /*+ hahsjoin(t2 t3)*/ t2.a as a from hint_t2 as t2 join hint_t3 as t3
on (t2.a = t3.a));
explain (costs off)
select 1 from hint_t1 as t1 where t1.a not in
(select /*+ nestloop(t2 t3)*/ t2.a as a from hint_t2 as t2 join hint_t3 as t3
on (t2.a = t3.a));
--view keep hint
create view hint_view_1 as
select /*+ leading(t2 t3) mergejoin(t2 t3)*/
t1.a
from hint_t1 as t1
join hint_t2 as t2
on(t1.a = t2.b)
join hint_t3 as t3
on (t2.a = t3.b);
explain (costs off)select * from hint_view_1;
create view hint_view_2 as
select /*+ leading((t3 t2)) mergejoin(t2 t3)*/
t1.a
from hint_t1 as t1
join hint_t2 as t2
on(t1.a = t2.b)
join hint_t3 as t3
on (t2.a = t3.b);
explain (costs off)select * from hint_view_2;
set explain_perf_mode = pretty;
create view hint_view_3 as
select /*+ nestloop(t2 t3) rows(t2 t3 #200)*/
t1.a
from hint_t1 as t1
join hint_t2 as t2
on(t1.a = t2.b)
join hint_t3 as t3
on (t2.a = t3.b);
explain select * from hint_view_3;
create view hint_view_4 as
select /*+ nestloop(t2 t3) rows(t2 t3 #200)*/
t1.a
from hint_t1 as t1
join hint_t2 as t2
on(t1.a = t2.b)
join hint_t3 as t3
on (t2.a = t3.b);
explain select * from hint_view_4;
create view hint_view_5 as
select /*+ nestloop(t2 t3) rows(t2 t3 #200)*/
t1.a
from hint_t1 as t1
join hint_t2 as t2
on(t1.a = t2.b)
join hint_t3 as t3
on (t2.a = t3.b);
explain select * from hint_view_5;
create view hint_view_6 as
select /*+ leading(t2 t3) nestloop(t2 t3) rows(t2 t3 #200)*/
t1.a
from hint_t1 as t1
join hint_t2 as t2
on(t1.a = t2.b)
join hint_t3 as t3
on (t2.a = t3.b);
explain select * from hint_view_6;
create view hint_view_7 as
select /*+ leading(t2 t3) nestloop(t2 t3) rows(t2 t3 #200)*/
t1.a
from hint_t1 as t1
join hint_t2 as t2
on(t1.a = t2.b)
join hint_t3 as t3
on (t2.a = t3.b);
explain select * from hint_view_7;
explain
select 1 from hint_t1 as t1 where t1.a in
(select /*+ nestloop(t2 t3) rows(t2 t3 #500)*/ sum(t2.a) as a from hint_t2 as t2 join hint_t3 as t3
on (t2.a = t3.a));
reset explain_perf_mode;
create view hint_view_8 as
select /*+ nestloop(t2 t3)*/
t1.a
from hint_t1 as t1
join hint_t2 as t2
on(t1.a = t2.b)
join hint_t3 as t3
on (t2.a = t3.b);
explain (costs off)select * from hint_view_8;
create view hint_view_9 as
select /*+ nestloop(t2 t3) */
t1.a
from hint_t1 as t1
join hint_t2 as t2
on(t1.a = t2.b)
join hint_t3 as t3
on (t2.a = t3.b);
explain (costs off)select * from hint_view_9;
create view hint_view_10 as
select /*+ leading(((t1 t2) t3)) nestloop(t2 t3) rows(t2 t3 #200)*/
t1.a
from hint_t1 as t1
join hint_t2 as t2
on(t1.a = t2.b)
join hint_t3 as t3
on (t2.a = t3.b);
explain (costst off)select * from hint_view_10;
\d+ hint_view_10
create index hintt1_index on hint_t1(a);
create index hintt2_index on hint_t1(a);
explain (costs off) select * from hint_t1 where a = 10 and b = 10;
explain (costs off) select /*+ tablescan(hint_t1)*/ * from hint_t1 where a = 10 and b = 10;
explain (costs off) select /*+ indexscan(hint_t1)*/ * from hint_t1 where a = 10 and b = 10;
explain (costs off) select /*+ indexscan(hint_t1 hintt1_index)*/ * from hint_t1 where a = 10 and b = 10;
explain (costs off) select /*+ indexscan(hint_t1 hintt2_index)*/ * from hint_t1 where a = 10 and b = 10;
explain (costs off) select /*+ indexonlyscan(hint_t1 hintt1_index)*/ * from hint_t1 where a = 10 and b = 10;
explain (costs off) select a from hint_t1 where a = 10;
explain (costs off) select /*+ indexonlyscan(hint_t1)*/ a from hint_t1 where a = 10;
explain (costs off) select /*+ indexonlyscan(hint_t1 hintt1_index)*/ a from hint_t1 where a = 10;
explain (costs off) select /*+ indexonlyscan(hint_t1 hintt2_index)*/ a from hint_t1 where a = 10;
create view hint_view1 as select /*+ tablescan(hint_t1)*/ * from hint_t1 where a = 10 and b = 10;
create view hint_view2 as select /*+ indexscan(hint_t1)*/ * from hint_t1 where a = 10 and b = 10;
create view hint_view3 as select /*+ indexscan(hint_t1 hintt1_index)*/ * from hint_t1 where a = 10 and b = 10;
create view hint_view4 as select /*+ indexonlyscan(hint_t1 hintt1_index)*/ a from hint_t1 where a = 10;
select /*+ tablescan(hint_t1 hint_t2 hint_t3)*/ * from hint_t1 where a = 10 and b = 10;
explain (costs off) select * from hint_view1;
explain (costs off) select * from hint_view2;
explain (costs off) select * from hint_view3;
explain (costs off) select * from hint_view4;
explain (costs off)select /*+ tablescan(t1) tablescan(t1) indexscan(t1) indexscan(t1) indexscan(t1 hintt1_index) indexscan(t1 hintt1_index)*/
* from hint_t1 as t1;
create table hint_vec(a int, b int, c int) with(orientation = column) ;
create index hint_vec_index on hint_vec(a);
create index hint_vec_index2 on hint_vec(b);
explain (costs off) select a from hint_vec where a = 10;
explain (costs off) select /*+ tablescan(hint_vec)*/ a from hint_vec where a = 10;
explain (costs off) select /*+ indexscan(hint_vec hint_vec_index)*/ a from hint_vec where a = 10;
explain (costs off) select /*+ indexonlyscan(hint_vec hint_vec_index)*/ a from hint_vec where a = 10;
-- test conflict
explain (costs off) select /*+ tablescan(hint_vec) indexonlyscan(hint_vec hint_vec_index)*/ a from hint_vec where a = 10;
explain (costs off) select /*+ tablescan(hint_vec) no indexonlyscan(hint_vec hint_vec_index2)*/ a from hint_vec where a = 10;
explain (costs off) select /*+ indexscan(hint_vec) no indexscan(hint_vec hint_vec_index2)*/ a from hint_vec where a = 10;
explain (costs off) select /*+ no indexscan(hint_vec hint_vec_index2) indexscan(hint_vec)*/ a from hint_vec where a = 10;
explain (costs off) select /*+ no indexscan(hint_vec hint_vec_index) indexscan(hint_vec)*/ a from hint_vec where a = 10;
explain (costs off) select /*+ no tablescan no indexonlyscan(hint_vec hint_vec_index2)*/ a from hint_vec where a = 10;
explain (costs off) select /*+ no indexonlyscan(hint_vec hint_vec_index) no indexonlyscan(hint_vec hint_vec_index2)*/ a from hint_vec where a = 10;
-- same keyword
-- yes yes
explain (costs off) select /*+ indexonlyscan(hint_vec) indexonlyscan(hint_vec hint_vec_index)*/ a from hint_vec where a = 10;
explain (costs off) select /*+ indexonlyscan(hint_vec) indexonlyscan(hint_vec)*/ a from hint_vec where a = 10;
explain (costs off) select /*+ indexonlyscan(hint_vec hint_vec_index) indexonlyscan(hint_vec hint_vec_index2)*/ a from hint_vec where a = 10;
-- yes no
explain (costs off) select /*+ indexonlyscan(hint_vec) no indexonlyscan(hint_vec hint_vec_index)*/ a from hint_vec where a = 10;
explain (costs off) select /*+ indexonlyscan(hint_vec hint_vec_index) no indexonlyscan(hint_vec)*/ a from hint_vec where a = 10;
explain (costs off) select /*+ indexonlyscan(hint_vec) no indexonlyscan(hint_vec)*/ a from hint_vec where a = 10;
explain (costs off) select /*+ indexonlyscan(hint_vec hint_vec_index) no indexonlyscan(hint_vec hint_vec_index2)*/ a from hint_vec where a = 10;
-- no yes
explain (costs off) select /*+ no indexonlyscan(hint_vec) indexonlyscan(hint_vec hint_vec_index)*/ a from hint_vec where a = 10;
explain (costs off) select /*+ no indexonlyscan(hint_vec hint_vec_index) indexonlyscan(hint_vec)*/ a from hint_vec where a = 10;
explain (costs off) select /*+ no indexonlyscan(hint_vec) indexonlyscan(hint_vec)*/ a from hint_vec where a = 10;
explain (costs off) select /*+ no indexonlyscan(hint_vec hint_vec_index) indexonlyscan(hint_vec hint_vec_index2)*/ a from hint_vec where a = 10;
-- no no
explain (costs off) select /*+ no indexonlyscan(hint_vec) no indexonlyscan(hint_vec hint_vec_index)*/ a from hint_vec where a = 10;
explain (costs off) select /*+ no indexonlyscan(hint_vec hint_vec_index) no indexonlyscan(hint_vec)*/ a from hint_vec where a = 10;
explain (costs off) select /*+ no indexonlyscan(hint_vec) no indexonlyscan(hint_vec)*/ a from hint_vec where a = 10;
explain (costs off) select /*+ no indexonlyscan(hint_vec hint_vec_index) no indexonlyscan(hint_vec hint_vec_index2)*/ a from hint_vec where a = 10;
-- different keyword
-- yes yes
explain (costs off) select /*+ indexonlyscan(hint_vec) indexscan(hint_vec hint_vec_index)*/ a from hint_vec where a = 10;
explain (costs off) select /*+ indexonlyscan(hint_vec) indexscan(hint_vec)*/ a from hint_vec where a = 10;
explain (costs off) select /*+ indexonlyscan(hint_vec hint_vec_index) indexscan(hint_vec hint_vec_index2)*/ a from hint_vec where a = 10;
-- yes no
explain (costs off) select /*+ indexonlyscan(hint_vec) no indexscan(hint_vec hint_vec_index)*/ a from hint_vec where a = 10;
explain (costs off) select /*+ indexonlyscan(hint_vec hint_vec_index) no indexscan(hint_vec)*/ a from hint_vec where a = 10;
explain (costs off) select /*+ indexonlyscan(hint_vec) no indexscan(hint_vec)*/ a from hint_vec where a = 10;
explain (costs off) select /*+ indexonlyscan(hint_vec hint_vec_index) no indexscan(hint_vec hint_vec_index2)*/ a from hint_vec where a = 10;
-- no yes
explain (costs off) select /*+ no indexonlyscan(hint_vec) indexscan(hint_vec hint_vec_index)*/ a from hint_vec where a = 10;
explain (costs off) select /*+ no indexonlyscan(hint_vec hint_vec_index) indexscan(hint_vec)*/ a from hint_vec where a = 10;
explain (costs off) select /*+ no indexonlyscan(hint_vec) indexscan(hint_vec)*/ a from hint_vec where a = 10;
explain (costs off) select /*+ no indexonlyscan(hint_vec hint_vec_index) indexscan(hint_vec hint_vec_index2)*/ a from hint_vec where a = 10;
-- no no
explain (costs off) select /*+ no indexonlyscan(hint_vec) no indexscan(hint_vec hint_vec_index)*/ a from hint_vec where a = 10;
explain (costs off) select /*+ no indexonlyscan(hint_vec hint_vec_index) no indexscan(hint_vec)*/ a from hint_vec where a = 10;
explain (costs off) select /*+ no indexonlyscan(hint_vec) no indexscan(hint_vec)*/ a from hint_vec where a = 10;
explain (costs off) select /*+ no indexonlyscan(hint_vec hint_vec_index) no indexscan(hint_vec hint_vec_index2)*/ a from hint_vec where a = 10;
explain (costs off) select hint_t1.a from hint_t1
join (select /*+ hashjoin(t2 aa)*/ a from hint_t2 as t2
where t2.a in (select /*+ blockname(aa)*/ a from hint_t3 group by a))as bb
on (hint_t1.a = bb.a);
explain (costs off) select /*+ nestloop(t1 aa)*/ * from hint_t1 as t1 where t1.a in (select /*+ blockname(aa)*/ a from hint_t2 as t2 group by a);
explain (costs off) select a from hint_t1 where a in (select /*+ blockname(t1) blockname(t2)*/ a from hint_t2);
explain (costs off) select a from hint_t1 where a in (select /*+ blockname(tt) blockname(tt) blockname(t1)*/ a from hint_t2);
\d+ hint_view1
\d+ hint_view3
explain (costs off, verbose on)
select /*+ leading(("T1" t2)) nestloop("T1" t2) mergejoin("T1" T2)*/ t2.a from hint_t1 as "T1" join hint_t2 as t2 on ("T1".a = t2.a);
-- duplicate name of blockname and table name
explain (costs off, verbose on)
select /*+ mergejoin(t1 t2)*/ t1.a from hint_t1 as t1 where t1.a in (select /*+blockname(t2)*/ b from hint_t2 as t2);
-- bms double free issue
explain (costs off) select /*+ leading((t1 (t2 t4) t3)) */
t1.a
from hint_t1 as t1
join hint_t2 as t2
on(t1.a = t2.b)
join hint_t3 as t3
on (t2.a = t3.b);
drop view hint_view_1;
drop view hint_view_2;
drop view hint_view_3;
drop view hint_view_4;
drop view hint_view_5;
drop view hint_view_6;
drop view hint_view_7;
drop view hint_view_8;
drop view hint_view_9;
drop view hint_view_10;
drop view hint_view1;
drop view hint_view2;
drop view hint_view3;
drop view hint_view4;
drop table hint_t1;
drop table hint_t2;
drop table hint_t3;
drop table hint_t4;
drop table hint_t5;
drop table hint_vec;
drop schema plan_hint cascade; | the_stack |
-- 18.02.2017 17:36
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_UI_ElementGroup (AD_Client_ID,AD_Org_ID,AD_UI_Column_ID,AD_UI_ElementGroup_ID,Created,CreatedBy,IsActive,Name,SeqNo,UIStyle,Updated,UpdatedBy) VALUES (0,0,540089,540124,TO_TIMESTAMP('2017-02-18 17:36:12','YYYY-MM-DD HH24:MI:SS'),100,'Y','default',10,'primary',TO_TIMESTAMP('2017-02-18 17:36:12','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 18.02.2017 17:36
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_ElementGroup SET Name='advanced edit', SeqNo=99, UIStyle='',Updated=TO_TIMESTAMP('2017-02-18 17:36:28','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_ElementGroup_ID=540123
;
-- 18.02.2017 17:39
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,Created,CreatedBy,IsActive,IsAdvancedField,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,557822,0,540787,540124,541784,TO_TIMESTAMP('2017-02-18 17:39:07','YYYY-MM-DD HH24:MI:SS'),100,'Y','N','Y','N','N','Produkt',10,0,0,TO_TIMESTAMP('2017-02-18 17:39:07','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 18.02.2017 17:39
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,Created,CreatedBy,IsActive,IsAdvancedField,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,557820,0,540787,540124,541785,TO_TIMESTAMP('2017-02-18 17:39:45','YYYY-MM-DD HH24:MI:SS'),100,'Y','N','Y','N','N','Version Preisliste',20,0,0,TO_TIMESTAMP('2017-02-18 17:39:45','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 18.02.2017 17:40
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_UI_ElementGroup (AD_Client_ID,AD_Org_ID,AD_UI_Column_ID,AD_UI_ElementGroup_ID,Created,CreatedBy,IsActive,Name,SeqNo,UIStyle,Updated,UpdatedBy) VALUES (0,0,540089,540125,TO_TIMESTAMP('2017-02-18 17:40:09','YYYY-MM-DD HH24:MI:SS'),100,'Y','preise',20,'primary',TO_TIMESTAMP('2017-02-18 17:40:09','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 18.02.2017 17:40
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET UIStyle='primary',Updated=TO_TIMESTAMP('2017-02-18 17:40:17','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=541784
;
-- 18.02.2017 17:40
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,Created,CreatedBy,IsActive,IsAdvancedField,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,557826,0,540787,540125,541786,TO_TIMESTAMP('2017-02-18 17:40:47','YYYY-MM-DD HH24:MI:SS'),100,'Y','N','Y','N','N','Auszeichnungspreis',10,0,0,TO_TIMESTAMP('2017-02-18 17:40:47','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 18.02.2017 17:41
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,Created,CreatedBy,IsActive,IsAdvancedField,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,557827,0,540787,540125,541787,TO_TIMESTAMP('2017-02-18 17:41:09','YYYY-MM-DD HH24:MI:SS'),100,'Y','N','Y','N','N','Standardpreis',20,0,0,TO_TIMESTAMP('2017-02-18 17:41:09','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 18.02.2017 17:41
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,Created,CreatedBy,IsActive,IsAdvancedField,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,557828,0,540787,540125,541788,TO_TIMESTAMP('2017-02-18 17:41:26','YYYY-MM-DD HH24:MI:SS'),100,'Y','N','Y','N','N','Mindestpreis',30,0,0,TO_TIMESTAMP('2017-02-18 17:41:26','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 18.02.2017 17:41
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,Created,CreatedBy,IsActive,IsAdvancedField,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,557833,0,540787,540125,541789,TO_TIMESTAMP('2017-02-18 17:41:57','YYYY-MM-DD HH24:MI:SS'),100,'Y','N','Y','N','N','Preiseinheit',40,0,0,TO_TIMESTAMP('2017-02-18 17:41:57','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 18.02.2017 17:42
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,Created,CreatedBy,IsActive,IsAdvancedField,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,557823,0,540787,540125,541790,TO_TIMESTAMP('2017-02-18 17:42:11','YYYY-MM-DD HH24:MI:SS'),100,'Y','N','Y','N','N','Steuerkategorie',50,0,0,TO_TIMESTAMP('2017-02-18 17:42:11','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 18.02.2017 17:42
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
DELETE FROM AD_UI_ElementField WHERE AD_UI_ElementField_ID=540085
;
-- 18.02.2017 17:42
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
DELETE FROM AD_UI_Element WHERE AD_UI_Element_ID=541769
;
-- 18.02.2017 17:43
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_UI_ElementField (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_UI_ElementField_ID,AD_UI_Element_ID,Created,CreatedBy,IsActive,SeqNo,Updated,UpdatedBy) VALUES (0,557835,0,540086,541784,TO_TIMESTAMP('2017-02-18 17:43:04','YYYY-MM-DD HH24:MI:SS'),100,'Y',10,TO_TIMESTAMP('2017-02-18 17:43:04','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 18.02.2017 17:43
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
DELETE FROM AD_UI_Element WHERE AD_UI_Element_ID=541767
;
-- 18.02.2017 17:43
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
DELETE FROM AD_UI_Element WHERE AD_UI_Element_ID=541770
;
-- 18.02.2017 17:43
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
DELETE FROM AD_UI_Element WHERE AD_UI_Element_ID=541773
;
-- 18.02.2017 17:43
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
DELETE FROM AD_UI_Element WHERE AD_UI_Element_ID=541774
;
-- 18.02.2017 17:43
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
DELETE FROM AD_UI_Element WHERE AD_UI_Element_ID=541775
;
-- 18.02.2017 17:43
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
DELETE FROM AD_UI_Element WHERE AD_UI_Element_ID=541780
;
-- 18.02.2017 17:44
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_UI_ElementGroup (AD_Client_ID,AD_Org_ID,AD_UI_Column_ID,AD_UI_ElementGroup_ID,Created,CreatedBy,IsActive,Name,SeqNo,Updated,UpdatedBy) VALUES (0,0,540090,540126,TO_TIMESTAMP('2017-02-18 17:44:08','YYYY-MM-DD HH24:MI:SS'),100,'Y','flags',10,TO_TIMESTAMP('2017-02-18 17:44:08','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 18.02.2017 17:44
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,Created,CreatedBy,IsActive,IsAdvancedField,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,557824,0,540787,540126,541791,TO_TIMESTAMP('2017-02-18 17:44:25','YYYY-MM-DD HH24:MI:SS'),100,'Y','N','Y','N','N','Aktiv',10,0,0,TO_TIMESTAMP('2017-02-18 17:44:25','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 18.02.2017 17:45
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,Created,CreatedBy,IsActive,IsAdvancedField,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,557834,0,540787,540126,541792,TO_TIMESTAMP('2017-02-18 17:45:33','YYYY-MM-DD HH24:MI:SS'),100,'Y','N','Y','N','N','Reihenfolge',20,0,0,TO_TIMESTAMP('2017-02-18 17:45:33','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 18.02.2017 17:45
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,Created,CreatedBy,IsActive,IsAdvancedField,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,557829,0,540787,540126,541793,TO_TIMESTAMP('2017-02-18 17:45:55','YYYY-MM-DD HH24:MI:SS'),100,'Y','N','Y','N','N','Preis Priorität',30,0,0,TO_TIMESTAMP('2017-02-18 17:45:55','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 18.02.2017 17:47
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,Created,CreatedBy,IsActive,IsAdvancedField,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,557825,0,540787,540126,541794,TO_TIMESTAMP('2017-02-18 17:47:55','YYYY-MM-DD HH24:MI:SS'),100,'Y','N','Y','N','N','Staffelpreis',40,0,0,TO_TIMESTAMP('2017-02-18 17:47:55','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 18.02.2017 17:48
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,Created,CreatedBy,IsActive,IsAdvancedField,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,557830,0,540787,540126,541795,TO_TIMESTAMP('2017-02-18 17:48:23','YYYY-MM-DD HH24:MI:SS'),100,'Y','N','Y','N','N','Attributpreis',50,0,0,TO_TIMESTAMP('2017-02-18 17:48:23','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 18.02.2017 17:48
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,Created,CreatedBy,IsActive,IsAdvancedField,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,557836,0,540787,540126,541796,TO_TIMESTAMP('2017-02-18 17:48:38','YYYY-MM-DD HH24:MI:SS'),100,'Y','N','Y','N','N','Gebindepreis',60,0,0,TO_TIMESTAMP('2017-02-18 17:48:38','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 18.02.2017 17:57
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,Created,CreatedBy,IsActive,IsAdvancedField,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,557832,0,540787,540126,541797,TO_TIMESTAMP('2017-02-18 17:57:02','YYYY-MM-DD HH24:MI:SS'),100,'Y','N','Y','N','N','Saisonfixpreis',70,0,0,TO_TIMESTAMP('2017-02-18 17:57:02','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 18.02.2017 17:57
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_UI_ElementGroup (AD_Client_ID,AD_Org_ID,AD_UI_Column_ID,AD_UI_ElementGroup_ID,Created,CreatedBy,IsActive,Name,SeqNo,Updated,UpdatedBy) VALUES (0,0,540090,540127,TO_TIMESTAMP('2017-02-18 17:57:20','YYYY-MM-DD HH24:MI:SS'),100,'Y','org',20,TO_TIMESTAMP('2017-02-18 17:57:20','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 18.02.2017 17:57
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,Created,CreatedBy,IsActive,IsAdvancedField,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,557821,0,540787,540127,541798,TO_TIMESTAMP('2017-02-18 17:57:45','YYYY-MM-DD HH24:MI:SS'),100,'Y','N','Y','N','N','Produkt Kategorie',10,0,0,TO_TIMESTAMP('2017-02-18 17:57:45','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 18.02.2017 17:57
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,Created,CreatedBy,IsActive,IsAdvancedField,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,557819,0,540787,540127,541799,TO_TIMESTAMP('2017-02-18 17:57:58','YYYY-MM-DD HH24:MI:SS'),100,'Y','N','Y','N','N','Sektion',20,0,0,TO_TIMESTAMP('2017-02-18 17:57:58','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 18.02.2017 17:58
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
DELETE FROM AD_UI_Element WHERE AD_UI_Element_ID=541781
;
-- 18.02.2017 17:58
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
DELETE FROM AD_UI_Element WHERE AD_UI_Element_ID=541782
;
-- 18.02.2017 17:58
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
DELETE FROM AD_UI_Element WHERE AD_UI_Element_ID=541779
;
-- 18.02.2017 17:58
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
DELETE FROM AD_UI_Element WHERE AD_UI_Element_ID=541777
;
-- 18.02.2017 17:58
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
DELETE FROM AD_UI_Element WHERE AD_UI_Element_ID=541776
;
-- 18.02.2017 17:58
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
DELETE FROM AD_UI_Element WHERE AD_UI_Element_ID=541772
;
-- 18.02.2017 17:58
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
DELETE FROM AD_UI_Element WHERE AD_UI_Element_ID=541771
;
-- 18.02.2017 17:59
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
DELETE FROM AD_UI_Element WHERE AD_UI_Element_ID=541766
;
-- 18.02.2017 17:59
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
DELETE FROM AD_UI_Element WHERE AD_UI_Element_ID=541768
;
-- 18.02.2017 18:05
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,Created,CreatedBy,IsActive,IsAdvancedField,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,557831,0,540787,540124,541800,TO_TIMESTAMP('2017-02-18 18:05:01','YYYY-MM-DD HH24:MI:SS'),100,'Y','N','Y','N','N','Attribute',20,0,0,TO_TIMESTAMP('2017-02-18 18:05:01','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 18.02.2017 18:05
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET SeqNo=30,Updated=TO_TIMESTAMP('2017-02-18 18:05:04','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=541785
;
-- 18.02.2017 18:06
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
DELETE FROM AD_UI_Element WHERE AD_UI_Element_ID=541778
;
-- 18.02.2017 18:06
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
DELETE FROM AD_UI_Element WHERE AD_UI_Element_ID=541783
;
-- 18.02.2017 18:06
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsAdvancedField='Y',Updated=TO_TIMESTAMP('2017-02-18 18:06:27','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=541765
;
-- 18.02.2017 18:06
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,Created,CreatedBy,IsActive,IsAdvancedField,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,557837,0,540787,540126,541801,TO_TIMESTAMP('2017-02-18 18:06:57','YYYY-MM-DD HH24:MI:SS'),100,'Y','N','Y','N','N','Unbestimmte Kapazität',80,0,0,TO_TIMESTAMP('2017-02-18 18:06:57','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 18.02.2017 18:11
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayedGrid='N', SeqNoGrid=0,Updated=TO_TIMESTAMP('2017-02-18 18:11:37','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=541765
;
-- 18.02.2017 18:11
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=10,Updated=TO_TIMESTAMP('2017-02-18 18:11:37','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=541792
;
-- 18.02.2017 18:11
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=20,Updated=TO_TIMESTAMP('2017-02-18 18:11:37','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=541793
;
-- 18.02.2017 18:11
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=30,Updated=TO_TIMESTAMP('2017-02-18 18:11:37','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=541784
;
-- 18.02.2017 18:11
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=40,Updated=TO_TIMESTAMP('2017-02-18 18:11:37','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=541800
;
-- 18.02.2017 18:11
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=50,Updated=TO_TIMESTAMP('2017-02-18 18:11:37','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=541786
;
-- 18.02.2017 18:11
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=60,Updated=TO_TIMESTAMP('2017-02-18 18:11:37','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=541787
;
-- 18.02.2017 18:11
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=70,Updated=TO_TIMESTAMP('2017-02-18 18:11:37','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=541788
;
-- 18.02.2017 18:11
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=80,Updated=TO_TIMESTAMP('2017-02-18 18:11:37','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=541789
;
-- 18.02.2017 18:11
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=90,Updated=TO_TIMESTAMP('2017-02-18 18:11:37','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=541785
;
-- 18.02.2017 18:11
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=100,Updated=TO_TIMESTAMP('2017-02-18 18:11:37','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=541794
;
-- 18.02.2017 18:11
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=110,Updated=TO_TIMESTAMP('2017-02-18 18:11:37','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=541795
;
-- 18.02.2017 18:11
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=120,Updated=TO_TIMESTAMP('2017-02-18 18:11:37','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=541796
;
-- 18.02.2017 18:11
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=130,Updated=TO_TIMESTAMP('2017-02-18 18:11:37','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=541797
;
-- 18.02.2017 18:11
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=140,Updated=TO_TIMESTAMP('2017-02-18 18:11:37','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=541799
;
-- 18.02.2017 18:14
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayed_SideList='Y', SeqNo_SideList=10,Updated=TO_TIMESTAMP('2017-02-18 18:14:29','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=541784
;
-- 18.02.2017 18:14
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayed_SideList='Y', SeqNo_SideList=20,Updated=TO_TIMESTAMP('2017-02-18 18:14:29','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=541786
;
-- 18.02.2017 18:14
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayed_SideList='Y', SeqNo_SideList=30,Updated=TO_TIMESTAMP('2017-02-18 18:14:29','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=541787
;
-- 18.02.2017 18:14
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayed_SideList='Y', SeqNo_SideList=40,Updated=TO_TIMESTAMP('2017-02-18 18:14:29','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=541788
;
-- 18.02.2017 18:14
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayed_SideList='Y', SeqNo_SideList=50,Updated=TO_TIMESTAMP('2017-02-18 18:14:29','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=541789
; | the_stack |
UPDATE configuration SET version = '0.15';
REVOKE ALL PRIVILEGES ON DATABASE {dbname} FROM PUBLIC;
REVOKE ALL PRIVILEGES ON SCHEMA public FROM PUBLIC;
GRANT CONNECT, TEMP ON DATABASE {dbname} TO {username};
GRANT USAGE ON SCHEMA public TO {username};
-- Fix some historic screw-ups in the privileges
GRANT SELECT ON configuration TO {username};
REVOKE INSERT ON dependencies FROM {username};
DROP VIEW statistics;
DROP VIEW downloads_recent;
DROP VIEW versions_detail;
ALTER TABLE build_abis
ADD COLUMN skip VARCHAR(100) DEFAULT '' NOT NULL;
DROP FUNCTION delete_build(TEXT, TEXT);
CREATE FUNCTION delete_build(pkg TEXT, ver TEXT)
RETURNS VOID
LANGUAGE SQL
CALLED ON NULL INPUT
SECURITY DEFINER
SET search_path = public, pg_temp
AS $sql$
-- Foreign keys take care of the rest
DELETE FROM builds b WHERE b.package = pkg AND b.version = ver;
$sql$;
REVOKE ALL ON FUNCTION delete_build(TEXT, TEXT) FROM PUBLIC;
GRANT EXECUTE ON FUNCTION delete_build(TEXT, TEXT) TO {username};
DROP FUNCTION skip_package(TEXT, TEXT);
CREATE FUNCTION skip_package(pkg TEXT, reason TEXT)
RETURNS VOID
LANGUAGE SQL
CALLED ON NULL INPUT
SECURITY DEFINER
SET search_path = public, pg_temp
AS $sql$
UPDATE packages SET skip = reason WHERE package = pkg;
$sql$;
REVOKE ALL ON FUNCTION skip_package(TEXT, TEXT) FROM PUBLIC;
GRANT EXECUTE ON FUNCTION skip_package(TEXT, TEXT) TO {username};
DROP FUNCTION skip_package_version(TEXT, TEXT, TEXT);
CREATE FUNCTION skip_package_version(pkg TEXT, ver TEXT, reason TEXT)
RETURNS VOID
LANGUAGE SQL
CALLED ON NULL INPUT
SECURITY DEFINER
SET search_path = public, pg_temp
AS $sql$
UPDATE versions SET skip = reason
WHERE package = pkg AND version = ver;
$sql$;
REVOKE ALL ON FUNCTION skip_package_version(TEXT, TEXT, TEXT) FROM PUBLIC;
GRANT EXECUTE ON FUNCTION skip_package_version(TEXT, TEXT, TEXT) TO {username};
CREATE FUNCTION get_pypi_serial()
RETURNS BIGINT
LANGUAGE SQL
RETURNS NULL ON NULL INPUT
SECURITY DEFINER
SET search_path = public, pg_temp
AS $sql$
SELECT pypi_serial FROM configuration WHERE id = 1;
$sql$;
REVOKE ALL ON FUNCTION get_pypi_serial() FROM PUBLIC;
GRANT EXECUTE ON FUNCTION get_pypi_serial() TO {username};
CREATE FUNCTION test_package(pkg TEXT)
RETURNS BOOLEAN
LANGUAGE SQL
RETURNS NULL ON NULL INPUT
SECURITY DEFINER
SET search_path = public, pg_temp
AS $sql$
SELECT COUNT(*) = 1 FROM packages p WHERE p.package = pkg;
$sql$;
REVOKE ALL ON FUNCTION test_package(TEXT) FROM PUBLIC;
GRANT EXECUTE ON FUNCTION test_package(TEXT) TO {username};
CREATE FUNCTION test_package_version(pkg TEXT, ver TEXT)
RETURNS BOOLEAN
LANGUAGE SQL
RETURNS NULL ON NULL INPUT
SECURITY DEFINER
SET search_path = public, pg_temp
AS $sql$
SELECT COUNT(*) = 1 FROM versions v
WHERE v.package = pkg AND v.version = ver;
$sql$;
REVOKE ALL ON FUNCTION test_package_version(TEXT, TEXT) FROM PUBLIC;
GRANT EXECUTE ON FUNCTION test_package_version(TEXT, TEXT) TO {username};
CREATE TABLE rewrites_pending (
package VARCHAR(200) NOT NULL,
added_at TIMESTAMP NOT NULL,
command VARCHAR(8) NOT NULL,
CONSTRAINT rewrites_pending_pk PRIMARY KEY (package),
CONSTRAINT rewrites_pending_package_fk FOREIGN KEY (package)
REFERENCES packages (package) ON DELETE CASCADE,
CONSTRAINT rewrites_pending_command_ck CHECK
(command IN ('PKGPROJ', 'PKGBOTH'))
);
CREATE INDEX rewrites_pending_added ON rewrites_pending(added_at);
GRANT SELECT ON rewrites_pending TO {username};
DROP VIEW builds_pending;
CREATE VIEW builds_pending AS
-- Finally, because I can't write this in order due to postgres' annoying
-- materialization of CTEs, the same set as below but augmented with a per-ABI
-- build queue position, based on version release date, primarily for the
-- purposes of filtering
SELECT
abi_tag,
ROW_NUMBER() OVER (PARTITION BY abi_tag ORDER BY released) AS position,
package,
version
FROM
(
-- The set of package versions against each ABI for which they haven't
-- been attempted and for which no covering "none" ABI wheel exists
SELECT
q.package,
q.version,
v.released,
MIN(q.abi_tag) AS abi_tag
FROM
(
-- The set of package versions X build ABIs that we want to
-- exist once the queue is complete
SELECT
v.package,
v.version,
b.abi_tag
FROM
packages AS p
JOIN versions AS v ON v.package = p.package
CROSS JOIN build_abis AS b
WHERE
v.skip = ''
AND p.skip = ''
AND b.skip = ''
EXCEPT ALL
(
-- The set of package versions that successfully produced
-- wheels with ABI "none", and which therefore count as
-- all build ABIs
SELECT
b.package,
b.version,
v.abi_tag
FROM
builds AS b
JOIN files AS f ON b.build_id = f.build_id
CROSS JOIN build_abis AS v
WHERE f.abi_tag = 'none'
UNION ALL
-- The set of package versions that successfully produced a
-- wheel with a single ABI (abi_tag <> 'none') or which
-- were attempted but failed (build_id IS NULL)
SELECT
b.package,
b.version,
COALESCE(f.abi_tag, b.abi_tag) AS abi_tag
FROM
builds AS b
LEFT JOIN files AS f ON b.build_id = f.build_id
WHERE
f.build_id IS NULL
OR f.abi_tag <> 'none'
)
) AS q
JOIN versions v ON q.package = v.package AND q.version = v.version
GROUP BY
q.package,
q.version,
v.released
) AS t;
GRANT SELECT ON builds_pending TO {username};
CREATE FUNCTION get_build_queue(lim INTEGER)
RETURNS TABLE(
abi_tag builds_pending.abi_tag%TYPE,
package builds_pending.package%TYPE,
version builds_pending.version%TYPE
)
LANGUAGE SQL
RETURNS NULL ON NULL INPUT
SECURITY DEFINER
SET search_path = public, pg_temp
AS $sql$
SELECT abi_tag, package, version
FROM builds_pending
WHERE position <= lim
ORDER BY abi_tag, position;
$sql$;
REVOKE ALL ON FUNCTION get_build_queue(INTEGER) FROM PUBLIC;
GRANT EXECUTE ON FUNCTION get_build_queue(INTEGER) TO {username};
CREATE FUNCTION get_statistics()
RETURNS TABLE(
packages_built INTEGER,
builds_count INTEGER,
builds_count_success INTEGER,
builds_count_last_hour INTEGER,
builds_time INTERVAL,
files_count INTEGER,
builds_size BIGINT,
downloads_last_month INTEGER,
downloads_all INTEGER
)
LANGUAGE SQL
RETURNS NULL ON NULL INPUT
SECURITY DEFINER
SET search_path = public, pg_temp
AS $sql$
WITH build_stats AS (
SELECT
COUNT(*) AS builds_count,
COUNT(*) FILTER (WHERE status) AS builds_count_success,
COALESCE(SUM(CASE
-- This guards against including insanely huge durations as
-- happens when a builder starts without NTP time sync and
-- records a start time of 1970-01-01 and a completion time
-- sometime this millenium...
WHEN duration < INTERVAL '1 week' THEN duration
ELSE INTERVAL '0'
END), INTERVAL '0') AS builds_time
FROM
builds
),
build_latest AS (
SELECT COUNT(*) AS builds_count_last_hour
FROM builds
WHERE built_at > CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '1 hour'
),
file_count AS (
SELECT
COUNT(*) AS files_count,
COUNT(DISTINCT package_tag) AS packages_built
FROM files
),
file_stats AS (
-- Exclude armv6l packages as they're just hard-links to armv7l
-- packages and thus don't really count towards space used ... in most
-- cases anyway
SELECT COALESCE(SUM(filesize), 0) AS builds_size
FROM files
WHERE platform_tag <> 'linux_armv6l'
),
download_stats AS (
SELECT
COUNT(*) FILTER (
WHERE accessed_at > CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '30 days'
) AS downloads_last_month,
COUNT(*) AS downloads_all
FROM downloads
)
SELECT
CAST(fc.packages_built AS INTEGER),
CAST(bs.builds_count AS INTEGER),
CAST(bs.builds_count_success AS INTEGER),
CAST(bl.builds_count_last_hour AS INTEGER),
bs.builds_time,
CAST(fc.files_count AS INTEGER),
fs.builds_size,
CAST(dl.downloads_last_month AS INTEGER),
CAST(dl.downloads_all AS INTEGER)
FROM
build_stats bs,
build_latest bl,
file_count fc,
file_stats fs,
download_stats dl;
$sql$;
REVOKE ALL ON FUNCTION get_statistics() FROM PUBLIC;
GRANT EXECUTE ON FUNCTION get_statistics() TO {username};
CREATE FUNCTION get_search_index()
RETURNS TABLE(
package packages.package%TYPE,
downloads_recent INTEGER,
downloads_all INTEGER
)
LANGUAGE SQL
RETURNS NULL ON NULL INPUT
SECURITY DEFINER
SET search_path = public, pg_temp
AS $sql$
SELECT
p.package,
CAST(COALESCE(COUNT(d.filename) FILTER (
WHERE d.accessed_at > CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '30 days'
), 0) AS INTEGER) AS downloads_recent,
CAST(COALESCE(COUNT(d.filename), 0) AS INTEGER) AS downloads_all
FROM
packages AS p
LEFT JOIN (
builds AS b
JOIN files AS f ON b.build_id = f.build_id
JOIN downloads AS d ON d.filename = f.filename
) ON p.package = b.package
GROUP BY p.package;
$sql$;
REVOKE ALL ON FUNCTION get_search_index() FROM PUBLIC;
GRANT EXECUTE ON FUNCTION get_search_index() TO {username};
CREATE FUNCTION get_package_files(pkg TEXT)
RETURNS TABLE(
filename files.filename%TYPE,
filehash files.filehash%TYPE
)
LANGUAGE SQL
RETURNS NULL ON NULL INPUT
SECURITY DEFINER
SET search_path = public, pg_temp
AS $sql$
SELECT f.filename, f.filehash
FROM builds b JOIN files f USING (build_id)
WHERE b.status AND b.package = pkg;
$sql$;
REVOKE ALL ON FUNCTION get_package_files(TEXT) FROM PUBLIC;
GRANT EXECUTE ON FUNCTION get_package_files(TEXT) TO {username};
CREATE FUNCTION get_version_files(pkg TEXT, ver TEXT)
RETURNS TABLE(
filename files.filename%TYPE
)
LANGUAGE SQL
RETURNS NULL ON NULL INPUT
SECURITY DEFINER
SET search_path = public, pg_temp
AS $sql$
SELECT f.filename
FROM builds b JOIN files f USING (build_id)
WHERE b.status AND b.package = pkg AND b.version = ver;
$sql$;
REVOKE ALL ON FUNCTION get_version_files(TEXT, TEXT) FROM PUBLIC;
GRANT EXECUTE ON FUNCTION get_version_files(TEXT, TEXT) TO {username};
CREATE FUNCTION get_project_versions(pkg TEXT)
RETURNS TABLE(
version versions.version%TYPE,
skipped versions.skip%TYPE,
builds_succeeded TEXT,
builds_failed TEXT
)
LANGUAGE SQL
RETURNS NULL ON NULL INPUT
SECURITY DEFINER
SET search_path = public, pg_temp
AS $sql$
SELECT
v.version,
COALESCE(NULLIF(v.skip, ''), p.skip) AS skipped,
COALESCE(STRING_AGG(DISTINCT b.abi_tag, ', ') FILTER (WHERE b.status), '') AS builds_succeeded,
COALESCE(STRING_AGG(DISTINCT b.abi_tag, ', ') FILTER (WHERE NOT b.status), '') AS builds_failed
FROM
packages p
JOIN versions v USING (package)
LEFT JOIN builds b USING (package, version)
WHERE v.package = pkg
GROUP BY version, skipped;
$sql$;
REVOKE ALL ON FUNCTION get_project_versions(TEXT) FROM PUBLIC;
GRANT EXECUTE ON FUNCTION get_project_versions(TEXT) TO {username};
CREATE FUNCTION get_project_files(pkg TEXT)
RETURNS TABLE(
version builds.version%TYPE,
abi_tag files.abi_tag%TYPE,
filename files.filename%TYPE,
filesize files.filesize%TYPE,
filehash files.filehash%TYPE
)
LANGUAGE SQL
RETURNS NULL ON NULL INPUT
SECURITY DEFINER
SET search_path = public, pg_temp
AS $sql$
SELECT
b.version,
f.abi_tag,
f.filename,
f.filesize,
f.filehash
FROM
builds b
JOIN files f USING (build_id)
WHERE b.status
AND b.package = pkg;
$sql$;
REVOKE ALL ON FUNCTION get_project_files(TEXT) FROM PUBLIC;
GRANT EXECUTE ON FUNCTION get_project_files(TEXT) TO {username};
CREATE FUNCTION get_file_dependencies(fn TEXT)
RETURNS TABLE(
tool dependencies.tool%TYPE,
dependency dependencies.dependency%TYPE
)
LANGUAGE SQL
RETURNS NULL ON NULL INPUT
SECURITY DEFINER
SET search_path = public, pg_temp
AS $sql$
SELECT
d.tool,
d.dependency
FROM dependencies d
WHERE d.filename = fn
ORDER BY tool, dependency;
$sql$;
REVOKE ALL ON FUNCTION get_file_dependencies(TEXT) FROM PUBLIC;
GRANT EXECUTE ON FUNCTION get_file_dependencies(TEXT) TO {username};
CREATE FUNCTION save_rewrites_pending(data rewrites_pending ARRAY)
RETURNS VOID
LANGUAGE SQL
CALLED ON NULL INPUT
SECURITY DEFINER
SET search_path = public, pg_temp
AS $sql$
DELETE FROM rewrites_pending;
INSERT INTO rewrites_pending (
package,
added_at,
command
)
SELECT
d.package,
d.added_at,
d.command
FROM
UNNEST(data) AS d;
$sql$;
REVOKE ALL ON FUNCTION save_rewrites_pending(rewrites_pending ARRAY) FROM PUBLIC;
GRANT EXECUTE ON FUNCTION save_rewrites_pending(rewrites_pending ARRAY) TO {username};
CREATE FUNCTION load_rewrites_pending()
RETURNS TABLE(
package rewrites_pending.package%TYPE,
added_at rewrites_pending.added_at%TYPE,
command rewrites_pending.command%TYPE
)
LANGUAGE SQL
CALLED ON NULL INPUT
SECURITY DEFINER
SET search_path = public, pg_temp
AS $sql$
SELECT package, added_at, command
FROM rewrites_pending
ORDER BY added_at;
$sql$;
REVOKE ALL ON FUNCTION load_rewrites_pending() FROM PUBLIC;
GRANT EXECUTE ON FUNCTION load_rewrites_pending() TO {username};
DROP FUNCTION log_build_success(TEXT, TEXT, INTEGER, INTERVAL, TEXT, TEXT,
files ARRAY, dependencies ARRAY);
CREATE FUNCTION log_build_success(
package TEXT,
version TEXT,
built_by INTEGER,
duration INTERVAL,
abi_tag TEXT,
output TEXT,
build_files files ARRAY,
build_deps dependencies ARRAY
)
RETURNS INTEGER
LANGUAGE plpgsql
CALLED ON NULL INPUT
SECURITY DEFINER
SET search_path = public, pg_temp
AS $sql$
DECLARE
new_build_id INTEGER;
BEGIN
IF ARRAY_LENGTH(build_files, 1) = 0 THEN
RAISE EXCEPTION integrity_constraint_violation
USING MESSAGE = 'Successful build must include at least one file';
END IF;
INSERT INTO builds (
package,
version,
built_by,
duration,
status,
abi_tag
)
VALUES (
package,
version,
built_by,
duration,
TRUE,
abi_tag
)
RETURNING build_id
INTO new_build_id;
INSERT INTO output (build_id, output) VALUES (new_build_id, output);
-- We delete the existing entries from files rather than using INSERT..ON
-- CONFLICT UPDATE because we need to delete dependencies associated with
-- those files too. This is considerably simpler than a multi-layered
-- upsert across tables.
DELETE FROM files f
USING UNNEST(build_files) AS b
WHERE f.filename = b.filename;
INSERT INTO files (
filename,
build_id,
filesize,
filehash,
package_tag,
package_version_tag,
py_version_tag,
abi_tag,
platform_tag
)
SELECT
b.filename,
new_build_id,
b.filesize,
b.filehash,
b.package_tag,
b.package_version_tag,
b.py_version_tag,
b.abi_tag,
b.platform_tag
FROM
UNNEST(build_files) AS b;
INSERT INTO dependencies (
filename,
tool,
dependency
)
SELECT
d.filename,
d.tool,
d.dependency
FROM
UNNEST(build_deps) AS d;
RETURN new_build_id;
END;
$sql$;
REVOKE ALL ON FUNCTION log_build_success(
TEXT, TEXT, INTEGER, INTERVAL, TEXT, TEXT, files ARRAY, dependencies ARRAY
) FROM PUBLIC;
GRANT EXECUTE ON FUNCTION log_build_success(
TEXT, TEXT, INTEGER, INTERVAL, TEXT, TEXT, files ARRAY, dependencies ARRAY
) TO {username};
DROP FUNCTION log_build_failure(TEXT, TEXT, INTEGER, INTERVAL, TEXT, TEXT);
CREATE FUNCTION log_build_failure(
package TEXT,
version TEXT,
built_by INTEGER,
duration INTERVAL,
abi_tag TEXT,
output TEXT
)
RETURNS INTEGER
LANGUAGE plpgsql
CALLED ON NULL INPUT
SECURITY DEFINER
SET search_path = public, pg_temp
AS $sql$
DECLARE
new_build_id INTEGER;
BEGIN
INSERT INTO builds (
package,
version,
built_by,
duration,
status,
abi_tag
)
VALUES (
package,
version,
built_by,
duration,
FALSE,
abi_tag
)
RETURNING build_id
INTO new_build_id;
INSERT INTO output (build_id, output) VALUES (new_build_id, output);
RETURN new_build_id;
END;
$sql$;
REVOKE ALL ON FUNCTION log_build_failure(
TEXT, TEXT, INTEGER, INTERVAL, TEXT, TEXT
) FROM PUBLIC;
GRANT EXECUTE ON FUNCTION log_build_failure(
TEXT, TEXT, INTEGER, INTERVAL, TEXT, TEXT
) TO {username};
COMMIT; | the_stack |
DROP FUNCTION IF EXISTS report.umsatzliste_bpartner_report
(
IN Base_Period_Start date,IN Base_Period_End date, IN Comp_Period_Start date, IN Comp_Period_End date, IN issotrx character varying,IN C_BPartner_ID numeric, IN C_Activity_ID numeric,IN M_Product_ID numeric,IN M_Product_Category_ID numeric,IN M_AttributeSetInstance_ID numeric,IN AD_Org_ID numeric
);
DROP FUNCTION IF EXISTS report.umsatzliste_bpartner_report_sub
(
IN Base_Period_Start date,IN Base_Period_End date, IN Comp_Period_Start date, IN Comp_Period_End date, IN issotrx character varying,IN C_BPartner_ID numeric, IN C_Activity_ID numeric, IN M_Product_ID numeric,IN M_Product_Category_ID numeric,IN M_AttributeSetInstance_ID numeric,IN AD_Org_ID numeric
);
DROP FUNCTION IF EXISTS report.umsatzliste_bpartner_report
(
IN Base_Period_Start date,
IN Base_Period_End date,
IN Comp_Period_Start date,
IN Comp_Period_End date,
IN issotrx character varying,
IN C_BPartner_ID numeric,
IN C_Activity_ID numeric,
IN M_Product_ID numeric,
IN M_Product_Category_ID numeric,
IN M_AttributeSetInstance_ID numeric,
IN AD_Org_ID numeric,
IN AD_Language Character Varying (6)
);
DROP FUNCTION IF EXISTS report.umsatzliste_bpartner_report_sub
(
IN Base_Period_Start date,
IN Base_Period_End date,
IN Comp_Period_Start date,
IN Comp_Period_End date,
IN issotrx character varying,
IN C_BPartner_ID numeric,
IN C_Activity_ID numeric,
IN M_Product_ID numeric,
IN M_Product_Category_ID numeric,
IN M_AttributeSetInstance_ID numeric,
IN AD_Org_ID numeric,
IN AD_Language Character Varying (6)
);
DROP TABLE IF EXISTS report.umsatzliste_bpartner_report;
DROP TABLE IF EXISTS report.umsatzliste_bpartner_report_sub;
/* ***************************************************************** */
CREATE TABLE report.umsatzliste_bpartner_report_sub
(
bp_name character varying(60),
pc_name character varying(60),
p_name character varying(255),
sameperiodsum numeric,
compperiodsum numeric,
sameperiodqtysum numeric,
compperiodqtysum numeric,
perioddifference numeric,
periodqtydifference numeric,
perioddiffpercentage numeric,
periodqtydiffpercentage numeric,
Base_Period_Start character varying(10),
Base_Period_End character varying(10),
Comp_Period_Start character varying(10),
Comp_Period_End character varying(10),
param_bp character varying(60),
param_Activity character varying(60),
param_product character varying(255),
param_Product_Category character varying(60),
Param_Attributes character varying(255),
currency character(3),
ad_org_id numeric
)
WITH (
OIDS=FALSE
);
CREATE FUNCTION report.umsatzliste_bpartner_report_sub
(
IN Base_Period_Start date,
IN Base_Period_End date,
IN Comp_Period_Start date,
IN Comp_Period_End date,
IN issotrx character varying,
IN C_BPartner_ID numeric,
IN C_Activity_ID numeric,
IN M_Product_ID numeric,
IN M_Product_Category_ID numeric,
IN M_AttributeSetInstance_ID numeric,
IN AD_Org_ID numeric,
IN AD_Language Character Varying (6)
)
RETURNS SETOF report.umsatzliste_bpartner_report_sub AS
$BODY$
SELECT
bp.Name AS bp_name,
pc.Name AS pc_name,
COALESCE(pt.Name, p.Name) AS P_name,
SamePeriodSum,
CompPeriodSum,
SamePeriodQtySum,
CompPeriodQtySum,
SamePeriodSum - CompPeriodSum AS PeriodDifference,
SamePeriodQtySum - CompPeriodQtySum AS PeriodQtyDifference,
CASE WHEN SamePeriodSum - CompPeriodSum != 0 AND CompPeriodSum != 0
THEN (SamePeriodSum - CompPeriodSum) / CompPeriodSum * 100 ELSE NULL
END AS PeriodDiffPercentage,
CASE WHEN SamePeriodQtySum - CompPeriodQtySum != 0 AND CompPeriodQtySum != 0
THEN (SamePeriodQtySum - CompPeriodQtySum) / CompPeriodQtySum * 100 ELSE NULL
END AS PeriodQtyDiffPercentage,
to_char($1, 'DD.MM.YYYY') AS Base_Period_Start,
to_char($2, 'DD.MM.YYYY') AS Base_Period_End,
COALESCE( to_char($3, 'DD.MM.YYYY'), '') AS Comp_Period_Start,
COALESCE( to_char($4, 'DD.MM.YYYY'), '') AS Comp_Period_End,
(SELECT name FROM C_BPartner WHERE C_BPartner_ID = $6 and isActive = 'Y') AS param_bp,
(SELECT name FROM C_Activity WHERE C_Activity_ID = $7 and isActive = 'Y') AS param_Activity,
(SELECT COALESCE(pt.name, p.name) FROM M_Product p
LEFT OUTER JOIN M_Product_Trl pt ON p.M_Product_ID = pt.M_Product_ID AND pt.AD_Language = $12 AND pt.isActive = 'Y'
WHERE p.M_Product_ID = $8
) AS param_product,
(SELECT name FROM M_Product_Category WHERE M_Product_Category_ID = $9 and isActive = 'Y') AS param_Product_Category,
(SELECT String_Agg(ai_value, ', ' ORDER BY ai_Value) FROM Report.fresh_Attributes WHERE M_AttributeSetInstance_ID = $10) AS Param_Attributes,
c.iso_code AS currency,
a.ad_org_id
FROM
(
SELECT
fa.C_BPartner_ID,
fa.M_Product_ID,
SUM( CASE WHEN IsInPeriod THEN AmtAcct ELSE 0 END ) AS SamePeriodSum,
SUM( CASE WHEN IsInCompPeriod THEN AmtAcct ELSE 0 END ) AS CompPeriodSum,
SUM( CASE WHEN IsInPeriod THEN il.qtyinvoiced ELSE 0 END ) AS SamePeriodQtySum,
SUM( CASE WHEN IsInCompPeriod THEN il.qtyinvoiced ELSE 0 END ) AS CompPeriodQtySum,
1 AS Line_Order,
fa.ad_org_id
FROM
(
SELECT fa.*,
( fa.DateAcct >= $1 AND fa.DateAcct <= $2 ) AS IsInPeriod,
( fa.DateAcct >= $3 AND fa.DateAcct <= $4 ) AS IsInCompPeriod,
CASE WHEN isSOTrx = 'Y' THEN AmtAcctCr - AmtAcctDr ELSE AmtAcctDr - AmtAcctCr END AS AmtAcct
FROM Fact_Acct fa JOIN C_Invoice i ON fa.Record_ID = i.C_Invoice_ID AND i.isActive = 'Y'
WHERE AD_Table_ID = (SELECT Get_Table_ID('C_Invoice')) AND fa.isActive = 'Y'
) fa
INNER JOIN C_Invoice i ON fa.Record_ID = i.C_Invoice_ID AND i.isActive = 'Y'
INNER JOIN C_InvoiceLine il ON fa.Line_ID = il.C_InvoiceLine_ID AND il.isActive = 'Y'
/* Please note: This is an important implicit filter. Inner Joining the Product
* filters Fact Acct records for e.g. Taxes
*/
INNER JOIN M_Product p ON fa.M_Product_ID = p.M_Product_ID
WHERE
AD_Table_ID = ( SELECT Get_Table_ID( 'C_Invoice' ) )
AND ( IsInPeriod OR IsInCompPeriod )
AND i.IsSOtrx = $5
AND ( CASE WHEN $6 IS NULL THEN TRUE ELSE fa.C_BPartner_ID = $6 END )
AND ( CASE WHEN $7 IS NULL THEN TRUE ELSE fa.C_Activity_ID = $7 END )
AND ( CASE WHEN $8 IS NULL THEN TRUE ELSE p.M_Product_ID = $8 END AND p.M_Product_ID IS NOT NULL )
AND ( CASE WHEN $9 IS NULL THEN TRUE ELSE p.M_Product_Category_ID = $9 END
-- It was a requirement to not have HU Packing material within the sums of this report
AND p.M_Product_Category_ID != getSysConfigAsNumeric('PackingMaterialProductCategoryID', il.AD_Client_ID, il.AD_Org_ID)
)
AND (
CASE WHEN EXISTS ( SELECT ai_value FROM report.fresh_Attributes WHERE M_AttributeSetInstance_ID = $10 )
THEN (
EXISTS (
SELECT 0
FROM report.fresh_Attributes a
INNER JOIN report.fresh_Attributes pa ON a.at_value = pa.at_value AND a.ai_value = pa.ai_value
AND pa.M_AttributeSetInstance_ID = $10
WHERE a.M_AttributeSetInstance_ID = il.M_AttributeSetInstance_ID
)
AND NOT EXISTS (
SELECT 0
FROM report.fresh_Attributes pa
LEFT OUTER JOIN report.fresh_Attributes a ON a.at_value = pa.at_value AND a.ai_value = pa.ai_value
AND a.M_AttributeSetInstance_ID = il.M_AttributeSetInstance_ID
WHERE pa.M_AttributeSetInstance_ID = $10
AND a.M_AttributeSetInstance_ID IS null
)
)
ELSE TRUE END
)
AND fa.ad_org_id = $11
GROUP BY
fa.C_BPartner_ID,
fa.M_Product_ID,
fa.ad_org_id
) a
INNER JOIN C_BPartner bp ON a.C_BPartner_ID = bp.C_BPartner_ID AND bp.isActive = 'Y'
INNER JOIN M_Product p ON a.M_Product_ID = p.M_Product_ID
LEFT OUTER JOIN M_Product_Trl pt ON p.M_Product_ID = pt.M_Product_ID AND pt.AD_Language = $12 AND pt.isActive = 'Y'
INNER JOIN M_Product_Category pc ON p.M_Product_Category_ID = pc.M_Product_Category_ID AND pc.isActive = 'Y'
--taking the currency of the client
LEFT OUTER JOIN AD_ClientInfo ci ON ci.AD_Client_ID=bp.ad_client_id AND ci.isActive = 'Y'
LEFT OUTER JOIN C_AcctSchema acs ON acs.C_AcctSchema_ID=ci.C_AcctSchema1_ID AND acs.isActive = 'Y'
LEFT OUTER JOIN C_Currency c ON acs.C_Currency_ID=c.C_Currency_ID AND c.isActive = 'Y'
$BODY$
LANGUAGE sql STABLE;
/* ***************************************************************** */
CREATE TABLE report.umsatzliste_bpartner_report
(
bp_name character varying(60),
pc_name character varying(60),
p_name character varying(255),
sameperiodsum numeric,
compperiodsum numeric,
sameperiodqtysum numeric,
compperiodqtysum numeric,
perioddifference numeric,
periodqtydifference numeric,
perioddiffpercentage numeric,
periodqtydiffpercentage numeric,
Base_Period_Start character varying(10),
Base_Period_End character varying(10),
Comp_Period_Start character varying(10),
Comp_Period_End character varying(10),
param_bp character varying(60),
param_Activity character varying(60),
param_product character varying(255),
param_Product_Category character varying(60),
Param_Attributes character varying(255),
currency character(3),
ad_org_id numeric,
unionorder integer
)
WITH (
OIDS=FALSE
);
CREATE FUNCTION report.umsatzliste_bpartner_report
(
IN Base_Period_Start date,
IN Base_Period_End date,
IN Comp_Period_Start date,
IN Comp_Period_End date,
IN issotrx character varying,
IN C_BPartner_ID numeric,
IN C_Activity_ID numeric,
IN M_Product_ID numeric,
IN M_Product_Category_ID numeric,
IN M_AttributeSetInstance_ID numeric,
IN AD_Org_ID numeric,
IN AD_Language Character Varying (6)
)
RETURNS SETOF report.umsatzliste_bpartner_report AS
$BODY$
SELECT
*, 1 AS UnionOrder
FROM
report.umsatzliste_bpartner_report_sub ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12)
UNION ALL
SELECT
bp_name, pc_name, null AS P_name,
SUM( SamePeriodSum ) AS SamePeriodSum,
SUM( CompPeriodSum ) AS CompPeriodSum,
SUM( SamePeriodQtySum ) AS SamePeriodQtySum,
SUM( CompPeriodQtySum ) AS CompPeriodQtySum,
SUM( SamePeriodSum ) - SUM( CompPeriodSum ) AS PeriodDifference,
SUM( SamePeriodQtySum ) - SUM( CompPeriodQtySum ) AS PeriodQtyDifference,
CASE WHEN SUM( SamePeriodSum ) - SUM( CompPeriodSum ) != 0 AND SUM( CompPeriodSum ) != 0
THEN (SUM( SamePeriodSum ) - SUM( CompPeriodSum )) / SUM( CompPeriodSum ) * 100 ELSE NULL
END AS PeriodDiffPercentage,
CASE WHEN SUM( SamePeriodQtySum ) - SUM( CompPeriodQtySum ) != 0 AND SUM( CompPeriodQtySum ) != 0
THEN (SUM( SamePeriodQtySum ) - SUM( CompPeriodQtySum )) / SUM( CompPeriodQtySum ) * 100 ELSE NULL
END AS PeriodQtyDiffPercentage,
Base_Period_Start, Base_Period_End, Comp_Period_Start, Comp_Period_End,
param_bp, param_Activity, param_product, param_Product_Category, Param_Attributes, currency, ad_org_id,
2 AS UnionOrder
FROM
report.umsatzliste_bpartner_report_sub ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12)
GROUP BY
bp_name, pc_name,
Base_Period_Start, Base_Period_End, Comp_Period_Start, Comp_Period_End,
param_bp, param_Activity, param_product, param_Product_Category, Param_Attributes, currency, ad_org_id
UNION ALL
SELECT
bp_name, null, null,
SUM( SamePeriodSum ) AS SamePeriodSum,
SUM( CompPeriodSum ) AS CompPeriodSum,
SUM( SamePeriodQtySum ) AS SamePeriodQtySum,
SUM( CompPeriodQtySum ) AS CompPeriodQtySum,
SUM( SamePeriodSum ) - SUM( CompPeriodSum ) AS PeriodDifference,
SUM( SamePeriodQtySum ) - SUM( CompPeriodQtySum ) AS PeriodQtyDifference,
CASE WHEN SUM( SamePeriodSum ) - SUM( CompPeriodSum ) != 0 AND SUM( CompPeriodSum ) != 0
THEN (SUM( SamePeriodSum ) - SUM( CompPeriodSum )) / SUM( CompPeriodSum ) * 100 ELSE NULL
END AS PeriodDiffPercentage,
CASE WHEN SUM( SamePeriodQtySum ) - SUM( CompPeriodQtySum ) != 0 AND SUM( CompPeriodQtySum ) != 0
THEN (SUM( SamePeriodQtySum ) - SUM( CompPeriodQtySum )) / SUM( CompPeriodQtySum ) * 100 ELSE NULL
END AS PeriodQtyDiffPercentage,
Base_Period_Start, Base_Period_End, Comp_Period_Start, Comp_Period_End,
param_bp, param_Activity, param_product, param_Product_Category, Param_Attributes, currency, ad_org_id,
3 AS UnionOrder
FROM
report.umsatzliste_bpartner_report_sub ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12)
GROUP BY
bp_name,
Base_Period_Start, Base_Period_End, Comp_Period_Start, Comp_Period_End,
param_bp, param_Activity, param_product, param_Product_Category, Param_Attributes, currency, ad_org_id
ORDER BY
bp_name, pc_name NULLS LAST, UnionOrder, p_name
$BODY$
LANGUAGE sql STABLE; | the_stack |
\set VERBOSITY terse
SET client_encoding = utf8;
set datestyle='ISO,MDY';
set time zone 'PRC';
set compatible_mode to oracle;
select oracle.from_tz('2021-11-08 09:12:39','+16:00') from dual;
select oracle.from_tz('2021-11-08 09:12:39','-12:00') from dual;
select oracle.from_tz('2021-11-08 09:12:39','Asia/Shanghai123123') from dual;
select oracle.from_tz('2021-11-08 09:12:39','Asia/Shanghai') from dual;
select oracle.from_tz('2021-11-08 09:12:39','SAST') from dual;
select oracle.from_tz('2021-11-08 09:12:39','SAST123') from dual;
select oracle.from_tz(NULL,'SAST') from dual;
select oracle.from_tz('2021-11-08 09:12:31',NULL) from dual;
select oracle.from_tz(NULL,NULL) from dual;
--numtodsinterval function
select oracle.numtodsinterval(2147483647.1232131232,'day') from dual;
select oracle.numtodsinterval(2147483646.1232131232,'day') from dual;
select oracle.numtodsinterval(2147483647.1232131232,'hour') from dual;
select oracle.numtodsinterval(2147483648.1232131232,'hour') from dual;
select oracle.numtodsinterval(128849018879.1232131232,'minute') from dual;
select oracle.numtodsinterval(128849018880.1232131232,'minute') from dual;
select oracle.numtodsinterval(7730941132799.1232131232,'second') from dual;
select oracle.numtodsinterval(7730941132800.1232131232,'second') from dual;
select oracle.numtodsinterval(NULL,'second') from dual;
select oracle.numtodsinterval(7730941132800.1232131232,NULL) from dual;
select oracle.numtodsinterval(NULL,NULL) from dual;
--numtoyminterval function
select oracle.numtoyminterval(178956970.1232131232,'year') from dual;
select oracle.numtoyminterval(178956971.1232131232,'year') from dual;
select oracle.numtoyminterval(2147483646.1232131232,'month') from dual;
select oracle.numtoyminterval(2147483647.1232131232,'month') from dual;
select oracle.numtoyminterval(NULL,'month') from dual;
select oracle.numtoyminterval(2147483647.1232131232,NULL) from dual;
select oracle.numtoyminterval(NULL,NULL) from dual;
--sys_extract_utc function
select oracle.sys_extract_utc('2018-03-28 11:30:00.00 +09:00'::timestamptz) from dual;
select oracle.sys_extract_utc(NULL) from dual;
--sessiontimezone and dbtimezone function
select oracle.sessiontimezone() from dual;
select oracle.dbtimezone() from dual;
--days_between function
select oracle.days_between('2021-11-25 15:33:16'::timestamp,'2019-01-01 00:00:00'::timestamp) from dual;
select oracle.days_between('2019-09-08 09:09:09'::timestamp,'2019-01-01 00:00:00'::timestamp) from dual;
select oracle.days_between('2021-11-25 09:09:09'::timestamp,'2019-01-01 00:00:00'::timestamp) from dual;
select oracle.days_between(NULL,'2019-01-01 00:00:00'::timestamp) from dual;
select oracle.days_between('2019-09-08 09:09:09'::timestamp,NULL) from dual;
select oracle.days_between(NULL,NULL) from dual;
--days_between_tmtz function
select oracle.days_between_tmtz('2019-09-08 09:09:09+08'::timestamptz,'2019-05-08 12:34:09+08'::timestamptz) from dual;
select oracle.days_between_tmtz('2019-09-08 09:09:09+08'::timestamptz,'2019-05-08 12:34:09+09'::timestamptz) from dual;
select oracle.days_between_tmtz('2019-09-08 09:09:09-08'::timestamptz,'2019-05-08 12:34:09+09'::timestamptz) from dual;
select oracle.days_between_tmtz(NULL,'2019-05-08 12:34:09+08'::timestamptz) from dual;
select oracle.days_between_tmtz('2019-09-08 09:09:09+08'::timestamptz,NULL) from dual;
select oracle.days_between_tmtz(NULL,NULL) from dual;
--add_days_to_timestamp function
select oracle.add_days_to_timestamp('1009-09-15 09:00:00'::timestamp, '3267.123'::numeric) from dual;
select oracle.add_days_to_timestamp(NULL, '3267.123'::numeric) from dual;
select oracle.add_days_to_timestamp('1009-09-15 09:00:00'::timestamp, NULL) from dual;
select oracle.add_days_to_timestamp(NULl, NULL) from dual;
--subtract function
select oracle.subtract('2019-11-25 16:51:20'::timestamp,'3267.123'::numeric) from dual;
select oracle.subtract('2019-11-25 16:51:20'::timestamp, '2018-11-25 16:51:12'::timestamp) from dual;
select oracle.subtract(NULL,'3267.123'::numeric) from dual;
select oracle.subtract('2019-11-25 16:51:20'::timestamp,NULL) from dual;
select oracle.subtract(NULL,NULL) from dual;
--new_time function
select oracle.new_time(timestamp '2020-12-12 17:45:18', 'AST', 'ADT') from dual;
select oracle.new_time(timestamp '2020-12-12 17:45:18', 'BST', 'BDT') from dual;
select oracle.new_time(timestamp '2020-12-12 17:45:18', 'CST', 'CDT') from dual;
select oracle.new_time(timestamp '2020-12-12 17:45:18', 'EST', 'EDT') from dual;
select oracle.new_time(timestamp '2020-12-12 17:45:18', 'HST', 'HDT') from dual;
select oracle.new_time(timestamp '2020-12-12 17:45:18', 'MST', 'MDT') from dual;
select oracle.new_time(timestamp '2020-12-12 17:45:18', 'PST', 'PDT') from dual;
select oracle.new_time(timestamp '2020-12-12 17:45:18', 'YST', 'YDT') from dual;
select oracle.new_time(timestamp '2020-12-12 17:45:18', 'GMT', 'EDT') from dual;
select oracle.new_time(timestamp '2020-12-12 17:45:18', 'NST', 'GMT') from dual;
select oracle.new_time('2020-10-12 17:42:58 +08'::timestamptz, 'AST', 'ADT') from dual;
select oracle.new_time('2020-11-12 17:42:58 +08'::timestamptz, 'BST', 'BDT') from dual;
select oracle.new_time('2020-12-12 13:45:58 +08'::timestamptz, 'CST', 'CDT') from dual;
select oracle.new_time('2020-10-12 13:45:18 +08'::timestamptz, 'EST', 'EDT') from dual;
select oracle.new_time('2020-11-12 17:49:18 +08'::timestamptz, 'HST', 'HDT') from dual;
select oracle.new_time('2020-12-12 17:49:28 +08'::timestamptz, 'MST', 'MDT') from dual;
select oracle.new_time('2020-10-12 17:45:28 +08'::timestamptz, 'PST', 'PDT') from dual;
select oracle.new_time('2020-10-12 16:45:18 +08'::timestamptz, 'YST', 'YDT') from dual;
select oracle.new_time('2020-11-12 16:41:28 +08'::timestamptz, 'GMT', 'EDT') from dual;
select oracle.new_time('2020-12-12 17:41:18 +08'::timestamptz, 'NST', 'GMT') from dual;
set compatible_mode to oracle ;
--add_months function
select oracle.add_months(oracle.date '2020-02-15',7) from dual;
select oracle.add_months(oracle.date '2018-12-15',14) from dual;
select oracle.add_months(oracle.date '2019-12-15',12) from dual;
select oracle.add_months(oracle.date '0019-12-15',40) from dual;
select oracle.add_months(timestamp '2020-02-15 12:12:09',7) from dual;
select oracle.add_months(timestamp '2018-12-15 19:12:09',14) from dual;
select oracle.add_months(timestamp '2018-12-15 19:12:09',12) from dual;
select oracle.add_months(timestamp '2018-12-15 19:12:09',40) from dual;
select oracle.add_months(timestamptz'2020-02-15 12:12:09 +08',7) from dual;
select oracle.add_months(timestamptz'2018-12-15 12:12:09 +08',24) from dual;
select oracle.add_months(timestamptz'2018-12-15 12:12:09 +08',100) from dual;
select oracle.add_months(timestamptz'2018-12-15 12:12:09 +08',120) from dual;
select oracle.add_months(oracle.date '-2020-02-15',7) from dual;
select oracle.add_months(oracle.date '-2018-12-15',14) from dual;
select oracle.add_months(oracle.date '-2019-12-15',12) from dual;
select oracle.add_months(oracle.date '-0019-12-15',40) from dual;
select oracle.add_months(oracle.date '-0002-12-15',40) from dual;
select oracle.add_months(oracle.date '0002-12-15',-40) from dual;
select oracle.add_months(oracle.date '-0002-12-15 12:14:15',40) from dual;
select oracle.add_months(oracle.date '-0002-12-15 12:14:15',12) from dual;
select oracle.add_months(oracle.date '-0002-12-15 12:14:15',13) from dual;
select oracle.add_months(oracle.date '0002-12-15 10:02:09',-40) from dual;
select oracle.add_months(oracle.date '0002-12-15 10:02:09',-23) from dual;
select oracle.add_months(oracle.date '0002-12-15 10:02:09',-24) from dual;
--months_between function
select oracle.months_between(oracle.date '2020-03-15', oracle.date '2020-02-20') from dual;
select oracle.months_between(oracle.date '2020-02-10', oracle.date '2020-05-20') from dual;
select oracle.months_between(oracle.date '2021-11-10', oracle.date '2020-05-20') from dual;
select oracle.months_between(oracle.date '2021-11-10', oracle.date '2008-05-20') from dual;
select oracle.months_between(timestamp '2021-11-10 20:20:20', timestamp '2020-05-20 16:20:20') from dual;
select oracle.months_between(timestamp '2022-05-15 20:20:20', timestamp '2020-01-20 19:20:20') from dual;
select oracle.months_between(timestamp '2021-11-10 20:20:20', timestamp '2020-05-20 16:20:20') from dual;
select oracle.months_between(timestamp '2020-11-10 20:20:20', timestamp '2025-05-20 16:20:20') from dual;
select oracle.months_between(timestamptz '2021-11-10 20:20:20 +08', timestamptz '2020-05-20 16:20:20 +08') from dual;
select oracle.months_between(timestamptz '2021-11-10 00:00:00 +08', timestamptz '2020-05-20 16:20:20 +08') from dual;
select oracle.months_between(oracle.date '2021-11-10', timestamptz '2020-05-20 16:20:20 +08') from dual;
select oracle.months_between(timestamptz '2020-01-10 01:00:00 +08', timestamptz '2028-05-19 16:25:20 +08') from dual;
select oracle.months_between(timestamptz '2021-11-10 20:20:20 +05', timestamptz '2020-05-20 16:20:20 +03') from dual;
select oracle.months_between(timestamptz '2008-01-31 11:32:11 +8', timestamptz '2008-02-29 11:12:12') from dual;
select oracle.months_between(oracle.date '-2020-03-15', oracle.date '-2020-02-20') from dual;
select oracle.months_between(oracle.date '-2020-02-10', oracle.date '-2020-05-20') from dual;
select oracle.months_between(oracle.date '-2021-11-10', oracle.date '-2020-05-20') from dual;
select oracle.months_between(oracle.date '-2021-11-10 12:12:30', oracle.date '-2008-05-20 13:15:12') from dual;
--trunc function
select oracle.trunc(cast('2050-12-12' as oracle.date), 'SCC');
select oracle.trunc(cast('2050-06-12' as oracle.date), 'SYYYY');
select oracle.trunc(cast('2020-02-28' as oracle.date), 'IYYY');
select oracle.trunc(cast('2020-02-28' as oracle.date), 'Q');
select oracle.trunc(cast('2020-09-27' as oracle.date), 'MONTH');
select oracle.trunc(cast('2020-03-15' as oracle.date), 'WW');
select oracle.trunc(cast('2020-02-28' as oracle.date), 'IW');
select oracle.trunc(cast('2020-02-23' as oracle.date), 'W');
select oracle.trunc(cast('2020-06-18' as oracle.date), 'DDD');
select oracle.trunc(cast('2020-02-29' as oracle.date), 'DAY');
select oracle.trunc(cast('2050-12-12 12:12:13' as oracle.date), 'SCC');
select oracle.trunc(cast('2050-06-12 19:00:00' as oracle.date), 'SYYYY');
select oracle.trunc(cast('2020-02-28 20:00:00' as oracle.date), 'IYYY');
select oracle.trunc(cast('2020-02-28 21:01:09' as oracle.date), 'Q');
select oracle.trunc(cast('2020-09-27 22:10:12' as oracle.date), 'MONTH');
select oracle.trunc(cast('2020-03-15 23:15:36' as oracle.date), 'WW');
select oracle.trunc(cast('2020-02-28 09:11:12' as oracle.date), 'IW');
select oracle.trunc(cast('2020-02-23 14:20:18' as oracle.date), 'W');
select oracle.trunc(cast('2020-06-18 22:20:12' as oracle.date), 'DDD');
select oracle.trunc(cast('2020-02-29 08:00:01' as oracle.date), 'DAY');
select oracle.trunc(timestamp '2051-12-12 12:00:00', 'SCC');
select oracle.trunc(timestamp '2050-06-12 19:20:21', 'SYYYY');
select oracle.trunc(timestamp '2020-02-28 16:40:55', 'IYYY');
select oracle.trunc(timestamp '2020-07-28 19:16:12', 'Q');
select oracle.trunc(timestamp '2020-09-27 18:30:21', 'MONTH');
select oracle.trunc(timestamp '2020-03-15 12:12:19', 'WW');
select oracle.trunc(timestamp '2020-02-28 10:00:01', 'IW');
select oracle.trunc(timestamp '2020-02-23 12:12:14', 'W');
select oracle.trunc(timestamp '2020-06-18 13:12:18', 'DDD');
select oracle.trunc(timestamp '2020-02-29 14:40:20', 'DAY');
select oracle.trunc(timestamp '2020-02-29 11:40:20', 'HH');
select oracle.trunc(timestamp '2020-02-29 18:40:20', 'MI');
select oracle.trunc(timestamptz '2051-12-12 12:00:00 + 08', 'SCC');
select oracle.trunc(timestamptz '2050-06-12 19:20:21 + 08', 'SYYYY');
select oracle.trunc(timestamptz '2020-02-28 16:40:55 + 08', 'IYYY');
select oracle.trunc(timestamptz '2020-02-28 19:16:12 + 08', 'Q');
select oracle.trunc(timestamptz '2020-09-27 18:30:21 + 08', 'MONTH');
select oracle.trunc(timestamptz '2020-03-15 12:12:19 + 08', 'WW');
select oracle.trunc(timestamptz '2020-02-28 10:00:01 + 08', 'IW');
select oracle.trunc(timestamptz '2020-02-23 12:12:14 + 08', 'W');
select oracle.trunc(timestamptz '2020-06-18 13:12:18 + 08', 'DDD');
select oracle.trunc(timestamptz '2020-02-29 14:40:20 + 08', 'DAY');
select oracle.trunc(timestamptz '2020-02-29 11:40:20 + 08', 'HH');
select oracle.trunc(timestamptz '2020-02-29 14:40:50 + 08', 'MI');
--round function
select oracle.round(cast('2012-12-12' as oracle.date), 'CC');
select oracle.round(cast('2051-12-12' as oracle.date), 'SCC');
select oracle.round(cast('2050-12-12' as oracle.date), 'SYYYY');
select oracle.round(cast('2050-06-12' as oracle.date), 'IYYY');
select oracle.round(cast('2020-01-1' as oracle.date), 'Q');
select oracle.round(cast('2020-02-15' as oracle.date), 'MONTH');
select oracle.round(cast('2020-02-29' as oracle.date), 'WW');
select oracle.round(cast('2020-03-15' as oracle.date), 'IW');
select oracle.round(cast('2020-02-28' as oracle.date), 'W');
select oracle.round(cast('2020-03-15' as oracle.date), 'DDD');
select oracle.round(cast('2020-06-18' as oracle.date), 'DAY');
select oracle.round(cast('2012-12-12 12:13:15' as oracle.date), 'CC');
select oracle.round(cast('2051-12-12 19:00:00' as oracle.date), 'SCC');
select oracle.round(cast('2050-12-12 20:00:00' as oracle.date), 'SYYYY');
select oracle.round(cast('2050-06-12 21:40:00' as oracle.date), 'IYYY');
select oracle.round(cast('2020-01-1 22:00:00' as oracle.date), 'Q');
select oracle.round(cast('2020-02-15 23:57:09' as oracle.date), 'MONTH');
select oracle.round(cast('2020-02-29 11:11:00' as oracle.date), 'WW');
select oracle.round(cast('2020-03-15 09:05:21' as oracle.date), 'IW');
select oracle.round(cast('2020-02-28 21:11:01' as oracle.date), 'W');
select oracle.round(cast('2020-03-15 13:04:21' as oracle.date), 'DDD');
select oracle.round(cast('2020-06-18 22:03:01' as oracle.date), 'DAY');
select oracle.round(timestamp '2012-12-12 12:00:00', 'CC');
select oracle.round(timestamp '2050-12-12 12:00:00', 'SCC');
select oracle.round(timestamp '2050-06-12 19:20:21', 'SYYYY');
select oracle.round(timestamp '2050-06-12 16:40:55', 'IYYY');
select oracle.round(timestamp '2020-02-16 19:16:12', 'Q');
select oracle.round(timestamp '2020-09-27 18:30:21', 'MONTH');
select oracle.round(timestamp '2020-03-15 12:12:19', 'WW');
select oracle.round(timestamp '2020-02-28 10:00:01', 'IW');
select oracle.round(timestamp '2020-02-23 12:12:14', 'W');
select oracle.round(timestamp '2020-06-18 13:12:18', 'DDD');
select oracle.round(timestamp '2020-02-29 14:40:20', 'DAY');
select oracle.round(timestamp '2020-02-29 11:40:20', 'HH');
select oracle.round(timestamp '2020-02-29 14:40:20', 'MI');
select oracle.round(timestamptz '2012-12-12 12:00:00 + 08', 'CC');
select oracle.round(timestamptz '2050-12-12 12:00:00 + 08', 'SCC');
select oracle.round(timestamptz '2051-12-12 12:00:00 + 08', 'SCC');
select oracle.round(timestamptz '2050-06-12 19:20:21 + 08', 'SYYYY');
select oracle.round(timestamptz '2050-06-12 16:40:55 + 08', 'IYYY');
select oracle.round(timestamptz '2020-02-16 19:16:12 + 08', 'Q');
select oracle.round(timestamptz '2020-09-27 18:30:21 + 08', 'MONTH');
select oracle.round(timestamptz '2020-03-15 12:12:19 + 08', 'WW');
select oracle.round(timestamptz '2020-02-28 10:00:01 + 08', 'IW');
select oracle.round(timestamptz '2020-02-23 12:12:14 + 08', 'W');
select oracle.round(timestamptz '2020-06-18 13:12:18 + 08', 'DDD');
select oracle.round(timestamptz '2020-02-29 14:40:20 + 08', 'DAY');
select oracle.round(timestamptz '2020-02-29 11:40:20 + 08', 'HH');
select oracle.round(timestamptz '2020-06-18 14:40:20 + 08', 'MI');
--next_day function
select oracle.next_day(date '2020-02-15', 'Monday') from dual;
select oracle.next_day(date '2020-02-29', 'Monday') from dual;
select oracle.next_day(date '2020-06-14', 'Wednesday') from dual;
select oracle.next_day(date '2020-07-20', 'Wednesday') from dual;
select oracle.next_day(date '2020-09-15', 'Friday') from dual;
select oracle.next_day(date '2020-09-22', 'Friday') from dual;
select oracle.next_day(date '2020-02-15', 2) from dual;
select oracle.next_day(date '2020-02-29', 2) from dual;
select oracle.next_day(date '2020-06-14', 4) from dual;
select oracle.next_day(date '2020-07-20', 4) from dual;
select oracle.next_day(date '2020-09-15', 6) from dual;
select oracle.next_day(date '2020-09-22', 6) from dual;
select oracle.next_day(oracle.date '2020-02-15 12:10:10', 2) from dual;
select oracle.next_day(oracle.date '2020-02-29 09:45:59', 3) from dual;
select oracle.next_day(oracle.date '2020-06-14 01:20:12', 4) from dual;
select oracle.next_day(oracle.date '2020-07-20 14:20:23', 5) from dual;
select oracle.next_day(oracle.date '2020-09-15 05:19:43', 6) from dual;
select oracle.next_day(oracle.date '2020-09-22 12:00:00', 7) from dual;
select oracle.next_day(to_timestamp('2020-02-29 14:40:50', 'YYYY-MM-DD HH24:MI:SS'), 'Tuesday') from dual;
select oracle.next_day(to_timestamp('2020-05-05 19:43:51', 'YYYY-MM-DD HH24:MI:SS'), 'thursday') from dual;
select oracle.next_day(to_timestamp('2020-06-22 19:43:51', 'YYYY-MM-DD HH24:MI:SS'), 'Saturday') from dual;
select oracle.next_day(to_timestamp('2020-07-01 19:43:51', 'YYYY-MM-DD HH24:MI:SS'), 'Sunday') from dual;
select oracle.next_day(to_timestamp('2020-02-29 14:40:50', 'YYYY-MM-DD HH24:MI:SS'), 3) from dual;
select oracle.next_day(to_timestamp('2020-05-05 19:43:51', 'YYYY-MM-DD HH24:MI:SS'), 5) from dual;
select oracle.next_day(to_timestamp('2020-06-22 19:43:51', 'YYYY-MM-DD HH24:MI:SS'), 7) from dual;
select oracle.next_day(to_timestamp('2020-07-01 19:43:51', 'YYYY-MM-DD HH24:MI:SS'), 1) from dual;
select oracle.next_day('2020-02-29 14:40:50'::timestamptz, 'Tuesday') from dual;
select oracle.next_day('2020-05-05 19:43:51'::timestamptz, 'thursday') from dual;
select oracle.next_day('2020-06-22 19:43:51'::timestamptz, 'Saturday') from dual;
select oracle.next_day('2020-07-01 19:43:51'::timestamptz, 'Sunday') from dual;
select oracle.next_day('2020-02-29 14:40:50'::timestamptz, 3) from dual;
select oracle.next_day('2020-05-05 19:43:51'::timestamptz, 5) from dual;
select oracle.next_day('2020-06-22 19:43:51'::timestamptz, 7) from dual;
select oracle.next_day('2020-07-01 19:43:51'::timestamptz, 1) from dual;
--last_day function
select oracle.last_day(date '2020-02-15');
select oracle.last_day(date '2020-07-11');
select oracle.last_day(date '2020-09-09');
select oracle.last_day(date '2020-02-15');
select oracle.last_day(date '2020-07-11');
select oracle.last_day(date '2020-09-09');
select oracle.last_day(date '2020-02-15');
select oracle.last_day(date '2020-11-11');
select oracle.last_day(date '2020-09-09');
select oracle.last_day('2020-02-12 12:45:12'::timestamp) from dual;
select oracle.last_day(timestamp '2020-05-17 13:27:19') from dual;
select oracle.last_day(timestamp '2020-08-21 19:20:40') from dual;
select oracle.last_day('2020-10-05 12:45:12 +08'::timestamptz) from dual;
select oracle.last_day('2020-12-17 13:27:19 +08'::timestamptz) from dual;
select oracle.last_day('2020-11-29 19:20:40 +08'::timestamptz) from dual;
select oracle.last_day('-0001-3-1 13:27:19'::oracle.date) from dual;
select oracle.last_day('-0001-4-1 13:27:19'::oracle.date) from dual;
select oracle.last_day('-0001-2-1 13:27:19'::oracle.date) from dual;
select oracle.last_day('-0004-2-1 13:27:19'::oracle.date) from dual;
select oracle.last_day(oracle.date '2021-01-15 14:20:23');
select oracle.last_day(oracle.date '2021-02-11 09:10:21');
select oracle.last_day(oracle.date '2021-03-09 12:33:11');
select oracle.last_day(oracle.date '2021-04-15 11:59:59');
select oracle.last_day(oracle.date '2021-05-01 12:10:01');
select oracle.last_day(oracle.date '2021-06-18 01:00:01');
select oracle.last_day(oracle.date '2021-07-07 05:20:18');
select oracle.last_day(oracle.date '2021-08-15 17:19:13');
select oracle.last_day(oracle.date '2021-09-15 16:19:10');
select oracle.last_day(oracle.date '2021-11-11 17:30:00');
select oracle.last_day(oracle.date '2021-12-09 22:00:00'); | the_stack |
-- TABLE: entries
CREATE TABLE IF NOT EXISTS `bx_stream_streams` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`author` int(11) NOT NULL,
`added` int(11) NOT NULL,
`changed` int(11) NOT NULL,
`published` int(11) NOT NULL,
`thumb` int(11) NOT NULL,
`title` varchar(255) NOT NULL,
`cat` int(11) NOT NULL,
`multicat` text NOT NULL,
`text` mediumtext NOT NULL,
`key` varchar(12) NOT NULL,
`labels` text NOT NULL,
`location` text NOT NULL,
`views` int(11) NOT NULL default '0',
`rate` float NOT NULL default '0',
`votes` int(11) NOT NULL default '0',
`rrate` float NOT NULL default '0',
`rvotes` int(11) NOT NULL default '0',
`score` int(11) NOT NULL default '0',
`sc_up` int(11) NOT NULL default '0',
`sc_down` int(11) NOT NULL default '0',
`comments` int(11) NOT NULL default '0',
`reports` int(11) NOT NULL default '0',
`featured` int(11) NOT NULL default '0',
`allow_view_to` varchar(16) NOT NULL DEFAULT '3',
`disable_comments` tinyint(4) NOT NULL DEFAULT '0',
`status` enum('active','awaiting','failed','hidden') NOT NULL DEFAULT 'active',
`status_admin` enum('active','hidden','pending') NOT NULL DEFAULT 'active',
PRIMARY KEY (`id`),
FULLTEXT KEY `title_text` (`title`,`text`)
);
-- TABLE: storages & transcoders
CREATE TABLE IF NOT EXISTS `bx_stream_covers` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`profile_id` int(10) unsigned NOT NULL,
`remote_id` varchar(128) NOT NULL,
`path` varchar(255) NOT NULL,
`file_name` varchar(255) NOT NULL,
`mime_type` varchar(128) NOT NULL,
`ext` varchar(32) NOT NULL,
`size` bigint(20) NOT NULL,
`added` int(11) NOT NULL,
`modified` int(11) NOT NULL,
`private` int(11) NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `remote_id` (`remote_id`)
);
CREATE TABLE IF NOT EXISTS `bx_stream_photos_resized` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`profile_id` int(10) unsigned NOT NULL,
`remote_id` varchar(128) NOT NULL,
`path` varchar(255) NOT NULL,
`file_name` varchar(255) NOT NULL,
`mime_type` varchar(128) NOT NULL,
`ext` varchar(32) NOT NULL,
`size` bigint(20) NOT NULL,
`added` int(11) NOT NULL,
`modified` int(11) NOT NULL,
`private` int(11) NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `remote_id` (`remote_id`)
);
-- TABLE: comments
CREATE TABLE IF NOT EXISTS `bx_stream_cmts` (
`cmt_id` int(11) NOT NULL AUTO_INCREMENT,
`cmt_parent_id` int(11) NOT NULL DEFAULT '0',
`cmt_vparent_id` int(11) NOT NULL DEFAULT '0',
`cmt_object_id` int(11) NOT NULL DEFAULT '0',
`cmt_author_id` int(11) NOT NULL DEFAULT '0',
`cmt_level` int(11) NOT NULL DEFAULT '0',
`cmt_text` text NOT NULL,
`cmt_mood` tinyint(4) NOT NULL DEFAULT '0',
`cmt_rate` int(11) NOT NULL DEFAULT '0',
`cmt_rate_count` int(11) NOT NULL DEFAULT '0',
`cmt_time` int(11) unsigned NOT NULL DEFAULT '0',
`cmt_replies` int(11) NOT NULL DEFAULT '0',
`cmt_pinned` int(11) NOT NULL default '0',
PRIMARY KEY (`cmt_id`),
KEY `cmt_object_id` (`cmt_object_id`,`cmt_parent_id`),
FULLTEXT KEY `search_fields` (`cmt_text`)
);
CREATE TABLE IF NOT EXISTS `bx_stream_cmts_notes` (
`cmt_id` int(11) NOT NULL AUTO_INCREMENT,
`cmt_parent_id` int(11) NOT NULL DEFAULT '0',
`cmt_vparent_id` int(11) NOT NULL DEFAULT '0',
`cmt_object_id` int(11) NOT NULL DEFAULT '0',
`cmt_author_id` int(11) NOT NULL DEFAULT '0',
`cmt_level` int(11) NOT NULL DEFAULT '0',
`cmt_text` text NOT NULL,
`cmt_mood` tinyint(4) NOT NULL DEFAULT '0',
`cmt_rate` int(11) NOT NULL DEFAULT '0',
`cmt_rate_count` int(11) NOT NULL DEFAULT '0',
`cmt_time` int(11) unsigned NOT NULL DEFAULT '0',
`cmt_replies` int(11) NOT NULL DEFAULT '0',
`cmt_pinned` int(11) NOT NULL default '0',
PRIMARY KEY (`cmt_id`),
KEY `cmt_object_id` (`cmt_object_id`,`cmt_parent_id`),
FULLTEXT KEY `search_fields` (`cmt_text`)
);
-- TABLE: votes
CREATE TABLE IF NOT EXISTS `bx_stream_votes` (
`object_id` int(11) NOT NULL default '0',
`count` int(11) NOT NULL default '0',
`sum` int(11) NOT NULL default '0',
UNIQUE KEY `object_id` (`object_id`)
);
CREATE TABLE IF NOT EXISTS `bx_stream_votes_track` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`object_id` int(11) NOT NULL default '0',
`author_id` int(11) NOT NULL default '0',
`author_nip` int(11) unsigned NOT NULL default '0',
`value` tinyint(4) NOT NULL default '0',
`date` int(11) NOT NULL default '0',
PRIMARY KEY (`id`),
KEY `vote` (`object_id`, `author_nip`)
);
CREATE TABLE IF NOT EXISTS `bx_stream_reactions` (
`object_id` int(11) NOT NULL default '0',
`reaction` varchar(32) NOT NULL default '',
`count` int(11) NOT NULL default '0',
`sum` int(11) NOT NULL default '0',
UNIQUE KEY `reaction` (`object_id`, `reaction`)
);
CREATE TABLE IF NOT EXISTS `bx_stream_reactions_track` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`object_id` int(11) NOT NULL default '0',
`author_id` int(11) NOT NULL default '0',
`author_nip` int(11) unsigned NOT NULL default '0',
`reaction` varchar(32) NOT NULL default '',
`value` tinyint(4) NOT NULL default '0',
`date` int(11) NOT NULL default '0',
PRIMARY KEY (`id`),
KEY `vote` (`object_id`, `author_nip`)
);
-- TABLE: views
CREATE TABLE `bx_stream_views_track` (
`object_id` int(11) NOT NULL default '0',
`viewer_id` int(11) NOT NULL default '0',
`viewer_nip` int(11) unsigned NOT NULL default '0',
`date` int(11) NOT NULL default '0',
KEY `id` (`object_id`,`viewer_id`,`viewer_nip`)
);
-- TABLE: metas
CREATE TABLE `bx_stream_meta_keywords` (
`object_id` int(10) unsigned NOT NULL,
`keyword` varchar(255) NOT NULL,
KEY `object_id` (`object_id`),
KEY `keyword` (`keyword`)
);
CREATE TABLE `bx_stream_meta_mentions` (
`object_id` int(10) unsigned NOT NULL,
`profile_id` int(10) unsigned NOT NULL,
KEY `object_id` (`object_id`),
KEY `profile_id` (`profile_id`)
);
CREATE TABLE `bx_stream_meta_locations` (
`object_id` int(10) unsigned NOT NULL,
`lat` double NOT NULL,
`lng` double NOT NULL,
`country` varchar(2) NOT NULL,
`state` varchar(255) NOT NULL,
`city` varchar(255) NOT NULL,
`zip` varchar(255) NOT NULL,
`street` varchar(255) NOT NULL,
`street_number` varchar(255) NOT NULL,
PRIMARY KEY (`object_id`),
KEY `country_state_city` (`country`,`state`(8),`city`(8))
);
-- TABLE: reports
CREATE TABLE IF NOT EXISTS `bx_stream_reports` (
`object_id` int(11) NOT NULL default '0',
`count` int(11) NOT NULL default '0',
UNIQUE KEY `object_id` (`object_id`)
);
CREATE TABLE IF NOT EXISTS `bx_stream_reports_track` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`object_id` int(11) NOT NULL default '0',
`author_id` int(11) NOT NULL default '0',
`author_nip` int(11) unsigned NOT NULL default '0',
`type` varchar(32) NOT NULL default '',
`text` text NOT NULL default '',
`date` int(11) NOT NULL default '0',
`checked_by` int(11) NOT NULL default '0',
`status` tinyint(11) NOT NULL default '0',
PRIMARY KEY (`id`),
KEY `report` (`object_id`, `author_nip`)
);
-- TABLE: scores
CREATE TABLE IF NOT EXISTS `bx_stream_scores` (
`object_id` int(11) NOT NULL default '0',
`count_up` int(11) NOT NULL default '0',
`count_down` int(11) NOT NULL default '0',
UNIQUE KEY `object_id` (`object_id`)
);
CREATE TABLE IF NOT EXISTS `bx_stream_scores_track` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`object_id` int(11) NOT NULL default '0',
`author_id` int(11) NOT NULL default '0',
`author_nip` int(11) unsigned NOT NULL default '0',
`type` varchar(8) NOT NULL default '',
`date` int(11) NOT NULL default '0',
PRIMARY KEY (`id`),
KEY `vote` (`object_id`, `author_nip`)
);
-- STORAGES & TRANSCODERS
SET @sStorageEngine = (SELECT `value` FROM `sys_options` WHERE `name` = 'sys_storage_default');
INSERT INTO `sys_objects_storage` (`object`, `engine`, `params`, `token_life`, `cache_control`, `levels`, `table_files`, `ext_mode`, `ext_allow`, `ext_deny`, `quota_size`, `current_size`, `quota_number`, `current_number`, `max_file_size`, `ts`) VALUES
('bx_stream_covers', @sStorageEngine, '', 360, 2592000, 3, 'bx_stream_covers', 'allow-deny', 'jpg,jpeg,jpe,gif,png', '', 0, 0, 0, 0, 0, 0),
('bx_stream_photos_resized', @sStorageEngine, '', 360, 2592000, 3, 'bx_stream_photos_resized', 'allow-deny', 'jpg,jpeg,jpe,gif,png', '', 0, 0, 0, 0, 0, 0);
INSERT INTO `sys_objects_transcoder` (`object`, `storage_object`, `source_type`, `source_params`, `private`, `atime_tracking`, `atime_pruning`, `ts`, `override_class_name`, `override_class_file`) VALUES
('bx_stream_preview', 'bx_stream_photos_resized', 'Storage', 'a:1:{s:6:"object";s:16:"bx_stream_covers";}', 'no', '1', '2592000', '0', '', ''),
('bx_stream_gallery', 'bx_stream_photos_resized', 'Storage', 'a:1:{s:6:"object";s:16:"bx_stream_covers";}', 'no', '1', '2592000', '0', '', ''),
('bx_stream_cover', 'bx_stream_photos_resized', 'Storage', 'a:1:{s:6:"object";s:16:"bx_stream_covers";}', 'no', '1', '2592000', '0', '', '');
INSERT INTO `sys_transcoder_filters` (`transcoder_object`, `filter`, `filter_params`, `order`) VALUES
('bx_stream_preview', 'Resize', 'a:3:{s:1:"w";s:3:"300";s:1:"h";s:3:"200";s:11:"crop_resize";s:1:"1";}', '0'),
('bx_stream_gallery', 'Resize', 'a:1:{s:1:"w";s:3:"500";}', '0'),
('bx_stream_cover', 'Resize', 'a:1:{s:1:"w";s:4:"2000";}', '0');
-- FORMS: entry (post)
INSERT INTO `sys_objects_form`(`object`, `module`, `title`, `action`, `form_attrs`, `table`, `key`, `uri`, `uri_title`, `submit_name`, `params`, `deletable`, `active`, `override_class_name`, `override_class_file`) VALUES
('bx_stream', 'bx_stream', '_bx_stream_form_entry', '', 'a:1:{s:7:"enctype";s:19:"multipart/form-data";}', 'bx_stream_streams', 'id', '', '', 'a:2:{i:0;s:9:"do_submit";i:1;s:10:"do_publish";}', '', 0, 1, 'BxStrmFormEntry', 'modules/boonex/stream/classes/BxStrmFormEntry.php');
INSERT INTO `sys_form_displays`(`object`, `display_name`, `module`, `view_mode`, `title`) VALUES
('bx_stream', 'bx_stream_entry_add', 'bx_stream', 0, '_bx_stream_form_entry_display_add'),
('bx_stream', 'bx_stream_entry_delete', 'bx_stream', 0, '_bx_stream_form_entry_display_delete'),
('bx_stream', 'bx_stream_entry_edit', 'bx_stream', 0, '_bx_stream_form_entry_display_edit'),
('bx_stream', 'bx_stream_entry_view', 'bx_stream', 1, '_bx_stream_form_entry_display_view');
INSERT INTO `sys_form_inputs`(`object`, `module`, `name`, `value`, `values`, `checked`, `type`, `caption_system`, `caption`, `info`, `required`, `collapsed`, `html`, `attrs`, `attrs_tr`, `attrs_wrapper`, `checker_func`, `checker_params`, `checker_error`, `db_pass`, `db_params`, `editable`, `deletable`) VALUES
('bx_stream', 'bx_stream', 'allow_view_to', '', '', 0, 'custom', '_bx_stream_form_entry_input_sys_allow_view_to', '_bx_stream_form_entry_input_allow_view_to', '', 1, 0, 0, '', '', '', '', '', '', '', '', 1, 0),
('bx_stream', 'bx_stream', 'delete_confirm', 1, '', 0, 'checkbox', '_bx_stream_form_entry_input_sys_delete_confirm', '_bx_stream_form_entry_input_delete_confirm', '_bx_stream_form_entry_input_delete_confirm_info', 1, 0, 0, '', '', '', 'Avail', '', '_bx_stream_form_entry_input_delete_confirm_error', '', '', 1, 0),
('bx_stream', 'bx_stream', 'do_publish', '_bx_stream_form_entry_input_do_publish', '', 0, 'submit', '_bx_stream_form_entry_input_sys_do_publish', '', '', 0, 0, 0, '', '', '', '', '', '', '', '', 1, 0),
('bx_stream', 'bx_stream', 'do_submit', '_bx_stream_form_entry_input_do_submit', '', 0, 'submit', '_bx_stream_form_entry_input_sys_do_submit', '', '', 0, 0, 0, '', '', '', '', '', '', '', '', 1, 0),
('bx_stream', 'bx_stream', 'location', '', '', 0, 'location', '_sys_form_input_sys_location', '_sys_form_input_location', '', 0, 0, 0, '', '', '', '', '', '', '', '', 1, 0),
('bx_stream', 'bx_stream', 'covers', 'a:1:{i:0;s:15:"bx_stream_html5";}', 'a:2:{s:16:"bx_stream_simple";s:26:"_sys_uploader_simple_title";s:15:"bx_stream_html5";s:25:"_sys_uploader_html5_title";}', 0, 'files', '_bx_stream_form_entry_input_sys_covers', '_bx_stream_form_entry_input_covers', '', 0, 0, 0, '', '', '', '', '', '', '', '', 1, 0),
('bx_stream', 'bx_stream', 'text', '', '', 0, 'textarea', '_bx_stream_form_entry_input_sys_text', '_bx_stream_form_entry_input_text', '', 1, 0, 2, '', '', '', 'Avail', '', '_bx_stream_form_entry_input_text_err', 'XssHtml', '', 1, 0),
('bx_stream', 'bx_stream', 'title', '', '', 0, 'text', '_bx_stream_form_entry_input_sys_title', '_bx_stream_form_entry_input_title', '', 1, 0, 0, '', '', '', 'Avail', '', '_bx_stream_form_entry_input_title_err', 'Xss', '', 1, 0),
('bx_stream', 'bx_stream', 'cat', '', '#!bx_stream_cats', 0, 'select', '_bx_stream_form_entry_input_sys_cat', '_bx_stream_form_entry_input_cat', '', 1, 0, 0, '', '', '', 'avail', '', '_bx_stream_form_entry_input_cat_err', 'Xss', '', 1, 0),
('bx_stream', 'bx_stream', 'multicat', '', '', 0, 'custom', '_bx_stream_form_entry_input_sys_multicat', '_bx_stream_form_entry_input_multicat', '', 1, 0, 0, '', '', '', 'avail', '', '_bx_stream_form_entry_input_multicat_err', 'Xss', '', 1, 0),
('bx_stream', 'bx_stream', 'added', '', '', 0, 'datetime', '_bx_stream_form_entry_input_sys_date_added', '_bx_stream_form_entry_input_date_added', '', 0, 0, 0, '', '', '', '', '', '', '', '', 1, 0),
('bx_stream', 'bx_stream', 'changed', '', '', 0, 'datetime', '_bx_stream_form_entry_input_sys_date_changed', '_bx_stream_form_entry_input_date_changed', '', 0, 0, 0, '', '', '', '', '', '', '', '', 1, 0),
('bx_stream', 'bx_stream', 'labels', '', '', 0, 'custom', '_sys_form_input_sys_labels', '_sys_form_input_labels', '', 0, 0, 0, '', '', '', '', '', '', '', '', 1, 0),
('bx_stream', 'bx_stream', 'anonymous', '', '', 0, 'switcher', '_sys_form_input_sys_anonymous', '_sys_form_input_anonymous', '', 0, 0, 0, '', '', '', '', '', '', '', '', 1, 0),
('bx_stream', 'bx_stream', 'disable_comments', '1', '', 0, 'switcher', '_bx_stream_form_entry_input_sys_disable_comments', '_bx_stream_form_entry_input_disable_comments', '', 0, 0, 0, '', '', '', '', '', '', 'Int', '', 1, 0);
INSERT INTO `sys_form_display_inputs`(`display_name`, `input_name`, `visible_for_levels`, `active`, `order`) VALUES
('bx_stream_entry_add', 'delete_confirm', 2147483647, 0, 1),
('bx_stream_entry_add', 'title', 2147483647, 1, 2),
('bx_stream_entry_add', 'cat', 2147483647, 1, 3),
('bx_stream_entry_add', 'text', 2147483647, 1, 4),
('bx_stream_entry_add', 'covers', 2147483647, 1, 5),
('bx_stream_entry_add', 'allow_view_to', 2147483647, 1, 6),
('bx_stream_entry_add', 'location', 2147483647, 1, 7),
('bx_stream_entry_add', 'disable_comments', 192, 1, 8),
('bx_stream_entry_add', 'do_publish', 2147483647, 1, 9),
('bx_stream_entry_delete', 'delete_confirm', 2147483647, 1, 1),
('bx_stream_entry_delete', 'do_submit', 2147483647, 1, 2),
('bx_stream_entry_edit', 'do_publish', 2147483647, 0, 1),
('bx_stream_entry_edit', 'delete_confirm', 2147483647, 0, 2),
('bx_stream_entry_edit', 'title', 2147483647, 1, 3),
('bx_stream_entry_edit', 'cat', 2147483647, 1, 4),
('bx_stream_entry_edit', 'text', 2147483647, 1, 5),
('bx_stream_entry_edit', 'covers', 2147483647, 1, 6),
('bx_stream_entry_edit', 'allow_view_to', 2147483647, 1, 7),
('bx_stream_entry_edit', 'location', 2147483647, 1, 8),
('bx_stream_entry_edit', 'disable_comments', 192, 1, 9),
('bx_stream_entry_edit', 'do_submit', 2147483647, 1, 10),
('bx_stream_entry_view', 'cat', 2147483647, 1, 1),
('bx_stream_entry_view', 'added', 2147483647, 1, 2),
('bx_stream_entry_view', 'changed', 2147483647, 1, 3),
('bx_stream_entry_view', 'published', 192, 1, 4);
-- PRE-VALUES
INSERT INTO `sys_form_pre_lists`(`key`, `title`, `module`, `use_for_sets`) VALUES
('bx_stream_cats', '_bx_stream_pre_lists_cats', 'bx_stream', '0');
INSERT INTO `sys_form_pre_values`(`Key`, `Value`, `Order`, `LKey`, `LKey2`) VALUES
('bx_stream_cats', '', 0, '_sys_please_select', ''),
('bx_stream_cats', '1', 1, '_bx_stream_cat_Animals_Pets', ''),
('bx_stream_cats', '2', 2, '_bx_stream_cat_Architecture', ''),
('bx_stream_cats', '3', 3, '_bx_stream_cat_Art', ''),
('bx_stream_cats', '4', 4, '_bx_stream_cat_Cars_Motorcycles', ''),
('bx_stream_cats', '5', 5, '_bx_stream_cat_Celebrities', ''),
('bx_stream_cats', '6', 6, '_bx_stream_cat_Design', ''),
('bx_stream_cats', '7', 7, '_bx_stream_cat_DIY_Crafts', ''),
('bx_stream_cats', '8', 8, '_bx_stream_cat_Education', ''),
('bx_stream_cats', '9', 9, '_bx_stream_cat_Film_Music_Books', ''),
('bx_stream_cats', '10', 10, '_bx_stream_cat_Food_Drink', ''),
('bx_stream_cats', '11', 11, '_bx_stream_cat_Gardening', ''),
('bx_stream_cats', '12', 12, '_bx_stream_cat_Geek', ''),
('bx_stream_cats', '13', 13, '_bx_stream_cat_Hair_Beauty', ''),
('bx_stream_cats', '14', 14, '_bx_stream_cat_Health_Fitness', ''),
('bx_stream_cats', '15', 15, '_bx_stream_cat_History', ''),
('bx_stream_cats', '16', 16, '_bx_stream_cat_Holidays_Events', ''),
('bx_stream_cats', '17', 17, '_bx_stream_cat_Home_Decor', ''),
('bx_stream_cats', '18', 18, '_bx_stream_cat_Humor', ''),
('bx_stream_cats', '19', 19, '_bx_stream_cat_Illustrations_Posters', ''),
('bx_stream_cats', '20', 20, '_bx_stream_cat_Kids_Parenting', ''),
('bx_stream_cats', '21', 21, '_bx_stream_cat_Mens_Fashion', ''),
('bx_stream_cats', '22', 22, '_bx_stream_cat_Outdoors', ''),
('bx_stream_cats', '23', 23, '_bx_stream_cat_Photography', ''),
('bx_stream_cats', '24', 24, '_bx_stream_cat_Products', ''),
('bx_stream_cats', '25', 25, '_bx_stream_cat_Quotes', ''),
('bx_stream_cats', '26', 26, '_bx_stream_cat_Science_Nature', ''),
('bx_stream_cats', '27', 27, '_bx_stream_cat_Sports', ''),
('bx_stream_cats', '28', 28, '_bx_stream_cat_Tattoos', ''),
('bx_stream_cats', '29', 29, '_bx_stream_cat_Technology', ''),
('bx_stream_cats', '30', 30, '_bx_stream_cat_Travel', ''),
('bx_stream_cats', '31', 31, '_bx_stream_cat_Weddings', ''),
('bx_stream_cats', '32', 32, '_bx_stream_cat_Womens_Fashion', '');
-- COMMENTS
INSERT INTO `sys_objects_cmts` (`Name`, `Module`, `Table`, `CharsPostMin`, `CharsPostMax`, `CharsDisplayMax`, `Html`, `PerView`, `PerViewReplies`, `BrowseType`, `IsBrowseSwitch`, `PostFormPosition`, `NumberOfLevels`, `IsDisplaySwitch`, `IsRatable`, `ViewingThreshold`, `IsOn`, `RootStylePrefix`, `BaseUrl`, `ObjectVote`, `TriggerTable`, `TriggerFieldId`, `TriggerFieldAuthor`, `TriggerFieldTitle`, `TriggerFieldComments`, `ClassName`, `ClassFile`) VALUES
('bx_stream', 'bx_stream', 'bx_stream_cmts', 1, 5000, 1000, 3, 5, 3, 'tail', 1, 'bottom', 1, 1, 1, -3, 1, 'cmt', 'page.php?i=view-stream&id={object_id}', '', 'bx_stream_streams', 'id', 'author', 'title', 'comments', '', ''),
('bx_stream_notes', 'bx_stream', 'bx_stream_cmts_notes', 1, 5000, 1000, 0, 5, 3, 'tail', 1, 'bottom', 1, 1, 1, -3, 1, 'cmt', 'page.php?i=view-stream&id={object_id}', '', 'bx_stream_streams', 'id', 'author', 'title', '', 'BxTemplCmtsNotes', '');
-- VOTES
INSERT INTO `sys_objects_vote` (`Name`, `TableMain`, `TableTrack`, `PostTimeout`, `MinValue`, `MaxValue`, `IsUndo`, `IsOn`, `TriggerTable`, `TriggerFieldId`, `TriggerFieldAuthor`, `TriggerFieldRate`, `TriggerFieldRateCount`, `ClassName`, `ClassFile`) VALUES
('bx_stream', 'bx_stream_votes', 'bx_stream_votes_track', '604800', '1', '1', '0', '1', 'bx_stream_streams', 'id', 'author', 'rate', 'votes', '', ''),
('bx_stream_reactions', 'bx_stream_reactions', 'bx_stream_reactions_track', '604800', '1', '1', '1', '1', 'bx_stream_streams', 'id', 'author', 'rrate', 'rvotes', 'BxTemplVoteReactions', ''),
('bx_stream_poll_answers', 'bx_stream_polls_answers_votes', 'bx_stream_polls_answers_votes_track', '604800', '1', '1', '0', '1', 'bx_stream_polls_answers', 'id', 'author_id', 'rate', 'votes', 'BxStrmVotePollAnswers', 'modules/boonex/stream/classes/BxStrmVotePollAnswers.php');
-- SCORES
INSERT INTO `sys_objects_score` (`name`, `module`, `table_main`, `table_track`, `post_timeout`, `is_on`, `trigger_table`, `trigger_field_id`, `trigger_field_author`, `trigger_field_score`, `trigger_field_cup`, `trigger_field_cdown`, `class_name`, `class_file`) VALUES
('bx_stream', 'bx_stream', 'bx_stream_scores', 'bx_stream_scores_track', '604800', '0', 'bx_stream_streams', 'id', 'author', 'score', 'sc_up', 'sc_down', '', '');
-- REPORTS
INSERT INTO `sys_objects_report` (`name`, `module`, `table_main`, `table_track`, `is_on`, `base_url`, `object_comment`, `trigger_table`, `trigger_field_id`, `trigger_field_author`, `trigger_field_count`, `class_name`, `class_file`) VALUES
('bx_stream', 'bx_stream', 'bx_stream_reports', 'bx_stream_reports_track', '1', 'page.php?i=view-stream&id={object_id}', 'bx_stream_notes', 'bx_stream_streams', 'id', 'author', 'reports', '', '');
-- VIEWS
INSERT INTO `sys_objects_view` (`name`, `table_track`, `period`, `is_on`, `trigger_table`, `trigger_field_id`, `trigger_field_author`, `trigger_field_count`, `class_name`, `class_file`) VALUES
('bx_stream', 'bx_stream_views_track', '86400', '1', 'bx_stream_streams', 'id', 'author', 'views', '', '');
-- FEATURED
INSERT INTO `sys_objects_feature` (`name`, `module`, `is_on`, `is_undo`, `base_url`, `trigger_table`, `trigger_field_id`, `trigger_field_author`, `trigger_field_flag`, `class_name`, `class_file`) VALUES
('bx_stream', 'bx_stream', '1', '1', 'page.php?i=view-stream&id={object_id}', 'bx_stream_streams', 'id', 'author', 'featured', '', '');
-- CONTENT INFO
INSERT INTO `sys_objects_content_info` (`name`, `title`, `alert_unit`, `alert_action_add`, `alert_action_update`, `alert_action_delete`, `class_name`, `class_file`) VALUES
('bx_stream', '_bx_stream', 'bx_stream', 'added', 'edited', 'deleted', '', ''),
('bx_stream_cmts', '_bx_stream_cmts', 'bx_stream', 'commentPost', 'commentUpdated', 'commentRemoved', 'BxDolContentInfoCmts', '');
INSERT INTO `sys_content_info_grids` (`object`, `grid_object`, `grid_field_id`, `condition`, `selection`) VALUES
('bx_stream', 'bx_stream_administration', 'id', '', ''),
('bx_stream', 'bx_stream_common', 'id', '', '');
-- SEARCH EXTENDED
INSERT INTO `sys_objects_search_extended` (`object`, `object_content_info`, `module`, `title`, `active`, `class_name`, `class_file`) VALUES
('bx_stream', 'bx_stream', 'bx_stream', '_bx_stream_search_extended', 1, '', ''),
('bx_stream_cmts', 'bx_stream_cmts', 'bx_stream', '_bx_stream_search_extended_cmts', 1, 'BxTemplSearchExtendedCmts', '');
-- LOGS
INSERT INTO `sys_objects_logs` (`object`, `module`, `logs_storage`, `title`, `active`, `class_name`, `class_file`) VALUES
('bx_stream_ome_api', 'bx_stream', 'Auto', '_bx_stream_logs_ome_api', 0, '', '');
-- STUDIO: page & widget
INSERT INTO `sys_std_pages`(`index`, `name`, `header`, `caption`, `icon`) VALUES
(3, 'bx_stream', '_bx_stream', '_bx_stream', 'bx_stream@modules/boonex/stream/|std-icon.svg');
SET @iPageId = LAST_INSERT_ID();
SET @iParentPageId = (SELECT `id` FROM `sys_std_pages` WHERE `name` = 'home');
SET @iParentPageOrder = (SELECT MAX(`order`) FROM `sys_std_pages_widgets` WHERE `page_id` = @iParentPageId);
INSERT INTO `sys_std_widgets` (`page_id`, `module`, `type`, `url`, `click`, `icon`, `caption`, `cnt_notices`, `cnt_actions`) VALUES
(@iPageId, 'bx_stream', 'content', '{url_studio}module.php?name=bx_stream', '', 'bx_stream@modules/boonex/stream/|std-icon.svg', '_bx_stream', '', 'a:4:{s:6:"module";s:6:"system";s:6:"method";s:11:"get_actions";s:6:"params";a:0:{}s:5:"class";s:18:"TemplStudioModules";}');
INSERT INTO `sys_std_pages_widgets` (`page_id`, `widget_id`, `order`) VALUES
(@iParentPageId, LAST_INSERT_ID(), IF(ISNULL(@iParentPageOrder), 1, @iParentPageOrder + 1)); | the_stack |
set echo on
spool INSTALL_XML_SCHEMAWIZARD.log
--
ALTER SESSION SET PLSQL_CCFLAGS = 'DEBUG:FALSE'
/
--
set define on
--
create or replace package XFILES_XMLSCHEMA_WIZARD
authid CURRENT_USER
as
function UNPACK_ARCHIVE(P_ARCHIVE_PATH VARCHAR2) return NUMBER;
function ORDER_SCHEMA(P_XML_SCHEMA_FOLDER VARCHAR2, P_ROOT_XML_SCHEMA VARCHAR2, P_SCHEMA_LOCATION_PREFIX VARCHAR2 DEFAULT '') return XMLTYPE;
function ORDER_SCHEMAS_IN_FOLDER(P_XML_SCHEMA_FOLDER VARCHAR2, P_SCHEMA_LOCATION_PREFIX VARCHAR2 DEFAULT '') return XMLTYPE;
function ORDER_SCHEMA_LIST(P_XML_SCHEMA_FOLDER VARCHAR2, P_XML_SCHEMAS XMLTYPE, P_SCHEMA_LOCATION_PREFIX VARCHAR2 DEFAULT '') return XMLTYPE;
function GET_GLOBAL_ELEMENT_LIST(P_XML_SCHEMA_FOLDER VARCHAR2) return XMLTYPE;
function DO_TYPE_ANALYSIS(P_XML_SCHEMA_CONFIG IN OUT XMLTYPE, P_SCHEMA_LOCATION_HINT VARCHAR2, P_OWNER VARCHAR2 DEFAULT USER) return BOOLEAN;
function CREATE_SCRIPT(
P_XML_SCHEMA_CONFIGURATION XMLTYPE,
P_BINARY_XML BOOLEAN DEFAULT FALSE,
P_LOCAL BOOLEAN DEFAULT TRUE,
P_DISABLE_DOM_FIDELITY BOOLEAN DEFAULT TRUE,
P_REPOSITORY_USAGE VARCHAR2,
P_DELETE_SCHEMAS BOOLEAN DEFAULT FALSE,
P_CREATE_TABLES BOOLEAN DEFAULT FALSE,
P_LOAD_INSTANCES BOOLEAN DEFAULT FALSE
) return VARCHAR2;
procedure REGISTER_SCHEMA(
P_SCHEMA_LOCATION_HINT VARCHAR2,
P_SCHEMA_PATH VARCHAR2,
P_FORCE BOOLEAN DEFAULT FALSE,
P_OWNER VARCHAR2 DEFAULT USER,
P_DISABLE_DOM_FIDELITY BOOLEAN DEFAULT TRUE,
P_TYPE_MAPPINGS XMLTYPE DEFAULT NULL
);
--
end XFILES_XMLSCHEMA_WIZARD;
/
show errors
--
create or replace package body XFILES_XMLSCHEMA_WIZARD
as
--
C_SQLTYPE_MAPPINGS VARCHAR2(4000) :=
'<xdbpm:SQLTypeMappings xmlns:xdbpm="http://xmlns.oracle.com/xdb/xdbpm">
<xdbpm:SQLTypeMapping>
<xdbpm:xsdType>dateTime</xdbpm:xsdType>
<xdbpm:SQLType>TIMESTAMP WITH TIME ZONE</xdbpm:SQLType>
</xdbpm:SQLTypeMapping>
</xdbpm:SQLTypeMappings>';
G_SQLTYPE_MAPPINGS XMLTYPE := XMLTYPE(C_SQLTYPE_MAPPINGS);
procedure writeLogRecord(P_MODULE_NAME VARCHAR2, P_INIT_TIME TIMESTAMP WITH TIME ZONE, P_PARAMETERS XMLType)
as
begin
XFILES_LOGGING.writeLogRecord('/orawsv/XFILES/XFILES_XMLSCHEMA_WIZARD/',P_MODULE_NAME, P_INIT_TIME, P_PARAMETERS);
end;
--
procedure writeErrorRecord(P_MODULE_NAME VARCHAR2, P_INIT_TIME TIMESTAMP WITH TIME ZONE, P_PARAMETERS XMLType, P_STACK_TRACE XMLType)
as
begin
XFILES_LOGGING.writeErrorRecord('/orawsv/XFILES/XFILES_XMLSCHEMA_WIZARD/',P_MODULE_NAME, P_INIT_TIME, P_PARAMETERS, P_STACK_TRACE);
end;
--
procedure handleException(P_MODULE_NAME VARCHAR2, P_INIT_TIME TIMESTAMP WITH TIME ZONE,P_PARAMETERS XMLTYPE)
as
V_STACK_TRACE XMLType;
V_RESULT boolean;
begin
V_STACK_TRACE := XFILES_LOGGING.captureStackTrace();
rollback;
writeErrorRecord(P_MODULE_NAME,P_INIT_TIME,P_PARAMETERS,V_STACK_TRACE);
end;
--
function UNPACK_ARCHIVE(P_ARCHIVE_PATH VARCHAR2)
return NUMBER
--
-- Unzip the XML Schema Archive, remove redundant folders and return number of documents.
--
as
V_PARAMETERS XMLType;
V_INIT TIMESTAMP WITH TIME ZONE := SYSTIMESTAMP;
V_RESOURCE_COUNT NUMBER;
begin
select xmlElement("archivePath",P_ARCHIVE_PATH)
into V_PARAMETERS
from dual;
V_RESOURCE_COUNT := XDB_REGISTRATION_HELPER.unpackArchive(P_ARCHIVE_PATH);
writeLogRecord('UNPACK_ARCHIVE',V_INIT,V_PARAMETERS);
return V_RESOURCE_COUNT;
exception
when others then
handleException('UNPACK_ARCHIVE',V_INIT,V_PARAMETERS);
raise;
end;
--
function GET_GLOBAL_ELEMENT_LIST(P_XML_SCHEMA_FOLDER VARCHAR2)
return XMLTYPE
as
V_PARAMETERS XMLType;
V_INIT TIMESTAMP WITH TIME ZONE := SYSTIMESTAMP;
V_CHARSET_ID NUMBER(4);
V_RESULT XMLTYPE;
begin
select xmlConcat(
xmlElement("folderPath",P_XML_SCHEMA_FOLDER)
)
into V_PARAMETERS
from dual;
V_RESULT := XDB_ORDER_XMLSCHEMAS.getGlobalElementList(P_XML_SCHEMA_FOLDER);
writeLogRecord('GET_GLOBAL_ELEMENT_LIST',V_INIT,V_PARAMETERS);
return V_RESULT;
exception
when others then
handleException('GET_GLOBAL_ELEMENT_LIST',V_INIT,V_PARAMETERS);
raise;
end;
--
function ORDER_SCHEMAS_IN_FOLDER(P_XML_SCHEMA_FOLDER VARCHAR2, P_SCHEMA_LOCATION_PREFIX VARCHAR2 DEFAULT '')
return XMLTYPE
as
V_PARAMETERS XMLType;
V_INIT TIMESTAMP WITH TIME ZONE := SYSTIMESTAMP;
V_CHARSET_ID NUMBER(4);
V_RESULT XMLTYPE;
begin
select xmlConcat(
xmlElement("folderPath",P_XML_SCHEMA_FOLDER),
xmlElement("schemaLocationPrefix",P_SCHEMA_LOCATION_PREFIX)
)
into V_PARAMETERS
from dual;
V_RESULT := XDB_ORDER_XMLSCHEMAS.createSchemaOrderingDocument(P_XML_SCHEMA_FOLDER, P_XML_SCHEMA_FOLDER, XDB.XDB$STRING_LIST_T(), P_SCHEMA_LOCATION_PREFIX);
writeLogRecord('ORDER_SCHEMAS',V_INIT,V_PARAMETERS);
return V_RESULT;
exception
when others then
handleException('ORDER_SCHEMAS',V_INIT,V_PARAMETERS);
raise;
end;
--
function ORDER_SCHEMA_LIST(P_XML_SCHEMA_FOLDER VARCHAR2, P_XML_SCHEMAS XMLTYPE, P_SCHEMA_LOCATION_PREFIX VARCHAR2 DEFAULT '')
return XMLTYPE
as
V_PARAMETERS XMLType;
V_INIT TIMESTAMP WITH TIME ZONE := SYSTIMESTAMP;
V_CHARSET_ID NUMBER(4);
V_RESULT XMLTYPE;
V_XMLSCHEMA_PATHS XDB.XDB$STRING_LIST_T := XDB.XDB$STRING_LIST_T();
begin
select xmlConcat(
xmlElement("folderPath",P_XML_SCHEMA_FOLDER),
xmlElement("xmlSchemas",P_XML_SCHEMAS),
xmlElement("schemaLocationPrefix",P_SCHEMA_LOCATION_PREFIX)
)
into V_PARAMETERS
from dual;
select FOLDER_PATH
BULK COLLECT into V_XMLSCHEMA_PATHS
from XMLTABLE(
'/schemas/schema'
passing P_XML_SCHEMAS
columns
FOLDER_PATH VARCHAR2(4000) PATH 'text()'
);
V_RESULT := XDB_ORDER_XMLSCHEMAS.createSchemaOrderingDocument(P_XML_SCHEMA_FOLDER, P_XML_SCHEMA_FOLDER, V_XMLSCHEMA_PATHS, P_SCHEMA_LOCATION_PREFIX);
writeLogRecord('ORDER_SCHEMAS',V_INIT,V_PARAMETERS);
return V_RESULT;
exception
when others then
handleException('ORDER_SCHEMAS',V_INIT,V_PARAMETERS);
raise;
end;
--
function ORDER_SCHEMA(P_XML_SCHEMA_FOLDER VARCHAR2, P_ROOT_XML_SCHEMA VARCHAR2, P_SCHEMA_LOCATION_PREFIX VARCHAR2 DEFAULT '')
return XMLTYPE
as
V_PARAMETERS XMLType;
V_INIT TIMESTAMP WITH TIME ZONE := SYSTIMESTAMP;
V_CHARSET_ID NUMBER(4);
V_RESULT XMLTYPE;
V_XMLSCHEMA_PATHS XDB.XDB$STRING_LIST_T := XDB.XDB$STRING_LIST_T();
begin
select xmlConcat(
xmlElement("folderPath",P_XML_SCHEMA_FOLDER),
xmlElement("xmlSchema",P_ROOT_XML_SCHEMA),
xmlElement("schemaLocationPrefix",P_SCHEMA_LOCATION_PREFIX)
)
into V_PARAMETERS
from dual;
V_XMLSCHEMA_PATHS(1) := P_ROOT_XML_SCHEMA;
V_RESULT := XDB_ORDER_XMLSCHEMAS.createSchemaOrderingDocument(P_XML_SCHEMA_FOLDER,P_XML_SCHEMA_FOLDER,V_XMLSCHEMA_PATHS,P_SCHEMA_LOCATION_PREFIX);
writeLogRecord('ORDER_SCHEMAS',V_INIT,V_PARAMETERS);
return V_RESULT;
exception
when others then
handleException('ORDER_SCHEMAS',V_INIT,V_PARAMETERS);
raise;
end;
--
function DO_TYPE_ANALYSIS(P_XML_SCHEMA_CONFIG IN OUT XMLTYPE, P_SCHEMA_LOCATION_HINT VARCHAR2, P_OWNER VARCHAR2 DEFAULT USER)
return BOOLEAN
as
V_RESULT BOOLEAN;
V_PARAMETERS XMLType;
V_INIT TIMESTAMP WITH TIME ZONE := SYSTIMESTAMP;
begin
select xmlConcat
(
xmlElement("schemaConfiguration",P_XML_SCHEMA_CONFIG),
xmlElement("schemaLocationHint",P_SCHEMA_LOCATION_HINT),
xmlElement("owner",P_OWNER)
)
into V_PARAMETERS
from dual;
V_RESULT := XDB_OPTIMIZE_XMLSCHEMA.doTypeAnalysis(P_XML_SCHEMA_CONFIG,P_SCHEMA_LOCATION_HINT,P_OWNER);
writeLogRecord('DO_TYPE_ANALYSIS',V_INIT,V_PARAMETERS);
return V_RESULT;
exception
when others then
handleException('DO_TYPE_ANALYSIS',V_INIT,V_PARAMETERS);
raise;
end;
--
procedure REGISTER_SCHEMA(
P_SCHEMA_LOCATION_HINT VARCHAR2,
P_SCHEMA_PATH VARCHAR2,
P_FORCE BOOLEAN DEFAULT FALSE,
P_OWNER VARCHAR2 DEFAULT USER,
P_DISABLE_DOM_FIDELITY BOOLEAN DEFAULT TRUE,
P_TYPE_MAPPINGS XMLTYPE DEFAULT NULL
)
as
NO_MATCHING_NODE exception;
PRAGMA EXCEPTION_INIT( NO_MATCHING_NODE , -31061 );
V_PARAMETERS XMLType;
V_INIT TIMESTAMP WITH TIME ZONE := SYSTIMESTAMP;
V_XML_SCHEMA XMLType;
begin
select xmlConcat
(
xmlElement("schemaLocationHint",P_SCHEMA_LOCATION_HINT),
xmlElement("schemaPath",P_SCHEMA_PATH),
xmlElement("force",XDB_DOM_UTILITIES.BOOLEAN_TO_VARCHAR(P_FORCE)),
xmlElement("owner",P_OWNER),
xmlElement("disableDOMFidelity",XDB_DOM_UTILITIES.BOOLEAN_TO_VARCHAR(P_DISABLE_DOM_FIDELITY)),
xmlElement("typeMappings",P_TYPE_MAPPINGS)
)
into V_PARAMETERS
from dual;
V_XML_SCHEMA := xdburitype(P_SCHEMA_PATH).getXML();
if (P_TYPE_MAPPINGS is NULL) then
XDB_EDIT_XMLSCHEMA.setSQLTypeMappings(G_SQLTYPE_MAPPINGS);
else
XDB_EDIT_XMLSCHEMA.setSQLTypeMappings(P_TYPE_MAPPINGS);
end if;
XDB_EDIT_XMLSCHEMA.fixRelativeURLs(V_XML_SCHEMA,P_SCHEMA_LOCATION_HINT);
XDB_EDIT_XMLSCHEMA.removeAppInfo(V_XML_SCHEMA);
XDB_EDIT_XMLSCHEMA.applySQLTypeMappings(V_XML_SCHEMA);
DBMS_XMLSCHEMA_ANNOTATE.printWarnings(FALSE);
DBMS_XMLSCHEMA_ANNOTATE.disableDefaultTableCreation(V_XML_SCHEMA);
if ((P_DISABLE_DOM_FIDELITY) and (V_XML_SCHEMA.existsNode('//xsd:complexType','xmlns:xsd="http://www.w3.org/2001/XMLSchema"') = 1)) then
DBMS_XMLSCHEMA_ANNOTATE.disableMaintainDOM(V_XML_SCHEMA);
end if;
DBMS_XMLSCHEMA.registerSchema(
SCHEMAURL => P_SCHEMA_LOCATION_HINT,
SCHEMADOC => V_XML_SCHEMA,
LOCAL => TRUE,
GENBEAN => FALSE,
GENTYPES => TRUE,
GENTABLES => FALSE,
FORCE => P_FORCE,
OWNER => P_OWNER,
ENABLEHIERARCHY => DBMS_XMLSCHEMA.ENABLE_HIERARCHY_NONE
);
writeLogRecord('REGISTER_SCHEMA',V_INIT,V_PARAMETERS);
exception
when others then
handleException('REGISTER_SCHEMA',V_INIT,V_PARAMETERS);
raise;
end;
--
function CREATE_SCRIPT(
P_XML_SCHEMA_CONFIGURATION XMLTYPE,
P_BINARY_XML BOOLEAN DEFAULT FALSE,
P_LOCAL BOOLEAN DEFAULT TRUE,
P_DISABLE_DOM_FIDELITY BOOLEAN DEFAULT TRUE,
P_REPOSITORY_USAGE VARCHAR2,
P_DELETE_SCHEMAS BOOLEAN DEFAULT FALSE,
P_CREATE_TABLES BOOLEAN DEFAULT FALSE,
P_LOAD_INSTANCES BOOLEAN DEFAULT FALSE
)
return VARCHAR2
as
V_PARAMETERS XMLType;
V_INIT TIMESTAMP WITH TIME ZONE := SYSTIMESTAMP;
V_ENABLE_HEIRARCHY NUMBER;
V_SCRIPT_FILENAME VARCHAR2(700);
begin
select xmlConcat(
xmlElement("xmlSchemaCOnfiguration",P_XML_SCHEMA_CONFIGURATION),
xmlElement("binaryXML",XDB_DOM_UTILITIES.BOOLEAN_TO_VARCHAR(P_BINARY_XML)),
xmlElement("localSchema",XDB_DOM_UTILITIES.BOOLEAN_TO_VARCHAR(P_LOCAL)),
xmlElement("disableDOMFidelity",XDB_DOM_UTILITIES.BOOLEAN_TO_VARCHAR(P_DISABLE_DOM_FIDELITY)),
xmlElement("repositoryUsage",P_REPOSITORY_USAGE),
xmlElement("deleteSchemas",XDB_DOM_UTILITIES.BOOLEAN_TO_VARCHAR(P_DELETE_SCHEMAS)),
xmlElement("createTables",XDB_DOM_UTILITIES.BOOLEAN_TO_VARCHAR(P_CREATE_TABLES)),
xmlElement("loadInstances",XDB_DOM_UTILITIES.BOOLEAN_TO_VARCHAR(P_LOAD_INSTANCES))
)
into V_PARAMETERS
from dual;
if (P_REPOSITORY_USAGE = 'DBMS_XMLSCHEMA.ENABLE_HIERARCHY_NONE') then
V_ENABLE_HEIRARCHY := DBMS_XMLSCHEMA.ENABLE_HIERARCHY_NONE;
end if;
if (P_REPOSITORY_USAGE = 'DBMS_XMLSCHEMA.ENABLE_HIERARCHY_CONTENTS') then
V_ENABLE_HEIRARCHY := DBMS_XMLSCHEMA.ENABLE_HIERARCHY_CONTENTS;
end if;
if (P_REPOSITORY_USAGE = 'DBMS_XMLSCHEMA.ENABLE_HIERARCHY_RESMETADATA') then
V_ENABLE_HEIRARCHY := DBMS_XMLSCHEMA.ENABLE_HIERARCHY_RESMETADATA;
end if;
if (P_BINARY_XML) then
XDB_OPTIMIZE_XMLSCHEMA.setSchemaRegistrationOptions(
P_LOCAL => P_LOCAL
,P_OWNER => USER
,P_ENABLE_HIERARCHY => V_ENABLE_HEIRARCHY
,P_OPTIONS => DBMS_XMLSCHEMA.REGISTER_BINARYXML
);
else
XDB_OPTIMIZE_XMLSCHEMA.setSchemaRegistrationOptions(
P_LOCAL => P_LOCAL
,P_OWNER => USER
,P_ENABLE_HIERARCHY => V_ENABLE_HEIRARCHY
,P_OPTIONS => 0
);
XDB_OPTIMIZE_XMLSCHEMA.setRegistrationScriptOptions(
P_DISABLE_DOM_FIDELITY => P_DISABLE_DOM_FIDELITY
);
end if;
V_SCRIPT_FILENAME := XDB_OPTIMIZE_SCHEMA.createScriptFile(P_XML_SCHEMA_CONFIGURATION);
if (P_DELETE_SCHEMAS) then
V_SCRIPT_FILENAME := XDB_OPTIMIZE_SCHEMA.appendDeleteSchemaScript(P_XML_SCHEMA_CONFIGURATION);
end if;
V_SCRIPT_FILENAME := XDB_OPTIMIZE_XMLSCHEMA.appendRegisterSchemaScript(P_XML_SCHEMA_CONFIGURATION);
if ((P_REPOSITORY_USAGE = 'DBMS_XMLSCHEMA.ENABLE_HIERARCHY_NONE') and (P_CREATE_TABLES)) then
V_SCRIPT_FILENAME := XDB_OPTIMIZE_SCHEMA.appendCreateTablesScript(P_XML_SCHEMA_CONFIGURATION);
end if;
if (P_LOAD_INSTANCES) then
V_SCRIPT_FILENAME := XDB_OPTIMIZE_SCHEMA.appendLoadInstancesScript(P_XML_SCHEMA_CONFIGURATION);
end if;
writeLogRecord('CREATE_REGISTER_SCHEMA_SCRIPT',V_INIT,V_PARAMETERS);
return V_SCRIPT_FILENAME;
exception
when others then
handleException('CREATE_REGISTER_SCHEMA_SCRIPT',V_INIT,V_PARAMETERS);
raise;
end;
--
end XFILES_XMLSCHEMA_WIZARD;
/
show errors
--
grant execute on XFILES_XMLSCHEMA_WIZARD to public
/
--
quit | the_stack |
--
-- Licensed to the Apache Software Foundation (ASF) under one or more
-- contributor license agreements. See the NOTICE file distributed with
-- this work for additional information regarding copyright ownership.
-- The ASF licenses this file to You under the Apache License, Version 2.0
-- (the "License"); you may not use this file except in compliance with
-- the License. You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
--
--
-- this test is for identifiers and delimited idenifiers
-- identifiers get converted to upper case
-- delimited identifiers have their surrounding double quotes removed and
-- any pair of adjacent double quotes is converted to a single double quote
-- max identifier length is 128
--
-- trailing blank not trimmed
create table t1(" " int);
-- duplicate identifiers
create table t1 (c1 int, C1 int);
-- duplicate identifier/delimited identifier
create table t1 (c1 int, "C1" int);
-- duplicate delimited identifier/identifier
create table t1 ("C1" int, C1 int);
-- duplicate delimited identifiers
create table t1 ("C1" int, "C1" int);
-- verify preservation of spaces
create table success1 (c1 int, " C1" int, " C1 " int);
-- verify correct handling of case
create table success2 ("c1" int, "C1" int);
create table success3 (c1 int, "c1" int);
-- verify correct handling of double quotes
create table success4 ("C1""" int, "C1""""" int);
-- verify correct handling in an insert
insert into success1 (c1, " C1", " C1 ")
values (1, 2, 3);
insert into success1 (C1, " C1", " C1 ")
values (6, 7, 8);
-- negative testing for an insert
-- "c1 " is not in success1
insert into success1 (c1, "c1 ", " C1", " C1 ", " C1 ")
values (11, 12, 13, 14, 15);
-- C1 appears twice in the column list - C1 and "C1"
insert into success1 (C1, "C1", " C1", " C1 ", " C1 ")
values (16, 17, 18, 19, 20);
-- verify correct handling in a select
select C1, " C1", " C1", " C1 " from success1;
-- following should fail for "C1 "
select c1, "C1 ", " C1", " C1 ", " C1 " from success1;
-- negative testing for an insert
-- "c1 " should not match
select c1, "c1 ", " C1", " C1 ", " C1 " from success1;
-- negative test for max identifier width
-- NOTE: no negative test for max identifier length of function, savepoint and cursor
-- tables needed for index, trigger and view test
create table idtest1 (i integer, j integer);
create table idtest2 (i integer, j integer);
-- table
create table
asdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfaslast6
(c1 int);
create table
"asdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfaslast7"
(c1 int);
-- column
create table fail1 (ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccx integer);
create table fail2 ("ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccx" integer);
-- view
create view vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvx as select * from idtest1;
create view "vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvy" as select * from idtest1;
-- trigger
create trigger ttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttx after insert on idtest1 for each row update idtest2 set i=i;
create trigger "ttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttx" after insert on idtest1 for each row update idtest2 set i=i;
-- schema
create schema ssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssx;
create schema "ssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssx";
-- index
CREATE INDEX iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiix
ON idtest1 (i);
CREATE INDEX "iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiix"
ON idtest1 (j);
-- constraint
create table fail3 (i integer, constraint ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccx check (i > 0));
create table fail4 (i integer, constraint "ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccx" check (i > 0));
--- procedure
create procedure ppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppx(in i integer) external name 'a.b.c.d' language java parameter style java;
create procedure "ppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppx"(in i integer) external name 'a.b.c.d' language java parameter style java;
-- positive test for max identifier width
-- NOTE: no positive test for max identifier length of function, savepoint and cursor
-- table
create table
asdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfaslast
(c1 int);
insert into
asdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfaslast
values (1);
select * from
asdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfaslast;
create table
"delimitedsdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfaslast"
(c1 int);
insert into
"delimitedsdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfaslast"
values (2);
select * from
"delimitedsdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfaslast";
-- column
create table longid1 (cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc integer);
create table longid2 ("cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc" integer);
-- view
create view vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv as select * from idtest1;
create view "vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvw" as select * from idtest1;
-- trigger
create trigger tttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttt after insert on idtest1 for each row update idtest2 set i=i;
create trigger "tttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttt" after insert on idtest1 for each row update idtest2 set i=i;
-- schema
create schema ssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss;
create schema "ssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss";
-- index
CREATE INDEX iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
ON idtest1 (i);
CREATE INDEX "iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii"
ON idtest1 (j);
-- constraint
create table longid3 (i integer, constraint cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc check (i > 0));
create table longid4 (i integer, constraint "cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc" check (i > 0));
--- procedure
create procedure pppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppp(in i integer) external name 'a.b.c.d' language java parameter style java;
create procedure "pppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppp"(in i integer) external name 'a.b.c.d' language java parameter style java;
-- drop the tables etc.
drop view vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv;
drop view "vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvw";
drop trigger tttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttt;
drop trigger "tttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttt";
drop schema ssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss restrict;
drop schema "ssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss" restrict;
drop index iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii;
drop index "iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii";
drop table success1;
drop table success2;
drop table success3;
drop table success4;
drop table idtest1;
drop table idtest2;
drop table longid1;
drop table longid2;
drop table longid3;
drop table longid4;
drop table
asdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfaslast;
drop table
"delimitedsdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfaslast";
drop procedure pppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppp;
drop procedure "pppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppp";
-- 2003-04-14 14:04:38
-- new testcases for SQL92 reserved keywords as identifiers
CREATE TABLE WHEN (WHEN INT, A INT);
INSERT INTO WHEN (WHEN) VALUES (1);
INSERT INTO WHEN VALUES (2, 2);
SELECT * FROM WHEN;
SELECT WHEN.WHEN, WHEN FROM WHEN;
SELECT WHEN.WHEN, WHEN FROM WHEN WHEN;
DROP TABLE WHEN;
CREATE TABLE THEN (THEN INT, A INT);
INSERT INTO THEN (THEN) VALUES (1);
INSERT INTO THEN VALUES (2, 2);
SELECT * FROM THEN;
SELECT THEN.THEN, THEN FROM THEN;
SELECT THEN.THEN, THEN FROM THEN THEN;
DROP TABLE THEN;
CREATE TABLE SIZE (SIZE INT, A INT);
INSERT INTO SIZE (SIZE) VALUES (1);
INSERT INTO SIZE VALUES (2, 2);
SELECT * FROM SIZE;
SELECT SIZE.SIZE, SIZE FROM SIZE;
SELECT SIZE.SIZE, SIZE FROM SIZE SIZE;
DROP TABLE SIZE;
CREATE TABLE LEVEL (LEVEL INT, A INT);
INSERT INTO LEVEL (LEVEL) VALUES (1);
INSERT INTO LEVEL VALUES (2, 2);
SELECT * FROM LEVEL;
SELECT LEVEL.LEVEL, LEVEL FROM LEVEL;
SELECT LEVEL.LEVEL, LEVEL FROM LEVEL LEVEL;
DROP TABLE LEVEL;
CREATE TABLE DOMAIN (DOMAIN INT, A INT);
INSERT INTO DOMAIN (DOMAIN) VALUES (1);
INSERT INTO DOMAIN VALUES (2, 2);
SELECT * FROM DOMAIN;
SELECT DOMAIN.DOMAIN, DOMAIN FROM DOMAIN;
SELECT DOMAIN.DOMAIN, DOMAIN FROM DOMAIN DOMAIN;
DROP TABLE DOMAIN;
CREATE TABLE ZONE (ZONE INT, A INT);
INSERT INTO ZONE (ZONE) VALUES (1);
INSERT INTO ZONE VALUES (2, 2);
SELECT * FROM ZONE;
SELECT ZONE.ZONE, ZONE FROM ZONE;
SELECT ZONE.ZONE, ZONE FROM ZONE ZONE;
DROP TABLE ZONE;
CREATE TABLE LOCAL (LOCAL INT, A INT);
INSERT INTO LOCAL (LOCAL) VALUES (1);
INSERT INTO LOCAL VALUES (2, 2);
SELECT * FROM LOCAL;
SELECT LOCAL.LOCAL, LOCAL FROM LOCAL;
SELECT LOCAL.LOCAL, LOCAL FROM LOCAL LOCAL;
DROP TABLE LOCAL;
-- Negative tests
-- Novera wanted 0-length delimited identifiers but for db2-compatibility, we are going to stop supporting 0-length delimited identifiers
-- test1
create table "" (c1 int);
-- test2
create table t1111 ("" int);
-- test3
create schema "";
-- identifiers can not start with "_"
-- test4
create table _t1(_c1 int);
-- test5
create table t1(_c1 int);
-- test6
create view _v1 (c1) as select * from t1;
-- test7
create view v1 (__c1) as select * from t1;
-- test8
create index _i1 on t1(c1);
-- test9
create table "_"."_"(c1 int);
-- test10
create table "".""(c1 int); | the_stack |
SET FOREIGN_KEY_CHECKS=0;
-- ----------------------------
-- Table structure for admin_user
-- ----------------------------
DROP TABLE IF EXISTS `admin_user`;
CREATE TABLE `admin_user` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`create_time` datetime DEFAULT NULL,
`name` varchar(255) DEFAULT NULL,
`update_time` datetime DEFAULT NULL,
`password` varchar(255) DEFAULT NULL,
`salt` varchar(255) DEFAULT NULL,
`status` int(11) DEFAULT NULL,
`user_name` varchar(255) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;
-- ----------------------------
-- Records of admin_user
-- ----------------------------
INSERT INTO `admin_user` VALUES ('1', '2017-08-11 17:22:32', 'string', '2017-08-11 17:34:06', '11dbb64dac563eb66c5bedca104ef581', 'yg7djoh6yf', '0', 'string');
-- ----------------------------
-- Table structure for change_log
-- ----------------------------
DROP TABLE IF EXISTS `change_log`;
CREATE TABLE `change_log` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`create_time` datetime DEFAULT NULL,
`name` varchar(255) DEFAULT NULL,
`update_time` datetime DEFAULT NULL,
`online_time` varchar(255) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;
-- ----------------------------
-- Records of change_log
-- ----------------------------
INSERT INTO `change_log` VALUES ('1', '2017-08-11 17:35:34', 'string', '2017-08-11 17:35:34', 'string');
-- ----------------------------
-- Table structure for link
-- ----------------------------
DROP TABLE IF EXISTS `link`;
CREATE TABLE `link` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`create_time` datetime DEFAULT NULL,
`name` varchar(255) DEFAULT NULL,
`update_time` datetime DEFAULT NULL,
`url` varchar(255) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- ----------------------------
-- Records of link
-- ----------------------------
-- ----------------------------
-- Table structure for shikigame
-- ----------------------------
DROP TABLE IF EXISTS `shikigame`;
CREATE TABLE `shikigame` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`create_time` datetime DEFAULT NULL,
`name` varchar(255) DEFAULT NULL,
`update_time` datetime DEFAULT NULL,
`des` varchar(255) DEFAULT NULL,
`get_way` varchar(255) DEFAULT NULL,
`image` varchar(255) DEFAULT NULL,
`level` varchar(255) DEFAULT NULL,
`seiyou` varchar(255) DEFAULT NULL,
`sex` varchar(255) DEFAULT NULL,
`star` varchar(255) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=87 DEFAULT CHARSET=utf8;
-- ----------------------------
-- Records of shikigame
-- ----------------------------
INSERT INTO `shikigame` VALUES ('1', null, '匣中少女', null, '', '抽卡、碎片合成', 'http://uus-ng.img.d.cn/snapshot/201706/999/image/388/388/hd/20170628104915566.jpeg', 'SR', '小清水亚美', '女', '★★');
INSERT INTO `shikigame` VALUES ('2', null, '小松丸', null, '', '抽卡、碎片', 'http://uus-ng.img.d.cn/snapshot/201706/999/image/388/388/hd/20170628103321193.jpeg', 'SR', '芽野爱衣', '女', '★★');
INSERT INTO `shikigame` VALUES ('3', null, '以津真天', null, '', '抽奖、碎片', 'http://uus-ng.img.d.cn/snapshot/201706/999/image/388/388/hd/20170628103321133.jpeg', 'SR', '佐藤聪美', '女', '★★');
INSERT INTO `shikigame` VALUES ('4', null, '鸩', null, '', '碎片、抽卡', 'http://uus-ng.img.d.cn/snapshot/201706/999/image/388/388/hd/20170628103321247.jpeg', 'SR', '户松遥', '女', '★★');
INSERT INTO `shikigame` VALUES ('5', null, '彼岸花', null, '', '抽卡、碎片合成', 'http://uus-ng.img.d.cn/snapshot/201706/999/image/388/388/hd/20170628103321038.jpeg', 'SSR', '大原沙耶香', '女', '★★');
INSERT INTO `shikigame` VALUES ('6', null, '万年竹', null, '', '神龛兑换', 'http://uus-ng.img.d.cn/snapshot/201704/999/image/388/388/hd/20170425111533689.jpeg', 'SR', '立花慎之介', '男', '★★');
INSERT INTO `shikigame` VALUES ('7', null, '荒', null, '', '抽卡、碎片', 'http://uus-ng.img.d.cn/snapshot/201704/999/image/388/388/hd/20170425110822062.jpeg', 'SSR', '平川大辅', '男', '★★');
INSERT INTO `shikigame` VALUES ('8', null, '金鱼姬', null, '', '活动、抽卡', 'http://uus-ng.img.d.cn/snapshot/201704/999/image/388/388/hd/20170425102028952.jpeg', 'SR', '内田真礼', '女', '★★');
INSERT INTO `shikigame` VALUES ('9', null, '夜叉', null, '', '抽卡、碎片', 'http://uus-ng.img.d.cn/snapshot/201702/999/image/388/388/hd/20170215123933616.jpeg', 'SR', '小西克幸', '男', '★★');
INSERT INTO `shikigame` VALUES ('10', null, '烟烟罗', null, '', '抽卡、碎片合成', 'http://uus-ng.img.d.cn/snapshot/201702/999/image/388/388/hd/20170215123707014.jpeg', 'SR', '甲斐田裕子', '女', '★★');
INSERT INTO `shikigame` VALUES ('11', null, '辉夜姬', null, '', '抽卡、碎片', 'http://uus-ng.img.d.cn/snapshot/201702/999/image/388/388/hd/20170215113029024.jpeg', 'SSR', '竹达彩奈', '女', '★★');
INSERT INTO `shikigame` VALUES ('12', null, '花鸟卷', null, '', '抽卡、碎片', 'http://uus-ng.img.d.cn/snapshot/201702/999/image/388/388/hd/20170215112700922.jpeg', 'SSR', '早见沙织', '女', '★★');
INSERT INTO `shikigame` VALUES ('13', null, '古笼火', null, '', '抽卡、碎片', 'http://uus-ng.img.d.cn/snapshot/201702/999/image/388/388/hd/20170214170613314.jpeg', 'R', '松冈祯丞', '男', '★★');
INSERT INTO `shikigame` VALUES ('14', null, '黑童子', null, '', '抽卡、碎片', 'http://uus-ng.img.d.cn/snapshot/201702/999/image/388/388/hd/20170214170026831.jpeg', 'SR', '杉田智和', '男', '★★');
INSERT INTO `shikigame` VALUES ('15', null, '白童子', null, '', '抽卡、碎片', 'http://uus-ng.img.d.cn/snapshot/201702/999/image/388/388/hd/20170214165135364.jpeg', 'SR', '中村悠一', '男', '★★');
INSERT INTO `shikigame` VALUES ('16', null, '青坊主', null, '', '抽卡、碎片', 'http://uus-ng.img.d.cn/snapshot/201702/999/image/388/388/hd/20170214172404430.jpeg', 'SR', '细谷佳正', '男', '★★');
INSERT INTO `shikigame` VALUES ('17', null, '提灯小僧', null, '', '抽卡,碎片', 'http://uus-ng.img.d.cn/snapshot/201611/999/image/388/388/hd/20161114141227302.jpeg', 'N', '悠木碧', '男', '★★');
INSERT INTO `shikigame` VALUES ('18', null, '一目连', null, '', '抽卡、碎片', 'http://uus-ng.img.d.cn/snapshot/201611/999/image/388/388/hd/20161111163947709.jpeg', 'SSR', '绿川光', '男', '★★');
INSERT INTO `shikigame` VALUES ('19', null, '般若', null, '', '抽卡、碎片', 'http://uus-ng.img.d.cn/snapshot/201611/999/image/388/388/hd/20161111163328046.jpeg', 'SR', '梶裕贵', '男', '★★');
INSERT INTO `shikigame` VALUES ('20', null, '唐纸伞妖', null, '', '抽卡,碎片', 'http://uus-ng.img.d.cn/snapshot/201611/999/image/388/388/hd/20161103100753671.jpeg', 'N', '小林优', '男', '★★');
INSERT INTO `shikigame` VALUES ('21', null, '寄生魂', null, '', '章节十二', 'http://uus-ng.img.d.cn/snapshot/201610/999/image/388/388/hd/20161014155409432.jpeg', 'N', '无', '男', '★★');
INSERT INTO `shikigame` VALUES ('22', null, '帚神', null, '', '妖气封印、章节十四', 'http://uus-ng.img.d.cn/snapshot/201610/999/image/388/388/hd/20161014154807857.jpeg', 'N', '-', '男', '★★');
INSERT INTO `shikigame` VALUES ('23', null, '盗墓小鬼', null, '', '抽卡、碎片', 'http://uus-ng.img.d.cn/snapshot/201610/999/image/388/388/hd/20161014154249087.jpeg', 'N', '新谷真弓', '男', '★★');
INSERT INTO `shikigame` VALUES ('24', null, '赤舌', null, '', '抽卡、碎片', 'http://uus-ng.img.d.cn/snapshot/201610/999/image/388/388/hd/20161014153630952.jpeg', 'N', '森久保祥太郎', '男', '★★');
INSERT INTO `shikigame` VALUES ('25', null, '首无', null, '', '抽卡、碎片', 'http://uus-ng.img.d.cn/snapshot/201610/999/image/388/388/hd/20161013132716253.jpeg', 'R', '石川界人', '男', '★★');
INSERT INTO `shikigame` VALUES ('26', null, '络新妇', null, '', '抽奖、碎片', 'http://uus-ng.img.d.cn/snapshot/201610/999/image/388/388/hd/20161012162340089.jpeg', 'SR', '井上喜久子', '女', '★★');
INSERT INTO `shikigame` VALUES ('27', null, '樱花妖', null, '', '抽卡、碎片', 'http://uus-ng.img.d.cn/snapshot/201610/999/image/388/388/hd/20161012155327721.jpeg', 'SR', '能登麻美子', '女', '★★');
INSERT INTO `shikigame` VALUES ('28', null, '妖刀姬', null, '', '抽卡、碎片', 'http://uus-ng.img.d.cn/snapshot/201610/999/image/388/388/hd/20161012152409709.jpeg', 'SSR', '井泽诗织', '女', '★★');
INSERT INTO `shikigame` VALUES ('29', null, '清姬', null, '', '抽卡,碎片', 'http://uus-ng.img.d.cn/snapshot/201609/999/image/388/388/hd/20160926104658402.jpeg', 'SR', '行成桃姬', '女', '★★');
INSERT INTO `shikigame` VALUES ('30', null, '河童', null, '', '抽卡,碎片', 'http://uus-ng.img.d.cn/snapshot/201609/999/image/388/388/hd/20160926104424533.jpeg', 'R', '保志总一朗', '女', '★★');
INSERT INTO `shikigame` VALUES ('31', null, '鸦天狗', null, '', '抽卡,碎片', 'http://uus-ng.img.d.cn/snapshot/201609/999/image/388/388/hd/20160926102711340.jpeg', 'R', '小林优', '男', '★★');
INSERT INTO `shikigame` VALUES ('32', null, '食发鬼', null, '', '抽卡,碎片', 'http://uus-ng.img.d.cn/snapshot/201609/999/image/388/388/hd/20160926102255825.jpeg', 'R', '间宫康弘', '男', '★★');
INSERT INTO `shikigame` VALUES ('33', null, '山童', null, '', '抽卡,碎片', 'http://uus-ng.img.d.cn/snapshot/201609/999/image/388/388/hd/20160926102013107.jpeg', 'R', '保志总一朗', '女', '★★');
INSERT INTO `shikigame` VALUES ('34', null, '觉', null, '', '抽卡,碎片', 'http://uus-ng.img.d.cn/snapshot/201609/999/image/388/388/hd/20160926101743950.jpeg', 'R', '由加奈', '女', '★★');
INSERT INTO `shikigame` VALUES ('35', null, '青蛙瓷器', null, '', '抽卡,碎片', 'http://uus-ng.img.d.cn/snapshot/201609/999/image/388/388/hd/20160926101422781.jpeg', 'R', '吉野裕行', '男', '★★');
INSERT INTO `shikigame` VALUES ('36', null, '犬神', null, '', '抽卡,碎片', 'http://uus-ng.img.d.cn/snapshot/201609/999/image/388/388/hd/20160926101100598.jpeg', 'SR', '关俊彦', '男', '★★');
INSERT INTO `shikigame` VALUES ('37', null, '三尾狐', null, '', '抽卡,碎片', 'http://uus-ng.img.d.cn/snapshot/201609/999/image/388/388/hd/20160926100725543.jpeg', 'R', '泽城美雪', '女', '★★');
INSERT INTO `shikigame` VALUES ('38', null, '独眼小僧', null, '', '抽卡,碎片', 'http://uus-ng.img.d.cn/snapshot/201609/999/image/388/388/hd/20160926095821891.jpeg', 'R', '小林优', '男', '★★');
INSERT INTO `shikigame` VALUES ('39', null, '管狐', null, '', '抽卡,碎片', 'http://uus-ng.img.d.cn/snapshot/201609/999/image/388/388/hd/20160926095543173.jpeg', 'R', '松田健一郎', '男', '★★');
INSERT INTO `shikigame` VALUES ('40', null, '萤草', null, '', '抽卡,碎片', 'http://uus-ng.img.d.cn/snapshot/201609/999/image/388/388/hd/20160926095401921.jpeg', 'R', '诹访彩花', '女', '★★');
INSERT INTO `shikigame` VALUES ('41', null, '九命猫', null, '', '抽卡,碎片', 'http://uus-ng.img.d.cn/snapshot/201609/999/image/388/388/hd/20160926095022134.jpeg', 'R', '新谷真弓', '女', '★★');
INSERT INTO `shikigame` VALUES ('42', null, '童男', null, '', '抽卡,碎片', 'http://uus-ng.img.d.cn/snapshot/201609/999/image/388/388/hd/20160926094814879.jpeg', 'R', '井上麻里奈', '男', '★★★');
INSERT INTO `shikigame` VALUES ('43', null, '吸血姬', null, '', '抽卡,碎片', 'http://uus-ng.img.d.cn/snapshot/201609/999/image/388/388/hd/20160926094600059.jpeg', 'SR', '由加奈', '女', '★★');
INSERT INTO `shikigame` VALUES ('44', null, '惠比寿', null, '', '抽卡,碎片', 'http://uus-ng.img.d.cn/snapshot/201609/999/image/388/388/hd/20160926094357103.jpeg', 'SR', '茶风林', '男', '★★');
INSERT INTO `shikigame` VALUES ('45', null, '跳跳哥哥', null, '', '抽卡,碎片', 'http://uus-ng.img.d.cn/snapshot/201609/999/image/388/388/hd/20160926094121029.jpeg', 'SR', '远藤大辅', '男', '★★');
INSERT INTO `shikigame` VALUES ('46', null, '雪女', null, '', '抽卡,碎片', 'http://uus-ng.img.d.cn/snapshot/201609/999/image/388/388/hd/20160926093300209.jpeg', 'SR', '诹访彩花', '女', '★★');
INSERT INTO `shikigame` VALUES ('47', null, '茨木童子', null, '', '抽卡,碎片', 'http://uus-ng.img.d.cn/snapshot/201609/999/image/388/388/hd/20160926093041921.jpeg', 'SSR', '福山润', '男', '★★');
INSERT INTO `shikigame` VALUES ('48', null, '荒川之主', null, '', '抽卡,碎片', 'http://uus-ng.img.d.cn/snapshot/201609/999/image/388/388/hd/20160923170213025.jpeg', 'SSR', '子安武人', '男', '★★★');
INSERT INTO `shikigame` VALUES ('49', null, '酒吞童子', null, '', '抽卡,碎片', 'http://uus-ng.img.d.cn/snapshot/201609/999/image/388/388/hd/20160923165754494.jpeg', 'SSR', '阪口周平', '男', '★★★');
INSERT INTO `shikigame` VALUES ('50', null, '小鹿男', null, '', '抽卡,碎片', 'http://uus-ng.img.d.cn/snapshot/201609/999/image/388/388/hd/20160923165614197.jpeg', 'SSR', '川西健吾', '男', '★★★');
INSERT INTO `shikigame` VALUES ('51', null, '阎魔', null, '', '抽卡,碎片', 'http://uus-ng.img.d.cn/snapshot/201609/999/image/388/388/hd/20160923165311983.jpeg', 'SSR', '能登麻美子', '女', '★★');
INSERT INTO `shikigame` VALUES ('52', null, '山兔', null, '', '抽卡,碎片', 'http://uus-ng.img.d.cn/snapshot/201609/999/image/388/388/hd/20160923165039787.jpeg', 'R', '丰崎爱生', '女', '★★');
INSERT INTO `shikigame` VALUES ('53', null, '鲤鱼精', null, '', '抽卡,碎片', 'http://uus-ng.img.d.cn/snapshot/201701/999/image/388/388/hd/20170119113153623.jpeg', 'R', '悠木碧', '女', '★★');
INSERT INTO `shikigame` VALUES ('54', null, '白狼', null, '', '抽卡,碎片', 'http://uus-ng.img.d.cn/snapshot/201609/999/image/388/388/hd/20160923163557641.jpeg', 'SR', '桑岛法子', '女', '★★');
INSERT INTO `shikigame` VALUES ('55', null, '桃花妖', null, '', '抽卡,碎片', 'http://uus-ng.img.d.cn/snapshot/201609/999/image/388/388/hd/20160923163207205.jpeg', 'SR', '水树奈奈', '女', '★★');
INSERT INTO `shikigame` VALUES ('56', null, '妖狐', null, '', '抽卡,碎片', 'http://uus-ng.img.d.cn/snapshot/201609/999/image/388/388/hd/20160920181314803.jpeg', 'SR', '岛崎信长', '男', '★★');
INSERT INTO `shikigame` VALUES ('57', null, '椒图', null, '', '抽卡,碎片', 'http://uus-ng.img.d.cn/snapshot/201609/999/image/388/388/hd/20160920180651005.jpeg', 'R', '能登麻美子', '女', '★★');
INSERT INTO `shikigame` VALUES ('58', null, '鬼女红叶', null, '', '抽卡,碎片', 'http://uus-ng.img.d.cn/snapshot/201609/999/image/388/388/hd/20160920180215320.jpeg', 'SR', '桑岛法子', '女', '★★');
INSERT INTO `shikigame` VALUES ('59', null, '大天狗', null, '', '抽卡,碎片', 'http://uus-ng.img.d.cn/snapshot/201609/999/image/388/388/hd/20160920175835892.jpeg', 'SSR', '前野智昭', '男', '★★');
INSERT INTO `shikigame` VALUES ('60', null, '两面佛', null, '', '抽卡,碎片', 'http://uus-ng.img.d.cn/snapshot/201609/999/image/388/388/hd/20160920175602498.jpeg', 'SSR', '井上和彦', '男', '★★');
INSERT INTO `shikigame` VALUES ('61', null, '青行灯', null, '', '抽卡,碎片', 'http://uus-ng.img.d.cn/snapshot/201609/999/image/388/388/hd/20160920175352199.jpeg', 'SSR', '水树奈奈', '女', '★★');
INSERT INTO `shikigame` VALUES ('62', null, '姑获鸟', null, '', '抽卡,碎片', 'http://uus-ng.img.d.cn/snapshot/201609/999/image/388/388/hd/20160920175142834.jpeg', 'SR', '行成桃姬', '女', '★★');
INSERT INTO `shikigame` VALUES ('63', null, '二口女', null, '', '抽卡,碎片', 'http://uus-ng.img.d.cn/snapshot/201609/999/image/388/388/hd/20160920174727153.jpeg', 'SR', '新谷真弓', '女', '★★');
INSERT INTO `shikigame` VALUES ('64', null, '凤凰火', null, '', '抽卡,碎片', 'http://uus-ng.img.d.cn/snapshot/201609/999/image/388/388/hd/20160920174540667.jpeg', 'SR', '井上麻里奈', '女', '★★');
INSERT INTO `shikigame` VALUES ('65', null, '骨女', null, '', '抽卡,碎片', 'http://uus-ng.img.d.cn/snapshot/201609/999/image/388/388/hd/20160920174232252.jpeg', 'SR', '诹访彩花', '女', '★★');
INSERT INTO `shikigame` VALUES ('66', null, '鬼使白', null, '', '抽卡,碎片', 'http://uus-ng.img.d.cn/snapshot/201609/999/image/388/388/hd/20160920174054507.jpeg', 'SR', '铃村健一', '男', '★★');
INSERT INTO `shikigame` VALUES ('67', null, '鬼使黑', null, '', '抽卡,碎片', 'http://uus-ng.img.d.cn/snapshot/201609/999/image/388/388/hd/20160920155914788.jpeg', 'SR', '中井和哉', '男', '★★');
INSERT INTO `shikigame` VALUES ('68', null, '海坊主', null, '', '抽卡,碎片', 'http://uus-ng.img.d.cn/snapshot/201609/999/image/388/388/hd/20160920155617178.jpeg', 'SR', '关俊彦', '男', '★★');
INSERT INTO `shikigame` VALUES ('69', null, '傀儡师', null, '', '抽卡,碎片', 'http://uus-ng.img.d.cn/snapshot/201609/999/image/388/388/hd/20160920155205681.jpeg', 'SR', '能登麻美子', '女', '★★');
INSERT INTO `shikigame` VALUES ('70', null, '孟婆', null, '', '抽卡,碎片', 'http://uus-ng.img.d.cn/snapshot/201609/999/image/388/388/hd/20160920151321465.jpeg', 'SR', '钉宫理惠', '女', '★★');
INSERT INTO `shikigame` VALUES ('71', null, '判官', null, '', '抽卡,碎片', 'http://uus-ng.img.d.cn/snapshot/201609/999/image/388/388/hd/20160920151047481.jpeg', 'SR', '石田彰', '男', '★★');
INSERT INTO `shikigame` VALUES ('72', null, '食梦貘', null, '', '抽卡,碎片', 'http://uus-ng.img.d.cn/snapshot/201609/999/image/388/388/hd/20160920150850532.jpeg', 'SR', '西谷修一', '男', '★★');
INSERT INTO `shikigame` VALUES ('73', null, '妖琴师', null, '', '抽卡,碎片', 'http://uus-ng.img.d.cn/snapshot/201609/999/image/388/388/hd/20160920150636794.jpeg', 'SR', '岛崎信长', '男', '★★');
INSERT INTO `shikigame` VALUES ('74', null, '镰鼬', null, '', '抽卡,碎片', 'http://uus-ng.img.d.cn/snapshot/201609/999/image/388/388/hd/20160920150447931.jpeg', 'SR', '间宫康弘', '男', '★★');
INSERT INTO `shikigame` VALUES ('75', null, '蝴蝶精', null, '', '抽卡,碎片', 'http://uus-ng.img.d.cn/snapshot/201609/999/image/388/388/hd/20160920150221571.jpeg', 'R', '悠木碧', '女', '★★');
INSERT INTO `shikigame` VALUES ('76', null, '狸猫', null, '', '抽卡,碎片', 'http://uus-ng.img.d.cn/snapshot/201609/999/image/388/388/hd/20160920145918831.jpeg', 'R', '保志总一朗', '男', '★★');
INSERT INTO `shikigame` VALUES ('77', null, '跳跳弟弟', null, '', '抽卡,碎片', 'http://uus-ng.img.d.cn/snapshot/201609/999/image/388/388/hd/20160919192452025.jpeg', 'R', '高山南', '男', '★★');
INSERT INTO `shikigame` VALUES ('78', null, '跳跳妹妹', null, '', '抽卡,碎片', 'http://uus-ng.img.d.cn/snapshot/201609/999/image/388/388/hd/20160919192104507.jpeg', 'R', '诹访彩花', '女', '★★');
INSERT INTO `shikigame` VALUES ('79', null, '铁鼠', null, '', '抽卡,碎片', 'http://uus-ng.img.d.cn/snapshot/201609/999/image/388/388/hd/20160919191747925.jpeg', 'R', '石田彰', '女', '★★');
INSERT INTO `shikigame` VALUES ('80', null, '童女', null, '', '抽卡,碎片', 'http://uus-ng.img.d.cn/snapshot/201609/999/image/388/388/hd/20160919111719964.png', 'R', '加隈亚衣', '女', '★★');
INSERT INTO `shikigame` VALUES ('81', null, '巫蛊师', null, '', '抽卡,碎片', 'http://uus-ng.img.d.cn/snapshot/201609/999/image/388/388/hd/20160919111049876.jpeg', 'R', '间宫康弘', '男', '★★');
INSERT INTO `shikigame` VALUES ('82', null, '武士之灵', null, '', '抽卡,碎片', 'http://uus-ng.img.d.cn/snapshot/201609/999/image/388/388/hd/20160919110029060.jpeg', 'R', '井上和彦', '男', '★★');
INSERT INTO `shikigame` VALUES ('83', null, '雨女', null, '', '抽卡,碎片', 'http://uus-ng.img.d.cn/snapshot/201609/999/image/388/388/hd/20160919103128584.jpeg', 'R', '加隈亚衣', '女', '★★');
INSERT INTO `shikigame` VALUES ('84', null, '饿鬼', null, '', '抽卡,碎片', 'http://uus-ng.img.d.cn/snapshot/201609/999/image/388/388/hd/20160919101843632.jpeg', 'R', '井上麻里奈', '女', '★★');
INSERT INTO `shikigame` VALUES ('85', null, '座敷童子', null, '', '抽卡,碎片', 'http://uus-ng.img.d.cn/snapshot/201609/999/image/388/388/hd/20160919102039254.jpeg', 'R', '竹内顺子', '女', '★★');
INSERT INTO `shikigame` VALUES ('86', null, '兵佣', null, '', '抽卡,碎片', 'http://uus-ng.img.d.cn/snapshot/201609/999/image/388/388/hd/20160919102003545.jpeg', 'R', '石田彰', '男', '★★');
-- ----------------------------
-- Table structure for system_set
-- ----------------------------
DROP TABLE IF EXISTS `system_set`;
CREATE TABLE `system_set` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`create_time` datetime DEFAULT NULL,
`name` varchar(255) DEFAULT NULL,
`update_time` datetime DEFAULT NULL,
`beian_number` varchar(255) DEFAULT NULL,
`beian_url` varchar(255) DEFAULT NULL,
`from_year` int(11) DEFAULT NULL,
`icon` varchar(255) DEFAULT NULL,
`site_name` varchar(255) DEFAULT NULL,
`to_year` int(11) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;
-- ----------------------------
-- Records of system_set
-- ----------------------------
INSERT INTO `system_set` VALUES ('1', '2017-08-28 16:46:20', 'xiaomo', '2017-08-28 16:46:25', '我的备案号', 'https://xxx.xxx.xxx', '2015', 'https://image.xiaom.info/logo/avatar.png', '小莫的博客', '2017');
-- ----------------------------
-- Table structure for technology
-- ----------------------------
DROP TABLE IF EXISTS `technology`;
CREATE TABLE `technology` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`create_time` datetime DEFAULT NULL,
`name` varchar(255) DEFAULT NULL,
`update_time` datetime DEFAULT NULL,
`img_url` varchar(255) DEFAULT NULL,
`summary` varchar(255) DEFAULT NULL,
`url` varchar(255) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- ----------------------------
-- Records of technology
-- ----------------------------
-- ----------------------------
-- Table structure for user
-- ----------------------------
DROP TABLE IF EXISTS `user`;
CREATE TABLE `user` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`create_time` datetime DEFAULT NULL,
`name` varchar(255) DEFAULT NULL,
`update_time` datetime DEFAULT NULL,
`register_time` bigint(20) DEFAULT NULL,
`address` varchar(255) DEFAULT NULL,
`email` varchar(255) DEFAULT NULL,
`gender` int(11) DEFAULT NULL,
`img_url` varchar(255) DEFAULT NULL,
`nick_name` varchar(255) DEFAULT NULL,
`password` varchar(255) DEFAULT NULL,
`phone` bigint(20) DEFAULT NULL,
`salt` varchar(255) DEFAULT NULL,
`validate_code` varchar(255) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- ----------------------------
-- Records of user
-- ----------------------------
-- ----------------------------
-- Table structure for works
-- ----------------------------
DROP TABLE IF EXISTS `works`;
CREATE TABLE `works` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`create_time` datetime DEFAULT NULL,
`name` varchar(255) DEFAULT NULL,
`update_time` datetime DEFAULT NULL,
`complete_time` varchar(255) DEFAULT NULL,
`img_url` varchar(255) DEFAULT NULL,
`summary` varchar(255) DEFAULT NULL,
`url` varchar(255) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- ----------------------------
-- Records of works
-- ---------------------------- | the_stack |
--
-- Copyright 2013 Zynga Inc.
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
--
CREATE TABLE IF NOT EXISTS tracked_functions_flip_count
(
timestamp TIMESTAMP NOT NULL,
page VARCHAR(255) NOT NULL,
PRIMARY KEY (timestamp,page)
);
CREATE TABLE IF NOT EXISTS tracked_functions_flip_excl_time
(
timestamp TIMESTAMP NOT NULL,
page VARCHAR(255) NOT NULL,
PRIMARY KEY (timestamp,page)
);
CREATE TABLE IF NOT EXISTS tracked_functions_flip_incl_time
(
timestamp TIMESTAMP NOT NULL,
page VARCHAR(255) NOT NULL,
PRIMARY KEY (timestamp,page)
);
DROP PROCEDURE IF EXISTS add_new_tracked_index;
DELIMITER //
CREATE PROCEDURE add_new_tracked_index(IN tbl TEXT) BEGIN
IF NOT EXISTS(SELECT * from information_schema.COLUMNS WHERE COLUMN_NAME = 'page' AND TABLE_SCHEMA=DATABASE() AND TABLE_NAME=tbl) THEN
call run_query(CONCAT("ALTER TABLE `", tbl, "` ADD COLUMN `page` VARCHAR(255);"));
END IF;
IF NOT EXISTS(SELECT * from information_schema.TABLE_CONSTRAINTS WHERE CONSTRAINT_SCHEMA = DATABASE() AND CONSTRAINT_NAME = 'PRIMARY' AND TABLE_NAME= tbl) THEN
call run_query(CONCAT("ALTER TABLE `", tbl, "` ADD PRIMARY KEY(timestamp, page(255));"));
ELSE
call run_query(CONCAT("ALTER TABLE `", tbl, "` ADD PRIMARY KEY(timestamp, page(255)), DROP PRIMARY KEY;"));
END IF;
END//
DELIMITER ';'
CALL add_new_tracked_index('tracked_functions_flip_incl_time');
CALL add_new_tracked_index('tracked_functions_flip_excl_time');
CALL add_new_tracked_index('tracked_functions_flip_count');
DROP PROCEDURE IF EXISTS add_new_tracked_index;
CREATE TABLE IF NOT EXISTS tracked_functions_30min
(
timestamp TIMESTAMP NOT NULL,
gameid SMALLINT,
page VARCHAR(256) NOT NULL,
function VARCHAR(255) NOT NULL,
count INT DEFAULT 0,
incl_time FLOAT(10,3),
excl_time FLOAT(10,3),
PRIMARY KEY (timestamp, function),
INDEX tracked_index (timestamp,gameid,page,function)
);
ALTER TABLE `tracked_functions_30min`
ADD PRIMARY KEY(timestamp, page(64), function(144)),
DROP PRIMARY KEY;
-- daily aggregated table
CREATE TABLE IF NOT EXISTS tracked_functions_daily_flip_count LIKE tracked_functions_flip_count;
CREATE TABLE IF NOT EXISTS tracked_functions_daily_flip_excl_time LIKE tracked_functions_flip_excl_time;
CREATE TABLE IF NOT EXISTS tracked_functions_daily_flip_incl_time LIKE tracked_functions_flip_incl_time;
CREATE TABLE IF NOT EXISTS tracked_functions_daily LIKE tracked_functions_30min;
delimiter //
DROP PROCEDURE IF EXISTS pivot_tracked_functions_full//
CREATE PROCEDURE pivot_tracked_functions_full(IN col TEXT)
BEGIN
DECLARE end_loop INT DEFAULT 0;
DECLARE col_name TEXT;
DECLARE query TEXT;
DECLARE func_name TEXT ;
DECLARE func_col TEXT;
DECLARE juggle_table TEXT;
DECLARE uniq_functions CURSOR FOR
SELECT DISTINCT `function` FROM tracked_functions_30min LIMIT 100;
DECLARE CONTINUE HANDLER FOR NOT FOUND SET end_loop=1;
OPEN uniq_functions;
SET @query := CONCAT("SELECT SQL_CACHE timestamp, page ");
func_loop: loop
FETCH uniq_functions INTO func_name;
IF end_loop = 1 THEN
leave func_loop;
END IF;
SET @func_col := LEFT(CONCAT("",func_name), 64);
SET @query := CONCAT(@query, ", SUM(IF(function = '",func_name,"', ", col, ", 0)) as `", @func_col,"` ");
END LOOP func_loop;
SET @query := CONCAT(@query, " FROM tracked_functions_30min GROUP BY timestamp,page;");
call materialize_view(CONCAT("tracked_functions_flip_",col),@query);
CLOSE uniq_functions;
END//
DROP PROCEDURE IF EXISTS pivot_tracked_functions//
CREATE PROCEDURE pivot_tracked_functions(IN col TEXT)
BEGIN
DECLARE end_loop INT DEFAULT 0;
DECLARE query TEXT;
DECLARE func_name TEXT ;
DECLARE func_col TEXT;
DECLARE uniq_functions CURSOR FOR
SELECT DISTINCT `function` FROM tracked_functions_30min LIMIT 100;
DECLARE CONTINUE HANDLER FOR NOT FOUND SET end_loop=1;
call pivot_tracked_add_columns(col);
OPEN uniq_functions;
SET @query := CONCAT("INSERT into tracked_functions_flip_",col," (timestamp, page");
column_loop: loop
FETCH uniq_functions INTO func_name;
IF end_loop = 1 THEN
leave column_loop;
END IF;
SET @func_col := LEFT(CONCAT("",func_name), 64);
SET @query := CONCAT(@query, ", `", @func_col,"` ");
END LOOP column_loop;
SET @query := CONCAT(@query, ") ");
SELECT @query;
CLOSE uniq_functions;
-- re-open same cursor
OPEN uniq_functions;
SET end_loop := 0;
SET @query := CONCAT(@query, " SELECT SQL_CACHE timestamp, page ");
func_loop: loop
FETCH uniq_functions INTO func_name;
IF end_loop = 1 THEN
leave func_loop;
END IF;
SET @func_col := LEFT(CONCAT("",func_name), 64);
SET @query := CONCAT(@query, ", SUM(IF(function = '",func_name,"', ", col, ", 0)) as `", @func_col,"` ");
END LOOP func_loop;
SET @query := CONCAT(@query, " FROM tracked_functions_30min");
-- back-fill it
SET @query := CONCAT(@query, " WHERE timestamp > (select IFNULL(MAX(timestamp),from_unixtime(1)) from tracked_functions_flip_",col,")");
SET @query := CONCAT(@query, " GROUP BY timestamp, page ;");
call run_query(@query);
CLOSE uniq_functions;
END//
DROP PROCEDURE IF EXISTS pivot_tracked_add_columns//
CREATE PROCEDURE pivot_tracked_add_columns(IN col TEXT)
BEGIN
DECLARE end_loop INT DEFAULT 0;
DECLARE col_name TEXT;
DECLARE query TEXT;
DECLARE function_name TEXT ;
DECLARE function_col TEXT;
DECLARE missing_columns CURSOR FOR
SELECT `function` FROM (SELECT DISTINCT `function` from tracked_functions_30min LIMIT 4000) as functions WHERE `function` NOT IN (select column_name from information_schema.columns where table_schema = DATABASE() and table_name = CONCAT("tracked_functions_flip_",col) and column_name <> "timestamp" and column_name <> "page");
DECLARE CONTINUE HANDLER FOR NOT FOUND SET end_loop=1;
OPEN missing_columns;
SET @query := CONCAT("ALTER TABLE `tracked_functions_flip_",col,"` ");
function_loop: loop
FETCH missing_columns INTO function_name;
IF end_loop = 1 THEN
leave function_loop;
END IF;
SET @function_col := CONCAT("",function_name);
SET @query := CONCAT(@query, " ADD COLUMN `", @function_col,"` double(20,3) DEFAULT 0, ");
END LOOP function_loop;
SET @query := CONCAT(@query, " ORDER BY `timestamp`;");
call run_query(@query);
CLOSE missing_columns;
END//
-- Daily aggregated procedures
DROP PROCEDURE IF EXISTS pivot_tracked_functions_daily//
CREATE PROCEDURE pivot_tracked_functions_daily(IN col TEXT)
BEGIN
DECLARE end_loop INT DEFAULT 0;
DECLARE query TEXT;
DECLARE func_name TEXT ;
DECLARE func_col TEXT;
DECLARE uniq_functions CURSOR FOR
SELECT DISTINCT `function` FROM tracked_functions_daily LIMIT 100;
DECLARE CONTINUE HANDLER FOR NOT FOUND SET end_loop=1;
call pivot_tracked_daily_add_columns(col);
OPEN uniq_functions;
SET @query := CONCAT("INSERT into tracked_functions_daily_flip_",col," (timestamp, page");
column_loop: loop
FETCH uniq_functions INTO func_name;
IF end_loop = 1 THEN
leave column_loop;
END IF;
SET @func_col := LEFT(CONCAT("",func_name), 64);
SET @query := CONCAT(@query, ", `", @func_col,"` ");
END LOOP column_loop;
SET @query := CONCAT(@query, ") ");
SELECT @query;
CLOSE uniq_functions;
-- re-open same cursor
OPEN uniq_functions;
SET end_loop := 0;
SET @query := CONCAT(@query, " SELECT SQL_CACHE timestamp, page ");
func_loop: loop
FETCH uniq_functions INTO func_name;
IF end_loop = 1 THEN
leave func_loop;
END IF;
SET @func_col := LEFT(CONCAT("",func_name), 64);
SET @query := CONCAT(@query, ", SUM(IF(function = '",func_name,"', ", col, ", 0)) as `", @func_col,"` ");
END LOOP func_loop;
SET @query := CONCAT(@query, " FROM tracked_functions_daily");
-- back-fill it
SET @query := CONCAT(@query, " WHERE timestamp > (select IFNULL(MAX(timestamp),from_unixtime(1)) from tracked_functions_daily_flip_",col,")");
SET @query := CONCAT(@query, " GROUP BY timestamp, page ;");
call run_query(@query);
CLOSE uniq_functions;
END//
DROP PROCEDURE IF EXISTS pivot_tracked_daily_add_columns//
CREATE PROCEDURE pivot_tracked_daily_add_columns(IN col TEXT)
BEGIN
DECLARE end_loop INT DEFAULT 0;
DECLARE col_name TEXT;
DECLARE query TEXT;
DECLARE function_name TEXT ;
DECLARE function_col TEXT;
DECLARE missing_columns CURSOR FOR
SELECT `function` FROM (SELECT DISTINCT `function` from tracked_functions_daily LIMIT 4000) as functions WHERE `function` NOT IN (select column_name from information_schema.columns where table_schema = DATABASE() and table_name = CONCAT("tracked_functions_daily_flip_",col) and column_name <> "timestamp" and column_name <> "page");
DECLARE CONTINUE HANDLER FOR NOT FOUND SET end_loop=1;
OPEN missing_columns;
SET @query := CONCAT("ALTER TABLE `tracked_functions_daily_flip_",col,"` ");
function_loop: loop
FETCH missing_columns INTO function_name;
IF end_loop = 1 THEN
leave function_loop;
END IF;
SET @function_col := CONCAT("",function_name);
SET @query := CONCAT(@query, " ADD COLUMN `", @function_col,"` double(20,3) DEFAULT 0, ");
END LOOP function_loop;
SET @query := CONCAT(@query, " ORDER BY `timestamp`;");
call run_query(@query);
CLOSE missing_columns;
END//
delimiter ; | the_stack |
-- Copyright (c) 2021 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
-- SPDX-License-Identifier: Apache-2.0
---------------------------------------------------------------------------------------------------
-- V100: Append-only schema
--
-- This is a major redesign of the index database schema. Updates from the ReadService are
-- now written into the append-only table participant_events, and the set of active contracts is
-- reconstructed from the log of create and archive events.
---------------------------------------------------------------------------------------------------
CREATE TABLE packages
(
-- The unique identifier of the package (the hash of its content)
package_id VARCHAR2(4000) primary key not null,
-- Packages are uploaded as DAR files (i.e., in groups)
-- This field can be used to find out which packages were uploaded together
upload_id NVARCHAR2(1000) not null,
-- A human readable description of the package source
source_description NVARCHAR2(1000),
-- The size of the archive payload (i.e., the serialized DAML-LF package), in bytes
package_size NUMBER not null,
-- The time when the package was added
known_since NUMBER not null,
-- The ledger end at the time when the package was added
ledger_offset VARCHAR2(4000) not null,
-- The DAML-LF archive, serialized using the protobuf message `daml_lf.Archive`.
-- See also `daml-lf/archive/da/daml_lf.proto`.
package BLOB not null
);
CREATE INDEX packages_ledger_offset_idx ON packages(ledger_offset);
CREATE TABLE configuration_entries
(
ledger_offset VARCHAR2(4000) not null primary key,
recorded_at NUMBER not null,
submission_id NVARCHAR2(1000) not null,
-- The type of entry, one of 'accept' or 'reject'.
typ NVARCHAR2(1000) not null,
-- The configuration that was proposed and either accepted or rejected depending on the type.
-- Encoded according to participant-state/protobuf/ledger_configuration.proto.
-- Add the current configuration column to parameters.
configuration BLOB not null,
-- If the type is 'rejection', then the rejection reason is set.
-- Rejection reason is a human-readable description why the change was rejected.
rejection_reason NVARCHAR2(1000),
-- Check that fields are correctly set based on the type.
constraint configuration_entries_check_entry
check (
(typ = 'accept' and rejection_reason is null) or
(typ = 'reject' and rejection_reason is not null))
);
CREATE INDEX idx_configuration_submission ON configuration_entries (submission_id);
CREATE TABLE package_entries
(
ledger_offset VARCHAR2(4000) not null primary key,
recorded_at NUMBER not null,
-- SubmissionId for package to be uploaded
submission_id NVARCHAR2(1000),
-- The type of entry, one of 'accept' or 'reject'
typ NVARCHAR2(1000) not null,
-- If the type is 'reject', then the rejection reason is set.
-- Rejection reason is a human-readable description why the change was rejected.
rejection_reason NVARCHAR2(1000),
constraint check_package_entry_type
check (
(typ = 'accept' and rejection_reason is null) or
(typ = 'reject' and rejection_reason is not null)
)
);
-- Index for retrieving the package entry by submission id
CREATE INDEX idx_package_entries ON package_entries (submission_id);
CREATE TABLE party_entries
(
-- The ledger end at the time when the party allocation was added
-- cannot BLOB add as primary key with oracle
ledger_offset VARCHAR2(4000) primary key not null,
recorded_at NUMBER not null,
-- SubmissionId for the party allocation
submission_id NVARCHAR2(1000),
-- party
party NVARCHAR2(1000),
-- displayName
display_name NVARCHAR2(1000),
-- The type of entry, 'accept' or 'reject'
typ NVARCHAR2(1000) not null,
-- If the type is 'reject', then the rejection reason is set.
-- Rejection reason is a human-readable description why the change was rejected.
rejection_reason NVARCHAR2(1000),
-- true if the party was added on participantId node that owns the party
is_local NUMBER(1, 0),
constraint check_party_entry_type
check (
(typ = 'accept' and rejection_reason is null and party is not null) or
(typ = 'reject' and rejection_reason is not null)
)
);
CREATE INDEX idx_party_entries ON party_entries(submission_id);
CREATE INDEX idx_party_entries_party_and_ledger_offset ON party_entries(party, ledger_offset);
CREATE TABLE participant_command_completions
(
completion_offset VARCHAR2(4000) NOT NULL,
record_time NUMBER NOT NULL,
application_id NVARCHAR2(1000) NOT NULL,
-- The submission ID will be provided by the participant or driver if the application didn't provide one.
-- Nullable to support historical data.
submission_id NVARCHAR2(1000),
-- The three alternatives below are mutually exclusive, i.e. the deduplication
-- interval could have specified by the application as one of:
-- 1. an initial offset
-- 2. a duration (split into two columns, seconds and nanos, mapping protobuf's 1:1)
-- 3. an initial timestamp
deduplication_offset VARCHAR2(4000),
deduplication_duration_seconds NUMBER,
deduplication_duration_nanos NUMBER,
deduplication_start NUMBER,
submitters CLOB NOT NULL CONSTRAINT ensure_json_submitters CHECK (submitters IS JSON),
command_id NVARCHAR2(1000) NOT NULL,
transaction_id NVARCHAR2(1000), -- null for rejected transactions and checkpoints
rejection_status_code INTEGER, -- null for accepted transactions and checkpoints
rejection_status_message CLOB, -- null for accepted transactions and checkpoints
rejection_status_details BLOB -- null for accepted transactions and checkpoints
);
CREATE INDEX participant_command_completions_idx ON participant_command_completions(completion_offset, application_id);
CREATE TABLE participant_command_submissions
(
-- The deduplication key
deduplication_key NVARCHAR2(1000) primary key not null,
-- The time the command will stop being deduplicated
deduplicate_until NUMBER not null
);
---------------------------------------------------------------------------------------------------
-- Events table: divulgence
---------------------------------------------------------------------------------------------------
CREATE TABLE participant_events_divulgence (
-- * event identification
event_sequential_id NUMBER NOT NULL,
-- NOTE: this must be assigned sequentially by the indexer such that
-- for all events ev1, ev2 it holds that '(ev1.offset < ev2.offset) <=> (ev1.event_sequential_id < ev2.event_sequential_id)
event_offset VARCHAR2(4000), -- offset of the transaction that divulged the contract
-- * transaction metadata
command_id VARCHAR2(4000),
workflow_id VARCHAR2(4000),
application_id VARCHAR2(4000),
submitters CLOB CONSTRAINT ensure_json_ped_submitters CHECK (submitters IS JSON),
-- * shared event information
contract_id VARCHAR2(4000) NOT NULL,
template_id VARCHAR2(4000),
tree_event_witnesses CLOB DEFAULT '[]' NOT NULL CONSTRAINT ensure_json_tree_event_witnesses CHECK (tree_event_witnesses IS JSON), -- informees for create, exercise, and divulgance events
-- * divulgence and create events
create_argument BLOB,
-- * compression flags
create_argument_compression SMALLINT
);
-- offset index: used to translate to sequential_id
CREATE INDEX participant_events_divulgence_event_offset ON participant_events_divulgence(event_offset);
-- sequential_id index for paging
CREATE INDEX participant_events_divulgence_event_sequential_id ON participant_events_divulgence(event_sequential_id);
-- filtering by template
CREATE INDEX participant_events_divulgence_template_id_idx ON participant_events_divulgence(template_id);
-- filtering by witnesses (visibility) for some queries used in the implementation of
-- GetActiveContracts (flat), GetTransactions (flat) and GetTransactionTrees.
-- Note that Potsgres has trouble using these indices effectively with our paged access.
-- We might decide to drop them.
CREATE SEARCH INDEX participant_events_divulgence_tree_event_witnesses_idx ON participant_events_divulgence (tree_event_witnesses) FOR JSON;
-- lookup divulgance events, in order of ingestion
CREATE INDEX participant_events_divulgence_contract_id_idx ON participant_events_divulgence(contract_id, event_sequential_id);
---------------------------------------------------------------------------------------------------
-- Events table: create
---------------------------------------------------------------------------------------------------
CREATE TABLE participant_events_create (
-- * event identification
event_sequential_id NUMBER NOT NULL,
-- NOTE: this must be assigned sequentially by the indexer such that
-- for all events ev1, ev2 it holds that '(ev1.offset < ev2.offset) <=> (ev1.event_sequential_id < ev2.event_sequential_id)
ledger_effective_time NUMBER NOT NULL,
node_index INTEGER NOT NULL,
event_offset VARCHAR2(4000) NOT NULL,
-- * transaction metadata
transaction_id VARCHAR2(4000) NOT NULL,
workflow_id VARCHAR2(4000),
command_id VARCHAR2(4000),
application_id VARCHAR2(4000),
submitters CLOB CONSTRAINT ensure_json_pec_submitters CHECK (submitters IS JSON),
-- * event metadata
event_id VARCHAR2(4000) NOT NULL, -- string representation of (transaction_id, node_index)
-- * shared event information
contract_id VARCHAR2(4000) NOT NULL,
template_id VARCHAR2(4000) NOT NULL,
flat_event_witnesses CLOB DEFAULT '[]' NOT NULL CONSTRAINT ensure_json_pec_flat_event_witnesses CHECK (flat_event_witnesses IS JSON), -- stakeholders of create events and consuming exercise events
tree_event_witnesses CLOB DEFAULT '[]' NOT NULL CONSTRAINT ensure_json_pec_tree_event_witnesses CHECK (tree_event_witnesses IS JSON), -- informees for create, exercise, and divulgance events
-- * divulgence and create events
create_argument BLOB NOT NULL,
-- * create events only
create_signatories CLOB NOT NULL CONSTRAINT ensure_json_create_signatories CHECK (create_signatories IS JSON),
create_observers CLOB NOT NULL CONSTRAINT ensure_json_create_observers CHECK (create_observers is JSON),
create_agreement_text VARCHAR2(4000),
create_key_value BLOB,
create_key_hash VARCHAR2(4000),
-- * compression flags
create_argument_compression SMALLINT,
create_key_value_compression SMALLINT
);
-- offset index: used to translate to sequential_id
CREATE INDEX participant_events_create_event_offset ON participant_events_create(event_offset);
-- sequential_id index for paging
CREATE INDEX participant_events_create_event_sequential_id ON participant_events_create(event_sequential_id);
-- lookup by event-id
CREATE INDEX participant_events_create_event_id_idx ON participant_events_create(event_id);
-- lookup by transaction id
CREATE INDEX participant_events_create_transaction_id_idx ON participant_events_create(transaction_id);
-- filtering by template
CREATE INDEX participant_events_create_template_id_idx ON participant_events_create(template_id);
-- filtering by witnesses (visibility) for some queries used in the implementation of
-- GetActiveContracts (flat), GetTransactions (flat) and GetTransactionTrees.
-- Note that Potsgres has trouble using these indices effectively with our paged access.
-- We might decide to drop them.
CREATE SEARCH INDEX participant_events_create_flat_event_witnesses_idx ON participant_events_create (flat_event_witnesses) FOR JSON;
CREATE SEARCH INDEX participant_events_create_tree_event_witnesses_idx ON participant_events_create (tree_event_witnesses) FOR JSON;
-- lookup by contract id
CREATE INDEX participant_events_create_contract_id_idx ON participant_events_create(contract_id);
-- lookup by contract_key
CREATE INDEX participant_events_create_create_key_hash_idx ON participant_events_create(create_key_hash, event_sequential_id);
---------------------------------------------------------------------------------------------------
-- Events table: consuming exercise
---------------------------------------------------------------------------------------------------
CREATE TABLE participant_events_consuming_exercise (
-- * event identification
event_sequential_id NUMBER NOT NULL,
-- NOTE: this must be assigned sequentially by the indexer such that
-- for all events ev1, ev2 it holds that '(ev1.offset < ev2.offset) <=> (ev1.event_sequential_id < ev2.event_sequential_id)
event_offset VARCHAR2(4000) NOT NULL,
-- * transaction metadata
transaction_id VARCHAR2(4000) NOT NULL,
ledger_effective_time NUMBER NOT NULL,
command_id VARCHAR2(4000),
workflow_id VARCHAR2(4000),
application_id VARCHAR2(4000),
submitters CLOB CONSTRAINT ensure_json_pece_submitters CHECK (submitters is JSON),
-- * event metadata
node_index INTEGER NOT NULL,
event_id VARCHAR2(4000) NOT NULL, -- string representation of (transaction_id, node_index)
-- * shared event information
contract_id VARCHAR2(4000) NOT NULL,
template_id VARCHAR2(4000) NOT NULL,
flat_event_witnesses CLOB DEFAULT '[]' NOT NULL CONSTRAINT ensure_json_pece_flat_event_witnesses CHECK (flat_event_witnesses IS JSON), -- stakeholders of create events and consuming exercise events
tree_event_witnesses CLOB DEFAULT '[]' NOT NULL CONSTRAINT ensure_json_pece_tree_event_witnesses CHECK (tree_event_witnesses IS JSON), -- informees for create, exercise, and divulgance events
-- * information about the corresponding create event
create_key_value BLOB, -- used for the mutable state cache
-- * exercise events (consuming and non_consuming)
exercise_choice VARCHAR2(4000) NOT NULL,
exercise_argument BLOB NOT NULL,
exercise_result BLOB,
exercise_actors CLOB NOT NULL CONSTRAINT ensure_json_pece_exercise_actors CHECK (exercise_actors IS JSON),
exercise_child_event_ids CLOB NOT NULL CONSTRAINT ensure_json_pece_exercise_child_event_ids CHECK (exercise_child_event_ids IS JSON),
-- * compression flags
create_key_value_compression SMALLINT,
exercise_argument_compression SMALLINT,
exercise_result_compression SMALLINT
);
-- offset index: used to translate to sequential_id
CREATE INDEX participant_events_consuming_exercise_event_offset ON participant_events_consuming_exercise(event_offset);
-- sequential_id index for paging
CREATE INDEX participant_events_consuming_exercise_event_sequential_id ON participant_events_consuming_exercise(event_sequential_id);
-- lookup by event-id
CREATE INDEX participant_events_consuming_exercise_event_id_idx ON participant_events_consuming_exercise(event_id);
-- lookup by transaction id
CREATE INDEX participant_events_consuming_exercise_transaction_id_idx ON participant_events_consuming_exercise(transaction_id);
-- filtering by template
CREATE INDEX participant_events_consuming_exercise_template_id_idx ON participant_events_consuming_exercise(template_id);
-- filtering by witnesses (visibility) for some queries used in the implementation of
-- GetActiveContracts (flat), GetTransactions (flat) and GetTransactionTrees.
CREATE SEARCH INDEX participant_events_consuming_exercise_flat_event_witnesses_idx ON participant_events_consuming_exercise (flat_event_witnesses) FOR JSON;
CREATE SEARCH INDEX participant_events_consuming_exercise_tree_event_witnesses_idx ON participant_events_consuming_exercise (tree_event_witnesses) FOR JSON;
-- lookup by contract id
CREATE INDEX participant_events_consuming_exercise_contract_id_idx ON participant_events_consuming_exercise (contract_id);
---------------------------------------------------------------------------------------------------
-- Events table: non-consuming exercise
---------------------------------------------------------------------------------------------------
CREATE TABLE participant_events_non_consuming_exercise (
-- * event identification
event_sequential_id NUMBER NOT NULL,
-- NOTE: this must be assigned sequentially by the indexer such that
-- for all events ev1, ev2 it holds that '(ev1.offset < ev2.offset) <=> (ev1.event_sequential_id < ev2.event_sequential_id)
ledger_effective_time NUMBER NOT NULL,
node_index INTEGER NOT NULL,
event_offset VARCHAR2(4000) NOT NULL,
-- * transaction metadata
transaction_id VARCHAR2(4000) NOT NULL,
workflow_id VARCHAR2(4000),
command_id VARCHAR2(4000),
application_id VARCHAR2(4000),
submitters CLOB CONSTRAINT ensure_json_pence_submitters CHECK (submitters IS JSON),
-- * event metadata
event_id VARCHAR2(4000) NOT NULL, -- string representation of (transaction_id, node_index)
-- * shared event information
contract_id VARCHAR2(4000) NOT NULL,
template_id VARCHAR2(4000) NOT NULL,
flat_event_witnesses CLOB DEFAULT '{}' NOT NULL CONSTRAINT ensure_json_pence_flat_event_witnesses CHECK (flat_event_witnesses IS JSON), -- stakeholders of create events and consuming exercise events
tree_event_witnesses CLOB DEFAULT '{}' NOT NULL CONSTRAINT ensure_json_pence_tree_event_witnesses CHECK (tree_event_witnesses IS JSON), -- informees for create, exercise, and divulgance events
-- * information about the corresponding create event
create_key_value BLOB, -- used for the mutable state cache
-- * exercise events (consuming and non_consuming)
exercise_choice VARCHAR2(4000) NOT NULL,
exercise_argument BLOB NOT NULL,
exercise_result BLOB,
exercise_actors CLOB NOT NULL CONSTRAINT ensure_json_exercise_actors CHECK (exercise_actors IS JSON),
exercise_child_event_ids CLOB NOT NULL CONSTRAINT ensure_json_exercise_child_event_ids CHECK (exercise_child_event_ids IS JSON),
-- * compression flags
create_key_value_compression SMALLINT,
exercise_argument_compression SMALLINT,
exercise_result_compression SMALLINT
);
-- offset index: used to translate to sequential_id
CREATE INDEX participant_events_non_consuming_exercise_event_offset ON participant_events_non_consuming_exercise(event_offset);
-- sequential_id index for paging
CREATE INDEX participant_events_non_consuming_exercise_event_sequential_id ON participant_events_non_consuming_exercise(event_sequential_id);
-- lookup by event-id
CREATE INDEX participant_events_non_consuming_exercise_event_id_idx ON participant_events_non_consuming_exercise(event_id);
-- lookup by transaction id
CREATE INDEX participant_events_non_consuming_exercise_transaction_id_idx ON participant_events_non_consuming_exercise(transaction_id);
-- filtering by template
CREATE INDEX participant_events_non_consuming_exercise_template_id_idx ON participant_events_non_consuming_exercise(template_id);
-- filtering by witnesses (visibility) for some queries used in the implementation of
-- GetActiveContracts (flat), GetTransactions (flat) and GetTransactionTrees.
-- There is no equivalent to GIN index for oracle, but we explicitly mark as a JSON column for indexing
CREATE SEARCH INDEX participant_events_non_consuming_exercise_flat_event_witness_idx ON participant_events_non_consuming_exercise (flat_event_witnesses) FOR JSON;
CREATE SEARCH INDEX participant_events_non_consuming_exercise_tree_event_witness_idx ON participant_events_non_consuming_exercise (tree_event_witnesses) FOR JSON;
CREATE VIEW participant_events AS
SELECT cast(0 as SMALLINT) AS event_kind,
participant_events_divulgence.event_sequential_id,
cast(NULL as VARCHAR2(4000)) AS event_offset,
cast(NULL as VARCHAR2(4000)) AS transaction_id,
cast(NULL as NUMBER) AS ledger_effective_time,
participant_events_divulgence.command_id,
participant_events_divulgence.workflow_id,
participant_events_divulgence.application_id,
participant_events_divulgence.submitters,
cast(NULL as INTEGER) as node_index,
cast(NULL as VARCHAR2(4000)) as event_id,
participant_events_divulgence.contract_id,
participant_events_divulgence.template_id,
to_clob('[]') AS flat_event_witnesses,
participant_events_divulgence.tree_event_witnesses,
participant_events_divulgence.create_argument,
to_clob('[]') AS create_signatories,
to_clob('[]') AS create_observers,
cast(NULL as VARCHAR2(4000)) AS create_agreement_text,
NULL AS create_key_value,
cast(NULL as VARCHAR2(4000)) AS create_key_hash,
cast(NULL as VARCHAR2(4000)) AS exercise_choice,
NULL AS exercise_argument,
NULL AS exercise_result,
to_clob('[]') AS exercise_actors,
to_clob('[]') AS exercise_child_event_ids,
participant_events_divulgence.create_argument_compression,
cast(NULL as SMALLINT) AS create_key_value_compression,
cast(NULL as SMALLINT) AS exercise_argument_compression,
cast(NULL as SMALLINT) AS exercise_result_compression
FROM participant_events_divulgence
UNION ALL
SELECT (10) AS event_kind,
participant_events_create.event_sequential_id,
participant_events_create.event_offset,
participant_events_create.transaction_id,
participant_events_create.ledger_effective_time,
participant_events_create.command_id,
participant_events_create.workflow_id,
participant_events_create.application_id,
participant_events_create.submitters,
participant_events_create.node_index,
participant_events_create.event_id,
participant_events_create.contract_id,
participant_events_create.template_id,
participant_events_create.flat_event_witnesses,
participant_events_create.tree_event_witnesses,
participant_events_create.create_argument,
participant_events_create.create_signatories,
participant_events_create.create_observers,
participant_events_create.create_agreement_text,
participant_events_create.create_key_value,
participant_events_create.create_key_hash,
cast(NULL as VARCHAR2(4000)) AS exercise_choice,
NULL AS exercise_argument,
NULL AS exercise_result,
to_clob('[]') AS exercise_actors,
to_clob('[]') AS exercise_child_event_ids,
participant_events_create.create_argument_compression,
participant_events_create.create_key_value_compression,
cast(NULL as SMALLINT) AS exercise_argument_compression,
cast(NULL as SMALLINT) AS exercise_result_compression
FROM participant_events_create
UNION ALL
SELECT (20) AS event_kind,
participant_events_consuming_exercise.event_sequential_id,
participant_events_consuming_exercise.event_offset,
participant_events_consuming_exercise.transaction_id,
participant_events_consuming_exercise.ledger_effective_time,
participant_events_consuming_exercise.command_id,
participant_events_consuming_exercise.workflow_id,
participant_events_consuming_exercise.application_id,
participant_events_consuming_exercise.submitters,
participant_events_consuming_exercise.node_index,
participant_events_consuming_exercise.event_id,
participant_events_consuming_exercise.contract_id,
participant_events_consuming_exercise.template_id,
participant_events_consuming_exercise.flat_event_witnesses,
participant_events_consuming_exercise.tree_event_witnesses,
NULL AS create_argument,
to_clob('[]') AS create_signatories,
to_clob('[]') AS create_observers,
NULL AS create_agreement_text,
participant_events_consuming_exercise.create_key_value,
NULL AS create_key_hash,
participant_events_consuming_exercise.exercise_choice,
participant_events_consuming_exercise.exercise_argument,
participant_events_consuming_exercise.exercise_result,
participant_events_consuming_exercise.exercise_actors,
participant_events_consuming_exercise.exercise_child_event_ids,
NULL AS create_argument_compression,
participant_events_consuming_exercise.create_key_value_compression,
participant_events_consuming_exercise.exercise_argument_compression,
participant_events_consuming_exercise.exercise_result_compression
FROM participant_events_consuming_exercise
UNION ALL
SELECT (25) AS event_kind,
participant_events_non_consuming_exercise.event_sequential_id,
participant_events_non_consuming_exercise.event_offset,
participant_events_non_consuming_exercise.transaction_id,
participant_events_non_consuming_exercise.ledger_effective_time,
participant_events_non_consuming_exercise.command_id,
participant_events_non_consuming_exercise.workflow_id,
participant_events_non_consuming_exercise.application_id,
participant_events_non_consuming_exercise.submitters,
participant_events_non_consuming_exercise.node_index,
participant_events_non_consuming_exercise.event_id,
participant_events_non_consuming_exercise.contract_id,
participant_events_non_consuming_exercise.template_id,
participant_events_non_consuming_exercise.flat_event_witnesses,
participant_events_non_consuming_exercise.tree_event_witnesses,
NULL AS create_argument,
to_clob('[]') AS create_signatories,
to_clob('[]') AS create_observers,
NULL AS create_agreement_text,
participant_events_non_consuming_exercise.create_key_value,
NULL AS create_key_hash,
participant_events_non_consuming_exercise.exercise_choice,
participant_events_non_consuming_exercise.exercise_argument,
participant_events_non_consuming_exercise.exercise_result,
participant_events_non_consuming_exercise.exercise_actors,
participant_events_non_consuming_exercise.exercise_child_event_ids,
NULL AS create_argument_compression,
participant_events_non_consuming_exercise.create_key_value_compression,
participant_events_non_consuming_exercise.exercise_argument_compression,
participant_events_non_consuming_exercise.exercise_result_compression
FROM participant_events_non_consuming_exercise;
---------------------------------------------------------------------------------------------------
-- Parameters table
---------------------------------------------------------------------------------------------------
-- new field: the sequential_event_id up to which all events have been ingested
CREATE TABLE parameters
-- this table is meant to have a single row storing all the parameters we have
(
-- the generated or configured id identifying the ledger
ledger_id NVARCHAR2(1000) not null,
-- stores the head offset, meant to change with every new ledger entry
ledger_end VARCHAR2(4000),
participant_id NVARCHAR2(1000) not null,
participant_pruned_up_to_inclusive VARCHAR2(4000),
participant_all_divulged_contracts_pruned_up_to_inclusive VARCHAR2(4000),
ledger_end_sequential_id NUMBER
); | the_stack |
--
-- TRANSACTIONS
--
BEGIN;
SELECT *
INTO TABLE xacttest
FROM aggtest;
INSERT INTO xacttest (a, b) VALUES (777, 777.777);
END;
-- should retrieve one value--
SELECT a FROM xacttest WHERE a > 100;
BEGIN;
CREATE TABLE disappear (a int4);
DELETE FROM aggtest;
-- should be empty
SELECT * FROM aggtest;
ABORT;
-- should not exist
SELECT oid FROM pg_class WHERE relname = 'disappear';
-- should have members again
SELECT * FROM aggtest;
-- Read-only tests
CREATE TABLE writetest (a int);
CREATE TEMPORARY TABLE temptest (a int);
BEGIN;
SET TRANSACTION ISOLATION LEVEL SERIALIZABLE, READ ONLY, DEFERRABLE; -- ok
SELECT * FROM writetest; -- ok
SET TRANSACTION READ WRITE; --fail
COMMIT;
BEGIN;
SET TRANSACTION READ ONLY; -- ok
SET TRANSACTION READ WRITE; -- ok
SET TRANSACTION READ ONLY; -- ok
SELECT * FROM writetest; -- ok
SAVEPOINT x;
SET TRANSACTION READ ONLY; -- ok
SELECT * FROM writetest; -- ok
SET TRANSACTION READ ONLY; -- ok
SET TRANSACTION READ WRITE; --fail
COMMIT;
BEGIN;
SET TRANSACTION READ WRITE; -- ok
SAVEPOINT x;
SET TRANSACTION READ WRITE; -- ok
SET TRANSACTION READ ONLY; -- ok
SELECT * FROM writetest; -- ok
SET TRANSACTION READ ONLY; -- ok
SET TRANSACTION READ WRITE; --fail
COMMIT;
BEGIN;
SET TRANSACTION READ WRITE; -- ok
SAVEPOINT x;
SET TRANSACTION READ ONLY; -- ok
SELECT * FROM writetest; -- ok
ROLLBACK TO SAVEPOINT x;
SHOW transaction_read_only; -- off
SAVEPOINT y;
SET TRANSACTION READ ONLY; -- ok
SELECT * FROM writetest; -- ok
RELEASE SAVEPOINT y;
SHOW transaction_read_only; -- off
COMMIT;
SET SESSION CHARACTERISTICS AS TRANSACTION READ ONLY;
DROP TABLE writetest; -- fail
INSERT INTO writetest VALUES (1); -- fail
SELECT * FROM writetest; -- ok
DELETE FROM temptest; -- ok
UPDATE temptest SET a = 0 FROM writetest WHERE temptest.a = 1 AND writetest.a = temptest.a; -- ok
PREPARE test AS UPDATE writetest SET a = 0; -- ok
EXECUTE test; -- fail
SELECT * FROM writetest, temptest; -- ok
CREATE TABLE test AS SELECT * FROM writetest; -- fail
START TRANSACTION READ WRITE;
DROP TABLE writetest; -- ok
COMMIT;
-- Subtransactions, basic tests
-- create & drop tables
SET SESSION CHARACTERISTICS AS TRANSACTION READ WRITE;
CREATE TABLE trans_foobar (a int);
BEGIN;
CREATE TABLE trans_foo (a int);
SAVEPOINT one;
DROP TABLE trans_foo;
CREATE TABLE trans_bar (a int);
ROLLBACK TO SAVEPOINT one;
RELEASE SAVEPOINT one;
SAVEPOINT two;
CREATE TABLE trans_baz (a int);
RELEASE SAVEPOINT two;
drop TABLE trans_foobar;
CREATE TABLE trans_barbaz (a int);
COMMIT;
-- should exist: trans_barbaz, trans_baz, trans_foo
SELECT * FROM trans_foo; -- should be empty
SELECT * FROM trans_bar; -- shouldn't exist
SELECT * FROM trans_barbaz; -- should be empty
SELECT * FROM trans_baz; -- should be empty
-- inserts
BEGIN;
INSERT INTO trans_foo VALUES (1);
SAVEPOINT one;
INSERT into trans_bar VALUES (1);
ROLLBACK TO one;
RELEASE SAVEPOINT one;
SAVEPOINT two;
INSERT into trans_barbaz VALUES (1);
RELEASE two;
SAVEPOINT three;
SAVEPOINT four;
INSERT INTO trans_foo VALUES (2);
RELEASE SAVEPOINT four;
ROLLBACK TO SAVEPOINT three;
RELEASE SAVEPOINT three;
INSERT INTO trans_foo VALUES (3);
COMMIT;
SELECT * FROM trans_foo; -- should have 1 and 3
SELECT * FROM trans_barbaz; -- should have 1
-- test whole-tree commit
BEGIN;
SAVEPOINT one;
SELECT trans_foo;
ROLLBACK TO SAVEPOINT one;
RELEASE SAVEPOINT one;
SAVEPOINT two;
CREATE TABLE savepoints (a int);
SAVEPOINT three;
INSERT INTO savepoints VALUES (1);
SAVEPOINT four;
INSERT INTO savepoints VALUES (2);
SAVEPOINT five;
INSERT INTO savepoints VALUES (3);
ROLLBACK TO SAVEPOINT five;
COMMIT;
COMMIT; -- should not be in a transaction block
SELECT * FROM savepoints;
-- test whole-tree rollback
BEGIN;
SAVEPOINT one;
DELETE FROM savepoints WHERE a=1;
RELEASE SAVEPOINT one;
SAVEPOINT two;
DELETE FROM savepoints WHERE a=1;
SAVEPOINT three;
DELETE FROM savepoints WHERE a=2;
ROLLBACK;
COMMIT; -- should not be in a transaction block
SELECT * FROM savepoints;
-- test whole-tree commit on an aborted subtransaction
BEGIN;
INSERT INTO savepoints VALUES (4);
SAVEPOINT one;
INSERT INTO savepoints VALUES (5);
SELECT trans_foo;
COMMIT;
SELECT * FROM savepoints;
BEGIN;
INSERT INTO savepoints VALUES (6);
SAVEPOINT one;
INSERT INTO savepoints VALUES (7);
RELEASE SAVEPOINT one;
INSERT INTO savepoints VALUES (8);
COMMIT;
-- rows 6 and 8 should have been created by the same xact
SELECT a.xmin = b.xmin FROM savepoints a, savepoints b WHERE a.a=6 AND b.a=8;
-- rows 6 and 7 should have been created by different xacts
SELECT a.xmin = b.xmin FROM savepoints a, savepoints b WHERE a.a=6 AND b.a=7;
BEGIN;
INSERT INTO savepoints VALUES (9);
SAVEPOINT one;
INSERT INTO savepoints VALUES (10);
ROLLBACK TO SAVEPOINT one;
INSERT INTO savepoints VALUES (11);
COMMIT;
SELECT a FROM savepoints WHERE a in (9, 10, 11);
-- rows 9 and 11 should have been created by different xacts
SELECT a.xmin = b.xmin FROM savepoints a, savepoints b WHERE a.a=9 AND b.a=11;
BEGIN;
INSERT INTO savepoints VALUES (12);
SAVEPOINT one;
INSERT INTO savepoints VALUES (13);
SAVEPOINT two;
INSERT INTO savepoints VALUES (14);
ROLLBACK TO SAVEPOINT one;
INSERT INTO savepoints VALUES (15);
SAVEPOINT two;
INSERT INTO savepoints VALUES (16);
SAVEPOINT three;
INSERT INTO savepoints VALUES (17);
COMMIT;
SELECT a FROM savepoints WHERE a BETWEEN 12 AND 17;
BEGIN;
INSERT INTO savepoints VALUES (18);
SAVEPOINT one;
INSERT INTO savepoints VALUES (19);
SAVEPOINT two;
INSERT INTO savepoints VALUES (20);
ROLLBACK TO SAVEPOINT one;
INSERT INTO savepoints VALUES (21);
ROLLBACK TO SAVEPOINT one;
INSERT INTO savepoints VALUES (22);
COMMIT;
SELECT a FROM savepoints WHERE a BETWEEN 18 AND 22;
DROP TABLE savepoints;
-- only in a transaction block:
SAVEPOINT one;
ROLLBACK TO SAVEPOINT one;
RELEASE SAVEPOINT one;
-- Only "rollback to" allowed in aborted state
BEGIN;
SAVEPOINT one;
SELECT 0/0;
SAVEPOINT two; -- ignored till the end of ...
RELEASE SAVEPOINT one; -- ignored till the end of ...
ROLLBACK TO SAVEPOINT one;
SELECT 1;
COMMIT;
SELECT 1; -- this should work
-- check non-transactional behavior of cursors
BEGIN;
DECLARE c CURSOR FOR SELECT unique2 FROM tenk1 ORDER BY unique2;
SAVEPOINT one;
FETCH 10 FROM c;
ROLLBACK TO SAVEPOINT one;
FETCH 10 FROM c;
RELEASE SAVEPOINT one;
FETCH 10 FROM c;
CLOSE c;
DECLARE c CURSOR FOR SELECT unique2/0 FROM tenk1 ORDER BY unique2;
SAVEPOINT two;
FETCH 10 FROM c;
ROLLBACK TO SAVEPOINT two;
-- c is now dead to the world ...
FETCH 10 FROM c;
ROLLBACK TO SAVEPOINT two;
RELEASE SAVEPOINT two;
FETCH 10 FROM c;
COMMIT;
--
-- Check that "stable" functions are really stable. They should not be
-- able to see the partial results of the calling query. (Ideally we would
-- also check that they don't see commits of concurrent transactions, but
-- that's a mite hard to do within the limitations of pg_regress.)
--
select * from xacttest;
create or replace function max_xacttest() returns smallint language sql as
'select max(a) from xacttest' stable READS SQL DATA;
begin;
update xacttest set a = max_xacttest() + 10 where a > 0;
select * from xacttest;
rollback;
-- But a volatile function can see the partial results of the calling query
create or replace function max_xacttest() returns smallint language sql as
'select max(a) from xacttest' volatile READS SQL DATA;
begin;
update xacttest set a = max_xacttest() + 10 where a > 0;
select * from xacttest;
rollback;
-- Now the same test with plpgsql (since it depends on SPI which is different)
create or replace function max_xacttest() returns smallint language plpgsql as
'begin return max(a) from xacttest; end' stable READS SQL DATA;
begin;
update xacttest set a = max_xacttest() + 10 where a > 0;
select * from xacttest;
rollback;
create or replace function max_xacttest() returns smallint language plpgsql as
'begin return max(a) from xacttest; end' volatile READS SQL DATA;
begin;
update xacttest set a = max_xacttest() + 10 where a > 0;
select * from xacttest;
rollback;
-- test case for problems with dropping an open relation during abort
BEGIN;
savepoint x;
CREATE TABLE koju (a INT UNIQUE);
INSERT INTO koju VALUES (1);
INSERT INTO koju VALUES (1);
rollback to x;
CREATE TABLE koju (a INT UNIQUE);
INSERT INTO koju VALUES (1);
INSERT INTO koju VALUES (1);
ROLLBACK;
DROP TABLE trans_foo;
DROP TABLE trans_baz;
DROP TABLE trans_barbaz;
-- test case for problems with revalidating an open relation during abort
create function inverse(int) returns float8 as
$$
begin
analyze revalidate_bug;
return 1::float8/$1;
exception
when division_by_zero then return 0;
end$$ language plpgsql volatile;
create table revalidate_bug (c float8 unique);
insert into revalidate_bug values (1);
insert into revalidate_bug values (inverse(0));
drop table revalidate_bug;
drop function inverse(int);
-- verify that cursors created during an aborted subtransaction are
-- closed, but that we do not rollback the effect of any FETCHs
-- performed in the aborted subtransaction
begin;
savepoint x;
create table abc (a int);
insert into abc values (5);
insert into abc values (10);
declare foo cursor for select * from abc;
fetch from foo;
rollback to x;
-- should fail
fetch from foo;
commit;
begin;
create table abc (a int);
insert into abc values (5);
insert into abc values (10);
insert into abc values (15);
declare foo cursor for select * from abc;
fetch from foo;
savepoint x;
fetch from foo;
rollback to x;
fetch from foo;
abort;
-- Test for proper cleanup after a failure in a cursor portal
-- that was created in an outer subtransaction
CREATE FUNCTION invert(x float8) RETURNS float8 LANGUAGE plpgsql AS
$$ begin return 1/x; end $$;
CREATE FUNCTION create_temp_tab() RETURNS text
LANGUAGE plpgsql AS $$
BEGIN
CREATE TEMP TABLE new_table (f1 float8);
-- case of interest is that we fail while holding an open
-- relcache reference to new_table
INSERT INTO new_table SELECT invert(0.0);
RETURN 'foo';
END $$;
BEGIN;
DECLARE ok CURSOR FOR SELECT * FROM int8_tbl;
DECLARE ctt CURSOR FOR SELECT create_temp_tab();
FETCH ok;
SAVEPOINT s1;
FETCH ok; -- should work
FETCH ctt; -- error occurs here
ROLLBACK TO s1;
FETCH ok; -- should work
FETCH ctt; -- must be rejected
COMMIT;
DROP FUNCTION create_temp_tab();
DROP FUNCTION invert(x float8);
-- Tests for AND CHAIN
CREATE TABLE abc (a int);
-- set nondefault value so we have something to override below
SET default_transaction_read_only = on;
START TRANSACTION ISOLATION LEVEL REPEATABLE READ, READ WRITE, DEFERRABLE;
SHOW transaction_isolation;
SHOW transaction_read_only;
SHOW transaction_deferrable;
INSERT INTO abc VALUES (1);
INSERT INTO abc VALUES (2);
COMMIT AND CHAIN; -- TBLOCK_END
SHOW transaction_isolation;
SHOW transaction_read_only;
SHOW transaction_deferrable;
INSERT INTO abc VALUES ('error');
INSERT INTO abc VALUES (3); -- check it's really aborted
COMMIT AND CHAIN; -- TBLOCK_ABORT_END
SHOW transaction_isolation;
SHOW transaction_read_only;
SHOW transaction_deferrable;
INSERT INTO abc VALUES (4);
COMMIT;
START TRANSACTION ISOLATION LEVEL REPEATABLE READ, READ WRITE, DEFERRABLE;
SHOW transaction_isolation;
SHOW transaction_read_only;
SHOW transaction_deferrable;
SAVEPOINT x;
INSERT INTO abc VALUES ('error');
COMMIT AND CHAIN; -- TBLOCK_ABORT_PENDING
SHOW transaction_isolation;
SHOW transaction_read_only;
SHOW transaction_deferrable;
INSERT INTO abc VALUES (5);
COMMIT;
-- different mix of options just for fun
START TRANSACTION ISOLATION LEVEL SERIALIZABLE, READ WRITE, NOT DEFERRABLE;
SHOW transaction_isolation;
SHOW transaction_read_only;
SHOW transaction_deferrable;
INSERT INTO abc VALUES (6);
ROLLBACK AND CHAIN; -- TBLOCK_ABORT_PENDING
SHOW transaction_isolation;
SHOW transaction_read_only;
SHOW transaction_deferrable;
INSERT INTO abc VALUES ('error');
ROLLBACK AND CHAIN; -- TBLOCK_ABORT_END
SHOW transaction_isolation;
SHOW transaction_read_only;
SHOW transaction_deferrable;
ROLLBACK;
SELECT * FROM abc ORDER BY 1;
RESET default_transaction_read_only;
DROP TABLE abc;
-- Test assorted behaviors around the implicit transaction block created
-- when multiple SQL commands are sent in a single Query message. These
-- tests rely on the fact that psql will not break SQL commands apart at a
-- backslash-quoted semicolon, but will send them as one Query.
create temp table i_table (f1 int);
-- psql will show only the last result in a multi-statement Query
SELECT 1\; SELECT 2\; SELECT 3;
-- this implicitly commits:
insert into i_table values(1)\; select * from i_table;
-- 1/0 error will cause rolling back the whole implicit transaction
insert into i_table values(2)\; select * from i_table\; select 1/0;
select * from i_table;
rollback; -- we are not in a transaction at this point
-- can use regular begin/commit/rollback within a single Query
begin\; insert into i_table values(3)\; commit;
rollback; -- we are not in a transaction at this point
begin\; insert into i_table values(4)\; rollback;
rollback; -- we are not in a transaction at this point
-- begin converts implicit transaction into a regular one that
-- can extend past the end of the Query
select 1\; begin\; insert into i_table values(5);
commit;
select 1\; begin\; insert into i_table values(6);
rollback;
-- commit in implicit-transaction state commits but issues a warning.
insert into i_table values(7)\; commit\; insert into i_table values(8)\; select 1/0;
-- similarly, rollback aborts but issues a warning.
insert into i_table values(9)\; rollback\; select 2;
select * from i_table;
rollback; -- we are not in a transaction at this point
-- implicit transaction block is still a transaction block, for e.g. VACUUM
SELECT 1\; VACUUM;
SELECT 1\; COMMIT\; VACUUM;
-- we disallow savepoint-related commands in implicit-transaction state
SELECT 1\; SAVEPOINT sp;
SELECT 1\; COMMIT\; SAVEPOINT sp;
ROLLBACK TO SAVEPOINT sp\; SELECT 2;
SELECT 2\; RELEASE SAVEPOINT sp\; SELECT 3;
-- but this is OK, because the BEGIN converts it to a regular xact
SELECT 1\; BEGIN\; SAVEPOINT sp\; ROLLBACK TO SAVEPOINT sp\; COMMIT;
-- Test for successful cleanup of an aborted transaction at session exit.
-- THIS MUST BE THE LAST TEST IN THIS FILE.
begin;
select 1/0;
rollback to X;
-- DO NOT ADD ANYTHING HERE. | the_stack |
-- 2018-01-09T12:04:16.091
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_Message (AD_Client_ID,AD_Message_ID,AD_Org_ID,Created,CreatedBy,EntityType,IsActive,MsgText,MsgType,Updated,UpdatedBy,Value) VALUES (0,544619,0,TO_TIMESTAMP('2018-01-09 12:04:15','YYYY-MM-DD HH24:MI:SS'),100,'de.metas.ui.web','Y','Heute','I',TO_TIMESTAMP('2018-01-09 12:04:15','YYYY-MM-DD HH24:MI:SS'),100,'webui.window.daterange.today')
;
-- 2018-01-09T12:04:16.100
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_Message_Trl (AD_Language,AD_Message_ID, MsgText,MsgTip, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Message_ID, t.MsgText,t.MsgTip, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Message t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Message_ID=544619 AND NOT EXISTS (SELECT 1 FROM AD_Message_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Message_ID=t.AD_Message_ID)
;
-- 2018-01-09T12:25:24.834
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Message SET MsgTip='window.attachment.title',Updated=TO_TIMESTAMP('2018-01-09 12:25:24','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Message_ID=544619
;
-- 2018-01-09T12:28:23.496
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Message SET MsgTip='',Updated=TO_TIMESTAMP('2018-01-09 12:28:23','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Message_ID=544619
;
-- 2018-01-09T12:38:14.630
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_Message (AD_Client_ID,AD_Message_ID,AD_Org_ID,Created,CreatedBy,EntityType,IsActive,MsgText,MsgTip,MsgType,Updated,UpdatedBy,Value) VALUES (0,544620,0,TO_TIMESTAMP('2018-01-09 12:38:14','YYYY-MM-DD HH24:MI:SS'),100,'de.metas.ui.web','Y','Gestern','','I',TO_TIMESTAMP('2018-01-09 12:38:14','YYYY-MM-DD HH24:MI:SS'),100,'window.daterange.yesterday')
;
-- 2018-01-09T12:38:14.632
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_Message_Trl (AD_Language,AD_Message_ID, MsgText,MsgTip, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Message_ID, t.MsgText,t.MsgTip, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Message t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Message_ID=544620 AND NOT EXISTS (SELECT 1 FROM AD_Message_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Message_ID=t.AD_Message_ID)
;
-- 2018-01-09T12:39:15.609
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_Message (AD_Client_ID,AD_Message_ID,AD_Org_ID,Created,CreatedBy,EntityType,IsActive,MsgText,MsgTip,MsgType,Updated,UpdatedBy,Value) VALUES (0,544621,0,TO_TIMESTAMP('2018-01-09 12:39:15','YYYY-MM-DD HH24:MI:SS'),100,'de.metas.ui.web','Y','Letzte 7 Tage','','I',TO_TIMESTAMP('2018-01-09 12:39:15','YYYY-MM-DD HH24:MI:SS'),100,'window.daterange.last7days')
;
-- 2018-01-09T12:39:15.613
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_Message_Trl (AD_Language,AD_Message_ID, MsgText,MsgTip, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Message_ID, t.MsgText,t.MsgTip, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Message t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Message_ID=544621 AND NOT EXISTS (SELECT 1 FROM AD_Message_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Message_ID=t.AD_Message_ID)
;
-- 2018-01-09T12:39:44.284
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_Message (AD_Client_ID,AD_Message_ID,AD_Org_ID,Created,CreatedBy,EntityType,IsActive,MsgText,MsgTip,MsgType,Updated,UpdatedBy,Value) VALUES (0,544622,0,TO_TIMESTAMP('2018-01-09 12:39:44','YYYY-MM-DD HH24:MI:SS'),100,'de.metas.ui.web','Y','Letzte 30 Tage','','I',TO_TIMESTAMP('2018-01-09 12:39:44','YYYY-MM-DD HH24:MI:SS'),100,'window.daterange.last30days')
;
-- 2018-01-09T12:39:44.285
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_Message_Trl (AD_Language,AD_Message_ID, MsgText,MsgTip, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Message_ID, t.MsgText,t.MsgTip, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Message t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Message_ID=544622 AND NOT EXISTS (SELECT 1 FROM AD_Message_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Message_ID=t.AD_Message_ID)
;
-- 2018-01-09T12:40:18.867
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_Message (AD_Client_ID,AD_Message_ID,AD_Org_ID,Created,CreatedBy,EntityType,IsActive,MsgText,MsgTip,MsgType,Updated,UpdatedBy,Value) VALUES (0,544623,0,TO_TIMESTAMP('2018-01-09 12:40:18','YYYY-MM-DD HH24:MI:SS'),100,'de.metas.ui.web','Y','Dieser Monat','','I',TO_TIMESTAMP('2018-01-09 12:40:18','YYYY-MM-DD HH24:MI:SS'),100,'window.daterange.thismonth')
;
-- 2018-01-09T12:40:18.869
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_Message_Trl (AD_Language,AD_Message_ID, MsgText,MsgTip, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Message_ID, t.MsgText,t.MsgTip, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Message t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Message_ID=544623 AND NOT EXISTS (SELECT 1 FROM AD_Message_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Message_ID=t.AD_Message_ID)
;
-- 2018-01-09T12:40:57.869
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_Message (AD_Client_ID,AD_Message_ID,AD_Org_ID,Created,CreatedBy,EntityType,IsActive,MsgText,MsgTip,MsgType,Updated,UpdatedBy,Value) VALUES (0,544624,0,TO_TIMESTAMP('2018-01-09 12:40:57','YYYY-MM-DD HH24:MI:SS'),100,'de.metas.ui.web','Y','Letzter Monat','','I',TO_TIMESTAMP('2018-01-09 12:40:57','YYYY-MM-DD HH24:MI:SS'),100,'window.daterange.lastmonth')
;
-- 2018-01-09T12:40:57.873
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_Message_Trl (AD_Language,AD_Message_ID, MsgText,MsgTip, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Message_ID, t.MsgText,t.MsgTip, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Message t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Message_ID=544624 AND NOT EXISTS (SELECT 1 FROM AD_Message_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Message_ID=t.AD_Message_ID)
;
-- 2018-01-09T13:34:11.893
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Message_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2018-01-09 13:34:11','YYYY-MM-DD HH24:MI:SS'),IsTranslated='Y',MsgText='Today' WHERE AD_Message_ID=544619 AND AD_Language='en_US'
;
-- 2018-01-09T13:34:34.462
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Message_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2018-01-09 13:34:34','YYYY-MM-DD HH24:MI:SS'),IsTranslated='Y',MsgText='Last 30 Days' WHERE AD_Message_ID=544622 AND AD_Language='en_US'
;
-- 2018-01-09T13:34:45.693
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Message_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2018-01-09 13:34:45','YYYY-MM-DD HH24:MI:SS'),IsTranslated='Y',MsgText='Last 7 Days' WHERE AD_Message_ID=544621 AND AD_Language='en_US'
;
-- 2018-01-09T13:35:00.461
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Message_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2018-01-09 13:35:00','YYYY-MM-DD HH24:MI:SS'),IsTranslated='Y',MsgText='Last Month' WHERE AD_Message_ID=544624 AND AD_Language='en_US'
;
-- 2018-01-09T13:35:22.393
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Message_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2018-01-09 13:35:22','YYYY-MM-DD HH24:MI:SS'),IsTranslated='Y',MsgText='This Month' WHERE AD_Message_ID=544623 AND AD_Language='en_US'
;
-- 2018-01-09T13:35:32.309
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Message_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2018-01-09 13:35:32','YYYY-MM-DD HH24:MI:SS'),IsTranslated='Y',MsgText='Yesterday' WHERE AD_Message_ID=544620 AND AD_Language='en_US'
;
-- 2018-01-09T13:38:47.934
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Message SET Value='webui.window.daterange.last30days',Updated=TO_TIMESTAMP('2018-01-09 13:38:47','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Message_ID=544622
;
-- 2018-01-09T13:38:51.624
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Message SET Value='webui.window.daterange.last7days',Updated=TO_TIMESTAMP('2018-01-09 13:38:51','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Message_ID=544621
;
-- 2018-01-09T13:38:54.209
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Message SET Value='webui.window.daterange.lastmonth',Updated=TO_TIMESTAMP('2018-01-09 13:38:54','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Message_ID=544624
;
-- 2018-01-09T13:38:56.840
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Message SET Value='webui.window.daterange.thismonth',Updated=TO_TIMESTAMP('2018-01-09 13:38:56','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Message_ID=544623
;
-- 2018-01-09T13:39:01.776
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Message SET Value='webui.window.daterange.yesterday',Updated=TO_TIMESTAMP('2018-01-09 13:39:01','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Message_ID=544620
;
-- 2018-01-09T13:53:05.537
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_Message (AD_Client_ID,AD_Message_ID,AD_Org_ID,Created,CreatedBy,EntityType,IsActive,MsgText,MsgTip,MsgType,Updated,UpdatedBy,Value) VALUES (0,544625,0,TO_TIMESTAMP('2018-01-09 13:53:05','YYYY-MM-DD HH24:MI:SS'),100,'de.metas.ui.web','Y','Individuell','','I',TO_TIMESTAMP('2018-01-09 13:53:05','YYYY-MM-DD HH24:MI:SS'),100,'webui.window.daterange.custom')
;
-- 2018-01-09T13:53:05.541
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_Message_Trl (AD_Language,AD_Message_ID, MsgText,MsgTip, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Message_ID, t.MsgText,t.MsgTip, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Message t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Message_ID=544625 AND NOT EXISTS (SELECT 1 FROM AD_Message_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Message_ID=t.AD_Message_ID)
;
-- 2018-01-09T13:53:17.056
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Message_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2018-01-09 13:53:17','YYYY-MM-DD HH24:MI:SS'),IsTranslated='Y',MsgText='Custom' WHERE AD_Message_ID=544625 AND AD_Language='en_US'
;
-- 2018-01-09T13:58:41.671
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_Message (AD_Client_ID,AD_Message_ID,AD_Org_ID,Created,CreatedBy,EntityType,IsActive,MsgText,MsgTip,MsgType,Updated,UpdatedBy,Value) VALUES (0,544626,0,TO_TIMESTAMP('2018-01-09 13:58:41','YYYY-MM-DD HH24:MI:SS'),100,'de.metas.ui.web','Y','Anwenden','','I',TO_TIMESTAMP('2018-01-09 13:58:41','YYYY-MM-DD HH24:MI:SS'),100,'webui.window.daterange.apply')
;
-- 2018-01-09T13:58:41.676
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_Message_Trl (AD_Language,AD_Message_ID, MsgText,MsgTip, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Message_ID, t.MsgText,t.MsgTip, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Message t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Message_ID=544626 AND NOT EXISTS (SELECT 1 FROM AD_Message_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Message_ID=t.AD_Message_ID)
;
-- 2018-01-09T13:58:49.325
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Message_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2018-01-09 13:58:49','YYYY-MM-DD HH24:MI:SS'),IsTranslated='Y',MsgText='Apply' WHERE AD_Message_ID=544626 AND AD_Language='en_US'
;
-- 2018-01-09T13:59:23.046
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_Message (AD_Client_ID,AD_Message_ID,AD_Org_ID,Created,CreatedBy,EntityType,IsActive,MsgText,MsgTip,MsgType,Updated,UpdatedBy,Value) VALUES (0,544627,0,TO_TIMESTAMP('2018-01-09 13:59:22','YYYY-MM-DD HH24:MI:SS'),100,'de.metas.ui.web','Y','Abbrechen','','I',TO_TIMESTAMP('2018-01-09 13:59:22','YYYY-MM-DD HH24:MI:SS'),100,'webui.window.daterange.cancel')
;
-- 2018-01-09T13:59:23.049
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_Message_Trl (AD_Language,AD_Message_ID, MsgText,MsgTip, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Message_ID, t.MsgText,t.MsgTip, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Message t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Message_ID=544627 AND NOT EXISTS (SELECT 1 FROM AD_Message_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Message_ID=t.AD_Message_ID)
;
-- 2018-01-09T13:59:30.848
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Message_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2018-01-09 13:59:30','YYYY-MM-DD HH24:MI:SS'),IsTranslated='Y',MsgText='Cancel' WHERE AD_Message_ID=544627 AND AD_Language='en_US'
; | the_stack |
-- @@@ START COPYRIGHT @@@
--
-- Licensed to the Apache Software Foundation (ASF) under one
-- or more contributor license agreements. See the NOTICE file
-- distributed with this work for additional information
-- regarding copyright ownership. The ASF licenses this file
-- to you under the Apache License, Version 2.0 (the
-- "License"); you may not use this file except in compliance
-- with the License. You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing,
-- software distributed under the License is distributed on an
-- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-- KIND, either express or implied. See the License for the
-- specific language governing permissions and limitations
-- under the License.
--
-- @@@ END COPYRIGHT @@@
/* teste245.sql
* Mike Hanlon & Suresh Subbiah
* 02-16-2005
*
* embedded C tests for Non Atomic Rowsets
* Test Classification: Positive
* Test Level: Functional
* Test Coverage:
* non-VSBB Non-Atomic Rowset insert tests
*
*/
/* DDL for table nt1 is
CREATE TABLE nt1 (id int not null,
eventtime timestamp,
description varchar(12),
primary key (id), check (id > 0)) ; */
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <string.h>
#define NAR00 30022
#define SIZE 50
void display_diagnosis();
Int32 test1();
Int32 test2();
Int32 test3();
Int32 test4();
Int32 test5();
Int32 test6();
Int32 test7();
Int32 test8();
Int32 test9();
Int32 test10();
Int32 test11();
Int32 test12();
Int32 test13();
Int32 test14();
Int32 test15();
EXEC SQL MODULE CAT.SCH.TESTE245M NAMES ARE ISO88591;
/* globals */
EXEC SQL BEGIN DECLARE SECTION;
ROWSET [SIZE] Int32 a_int;
ROWSET [SIZE] VARCHAR b_char6[6];
ROWSET [SIZE] VARCHAR b_char3[3];
ROWSET [SIZE] Int32 b_date;
ROWSET [SIZE] char b_char11[11];
ROWSET [SIZE] short a_ind ;
ROWSET [SIZE] VARCHAR b_char5[5];
ROWSET [SIZE] Int32 b_int;
ROWSET [SIZE] char name_char[3];
ROWSET [SIZE] char pattern_char[4];
ROWSET [SIZE] VARCHAR escape_char[3];
char n_char[3];
char p_char[4];
char e_char[3];
ROWSET [SIZE] Int32 j;
Int32 numRows ;
Int32 savesqlcode;
EXEC SQL END DECLARE SECTION;
EXEC SQL BEGIN DECLARE SECTION;
/**** host variables for get diagnostics *****/
NUMERIC(5) i;
NUMERIC(5) hv_num;
Int32 hv_sqlcode;
Int32 hv_rowindex;
Int32 hv_rowcount;
char hv_msgtxt[329];
char hv_sqlstate[6];
char hv_tabname[129];
char hv_more[2];
char SQLSTATE[6];
Int32 SQLCODE;
EXEC SQL END DECLARE SECTION;
Int32 main()
{
test1();
test2();
test3();
test4();
test5();
test6();
test7();
test8();
test9();
test10();
test11();
test12();
test13();
// test14();
test15();
return 0;
}
Int32 test1()
{
printf("\n ***TEST1 : Expecting -8102 on row 25***\n");
EXEC SQL DELETE FROM nt1 ;
Int32 i=0;
for (i=0; i<SIZE; i++)
a_int[i] = i+1;
a_int[25] = 23 ;
EXEC SQL
INSERT INTO nt1 VALUES (:a_int, cast( '05.01.1997 03.04.55.123456' as timestamp),'how are you?') NOT ATOMIC ;
if (SQLCODE != 0 && SQLCODE != NAR00) {
printf("Failed to insert. SQLCODE = %d\n",SQLCODE);
}
else {
display_diagnosis();
EXEC SQL COMMIT ;
}
return(0);
}
Int32 test2()
{
printf("\n ***TEST2 : Expecting -8402 on row 25***\n");
EXEC SQL DELETE FROM nt1 ;
Int32 i=0;
for (i=0; i<SIZE; i++) {
a_int[i] = i+1;
strcpy(b_char6[i], "you?");
}
strcpy(b_char6[25], "you??");
EXEC SQL
INSERT INTO nt1 VALUES (:a_int, cast( '05.01.1997 03.04.55.123456' as timestamp),'how are ' || :b_char6) NOT ATOMIC ;
if (SQLCODE < 0) {
printf("Failed to insert. SQLCODE = %d\n",SQLCODE);
}
else {
display_diagnosis();
EXEC SQL COMMIT ;
}
return(0);
}
Int32 test3()
{
printf("\n ***TEST3 : Expecting -8404 on row 9***\n");
EXEC SQL DELETE FROM nt1 ;
Int32 i=0;
for (i=0; i<SIZE; i++) {
a_int[i] = i+1;
strcpy(b_char3[i], "?") ;
}
strcpy(b_char3[9], "??") ;
EXEC SQL
INSERT INTO nt1 VALUES (:a_int, cast( '05.01.1997 03.04.55.123456' as timestamp),
TRIM(:b_char3 FROM 'how are you?')) NOT ATOMIC ;
if (SQLCODE < 0) {
printf("Failed to insert. SQLCODE = %d\n",SQLCODE);
}
else {
display_diagnosis();
EXEC SQL COMMIT ;
}
return(0);
}
Int32 test4()
{
printf("\n ***TEST4 : Expecting -8405 on row 32***\n");
EXEC SQL DELETE FROM nt1 ;
Int32 i=0;
for (i=0; i<SIZE; i++) {
a_int[i] = i+1;
b_date[i] = 1 ;
}
b_date[32] = -1 ;
EXEC SQL
INSERT INTO nt1
VALUES (:a_int,
CONVERTTIMESTAMP(:b_date*211696834500000000),
'how are you?') NOT ATOMIC ;
if (SQLCODE < 0) {
printf("Failed to insert. SQLCODE = %d\n",SQLCODE);
}
else {
display_diagnosis();
EXEC SQL COMMIT ;
}
return(0);
}
Int32 test5()
{
printf("\n ***TEST5 : Expecting -8415 on row 7***\n");
EXEC SQL DELETE FROM nt2 ;
Int32 i=0;
for (i=0; i<SIZE; i++) {
a_int[i] = i+1;
strcpy(b_char11[i], "2000-11-11");
}
strcpy(b_char11[7], "2000-yy-zz");
EXEC SQL
INSERT INTO nt2 VALUES (:a_int,
cast( :b_char11 as date)) NOT ATOMIC ;
if (SQLCODE < 0) {
printf("Failed to insert. SQLCODE = %d\n",SQLCODE);
}
else {
display_diagnosis();
EXEC SQL COMMIT ;
}
return(0);
}
Int32 test6()
{
printf("\n ***TEST6 : Expecting -8421 on all rows except row 5***\n");
EXEC SQL DELETE FROM nt1 ;
Int32 i=0;
for (i=0; i<SIZE; i++) {
a_int[i] = i+1;
a_ind[i] = -1;
strcpy(b_char5[i], "you?");
}
a_ind[5] = 0;
EXEC SQL
INSERT INTO nt1 VALUES (:a_int :a_ind, cast( '05.01.1997 03.04.55.123456' as timestamp),'how are ' || :b_char5) NOT ATOMIC ;
if (SQLCODE < 0) {
printf("Failed to insert. SQLCODE = %d\n",SQLCODE);
}
else {
display_diagnosis();
EXEC SQL COMMIT ;
}
return(0);
}
Int32 test7()
{
printf("\n ***TEST7 : Expecting -8409 on row 45***\n");
EXEC SQL DELETE FROM nt1 ;
Int32 i=0;
for (i=0; i<SIZE; i++) {
a_int[i] = i+1;
b_int[i] = 1001 + i;
name_char[i][0] = 'a';
name_char[i][1] = 'b';
name_char[i][2] = 'c';
pattern_char[i][0] = 'a';
pattern_char[i][1] = 'b';
pattern_char[i][2] = 'c';
pattern_char[i][3] = 0;
escape_char[i][0] = '$';
escape_char[i][1] = 0;
escape_char[i][2] = 0;
}
escape_char[45][1] = 'a';
EXEC SQL
INSERT INTO nt1 VALUES (case when :name_char like :pattern_char escape :escape_char then :a_int else :b_int end, cast( '05.01.1997 03.04.55.123456' as timestamp),'how are you?') NOT ATOMIC;
if (SQLCODE != 0 && SQLCODE != NAR00) {
printf("Failed to insert. SQLCODE = %d\n",SQLCODE);
}
else {
display_diagnosis();
EXEC SQL COMMIT ;
}
return(0);
}
Int32 test8()
{
printf("\n ***TEST8 : Expecting -8410 on row 25***\n");
EXEC SQL DELETE FROM nt1 ;
Int32 i=0;
for (i=0; i<SIZE; i++) {
a_int[i] = i+1;
b_int[i] = 1001 + i;
name_char[i][0] = 'a';
name_char[i][1] = 'b';
name_char[i][2] = 'c';
pattern_char[i][0] = 'a';
pattern_char[i][1] = 'b';
pattern_char[i][2] = 'c';
pattern_char[i][3] = 0;
}
pattern_char[25][2] = '$';
EXEC SQL
INSERT INTO nt1 VALUES (case when :name_char like :pattern_char escape '$' then :a_int else :b_int end, cast( '05.01.1997 03.04.55.123456' as timestamp),'how are you?') NOT ATOMIC;
if (SQLCODE != 0 && SQLCODE != NAR00) {
printf("Failed to insert. SQLCODE = %d\n",SQLCODE);
}
else {
display_diagnosis();
EXEC SQL COMMIT ;
}
return(0);
}
Int32 test9()
{
printf("\n ***TEST9 : Expecting -8419 on rows 1,2,3,4,5,41,42,43,44, & 45. Also expecting -8102 on row 40***\n");
EXEC SQL DELETE FROM nt1 ;
i=0;
for (i=0; i<SIZE; i++) {
a_int[i] = i+1;
j[i] = 1;
}
a_int[40] = 1 ;
j[1] = 0;
j[2] = 0;
j[3] = 0;
j[4] = 0;
j[5] = 0;
j[41] = 0;
j[42] = 0;
j[43] = 0;
j[44] = 0;
j[45] = 0;
EXEC SQL
INSERT INTO nt1 VALUES (:a_int/:j, cast( '05.01.1997 03.04.55.123456' as timestamp),'how are you?') NOT ATOMIC ;
if (SQLCODE != 0 && SQLCODE != NAR00) {
printf("Failed to insert. SQLCODE = %d\n",SQLCODE);
}
else {
display_diagnosis();
EXEC SQL COMMIT ;
}
return(0);
}
Int32 test10()
{
printf("\n ***TEST10 : Expecting -8102 on all rows except row 0***\n");
EXEC SQL DELETE FROM nt1 ;
i=0;
for (i=0; i<SIZE; i++) {
a_int[i] = 1;
}
EXEC SQL
INSERT INTO nt1 VALUES (:a_int, cast( '05.01.1997 03.04.55.123456' as timestamp),'how are you?') NOT ATOMIC ;
if (SQLCODE != 0 && SQLCODE != NAR00) {
printf("Failed to insert. SQLCODE = %d\n",SQLCODE);
}
else {
display_diagnosis();
EXEC SQL COMMIT ;
}
return(0);
}
Int32 test11()
{
printf("\n ***TEST11 : Expecting -8412 on all rows ***\n");
EXEC SQL DELETE FROM nt1 ;
Int32 i=0;
for (i=0; i<SIZE; i++) {
a_int[i] = i+1;
memset(b_char5[i], '?', 5);
}
exec sql control query default upd_savepoint_on_error 'OFF';
EXEC SQL
INSERT INTO nt1 VALUES (:a_int, cast( '05.01.1997 03.04.55.123456' as timestamp),'how are ' || :b_char5) NOT ATOMIC ;
if (SQLCODE < 0) {
display_diagnosis();
printf("Failed to insert. SQLCODE = %d\n",SQLCODE);
}
else {
display_diagnosis();
EXEC SQL COMMIT ;
}
return(0);
}
Int32 test12()
{
printf("\n ***TEST12 : Expecting -8101 on all rows ***\n");
EXEC SQL DELETE FROM nt1 ;
i=0;
for (i=0; i<SIZE; i++) {
a_int[i] = 0;
}
EXEC SQL
INSERT INTO nt1 VALUES (:a_int, cast( '05.01.1997 03.04.55.123456' as timestamp),'how are you?') NOT ATOMIC ;
if (SQLCODE != 0 && SQLCODE != NAR00) {
display_diagnosis();
printf("Failed to insert. SQLCODE = %d\n",SQLCODE);
}
else {
display_diagnosis();
EXEC SQL COMMIT ;
}
return(0);
}
Int32 test13()
{
printf("\n ***TEST13 : Expecting -30031 after 35 8412 conditions ***\n");
EXEC SQL DELETE FROM nt1 ;
Int32 i=0;
for (i=0; i<SIZE; i++) {
a_int[i] = i+1;
memset(b_char5[i], '?', 5);
}
EXEC SQL CONTROL QUERY DEFAULT NOT_ATOMIC_FAILURE_LIMIT '35' ;
EXEC SQL
INSERT INTO nt1 VALUES (:a_int, cast( '05.01.1997 03.04.55.123456' as timestamp),'how are ' || :b_char5) NOT ATOMIC ;
if (SQLCODE < 0) {
display_diagnosis();
printf("Failed to insert. SQLCODE = %d\n",SQLCODE);
}
else {
display_diagnosis();
EXEC SQL COMMIT ;
}
return(0);
}
Int32 test14()
{
printf("\n ***TEST14 : Expecting -30031 after 40 -8102 conditions ***\n");
EXEC SQL DELETE FROM nt1 ;
i=0;
for (i=0; i<SIZE; i++) {
a_int[i] = 1;
}
EXEC SQL CONTROL QUERY DEFAULT NOT_ATOMIC_FAILURE_LIMIT '40' ;
EXEC SQL
INSERT INTO nt1 VALUES (:a_int, cast( '05.01.1997 03.04.55.123456' as timestamp),'how are you?') NOT ATOMIC ;
if (SQLCODE != 0 && SQLCODE != NAR00) {
display_diagnosis();
printf("Failed to insert. SQLCODE = %d\n",SQLCODE);
}
else {
display_diagnosis();
EXEC SQL COMMIT ;
}
return(0);
}
/******************************************************************************
Function: test15
Description:
------------
This tests attempts to cause an assertion in executor/ex_tuple_flow
(Non-Atomic insert received no diags area from the CLI)
by preparing and executing a non atomic rowset insert statement,
changing the table definition, and executing the same statement again.
The table definition change should remove the file open handle
aquired when the statement is first executed. The table definition change
should not require a recompilation of the plan.
- Grant privileges
- Prepare and execute non atomic rowset insert
- Revoke privileges
- Re-execute non atomic rowset insert
******************************************************************************/
Int32
test15()
{
printf("\n ***TEST15***\n");
// grant priviledges
EXEC SQL
GRANT ALL PRIVILEGES ON TABLE nt1 TO "sql.user1";
// create new data for the insert
Int32 i=0;
for (i=0; i<SIZE; i++)
{
a_int[i] = SIZE+i+1;
}
// insert, revoke privileges, insert again
for(i=0;i<2;i++)
{
EXEC SQL
INSERT INTO nt1 VALUES (:a_int,
cast( '05.01.1997 03.04.55.123456' as timestamp),
'how are you?') NOT ATOMIC ;
// create new data to avoid duplicate insertion errors
for (i=0; i<SIZE; i++)
{
a_int[i] = (SIZE*2)+i+1;
}
if( i == 0 )
{
EXEC SQL
REVOKE ALL PRIVILEGES ON TABLE nt1 FROM "sql.user1";
}
}
// check for errors
if (SQLCODE != 0)
{
display_diagnosis();
printf( "[ERROR] SQLCODE = %d\n", SQLCODE);
}
else
{
display_diagnosis();
EXEC SQL COMMIT ;
}
return 0;
}
/*****************************************************/
void display_diagnosis()
/*****************************************************/
{
savesqlcode = SQLCODE ;
hv_rowcount = -1 ;
hv_rowindex = -2 ;
exec sql get diagnostics :hv_num = NUMBER,
:hv_rowcount = ROW_COUNT,
:hv_more = MORE;
memset(hv_msgtxt,' ',sizeof(hv_msgtxt));
hv_msgtxt[328]='\0';
memset(hv_sqlstate,' ',sizeof(hv_sqlstate));
hv_sqlstate[6]='\0';
hv_more[1] = '\0';
printf("Number of conditions : %d\n", hv_num);
printf("Number of rows inserted: %d\n", hv_rowcount);
printf("More conditions?: %s\n", hv_more);
printf("\n");
for (i = 1; i <= hv_num; i++) {
exec sql get diagnostics exception :i
:hv_tabname = TABLE_NAME,
:hv_sqlcode = SQLCODE,
:hv_sqlstate = RETURNED_SQLSTATE,
/* :hv_rowindex = ROW_INDEX, */
:hv_msgtxt = MESSAGE_TEXT;
Int32 rowcondnum = 103;
Int32 retcode ;
retcode = SQL_EXEC_GetDiagnosticsCondInfo2(rowcondnum, i, &hv_rowindex, 0,0,0);
printf("Condition number : %d\n", i);
printf("ROW INDEX : %d\n", hv_rowindex);
printf("SQLCODE : %d\n", hv_sqlcode);
printf("SQLSTATE : %s\n", hv_sqlstate);
printf("MESSAGE : %s\n", hv_msgtxt);
printf("TABLE : %s\n", hv_tabname);
printf("\n");
memset(hv_msgtxt,' ',sizeof(hv_msgtxt));
hv_msgtxt[328]='\0';
memset(hv_tabname,' ',sizeof(hv_tabname));
hv_tabname[128]='\0';
memset(hv_sqlstate,' ',sizeof(hv_sqlstate));
hv_sqlstate[6]='\0';
}
SQLCODE = savesqlcode ;
} | the_stack |
DELETE FROM tournament_rank_points;
INSERT INTO tournament_rank_points
(level, draw_type, result, rank_points, rank_points_2008, goat_points, additive)
VALUES
-- Grand Slam
('G', 'KO', 'W', 2000, 1000, 8, FALSE),
('G', 'KO', 'F', 1200, 700, 4, FALSE),
('G', 'KO', 'SF', 720, 450, 2, FALSE),
('G', 'KO', 'QF', 360, 250, 1, FALSE),
('G', 'KO', 'R16', 180, 150, NULL, FALSE),
('G', 'KO', 'R32', 90, 75, NULL, FALSE),
('G', 'KO', 'R64', 45, 35, NULL, FALSE),
('G', 'KO', 'R128', 10, 5, NULL, FALSE),
-- Tour Finals
('F', 'RR', 'W', NULL, NULL, NULL, TRUE),
('F', 'RR', 'F', 500, 250, 2, TRUE),
('F', 'RR', 'SF', 400, 200, 1, TRUE),
('F', 'RR', 'RR', 200, 100, 1, TRUE),
('F', 'KO', 'W', 1500, 750, 6, FALSE),
('F', 'KO', 'F', 1000, 600, 3, FALSE),
('F', 'KO', 'SF', 500, 300, 1, FALSE),
-- Alt. Finals
('L', 'KO', 'W', 1000, 500, 4, FALSE),
('L', 'KO', 'F', 600, 350, 2, FALSE),
('L', 'KO', 'SF', 360, 225, 1, FALSE),
-- Masters
('M', 'KO', 'W', 1000, 500, 4, FALSE),
('M', 'KO', 'F', 600, 350, 2, FALSE),
('M', 'KO', 'SF', 360, 225, 1, FALSE),
('M', 'KO', 'QF', 180, 125, NULL, FALSE),
('M', 'KO', 'R16', 90, 75, NULL, FALSE),
('M', 'KO', 'R32', 45, 35, NULL, FALSE),
('M', 'KO', 'R64', 10, 5, NULL, FALSE),
-- Olympics
('O', 'KO', 'W', 750, 400, 3, FALSE),
('O', 'KO', 'F', 450, 280, 2, FALSE),
('O', 'KO', 'BR', 340, 205, 1, FALSE),
('O', 'KO', 'SF', 270, 155, NULL, FALSE),
('O', 'KO', 'QF', 135, 100, NULL, FALSE),
('O', 'KO', 'R16', 70, 50, NULL, FALSE),
('O', 'KO', 'R32', 35, 25, NULL, FALSE),
('O', 'KO', 'R64', 5, 5, NULL, FALSE),
-- ATP 500
('A', 'KO', 'W', 500, 300, 2, FALSE),
('A', 'KO', 'F', 300, 210, 1, FALSE),
('A', 'KO', 'SF', 180, 135, NULL, FALSE),
('A', 'KO', 'QF', 90, 75, NULL, FALSE),
('A', 'KO', 'R16', 45, 25, NULL, FALSE),
('A', 'KO', 'R32', NULL, NULL, NULL, FALSE),
-- ATP 250
('B', 'KO', 'W', 250, 250, 1, FALSE),
('B', 'KO', 'F', 150, 175, NULL, FALSE),
('B', 'KO', 'SF', 90, 110, NULL, FALSE),
('B', 'KO', 'QF', 45, 60, NULL, FALSE),
('B', 'KO', 'R16', 20, 25, NULL, FALSE),
('B', 'KO', 'R32', NULL, NULL, NULL, FALSE),
-- Davis Cup
('D', 'KO', 'W', 75, NULL, NULL, TRUE),
('D', 'KO', 'F', 75, NULL, 1, TRUE),
('D', 'KO', 'SF', 70, NULL, NULL, TRUE),
('D', 'KO', 'QF', 65, NULL, NULL, TRUE),
('D', 'KO', 'R16', 40, NULL, NULL, TRUE),
('D', 'RR', 'F', NULL, NULL, 1, TRUE),
-- Team Cups
('T', 'KO', 'F', NULL, NULL, 1, TRUE),
('T', 'RR', 'F', NULL, NULL, 1, TRUE);
DELETE FROM tournament_event_rank_factor;
INSERT INTO tournament_event_rank_factor
(rank_from, rank_to, rank_factor)
VALUES
( 1, 1, 100),
( 2, 2, 85),
( 3, 3, 75),
( 4, 4, 67),
( 5, 5, 60),
( 6, 6, 55),
( 7, 8, 50),
( 9, 10, 45),
( 11, 13, 40),
( 14, 16, 35),
( 17, 20, 30),
( 21, 25, 25),
( 26, 30, 20),
( 31, 35, 16),
( 36, 40, 13),
( 41, 45, 10),
( 46, 50, 8),
( 51, 60, 6),
( 61, 70, 5),
( 71, 80, 4),
( 81, 100, 3),
(101, 150, 2),
(151, 200, 1);
DELETE FROM year_end_rank_goat_points;
INSERT INTO year_end_rank_goat_points
(year_end_rank, goat_points)
VALUES
(1, 8),
(2, 5),
(3, 3),
(4, 2),
(5, 1);
DELETE FROM best_rank_goat_points;
INSERT INTO best_rank_goat_points
(best_rank, goat_points)
VALUES
(1, 8),
(2, 5),
(3, 3),
(4, 2),
(5, 1);
DELETE FROM weeks_at_no1_goat_points;
INSERT INTO weeks_at_no1_goat_points
(weeks_for_point)
VALUES
(10);
DELETE FROM weeks_at_elo_topn_goat_points;
INSERT INTO weeks_at_elo_topn_goat_points
(rank, weeks_for_point)
VALUES
(1, 10),
(2, 20),
(3, 30),
(4, 50),
(5, 80);
DELETE FROM best_elo_rating_goat_points;
INSERT INTO best_elo_rating_goat_points
(best_elo_rating_rank, goat_points)
VALUES
( 1, 16),
( 2, 12),
( 3, 9),
( 4, 7),
( 5, 5),
( 6, 4),
( 7, 3),
( 8, 2),
( 9, 1),
(10, 1);
DELETE FROM best_surface_elo_rating_goat_points;
INSERT INTO best_surface_elo_rating_goat_points
(best_elo_rating_rank, goat_points)
VALUES
( 1, 8),
( 2, 5),
( 3, 3),
( 4, 2),
( 5, 1);
DELETE FROM best_indoor_elo_rating_goat_points;
INSERT INTO best_indoor_elo_rating_goat_points
(best_elo_rating_rank, goat_points)
VALUES
( 1, 4),
( 2, 2),
( 3, 1);
DELETE FROM best_in_match_elo_rating_goat_points;
INSERT INTO best_in_match_elo_rating_goat_points
(best_elo_rating_rank, goat_points)
VALUES
( 1, 4),
( 2, 2),
( 3, 1);
DELETE FROM grand_slam_goat_points;
INSERT INTO grand_slam_goat_points
(career_grand_slam, season_grand_slam, season_3_grand_slam, grand_slam_holder, consecutive_grand_slam_on_same_event, grand_slam_on_same_event)
VALUES
(8, 8, 2, 4, 1, 0.5);
DELETE FROM big_win_match_factor;
INSERT INTO big_win_match_factor
(level, round, match_factor)
VALUES
-- Grand Slam
('G', 'F', 8),
('G', 'SF', 4),
('G', 'QF', 2),
('G', 'R16', 1),
-- Tour Finals
('F', 'F', 6),
('F', 'SF', 3),
('F', 'QF', 1),
('F', 'RR', 1),
-- Alt. Finals
('L', 'F', 4),
('L', 'SF', 2),
('L', 'QF', 1),
-- Masters
('M', 'F', 4),
('M', 'SF', 2),
('M', 'QF', 1),
-- Olympics
('O', 'F', 3),
('O', 'BR', 1),
('O', 'SF', 1),
-- ATP 500
('A', 'F', 2),
('A', 'SF', 1),
-- ATP 250
('B', 'F', 1),
-- Davis Cup
('D', 'F', 1),
-- Team Cups
('T', 'F', 1);
DELETE FROM big_win_rank_factor;
INSERT INTO big_win_rank_factor
(rank_from, rank_to, rank_factor)
VALUES
( 1, 1, 8),
( 2, 2, 6),
( 3, 3, 5),
( 4, 5, 4),
( 6, 7, 3),
( 8, 10, 2),
(11, 20, 1);
DELETE FROM h2h_rank_factor;
INSERT INTO h2h_rank_factor
(rank_from, rank_to, rank_factor)
VALUES
( 1, 1, 8),
( 2, 2, 6),
( 3, 3, 5),
( 4, 5, 4),
( 6, 7, 3),
( 8, 10, 2),
(11, 20, 1);
DELETE FROM records_goat_points;
INSERT INTO records_goat_points
(record_id, rank, goat_points)
VALUES
-- Titles
('Titles', 1, 4),
('Titles', 2, 2),
('Titles', 3, 1),
('GrandSlamTitles', 1, 8),
('GrandSlamTitles', 2, 5),
('GrandSlamTitles', 3, 3),
('GrandSlamTitles', 4, 2),
('GrandSlamTitles', 5, 1),
('TourFinalsTitles', 1, 4),
('TourFinalsTitles', 2, 2),
('TourFinalsTitles', 3, 1),
('AltFinalsTitles', 1, 2),
('AltFinalsTitles', 2, 1),
('MastersTitles', 1, 4),
('MastersTitles', 2, 2),
('MastersTitles', 3, 1),
('OlympicsTitles', 1, 2),
('OlympicsTitles', 2, 1),
('BigTitles', 1, 4),
('BigTitles', 2, 2),
('BigTitles', 3, 1),
('HardTitles', 1, 2),
('HardTitles', 2, 1),
('ClayTitles', 1, 2),
('ClayTitles', 2, 1),
('GrassTitles', 1, 2),
('GrassTitles', 2, 1),
('CarpetTitles', 1, 2),
('CarpetTitles', 2, 1),
('OutdoorTitles', 1, 1),
('IndoorTitles', 1, 1),
('SeasonTitles', 1, 2),
('SeasonTitles', 2, 1),
('SeasonGrandSlamTitles', 1, 4),
('SeasonGrandSlamTitles', 2, 2),
('SeasonGrandSlamTitles', 3, 1),
('SeasonMastersTitles', 1, 2),
('SeasonMastersTitles', 2, 1),
('SeasonBigTitles', 1, 2),
('SeasonBigTitles', 2, 1),
('TournamentTitles', 1, 2),
('TournamentTitles', 2, 1),
('TournamentGrandSlamTitles', 1, 4),
('TournamentGrandSlamTitles', 2, 2),
('TournamentGrandSlamTitles', 3, 1),
('TournamentMastersTitles', 1, 2),
('TournamentMastersTitles', 2, 1),
('DifferentMastersSlotTitles', 1, 2),
('DifferentMastersSlotTitles', 2, 1),
-- Finals
('Finals', 1, 1),
('GrandSlamFinals', 1, 2),
('GrandSlamFinals', 2, 1),
('TourFinalsFinals', 1, 1),
('MastersFinals', 1, 1),
('BigFinals', 1, 1),
('SeasonGrandSlamFinals', 1, 1),
('TournamentGrandSlamFinals', 1, 1),
-- Semi-Finals
('GrandSlamSemiFinals', 1, 1),
-- Title Winning Pct.
('TitleWinningPct', 1, 1),
('GrandSlamTitleWinningPct', 1, 2),
('GrandSlamTitleWinningPct', 2, 1),
('TourFinalsTitleWinningPct', 1, 1),
('MastersTitleWinningPct', 1, 1),
('BigTitleWinningPct', 1, 1),
-- Title Streaks
('TitleStreak', 1, 2),
('TitleStreak', 2, 1),
('GrandSlamTitleStreak', 1, 2),
('GrandSlamTitleStreak', 2, 1),
('TourFinalsTitleStreak', 1, 1),
('MastersTitleStreak', 1, 1),
('BigTitleStreak', 1, 2),
('BigTitleStreak', 2, 1),
-- Final Streaks
('FinalStreak', 1, 1),
('GrandSlamFinalStreak', 1, 1),
('BigFinalStreak', 1, 1),
-- Youngest/Oldest Champion
('YoungestTournamentChampion', 1, 1),
('YoungestGrandSlamChampion', 1, 2),
('YoungestGrandSlamChampion', 2, 1),
('YoungestTourFinalsChampion', 1, 1),
('YoungestMastersChampion', 1, 1),
('OldestTournamentChampion', 1, 1),
('OldestGrandSlamChampion', 1, 2),
('OldestGrandSlamChampion', 2, 1),
('OldestTourFinalsChampion', 1, 1),
('OldestMastersChampion', 1, 1),
-- Winning Streak
('WinningStreak', 1, 2),
('WinningStreak', 2, 1),
('GrandSlamWinningStreak', 1, 2),
('GrandSlamWinningStreak', 2, 1),
('TourFinalsWinningStreak', 1, 1),
('MastersWinningStreak', 1, 1),
('BigTournamentWinningStreak', 1, 2),
('BigTournamentWinningStreak', 2, 1),
('HardWinningStreak', 1, 1),
('ClayWinningStreak', 1, 1),
('GrassWinningStreak', 1, 1),
('CarpetWinningStreak', 1, 1),
('OutdoorWinningStreak', 1, 1),
('IndoorWinningStreak', 1, 1),
('WinningStreakVsNo1', 1, 1),
('WinningStreakVsTop5', 1, 1),
('WinningStreakVsTop10', 1, 1),
-- Winning Pct
('SeasonWinningPct', 1, 2),
('SeasonWinningPct', 2, 1),
-- ATP Ranking
('WeeksAtATPNo1', 1, 4),
('WeeksAtATPNo1', 2, 2),
('WeeksAtATPNo1', 3, 1),
('WeeksAtATPTop2', 1, 2),
('WeeksAtATPTop2', 2, 1),
('WeeksAtATPTop3', 1, 2),
('WeeksAtATPTop3', 2, 1),
('WeeksAtATPTop5', 1, 1),
('WeeksAtATPTop10', 1, 1),
('ConsecutiveWeeksAtATPNo1', 1, 2),
('ConsecutiveWeeksAtATPNo1', 2, 1),
('ConsecutiveWeeksAtATPTop2', 1, 1),
('ConsecutiveWeeksAtATPTop3', 1, 1),
('EndsOfSeasonAtATPNo1', 1, 4),
('EndsOfSeasonAtATPNo1', 2, 2),
('EndsOfSeasonAtATPNo1', 3, 1),
('EndsOfSeasonAtATPTop2', 1, 2),
('EndsOfSeasonAtATPTop2', 2, 1),
('EndsOfSeasonAtATPTop3', 1, 2),
('EndsOfSeasonAtATPTop3', 2, 1),
('EndsOfSeasonAtATPTop5', 1, 1),
('EndsOfSeasonAtATPTop10', 1, 1),
('YoungestATPNo1', 1, 1),
('OldestATPNo1', 1, 1),
('ATPPoints', 1, 2),
('ATPPoints', 2, 1),
('ATPPointsNo1No2DifferencePct', 1, 1),
-- H2H
('H2HSeriesWinningPct', 1, 2),
('H2HSeriesWinningPct', 2, 1),
-- Titles Won W/O Losing Set
('TitlesWonWOLosingSet', 1, 1),
('GrandSlamTitlesWonWOLosingSet', 1, 2),
('GrandSlamTitlesWonWOLosingSet', 2, 1),
('TourFinalsTitlesWonWOLosingSet', 1, 1),
('MastersTitlesWonWOLosingSet', 1, 1),
-- Mean Opponent Elo Rating
('HighestOpponentEloRating', 1, 1),
('HighestGrandSlamOpponentEloRating', 1, 2),
('HighestGrandSlamOpponentEloRating', 2, 1),
('HighestTourFinalsOpponentEloRating', 1, 1),
('HighestMastersOpponentEloRating', 1, 1);
DELETE FROM surface_records_goat_points;
INSERT INTO surface_records_goat_points
(record_id, rank, goat_points)
VALUES
-- Titles
('$Titles', 1, 2),
('$Titles', 2, 1),
('$GrandSlamTitles', 1, 4),
('$GrandSlamTitles', 2, 2),
('$GrandSlamTitles', 3, 1),
('$MastersTitles', 1, 2),
('$MastersTitles', 2, 1),
('$BigTitles', 1, 2),
('$BigTitles', 2, 1),
('Season$Titles', 1, 1),
-- Finals
('$GrandSlamFinals', 1, 1),
-- Title Streaks
('$TitleStreak', 1, 1),
-- Youngest/Oldest Champion
('Youngest$Champion', 1, 1),
('Oldest$Champion', 1, 1),
-- Winning Streak
('$WinningStreak', 1, 1),
-- Winning Pct
('$WinningPct', 1, 2),
('$WinningPct', 2, 1),
('Season$WinningPct', 1, 1),
-- Titles Won W/O Losing Set
('$TitlesWonWOLosingSet', 1, 1),
-- Mean Opponent Elo Rating
('Highest$OpponentEloRating', 1, 1);
DELETE FROM best_season_goat_points;
INSERT INTO best_season_goat_points
(season_rank, goat_points)
VALUES
(1, 8),
(2, 5),
(3, 3),
(4, 2),
(5, 1);
DELETE FROM greatest_rivalries_goat_points;
INSERT INTO greatest_rivalries_goat_points
(rivalry_rank, goat_points)
VALUES
(1, 8),
(2, 5),
(3, 3),
(4, 2),
(5, 1);
DELETE FROM performance_category;
INSERT INTO performance_category
(category_id, name, min_entries, sort_order)
VALUES
('matches', 'Overall Matches', 200, 1),
('grandSlamMatches', 'Grand Slam Matches', 50, 2),
('tourFinalsMatches', 'Tour Finals Matches', 10, 3),
('altFinalsMatches', 'Alt. Tour Finals Matches', 5, 4),
('mastersMatches', 'Masters Matches', 50, 5),
('olympicsMatches', 'Olympics Matches', 5, 6),
('hardMatches', 'Hard Matches', 100, 7),
('clayMatches', 'Clay Matches', 100, 8),
('grassMatches', 'Grass Matches', 50, 9),
('carpetMatches', 'Carpet Matches', 50, 10),
('decidingSets', 'Deciding Sets', 100, 11),
('fifthSets', 'Fifth Sets', 20, 12),
('finals', 'Finals', 20, 13),
('vsNo1', 'Vs No. 1', 10, 14),
('vsTop5', 'Vs Top 5', 20, 15),
('vsTop10', 'Vs Top 10', 20, 16),
('afterWinningFirstSet', 'After Winning First Set', 100, 17),
('afterLosingFirstSet', 'After Losing First Set', 100, 18),
('tieBreaks', 'Tie-Breaks', 100, 19),
('decidingSetTBs', 'Deciding Set Tie-Breaks', 10, 20);
DELETE FROM performance_goat_points;
INSERT INTO performance_goat_points
(category_id, rank, goat_points)
VALUES
('matches', 1, 4),
('matches', 2, 2),
('matches', 3, 1),
('grandSlamMatches', 1, 4),
('grandSlamMatches', 2, 2),
('grandSlamMatches', 3, 1),
('tourFinalsMatches', 1, 2),
('tourFinalsMatches', 2, 1),
('altFinalsMatches', 1, 1),
('mastersMatches', 1, 2),
('mastersMatches', 2, 1),
('olympicsMatches', 1, 1),
('hardMatches', 1, 2),
('hardMatches', 2, 1),
('clayMatches', 1, 2),
('clayMatches', 2, 1),
('grassMatches', 1, 2),
('grassMatches', 2, 1),
('carpetMatches', 1, 2),
('carpetMatches', 2, 1),
('decidingSets', 1, 2),
('decidingSets', 2, 1),
('fifthSets', 1, 2),
('fifthSets', 2, 1),
('finals', 1, 2),
('finals', 2, 1),
('vsNo1', 1, 4),
('vsNo1', 2, 2),
('vsNo1', 3, 1),
('vsTop5', 1, 4),
('vsTop5', 2, 2),
('vsTop5', 3, 1),
('vsTop10', 1, 4),
('vsTop10', 2, 2),
('vsTop10', 3, 1),
('afterWinningFirstSet', 1, 2),
('afterWinningFirstSet', 2, 1),
('afterLosingFirstSet', 1, 2),
('afterLosingFirstSet', 2, 1),
('tieBreaks', 1, 2),
('tieBreaks', 2, 1),
('decidingSetTBs', 1, 2),
('decidingSetTBs', 2, 1);
DELETE FROM statistics_category;
INSERT INTO statistics_category
(category_id, name, min_entries, sort_order)
VALUES
-- Serve
('acePct', 'Ace %', 10000, 1),
('doubleFaultPct', 'Double Fault %', 10000, 2),
('acesDfsRatio', 'Aces / DFs Ratio', 10000, 3),
('firstServePct', '1st Serve %', 10000, 4),
('firstServeWonPct', '1st Serve Won %', 10000, 5),
('secondServeWonPct', '2nd Serve Won %', 10000, 6),
('breakPointsSavedPct', 'Break Points Saved %', 10000, 7),
('servicePointsWonPct', 'Service Points Won %', 10000, 8),
('serviceGamesWonPct', 'Service Games Won %', 10000, 9),
-- Return
('firstServeReturnWonPct', '1st Serve Return Won %', 10000, 10),
('secondServeReturnWonPct', '2nd Serve Return Won %', 10000, 11),
('breakPointsPct', 'Break Points Won %', 10000, 12),
('returnPointsWonPct', 'Return Points Won %', 10000, 13),
('returnGamesWonPct', 'Return Games Won %', 10000, 14),
-- Total
('pointsDominanceRatio', 'Points Dominance Ratio', 10000, 15),
('gamesDominanceRatio', 'Games Dominance Ratio', 10000, 16),
('breakPointsRatio', 'Break Points Ratio', 10000, 17),
('overPerformingRatio', 'Over-Performing Ratio', 10000, 18),
('totalPointsWonPct', 'Total Points Won %', 10000, 19),
('totalGamesWonPct', 'Total Games Won %', 200, 20),
('setsWonPct', 'Sets Won %', 200, 21);
DELETE FROM statistics_goat_points;
INSERT INTO statistics_goat_points
(category_id, rank, goat_points)
VALUES
-- Serve
('acePct', 1, 1),
('doubleFaultPct', 1, 1),
('acesDfsRatio', 1, 1),
('firstServePct', 1, 1),
('firstServeWonPct', 1, 2),
('firstServeWonPct', 2, 1),
('secondServeWonPct', 1, 2),
('secondServeWonPct', 2, 1),
('breakPointsSavedPct', 1, 1),
('servicePointsWonPct', 1, 2),
('servicePointsWonPct', 2, 1),
('serviceGamesWonPct', 1, 2),
('serviceGamesWonPct', 2, 1),
-- Return
('firstServeReturnWonPct', 1, 2),
('firstServeReturnWonPct', 2, 1),
('secondServeReturnWonPct', 1, 2),
('secondServeReturnWonPct', 2, 1),
('breakPointsPct', 1, 1),
('returnPointsWonPct', 1, 2),
('returnPointsWonPct', 2, 1),
('returnGamesWonPct', 1, 2),
('returnGamesWonPct', 2, 1),
-- Total
('pointsDominanceRatio', 1, 1),
('gamesDominanceRatio', 1, 1),
('breakPointsRatio', 1, 1),
('overPerformingRatio', 1, 1),
('totalPointsWonPct', 1, 2),
('totalPointsWonPct', 2, 1),
('totalGamesWonPct', 1, 2),
('totalGamesWonPct', 2, 1),
('setsWonPct', 1, 2),
('setsWonPct', 2, 1);
DELETE FROM featured_content;
INSERT INTO featured_content
(type, value, description)
VALUES
-- Grand Slam
('PLAYER', NULL, NULL),
('RECORD', NULL, NULL),
('BLOG', 'goatCalculator', '<i class="fa fa-flag"></i> ''GOAT'' Calculator Explained'),
('PAGE', 'inProgressEventsForecasts', '<i class="fa fa-eye"></i> Tournament Event Forecasts');
COMMIT; | the_stack |
-- MySQL dump 10.13 Distrib 5.5.41, for debian-linux-gnu (x86_64)
--
-- Host: localhost Database: testclient
-- ------------------------------------------------------
-- Server version 5.5.41-0ubuntu0.14.04.1
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
--
-- Table structure for table `action_comment`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `action_comment` (
`action_id` bigint(20) NOT NULL,
`comment` text,
PRIMARY KEY (`action_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `action_tags`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `action_tags` (
`action_id` bigint(20) NOT NULL DEFAULT '0',
`tag_id` smallint(6) NOT NULL DEFAULT '0',
`tag` varchar(25) DEFAULT NULL,
PRIMARY KEY (`action_id`,`tag_id`),
KEY `a_index` (`action_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `action_type`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `action_type` (
`type_id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(25) DEFAULT NULL,
`weight` double DEFAULT NULL,
`def_value` double DEFAULT NULL,
`link_type` int(11) DEFAULT NULL,
`semantic` tinyint(1) DEFAULT '0',
PRIMARY KEY (`type_id`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `actions`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `actions` (
`action_id` bigint(20) NOT NULL AUTO_INCREMENT,
`user_id` bigint(20) NOT NULL,
`item_id` bigint(20) NOT NULL,
`type` int(11) DEFAULT NULL,
`times` int(11) DEFAULT NULL,
`date` datetime DEFAULT NULL,
`value` double DEFAULT NULL,
`client_user_id` varchar(255) DEFAULT NULL,
`client_item_id` varchar(255) DEFAULT NULL,
PRIMARY KEY (`action_id`),
KEY `i_index` (`item_id`),
KEY `idx` (`user_id`,`item_id`),
KEY `cukey` (`client_user_id`),
KEY `cikey` (`client_item_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8
/*!50100 PARTITION BY RANGE (action_id)
(PARTITION p1 VALUES LESS THAN (10000000) ENGINE = InnoDB,
PARTITION p2 VALUES LESS THAN (20000000) ENGINE = InnoDB,
PARTITION p3 VALUES LESS THAN (30000000) ENGINE = InnoDB,
PARTITION p4 VALUES LESS THAN (40000000) ENGINE = InnoDB,
PARTITION p5 VALUES LESS THAN (50000000) ENGINE = InnoDB,
PARTITION p6 VALUES LESS THAN (60000000) ENGINE = InnoDB,
PARTITION p7 VALUES LESS THAN (70000000) ENGINE = InnoDB,
PARTITION p8 VALUES LESS THAN (80000000) ENGINE = InnoDB,
PARTITION p9 VALUES LESS THAN (90000000) ENGINE = InnoDB,
PARTITION p10 VALUES LESS THAN MAXVALUE ENGINE = InnoDB) */;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `cluster_attr_exclude`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `cluster_attr_exclude` (
`attr_id` int(11) NOT NULL,
PRIMARY KEY (`attr_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `cluster_counts`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `cluster_counts` (
`id` int(11) NOT NULL,
`item_id` bigint(20) NOT NULL,
`count` double NOT NULL,
`t` bigint(20) NOT NULL,
PRIMARY KEY (`id`,`item_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `cluster_counts_item_total`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `cluster_counts_item_total` (
`item_id` bigint(20) NOT NULL,
`total` double NOT NULL,
`t` bigint(20) NOT NULL,
PRIMARY KEY (`item_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `cluster_counts_total`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `cluster_counts_total` (
`uid` int(11) NOT NULL,
`total` double NOT NULL,
`t` bigint(20) NOT NULL,
PRIMARY KEY (`uid`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `cluster_dim_exclude`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `cluster_dim_exclude` (
`dim_id` int(11) NOT NULL,
PRIMARY KEY (`dim_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `cluster_group`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `cluster_group` (
`cluster_id` int(11) NOT NULL,
`group_id` int(11) NOT NULL,
PRIMARY KEY (`cluster_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `cluster_referrer`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `cluster_referrer` (
`referrer` varchar(255) NOT NULL,
`cluster` int(11) NOT NULL,
PRIMARY KEY (`referrer`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `cluster_update`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `cluster_update` (
`lastupdate` bigint(20) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `demographic`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `demographic` (
`demo_id` int(11) NOT NULL AUTO_INCREMENT,
`attr_id` int(11) DEFAULT NULL,
`value_id` int(11) DEFAULT NULL,
PRIMARY KEY (`demo_id`),
KEY `idx` (`attr_id`,`value_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `dimension`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `dimension` (
`dim_id` int(11) NOT NULL AUTO_INCREMENT,
`item_type` int(11) DEFAULT NULL,
`attr_id` int(11) DEFAULT NULL,
`value_id` int(11) DEFAULT NULL,
`trustnetwork` tinyint(1) DEFAULT '0',
PRIMARY KEY (`dim_id`),
KEY `idx` (`attr_id`,`value_id`)
) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `item_attr`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `item_attr` (
`attr_id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(25) DEFAULT NULL,
`type` varchar(10) DEFAULT NULL,
`item_type` int(11) DEFAULT NULL,
`semantic` tinyint(1) DEFAULT NULL,
PRIMARY KEY (`attr_id`)
) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `item_attr_bigint`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `item_attr_bigint` (
`attr_id` int(11) NOT NULL,
`value_id` int(11) NOT NULL,
`min` bigint(20) DEFAULT NULL,
`max` int(11) DEFAULT NULL,
PRIMARY KEY (`value_id`,`attr_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `item_attr_boolean`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `item_attr_boolean` (
`attr_id` int(11) NOT NULL,
`value_id` int(11) NOT NULL,
`min` tinyint(1) DEFAULT NULL,
`max` tinyint(1) DEFAULT NULL,
PRIMARY KEY (`value_id`,`attr_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `item_attr_datetime`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `item_attr_datetime` (
`attr_id` int(11) NOT NULL,
`value_id` int(11) NOT NULL,
`min` datetime DEFAULT NULL,
`max` datetime DEFAULT NULL,
PRIMARY KEY (`value_id`,`attr_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `item_attr_double`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `item_attr_double` (
`attr_id` int(11) NOT NULL,
`value_id` int(11) NOT NULL,
`min` double DEFAULT NULL,
`max` int(11) DEFAULT NULL,
PRIMARY KEY (`value_id`,`attr_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `item_attr_enum`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `item_attr_enum` (
`attr_id` int(11) NOT NULL,
`value_id` int(11) NOT NULL,
`value_name` varchar(255) DEFAULT NULL,
`amount` double DEFAULT NULL,
`name` bit(1) DEFAULT b'0',
PRIMARY KEY (`attr_id`,`value_id`),
KEY `a_index` (`attr_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `item_attr_int`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `item_attr_int` (
`attr_id` int(11) NOT NULL,
`value_id` int(11) NOT NULL,
`min` int(11) DEFAULT NULL,
`max` int(11) DEFAULT NULL,
PRIMARY KEY (`value_id`,`attr_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `item_attr_varchar`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `item_attr_varchar` (
`attr_id` int(11) NOT NULL,
`value_id` int(11) NOT NULL,
`min` varchar(255) DEFAULT NULL,
`max` varchar(255) DEFAULT NULL,
PRIMARY KEY (`value_id`,`attr_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `item_clusters`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `item_clusters` (
`item_id` bigint(20) NOT NULL,
`cluster_id` int(11) NOT NULL,
`weight` double NOT NULL,
`created` bigint(20) NOT NULL,
PRIMARY KEY (`item_id`,`cluster_id`),
KEY `timekey` (`created`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `item_clusters_new`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `item_clusters_new` (
`item_id` bigint(20) NOT NULL,
`cluster_id` int(11) NOT NULL,
`weight` double NOT NULL,
`created` bigint(20) NOT NULL,
PRIMARY KEY (`item_id`,`cluster_id`),
KEY `timekey` (`created`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `item_counts`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `item_counts` (
`item_id` bigint(20) NOT NULL,
`count` int(11) NOT NULL,
`time` bigint(20) NOT NULL,
PRIMARY KEY (`item_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `item_demo`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `item_demo` (
`item_id` bigint(20) NOT NULL,
`demo_id` int(11) NOT NULL,
`relevance` double DEFAULT NULL,
PRIMARY KEY (`item_id`,`demo_id`),
KEY `u_index` (`item_id`),
KEY `d_index` (`demo_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `item_map_bigint`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `item_map_bigint` (
`item_id` bigint(20) NOT NULL,
`attr_id` int(11) NOT NULL,
`value` bigint(20) DEFAULT NULL,
PRIMARY KEY (`attr_id`,`item_id`),
KEY `uidx` (`item_id`,`attr_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `item_map_boolean`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `item_map_boolean` (
`item_id` bigint(20) NOT NULL,
`attr_id` int(11) NOT NULL,
`value` tinyint(1) DEFAULT NULL,
PRIMARY KEY (`attr_id`,`item_id`),
KEY `uidx` (`item_id`,`attr_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `item_map_datetime`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `item_map_datetime` (
`item_id` bigint(20) NOT NULL,
`attr_id` int(11) NOT NULL,
`value` datetime DEFAULT NULL,
PRIMARY KEY (`attr_id`,`item_id`),
KEY `uidx` (`item_id`,`attr_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `item_map_double`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `item_map_double` (
`item_id` bigint(20) NOT NULL,
`attr_id` int(11) NOT NULL,
`value` double DEFAULT NULL,
PRIMARY KEY (`attr_id`,`item_id`),
KEY `uidx` (`item_id`,`attr_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `item_map_enum`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `item_map_enum` (
`item_id` bigint(20) NOT NULL,
`attr_id` int(11) NOT NULL,
`value_id` int(11) DEFAULT NULL,
PRIMARY KEY (`attr_id`,`item_id`),
KEY `i_index` (`item_id`),
KEY `a_index` (`attr_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `item_map_int`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `item_map_int` (
`item_id` bigint(20) NOT NULL,
`attr_id` int(11) NOT NULL,
`value` int(11) DEFAULT NULL,
PRIMARY KEY (`attr_id`,`item_id`),
KEY `uidx` (`item_id`,`attr_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `item_map_text`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `item_map_text` (
`item_id` bigint(20) NOT NULL,
`attr_id` int(11) NOT NULL,
`value` text,
PRIMARY KEY (`attr_id`,`item_id`),
KEY `uidx` (`item_id`,`attr_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `item_map_varchar`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `item_map_varchar` (
`item_id` bigint(20) NOT NULL,
`attr_id` int(11) NOT NULL,
`value` varchar(255) DEFAULT NULL,
`pos` int(11) NOT NULL DEFAULT '1',
PRIMARY KEY (`attr_id`,`item_id`,`pos`) USING BTREE,
KEY `uidx` (`item_id`,`attr_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `item_similarity`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `item_similarity` (
`item_id` bigint(20) NOT NULL,
`item_id2` bigint(20) NOT NULL,
`score` double NOT NULL,
PRIMARY KEY (`item_id`,`item_id2`),
UNIQUE KEY `i2` (`item_id2`,`item_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `item_similarity_new`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `item_similarity_new` (
`item_id` bigint(20) NOT NULL,
`item_id2` bigint(20) NOT NULL,
`score` double NOT NULL,
PRIMARY KEY (`item_id`,`item_id2`),
UNIQUE KEY `i2` (`item_id2`,`item_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `item_type`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `item_type` (
`type_id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(25) DEFAULT NULL,
`link_type` int(11) DEFAULT NULL,
`semantic` tinyint(1) DEFAULT '0',
PRIMARY KEY (`type_id`)
) ENGINE=InnoDB AUTO_INCREMENT=101 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `items`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `items` (
`item_id` bigint(20) NOT NULL AUTO_INCREMENT,
`name` varchar(255) DEFAULT NULL,
`first_op` datetime DEFAULT NULL,
`last_op` datetime DEFAULT NULL,
`popular` tinyint(1) DEFAULT '0',
`client_item_id` varchar(255) DEFAULT NULL,
`type` int(11) DEFAULT '0',
`avgrating` double DEFAULT '0',
`stddevrating` double DEFAULT '0',
`num_op` int(11) DEFAULT NULL,
PRIMARY KEY (`item_id`),
UNIQUE KEY `c_index` (`client_item_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `items_popular`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `items_popular` (
`item_id` bigint(20) NOT NULL,
`opsum` double DEFAULT NULL,
PRIMARY KEY (`item_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `items_popular_new`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `items_popular_new` (
`item_id` bigint(20) NOT NULL,
`opsum` double DEFAULT NULL,
PRIMARY KEY (`item_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `user_attr`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `user_attr` (
`attr_id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(25) DEFAULT NULL,
`type` varchar(10) DEFAULT NULL,
`link_type` int(11) DEFAULT NULL,
`demographic` tinyint(1) DEFAULT NULL,
PRIMARY KEY (`attr_id`)
) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `user_attr_bigint`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `user_attr_bigint` (
`attr_id` int(11) NOT NULL,
`value_id` int(11) NOT NULL,
`min` bigint(20) DEFAULT NULL,
`max` int(11) DEFAULT NULL,
PRIMARY KEY (`value_id`,`attr_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `user_attr_boolean`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `user_attr_boolean` (
`attr_id` int(11) NOT NULL,
`value_id` int(11) NOT NULL,
`min` tinyint(1) DEFAULT NULL,
`max` tinyint(1) DEFAULT NULL,
PRIMARY KEY (`value_id`,`attr_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `user_attr_datetime`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `user_attr_datetime` (
`attr_id` int(11) NOT NULL,
`value_id` int(11) NOT NULL,
`min` datetime DEFAULT NULL,
`max` datetime DEFAULT NULL,
PRIMARY KEY (`value_id`,`attr_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `user_attr_double`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `user_attr_double` (
`attr_id` int(11) NOT NULL,
`value_id` int(11) NOT NULL,
`min` double DEFAULT NULL,
`max` int(11) DEFAULT NULL,
PRIMARY KEY (`value_id`,`attr_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `user_attr_enum`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `user_attr_enum` (
`attr_id` int(11) NOT NULL,
`value_id` int(11) NOT NULL,
`value_name` varchar(50) DEFAULT NULL,
`amount` double DEFAULT NULL,
PRIMARY KEY (`attr_id`,`value_id`),
KEY `a_index` (`attr_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `user_attr_int`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `user_attr_int` (
`attr_id` int(11) NOT NULL,
`value_id` int(11) NOT NULL,
`min` int(11) DEFAULT NULL,
`max` int(11) DEFAULT NULL,
PRIMARY KEY (`value_id`,`attr_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `user_attr_varchar`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `user_attr_varchar` (
`attr_id` int(11) NOT NULL,
`value_id` int(11) NOT NULL,
`min` varchar(25) DEFAULT NULL,
`max` varchar(25) DEFAULT NULL,
PRIMARY KEY (`value_id`,`attr_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `user_clusters`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `user_clusters` (
`user_id` bigint(20) NOT NULL,
`cluster_id` int(11) NOT NULL,
`weight` double NOT NULL,
PRIMARY KEY (`user_id`,`cluster_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `user_clusters_new`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `user_clusters_new` (
`user_id` bigint(20) NOT NULL,
`cluster_id` int(11) NOT NULL,
`weight` double NOT NULL,
PRIMARY KEY (`user_id`,`cluster_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `user_clusters_transient`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `user_clusters_transient` (
`t_id` bigint(20) NOT NULL AUTO_INCREMENT,
`user_id` bigint(20) NOT NULL,
`cluster_id` int(11) NOT NULL,
`weight` double NOT NULL,
PRIMARY KEY (`t_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `user_dim`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `user_dim` (
`user_id` bigint(20) NOT NULL,
`dim_id` int(11) NOT NULL,
`relevance` double DEFAULT NULL,
PRIMARY KEY (`user_id`,`dim_id`),
KEY `u_index` (`user_id`),
KEY `d_index` (`dim_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `user_dim_new`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `user_dim_new` (
`user_id` bigint(20) NOT NULL,
`dim_id` int(11) NOT NULL,
`relevance` double DEFAULT NULL,
PRIMARY KEY (`user_id`,`dim_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `user_interaction`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `user_interaction` (
`u1_id` bigint(20) unsigned NOT NULL,
`u2_fbid` varchar(30) NOT NULL,
`type` int(11) NOT NULL,
`sub_type` int(11) NOT NULL,
`count` int(11) NOT NULL,
`parameter_id` int(11) NOT NULL DEFAULT '0',
`date` datetime DEFAULT NULL,
PRIMARY KEY (`u1_id`,`u2_fbid`,`type`,`sub_type`,`parameter_id`),
KEY `u1idx` (`u1_id`),
KEY `u1typeidx` (`u1_id`,`type`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `user_map_bigint`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `user_map_bigint` (
`user_id` bigint(20) NOT NULL,
`attr_id` int(11) NOT NULL,
`value` bigint(20) DEFAULT NULL,
PRIMARY KEY (`attr_id`,`user_id`),
KEY `uidx` (`user_id`,`attr_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `user_map_boolean`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `user_map_boolean` (
`user_id` bigint(20) NOT NULL,
`attr_id` int(11) NOT NULL,
`value` tinyint(1) DEFAULT NULL,
PRIMARY KEY (`attr_id`,`user_id`),
KEY `uidx` (`user_id`,`attr_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `user_map_datetime`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `user_map_datetime` (
`user_id` bigint(20) NOT NULL,
`attr_id` int(11) NOT NULL,
`value` datetime DEFAULT NULL,
PRIMARY KEY (`attr_id`,`user_id`),
KEY `uidx` (`user_id`,`attr_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `user_map_double`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `user_map_double` (
`user_id` bigint(20) NOT NULL,
`attr_id` int(11) NOT NULL,
`value` double DEFAULT NULL,
PRIMARY KEY (`attr_id`,`user_id`),
KEY `uidx` (`user_id`,`attr_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `user_map_enum`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `user_map_enum` (
`user_id` bigint(20) NOT NULL,
`attr_id` int(11) NOT NULL,
`value_id` int(11) DEFAULT NULL,
PRIMARY KEY (`attr_id`,`user_id`),
KEY `i_index` (`user_id`),
KEY `a_index` (`attr_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `user_map_int`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `user_map_int` (
`user_id` bigint(20) NOT NULL,
`attr_id` int(11) NOT NULL,
`value` int(11) DEFAULT NULL,
PRIMARY KEY (`attr_id`,`user_id`),
KEY `uidx` (`user_id`,`attr_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `user_map_text`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `user_map_text` (
`user_id` bigint(20) NOT NULL,
`attr_id` int(11) NOT NULL,
`value` text,
PRIMARY KEY (`attr_id`,`user_id`),
KEY `uidx` (`user_id`,`attr_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `user_map_varchar`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `user_map_varchar` (
`user_id` bigint(20) NOT NULL,
`attr_id` int(11) NOT NULL,
`value` varchar(255) DEFAULT NULL,
PRIMARY KEY (`attr_id`,`user_id`),
KEY `uidx` (`user_id`,`attr_id`),
KEY `avidx` (`attr_id`,`value`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `user_similarity`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `user_similarity` (
`u1` bigint(20) NOT NULL,
`u2` bigint(20) NOT NULL,
`type` int(11) NOT NULL,
`score` double NOT NULL,
PRIMARY KEY (`u1`,`u2`,`type`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `user_tag`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `user_tag` (
`user_id` bigint(20) NOT NULL,
`tag` varchar(255) NOT NULL,
`count` int(11) NOT NULL,
PRIMARY KEY (`user_id`,`tag`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `user_user_avg`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `user_user_avg` (
`m1` bigint(20) NOT NULL,
`m2` bigint(20) NOT NULL,
`avgm1` double DEFAULT NULL,
`avgm2` double DEFAULT NULL,
PRIMARY KEY (`m1`,`m2`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `users`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `users` (
`user_id` bigint(20) NOT NULL AUTO_INCREMENT,
`username` varchar(64) DEFAULT NULL,
`first_op` datetime DEFAULT NULL,
`last_op` datetime DEFAULT NULL,
`type` int(11) DEFAULT NULL,
`num_op` int(11) DEFAULT NULL,
`active` tinyint(1) DEFAULT NULL,
`client_user_id` varchar(255) DEFAULT NULL,
`avgrating` double DEFAULT '0',
`stddevrating` double DEFAULT '0',
PRIMARY KEY (`user_id`),
UNIQUE KEY `c_index` (`client_user_id`),
KEY `u_index` (`username`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `version`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `version` (
`major` int(11) NOT NULL,
`minor` int(11) NOT NULL,
`bugfix` int(11) NOT NULL,
`date` datetime DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
--
-- Table structure for table `items_recent_popularity`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `items_recent_popularity` (
`item_id` int(11) unsigned NOT NULL,
`score` float DEFAULT '0',
`decay_id` int(11) NOT NULL DEFAULT '0',
`last_update` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`item_id`,`decay_id`),
KEY `score` (`score`,`decay_id`),
KEY `decay_id` (`decay_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
CREATE TABLE `items_recent_popularity_new` (
`item_id` int(11) unsigned NOT NULL,
`score` float DEFAULT '0',
`decay_id` int(11) NOT NULL DEFAULT '0',
`last_update` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`item_id`,`decay_id`),
KEY `score` (`score`,`decay_id`),
KEY `decay_id` (`decay_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `item_map_varchar_locale` (
`country` char(2) NOT NULL,
`language` char(2) NOT NULL,
`item_id` bigint(20) NOT NULL,
`attr_id` int(11) NOT NULL,
`value` varchar(255) DEFAULT NULL,
PRIMARY KEY (`country`,`language`,`attr_id`,`item_id`) USING BTREE,
KEY `uidx` (`item_id`,`attr_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- Dump completed on 2015-03-03 10:42:31 | the_stack |
-- 创建 dbms_job 相关 schema 和配置表
-- =============================================================================
create schema dbms_job;
drop table if exists dbms_job.antdb_job_config;
create table if not exists dbms_job.antdb_job_config
(
job_id serial constraint pk_antdb_job_config_id primary key,
job_user text,
job_schema text,
last_date timestamp,
next_date timestamp,
broken text default 'N',
job_interval text,
what text
);
drop table if exists dbms_job.antdb_job_log;
create table if not exists dbms_job.antdb_job_log
(
job_id int,
run_time timestamp,
complete_time timestamp,
run_message text
);
CREATE INDEX idx_antdb_job_log_job_Id on dbms_job.antdb_job_log(job_id);
-- 创建 submit 函数
-- =============================================================================
/*ora*/
create or replace function dbms_job.submit_internal( p_what text
, p_next_date timestamp default clock_timestamp()
, p_interval text default null
, p_no_parse boolean default 'false'
, p_instance int default 0
, p_force boolean default 'false')
return int
as $$
declare
l_job_id int;
l_next_date timestamp;
begin
if p_interval is not null
then
execute immediate '/*ora*/ select '||p_interval into l_next_date;
end if;
insert into dbms_job.antdb_job_config (job_user, job_schema, next_date, job_interval, what)
values (current_user(), current_schema(), p_next_date, p_interval, p_what) RETURNING job_id into l_job_id;
return l_job_id;
end $$;
-- 创建 submit 函数的重载,p_next_date 接收时区时间类型
-- =============================================================================
/*ora*/
create or replace function dbms_job.submit( p_what text
, p_next_date timestamp default clock_timestamp()
, p_interval text default null
, p_no_parse boolean default 'false'
, p_instance int default 0
, p_force boolean default 'false')
return int
as $$
begin
return dbms_job.submit_internal(case when p_what ~* '\A\s*(select|call)\s+' then p_what else 'select '||p_what end, p_next_date, p_interval, p_no_parse, p_instance, p_force);
end $$;
/*ora*/
create or replace function dbms_job.submit( p_what text
, p_next_date timestamp with time zone default clock_timestamp()
, p_interval text default null
, p_no_parse boolean default 'false'
, p_instance int default 0
, p_force boolean default 'false')
return int
as $$
begin
return dbms_job.submit_internal(case when p_what ~* '\A\s*(select|call)\s+' then p_what else 'select '||p_what end, p_next_date::timestamp, p_interval, p_no_parse, p_instance, p_force);
end $$;
-- 创建 run 函数,用于手动执行一个 job
-- =============================================================================
/*ora*/
create or replace function dbms_job.get_next_time(pi_job_interval text)
return timestamp
as $$
declare
l_next timestamp;
begin
execute immediate '/*ora*/ select '||pi_job_interval into l_next;
return l_next;
end;
$$;
/*pg*/
create or replace function dbms_job.run( p_job_id int
, p_force boolean default 'false')
returns void
as $$
declare
l_schema text;
l_job_interval text;
l_job_what text;
l_next timestamp;
begin
execute 'set lock_timeout=1';
update dbms_job.antdb_job_config
set last_date = next_date
where job_id = p_job_id
returning job_interval, what, job_schema
into l_job_interval, l_job_what, l_schema;
execute 'set lock_timeout=0';
select dbms_job.get_next_time(l_job_interval) into l_next;
raise notice 'execute job [%]', p_job_id;
execute 'set search_path = '''||l_schema||''',''public''';
execute l_job_what;
if l_job_interval is null
then
raise notice 'delete one time job [%] [%]', p_job_id, l_job_what;
delete from dbms_job.antdb_job_config where job_id = p_job_id;
else
raise notice 'set next time [%] [%]', p_job_id, l_next;
update dbms_job.antdb_job_config set next_date = l_next where job_id = p_job_id;
end if;
end $$ language plpgsql;
-- 创建 remove 函数,用于杀掉正在运行的 Job 进程
-- =============================================================================
/*pg*/
create or replace function dbms_job.kill_job ( p_job_id int )
returns void
as $$
declare
l_xc_exists bigint;
l_node record;
l_sess record;
begin
select count(*) into l_xc_exists from pg_class where relname = 'pgxc_node';
if l_xc_exists = 1
then
for l_node in select node_name from pgxc_node where node_type = 'C'
loop
for l_sess in execute ' execute direct on ('||l_node.node_name||') ''
select pid from pg_stat_activity
where regexp_match(query,''''^select dbms_job.run\(\d+\)[\s;]*$'''') is not null
and regexp_replace(query,''''[^\d]+'''','''''''',''''g'''')::int = '||p_job_id||''''
loop
execute 'execute direct on ('||l_node.node_name||') ''select pg_terminate_backend('||l_sess.pid||')''';
end loop;
end loop;
else
for l_sess in select pid from pg_stat_activity
where regexp_match(query,'^select dbms_job.run\(\d+\)$') is not null
and regexp_replace(query,'[^\d]+','','g')::int = p_job_id
loop
select pg_terminate_backend(l_sess.pid);
end loop;
end if;
end $$ language plpgsql;
-- 创建 remove 函数,用于移除一个 job
-- =============================================================================
/*ora*/
create or replace procedure dbms_job.remove( p_job_id int
, p_force boolean default 'false')
as $$
begin
-- 清理残留进程
if p_force
then
select dbms_job.kill_job(p_job_id);
end if;
-- 删除 Job 配置和日志
delete from dbms_job.antdb_job_config where job_id = p_job_id;
delete from dbms_job.antdb_job_log where job_id = p_job_id;
end $$;
-- 创建 what 函数,用于修改 what 命令
-- =============================================================================
/*ora*/
create or replace procedure dbms_job.what( p_job_id int
, p_what text
, p_force boolean default 'false')
as $$
begin
-- 清理残留进程
if p_force
then
select dbms_job.kill_job(p_job_id);
end if;
update dbms_job.antdb_job_config set what = p_what where job_id = p_job_id;
end $$;
-- 创建 next_date 函数,用于修改 next_date 属性
-- =============================================================================
/*ora*/
create or replace procedure dbms_job.next_date( p_job_id int
, p_next_date timestamp
, p_force boolean default 'false')
as $$
begin
-- 清理残留进程
if p_force
then
select dbms_job.kill_job(p_job_id);
end if;
update dbms_job.antdb_job_config set next_date = p_next_date where job_id = p_job_id;
end $$;
/*ora*/
create or replace procedure dbms_job.next_date( p_job_id int
, p_next_date timestamp with time zone
, p_force boolean default 'false')
as $$
begin
-- 清理残留进程
if p_force
then
select dbms_job.kill_job(p_job_id);
end if;
update dbms_job.antdb_job_config set next_date = p_next_date where job_id = p_job_id;
end $$;
-- 创建 interval 函数,用于修改 interval 属性
-- =============================================================================
/*ora*/
create or replace procedure dbms_job.interval( p_job_id int
, p_interval text
, p_force boolean default 'false')
as $$
declare
l_next_date timestamp;
begin
-- 清理残留进程
if p_force
then
select dbms_job.kill_job(p_job_id);
end if;
execute immediate '/*ora*/ select '||p_interval into l_next_date;
update dbms_job.antdb_job_config set job_interval = p_interval where job_id = p_job_id;
end $$;
-- 创建 change 函数,用于修改 job 属性
-- =============================================================================
/*ora*/
create or replace procedure dbms_job.change( p_job_id int
, p_what text
, p_next_date timestamp
, p_interval text
, p_instance int default 0
, p_force boolean default 'false')
as $$
declare
l_next_date timestamp;
begin
-- 清理残留进程
if p_force
then
select dbms_job.kill_job(p_job_id);
end if;
execute immediate '/*ora*/ select '||p_interval into l_next_date;
update dbms_job.antdb_job_config
set job_interval = p_interval
, next_date = p_next_date
, what = p_what
where job_id = p_job_id;
end $$;
/*ora*/
create or replace procedure dbms_job.change( p_job_id int
, p_what text
, p_next_date timestamp with time zone
, p_interval text
, p_instance int default 0
, p_force boolean default 'false')
as $$
declare
l_next_date timestamp;
begin
-- 清理残留进程
if p_force
then
select dbms_job.kill_job(p_job_id);
end if;
execute immediate '/*ora*/ select '||p_interval into l_next_date;
update dbms_job.antdb_job_config
set job_interval = p_interval
, next_date = p_next_date
, what = p_what
where job_id = p_job_id;
end $$;
-- 创建 broken 函数,用于修改 job 状态
-- =============================================================================
/*ora*/
create or replace procedure dbms_job.broken( p_job_id int
, p_broken boolean
, p_force boolean default 'false')
as $$
begin
-- 清理残留进程
if p_force
then
select dbms_job.kill_job(p_job_id);
end if;
update dbms_job.antdb_job_config
set broken = case when p_broken then 'Y' else 'N' end
where job_id = p_job_id;
end $$;
/*ora*/
create or replace procedure dbms_job.broken( p_job_id int
, p_broken boolean
, p_next_date timestamp
, p_force boolean default 'false')
as $$
begin
-- 清理残留进程
if p_force
then
select dbms_job.kill_job(p_job_id);
end if;
update dbms_job.antdb_job_config
set broken = case when p_broken then 'Y' else 'N' end
, next_date = p_next_date
where job_id = p_job_id;
end $$;
/*ora*/
create or replace procedure dbms_job.broken( p_job_id int
, p_broken boolean
, p_next_date timestamp with time zone
, p_force boolean default 'false')
as $$
begin
-- 清理残留进程
if p_force
then
select dbms_job.kill_job(p_job_id);
end if;
update dbms_job.antdb_job_config
set broken = case when p_broken then 'Y' else 'N' end
, next_date = p_next_date
where job_id = p_job_id;
end $$;
-- 加入 Linux crontab 进行调度,每分钟调度一次,调度在 gtm 节点执行
-- =============================================================================
cat > antdb_job_worker.sh <<"EOF"
SCRIPT_HOME=/data/hongye/scripts
LD_LIBRARY_PATH=/data/hongye/app/python3/lib:/data/hongye/app/antdb_5.0_cluster/lib:/usr/local/lib/:/usr/lib64/:/lib64:.
PATH=/data/hongye/app/antdb_5.0_cluster/bin:/data/hongye/app/python3/bin:/data/sy/jdk/jdk1.8.0_191/bin:/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/home/hongye/.local/bin:/home/hongye/bin:.
DB_OPTION=$1
JOB_INFO=$2
JOB_ID=`echo $JOB_INFO | cut -d '|' -f 1`
JOB_USER=`echo $JOB_INFO | cut -d '|' -f 2`
BEGIN_TIME=`date +%Y%m%d%H%M%S`
echo "Run job [$JOB_ID] using [$JOB_USER] at: $BEGIN_TIME"
JOB_RESULT=`psql $DB_OPTION -U $JOB_USER -c "select dbms_job.run($JOB_ID)" 2>&1`
END_TIME=`date +%Y%m%d%H%M%S`
JOB_RESULT=${JOB_RESULT//\'/\'\'}
#JOB_RESULT=${JOB_RESULT//\"/\\\"}
echo "Job end at: $END_TIME"
echo "Job result: $JOB_RESULT"
psql $DB_OPTION -c "insert into dbms_job.antdb_job_log (job_id,run_time,complete_time,run_message) select $JOB_ID, to_timestamp('$BEGIN_TIME', 'YYYYMMDDHH24MISS'), to_timestamp('$END_TIME', 'YYYYMMDDHH24MISS'), '$JOB_RESULT' where '$JOB_RESULT' not like '%lock timeout%update dbms_job.antdb_job_config%'"
EOF
cat > antdb_job_scheduler.sh <<"EOF"
SCRIPT_HOME=/data/hongye/scripts
LD_LIBRARY_PATH=/data/hongye/app/python3/lib:/data/hongye/app/antdb_5.0_cluster/lib:/usr/local/lib/:/usr/lib64/:/lib64:.
PATH=/data/hongye/app/antdb_5.0_cluster/bin:/data/hongye/app/python3/bin:/data/sy/jdk/jdk1.8.0_191/bin:/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/home/hongye/.local/bin:/home/hongye/bin:.
mkdir $SCRIPT_HOME/logs
db_option='-At -h 10.21.20.175 -p 55202 -d postgres'
for x in `psql $db_option -c "select job_id, job_user from dbms_job.antdb_job_config where broken = 'N' and next_date < clock_timestamp() + interval '30 seconds'"`
do
JOB_ID=`echo $x | cut -d '|' -f 1`
bash $SCRIPT_HOME/antdb_job_worker.sh "$db_option" "$x" 1>$SCRIPT_HOME/logs/worker_$JOB_ID.log 2>&1 &
done
EOF
* * * * * bash /data/hongye/scripts/antdb_job_scheduler.sh >>/data/hongye/scripts/logs/antdb_job_`date +"\%Y\%m\%d"`.log 2>>/data/hongye/scripts/logs/antdb_job_`date +"\%Y\%m\%d"`.log
-- 一些测试相关的命令
-- =============================================================================
create table test_job_log (id int, insert_time timestamp);
delete from dbms_job.antdb_job_config;
delete from dbms_job.antdb_job_log;
delete from test_job_log;
create function p_insert (p_value int) returns void
as $$
insert into test_job_log values(p_value, clock_timestamp());
$$ language sql;
-- 立即执行,并且每隔 1 分钟执行一次
set grammar to postgres;
select dbms_job.submit( 'select p_insert(1)'
, clock_timestamp()::timestamp
, 'clock_timestamp() + interval ''1 minutes''');
-- 立即执行,并且每隔 1 分钟执行一次,错误的命令
select dbms_job.submit_internal( 'insert into test_job_log_not_exists values(1, clock_timestamp());'
, clock_timestamp()::timestamp
, 'clock_timestamp() + interval ''1 minutes''');
-- Oracle 语法下,每分钟执行
set grammar to oracle;
select dbms_job.submit( 'p_insert(11);'
, sysdate
, 'sysdate + 1/1440');
-- 立即执行,并且每隔 3 分钟执行一次
select dbms_job.submit( 'insert into test_job_log values(3, clock_timestamp());'
, clock_timestamp()::timestamp
, 'clock_timestamp() + interval ''3 minutes''');
-- 每天凌晨 1 点执行
select dbms_job.submit( 'insert into test_job_log values(11, clock_timestamp());'
, clock_timestamp()::date::timestamp + interval '25 hours'
, 'clock_timestamp()::date::timestamp + interval ''25 hours''');
-- 立即执行,且只执行一次
select dbms_job.submit('insert into test_job_log values(100, clock_timestamp());'
, clock_timestamp()::timestamp);
select dbms_job.submit( 'insert into test_job_log values(2, clock_timestamp());'
, clock_timestamp()::timestamp
, 'clock_timestamp() + interval ''10 minutes''');
select dbms_job.submit( 'select pg_sleep(1000);'
, clock_timestamp()::timestamp
, 'clock_timestamp() + interval ''1 minutes''');
select dbms_job.run(1);
select dbms_job.run(2);
select * from dbms_job.antdb_job_config;
select * from test_job_log; | the_stack |
Helper functions to extract information or columns for dashbaord purposes.
Supported services
Compute Engine
Cloud Storage
Bigquery
NOTE:
1. Assumes that current project contains a dataset named 'dashboard' and creates
the functions in that dataset. Replace with correct name if that is not desired.
*/
-- Extract 'Category' or re-categorize 'Category' from taxonomy data and sku description.
CREATE OR REPLACE FUNCTION dashboard.Recategorize(
service STRING, category STRING, taxonomy STRING, sku STRING
)
AS (
CASE
-- Compute Engine
WHEN service = 'Compute Engine' and category = 'Compute'
THEN(
CASE
WHEN REGEXP_CONTAINS(taxonomy, r'ingress|egress|network other')
THEN 'Network'
WHEN REGEXP_CONTAINS(taxonomy, r'premium image') THEN 'Premium Image'
WHEN REGEXP_CONTAINS(taxonomy, r'gce->vms|vm image storage') THEN 'VM'
WHEN REGEXP_CONTAINS(taxonomy, r'gpus->gpus') THEN 'GPU'
WHEN REGEXP_CONTAINS(taxonomy, r'persistent disk|local ssd')
THEN 'Persistent Disk'
-- fallback
ELSE category
END
)
-- Compute Engine Network
WHEN service = 'Compute Engine' and category = 'Network' THEN 'Network'
-- Compute Engine Marketplace Services
WHEN service = 'Compute Engine' and category = 'Marketplace Services'
THEN 'Marketplace Services'
-- Compute Engine Analytics|Dataproc
WHEN service = 'Compute Engine' and category = 'Analytics'
THEN(
CASE
WHEN REGEXP_CONTAINS(taxonomy, r'analytics->(cloud dataflow)')
THEN 'Cloud Dataflow'
WHEN REGEXP_CONTAINS(taxonomy, r'analytics->cloud dataproc')
THEN 'Cloud Dataproc'
-- fallback
ELSE category
END
)
-- Cloud storage Network - NOTE: Nothing to recategorize
WHEN service = 'Cloud Storage' and category = 'Network' THEN 'Network'
WHEN service = 'Cloud Storage' and category = 'Storage'
THEN(
CASE
-- Cloud Storage Retrieval
WHEN REGEXP_CONTAINS(sku, r'data retrieval') THEN 'Data Retrieval'
-- Cloud Storage Operations
WHEN REGEXP_CONTAINS(taxonomy, r'gcs->ops') THEN 'Operations'
WHEN REGEXP_CONTAINS(taxonomy, r'early delete') THEN 'Early Deletes'
-- fallback
ELSE 'Data Storage'
END
)
-- Bigquery
WHEN
service IN (
'BigQuery', 'BigQuery Reservation API', 'BigQuery Storage API'
)
THEN category
-- Catch all other cases
ELSE '_PARSE_ERROR'
END
);
-- Extract Type information from taxonomy data and sku description.
CREATE OR REPLACE FUNCTION dashboard.Type(service STRING, taxonomy STRING, sku STRING)
AS (
CASE
-- Compute Engine
WHEN service = 'Compute Engine'
THEN(
CASE
-- Cores
WHEN REGEXP_CONTAINS(taxonomy, r'vms on demand->cores')
THEN 'Cores On-demand'
WHEN REGEXP_CONTAINS(taxonomy, r'vms preemptible->cores')
THEN 'Cores Preemptible'
WHEN REGEXP_CONTAINS(taxonomy, r'cores') THEN 'Cores'
-- RAM
WHEN REGEXP_CONTAINS(taxonomy, r'vms on demand->memory')
THEN 'RAM On-demand'
WHEN REGEXP_CONTAINS(taxonomy, r'vms preemptible->memory')
THEN 'RAM Preemptible'
WHEN REGEXP_CONTAINS(taxonomy, r'memory') THEN 'RAM'
-- PD/SSD
WHEN REGEXP_CONTAINS(taxonomy, r'local ssd->on demand')
THEN 'SSD Local On-demand'
WHEN REGEXP_CONTAINS(taxonomy, r'local ssd') THEN 'SSD Local'
WHEN REGEXP_CONTAINS(taxonomy, r'disk->ssd->capacity')
THEN 'SSD Capacity'
WHEN REGEXP_CONTAINS(taxonomy, r'disk->standard->capacity')
THEN 'Capacity'
WHEN REGEXP_CONTAINS(taxonomy, r'disk->standard->snapshot')
THEN 'Snapshot'
WHEN REGEXP_CONTAINS(taxonomy, r'vm image storage')
THEN 'Image Storage'
-- Compute Engine Storage Requests
WHEN REGEXP_CONTAINS(taxonomy, r'persistent disk->diskops')
THEN 'IO Requests'
-- Compute Engine Licenses
WHEN REGEXP_CONTAINS(taxonomy, r'premium image') THEN 'Licensing fee'
-- Compute Engine GPU
WHEN REGEXP_CONTAINS(taxonomy, r'gpus on demand')
THEN 'GPUs On-demand'
WHEN REGEXP_CONTAINS(taxonomy, r'gpus preemptible')
THEN 'GPUs Preemptible'
WHEN REGEXP_CONTAINS(taxonomy, r'gpus') THEN 'GPUs'
-- Compute Network
-- Ingress
WHEN
REGEXP_CONTAINS(
taxonomy, r'gce->ingress->premium|ingress->gce->premium'
)
THEN 'Ingress Premium'
WHEN REGEXP_CONTAINS(taxonomy, r'gce->ingress->standard')
THEN 'Ingress Standard'
WHEN REGEXP_CONTAINS(taxonomy, r'gce->ingress->inter-zone')
THEN 'Ingress Inter-zone'
WHEN REGEXP_CONTAINS(taxonomy, r'gce->ingress->intra-zone')
THEN 'Ingress Intra-zone'
WHEN REGEXP_CONTAINS(taxonomy, r'gce->ingress->inter-region')
THEN 'Ingress Inter-region'
WHEN REGEXP_CONTAINS(taxonomy, r'gce->ingress->standard')
THEN 'Ingress'
WHEN REGEXP_CONTAINS(taxonomy, r'gce->ingress') THEN 'Ingress'
-- Egress
WHEN
REGEXP_CONTAINS(
taxonomy, r'gce->egress->premium|egress->gce->premium'
)
THEN 'Egress Premium'
WHEN REGEXP_CONTAINS(taxonomy, r'gce->egress->standard')
THEN 'Egress Standard'
WHEN REGEXP_CONTAINS(taxonomy, r'gce->egress->inter-zone')
THEN 'Egress Inter-zone'
WHEN REGEXP_CONTAINS(taxonomy, r'gce->egress->intra-zone')
THEN 'Egress Intra-zone'
WHEN REGEXP_CONTAINS(taxonomy, r'gce->egress->inter-region')
THEN 'Egress Inter-region'
WHEN REGEXP_CONTAINS(taxonomy, r'gce->egress') THEN 'Ingress'
WHEN REGEXP_CONTAINS(taxonomy, r'network->egress->gce') THEN 'Egress'
-- Other
WHEN
REGEXP_CONTAINS(
taxonomy, r'cloud vpn->vpninter(region|net)ingress'
)
THEN 'Ingress VPN Inter-region/Internet'
WHEN
REGEXP_CONTAINS(
taxonomy, r'cloud vpn->vpninter(region|net)egress'
)
THEN 'Egress VPN Inter-region/Internet'
WHEN REGEXP_CONTAINS(taxonomy, r'interconnect->ingress')
THEN 'Ingress Interconnect'
WHEN REGEXP_CONTAINS(taxonomy, r'interconnect->egress')
THEN 'Egress Interconnect'
WHEN
REGEXP_CONTAINS(
taxonomy, r'interconnect->peeringorinterconnectegress'
)
THEN 'Egress Peering/Interconnect'
-- LB
WHEN REGEXP_CONTAINS(taxonomy, r'cloud lb->lb traffic') THEN 'LB'
WHEN REGEXP_CONTAINS(taxonomy, r'cloud lb->forwarding rule')
THEN 'LB Forwarding rule'
WHEN REGEXP_CONTAINS(taxonomy, r'cloud lb->internal')
THEN 'LB Internal'
WHEN REGEXP_CONTAINS(taxonomy, r'cloud lb->other') THEN 'LB Other'
-- CDN
WHEN REGEXP_CONTAINS(taxonomy, r'cloud cdn->cache fill')
THEN 'CDN Cache fill'
WHEN REGEXP_CONTAINS(taxonomy, r'cloud cdn->other') THEN 'CDN Other'
-- Cloud armor
WHEN REGEXP_CONTAINS(taxonomy, r'cloud armor->') THEN 'Cloud Armor'
-- VPN
WHEN REGEXP_CONTAINS(taxonomy, r'cloud vpn->vpntunnel')
THEN 'VPN tunnel'
-- External IP
WHEN REGEXP_CONTAINS(taxonomy, '->ip address') THEN 'IP Address'
WHEN REGEXP_CONTAINS(taxonomy, 'vpn->ip address')
THEN 'IP Address VPN'
-- Interconnect
WHEN REGEXP_CONTAINS(taxonomy, '->interconnect')
THEN 'Interconnect Partner/Dedicated'
-- NAT Gateway
WHEN REGEXP_CONTAINS(taxonomy, '->nat gateway') THEN 'NAT Gateway'
-- FLow logs
WHEN REGEXP_CONTAINS(taxonomy, '->vpc flow logs') THEN 'VPC flow logs'
-- Compute Engine Dataflow
-- Licensing
WHEN
REGEXP_CONTAINS(
taxonomy, 'licenses->dataflow streaming|licenses->dataproc'
)
THEN 'Licensing fee'
ELSE '_PARSE_ERROR'
END
)
-- Cloud Storage
WHEN service = 'Cloud Storage'
THEN(
CASE
-- Cloud Storage Network
WHEN REGEXP_CONTAINS(taxonomy, r'cdn->cache fill')
THEN 'CDN Cache fill'
WHEN REGEXP_CONTAINS(taxonomy, r'egress->gae->premium')
THEN 'Egress GAE/Firebase Premium'
WHEN REGEXP_CONTAINS(taxonomy, r'egress->gcs->(inter-region|premium)')
THEN 'Egress Inter-Region/Premium'
WHEN REGEXP_CONTAINS(taxonomy, r'interconnect->egress')
THEN 'Egress Peered/Interconnect'
-- Cloud Storage Operations|Early Deletes|Storage
-- DRA
WHEN REGEXP_CONTAINS(taxonomy, r'dra->regional and dual-regional')
THEN 'DRA Regional/Dual-Regional'
WHEN REGEXP_CONTAINS(taxonomy, r'dra') THEN 'DRA'
-- Standard
WHEN
REGEXP_CONTAINS(
taxonomy, r'standard->multi-regional and dual-regional'
)
THEN 'Standard Mutli-Regional/Dual-Regional'
WHEN REGEXP_CONTAINS(taxonomy, r'standard->multi-regional')
THEN 'Standard Mutli-Regional'
WHEN
REGEXP_CONTAINS(taxonomy, r'standard->regional and dual-regional')
THEN 'Standard Regional/Dual-Regional'
WHEN REGEXP_CONTAINS(taxonomy, r'standard->regional')
THEN 'Standard Regional/Dual-Regional'
-- Archive
WHEN REGEXP_CONTAINS(taxonomy, r'archive->regional and dual-regional')
THEN 'Archive Regional/Dual-Regional'
WHEN REGEXP_CONTAINS(taxonomy, r'archive->multi-regional')
THEN 'Archive Mutli-Regional'
WHEN REGEXP_CONTAINS(taxonomy, r'archive') THEN 'Archive'
-- Coldline
WHEN REGEXP_CONTAINS(taxonomy, r'coldline->multi-regional')
THEN 'Coldline Multi-Regional'
WHEN
REGEXP_CONTAINS(taxonomy, r'coldline->regional and dual-regional')
THEN 'Coldline Regional/Dual-Regional'
WHEN REGEXP_CONTAINS(taxonomy, r'coldline') THEN 'Coldline'
-- Nearline
WHEN REGEXP_CONTAINS(taxonomy, r'storage->nearline->multi-regional')
THEN 'Nearline Multi-Regional'
WHEN
REGEXP_CONTAINS(taxonomy, r'nearline->regional and dual-regional')
THEN 'Nearline Regional/Dual-Regional'
WHEN REGEXP_CONTAINS(taxonomy, r'nearline') THEN 'Nearline'
-- fallback
ELSE '_PARSE_ERROR'
END
)
-- BigQuery
WHEN service = 'BigQuery'
THEN(
CASE
-- BigQuery Analysis
WHEN REGEXP_CONTAINS(taxonomy, r'gbq->analysis->on demand')
THEN 'Analysis On-demand'
WHEN REGEXP_CONTAINS(taxonomy, r'gbq->analysis') THEN 'Analysis'
-- BigQuery Streaming
WHEN REGEXP_CONTAINS(taxonomy, r'gbq->streaming')
THEN 'Streaming Inserts'
-- BigQuery Storage
WHEN REGEXP_CONTAINS(taxonomy, r'gbq->storage->active')
THEN 'Storage Active'
WHEN REGEXP_CONTAINS(taxonomy, r'gbq->storage->long term')
THEN 'Storage Long-term'
WHEN REGEXP_CONTAINS(taxonomy, r'gbq->storage') THEN 'Storage'
-- catch all
ELSE '_PARSE_ERROR'
END
)
WHEN service = 'BigQuery Reservation API'
THEN(
CASE
-- BQ Reservation API
WHEN REGEXP_CONTAINS(taxonomy, r'reservation api->flat rate flex') THEN 'Flat rate flex'
WHEN REGEXP_CONTAINS(taxonomy, r'reservation api->flat rate') THEN 'Flat rate'
-- catch all
ELSE '_PARSE_ERROR'
END
)
WHEN service = 'BigQuery Storage API'
THEN(
CASE
-- BQ Storage API
WHEN REGEXP_CONTAINS(taxonomy, r'gbq->streaming') AND sku LIKE '%api - read' THEN 'Streaming Read'
ELSE '_PARSE_ERROR'
END
)
-- catch all for unsupported services
ELSE '_PARSE_ERROR'
END
);
-- Extract SubType information from taxonomy data and sku description.
CREATE OR REPLACE FUNCTION dashboard.SubType(service STRING, taxonomy STRING, sku STRING)
AS (
CASE
-- Compute Engine Cores
WHEN REGEXP_CONTAINS(taxonomy, r'gce->vms(.*)cores:') and REGEXP_CONTAINS(sku, r'^commit.*cpu') THEN
IFNULL(REGEXP_EXTRACT(sku, r'commit.*: (.*) cpu .*'), 'Standard')
WHEN REGEXP_CONTAINS(taxonomy, r'gce->vms(.*)cores:') and REGEXP_CONTAINS(sku, r'^commit.*core') THEN
IFNULL(REGEXP_EXTRACT(sku, r'commit.*: (.*) core .*'), 'Standard')
WHEN REGEXP_CONTAINS(taxonomy, r'gce->vms(.*)cores:') and REGEXP_CONTAINS(sku, r'^preemptible .* instance') THEN
REGEXP_EXTRACT(sku, r'^preemptible(.*) instance .*')
WHEN REGEXP_CONTAINS(taxonomy, r'gce->vms(.*)cores:') and REGEXP_CONTAINS(sku, r'^preemptible .* core') THEN
REGEXP_EXTRACT(sku, r'^preemptible(.*) core .*')
WHEN REGEXP_CONTAINS(taxonomy, r'gce->vms(.*)cores:') and REGEXP_CONTAINS(sku, r'premium') THEN
REGEXP_EXTRACT(sku, r'(.*) premium .*')
WHEN REGEXP_CONTAINS(taxonomy, r'gce->vms(.*)cores:') and REGEXP_CONTAINS(sku, r'instance') THEN
REGEXP_EXTRACT(sku, r'(.*) instance .*')
WHEN REGEXP_CONTAINS(taxonomy, r'gce->vms(.*)cores:') and REGEXP_CONTAINS(sku, r'core') THEN
REGEXP_EXTRACT(sku, r'(.*) core .*')
-- Compute Engine RAM
WHEN REGEXP_CONTAINS(taxonomy, r'gce->vms(.*)memory:') and REGEXP_CONTAINS(sku, r'^commit') THEN
IFNULL(REGEXP_EXTRACT(sku, r'commit.*: (.*) ram .*'), 'Standard')
WHEN REGEXP_CONTAINS(taxonomy, r'gce->vms(.*)memory:') and REGEXP_CONTAINS(sku, r'^preemptible .* instance') THEN
REGEXP_EXTRACT(sku, r'^preemptible(.*) instance .*')
WHEN REGEXP_CONTAINS(taxonomy, r'gce->vms(.*)memory:') and REGEXP_CONTAINS(sku, r'^preemptible .* ram') THEN
REGEXP_EXTRACT(sku, r'^preemptible(.*) ram .*')
WHEN REGEXP_CONTAINS(taxonomy, r'gce->vms(.*)memory:') and REGEXP_CONTAINS(sku, r'premium') THEN
REGEXP_EXTRACT(sku, r'(.*) premium .*')
WHEN REGEXP_CONTAINS(taxonomy, r'gce->vms(.*)memory:') and REGEXP_CONTAINS(sku, r'instance') THEN
REGEXP_EXTRACT(sku, r'(.*) instance .*')
WHEN REGEXP_CONTAINS(taxonomy, r'gce->vms(.*)memory:') and REGEXP_CONTAINS(sku, r'ram') THEN
REGEXP_EXTRACT(sku, r'(.*) ram .*')
-- Cloud Storage
WHEN service = 'Cloud Storage' THEN ''
-- BQ
WHEN service LIKE 'BigQuery%' THEN ''
-- catch all
ELSE ''
END
);
-- Extract UsageType information from taxonomy data
CREATE OR REPLACE FUNCTION dashboard.UsageType(taxonomy STRING)
AS (
CASE
-- Compute Engine
WHEN REGEXP_CONTAINS(taxonomy, 'offline') THEN 'Commitment'
WHEN REGEXP_CONTAINS(taxonomy, 'gce->vms commit') THEN 'Commitment'
-- Compute Engine GPUS
WHEN REGEXP_CONTAINS(taxonomy, 'gpus->gpus commit') THEN 'Commitment'
-- Compute Engine Storage
WHEN REGEXP_CONTAINS(taxonomy, 'commit') THEN 'Commitment'
ELSE 'Usage'
END
);
-- Extract the following fields from taxonomy data and sku description
-- 1. Category
-- 2. Type
-- 3. SubType
-- 4. UsageType
CREATE OR REPLACE FUNCTION dashboard.ItemSpec(
service STRING, category STRING, taxonomy STRING, sku STRING
)
AS (
STRUCT(
dashboard.Recategorize(service, category, taxonomy, sku) as pricing_category,
dashboard.Type(service, taxonomy, sku) as pricing_type,
dashboard.SubType(service, taxonomy, sku) as pricing_sub_type,
dashboard.UsageType(taxonomy) as pricing_usage_type
)
); | the_stack |
-- 2021-03-29T17:17:46.143854300Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Message_Trl SET IsTranslated='Y', MsgText='Sektionswechsel von {0} zu {1} durchgeführt am {2}.',Updated=TO_TIMESTAMP('2021-03-29 20:17:46','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Language='de_DE' AND AD_Message_ID=545028
;
-- 2021-03-29T17:17:57.416054600Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Message_Trl SET IsTranslated='Y', MsgText='Sektionswechsel von {0} zu {1} durchgeführt am {2}.',Updated=TO_TIMESTAMP('2021-03-29 20:17:57','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Language='de_CH' AND AD_Message_ID=545028
;
-- 2021-03-29T17:18:13.141124400Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Message SET MsgText='Org switch from organization {0} to organization {1} performed on date {2}.',Updated=TO_TIMESTAMP('2021-03-29 20:18:13','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Message_ID=545028
;
-- 2021-03-29T17:18:30.311124800Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Message_Trl SET MsgText='Org switch from organization {0} to organization {1} performed on date {2}.',Updated=TO_TIMESTAMP('2021-03-29 20:18:30','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Language='en_US' AND AD_Message_ID=545028
;
-- 2021-03-29T17:20:23.313986200Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Process_Trl SET IsTranslated='Y', Name='Organisation Change',Updated=TO_TIMESTAMP('2021-03-29 20:20:23','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Language='en_US' AND AD_Process_ID=584810
;
-- 2021-03-29T17:21:40.097882500Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Ref_List_Trl SET Name='Organisation Change',Updated=TO_TIMESTAMP('2021-03-29 20:21:40','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Language='en_US' AND AD_Ref_List_ID=542353
;
-- 2021-03-29T17:23:05.924684200Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Element_Trl SET IsTranslated='Y', Name='Ziel-Sektion', PrintName='Ziel-Sektion',Updated=TO_TIMESTAMP('2021-03-29 20:23:05','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=542976 AND AD_Language='fr_CH'
;
-- 2021-03-29T17:23:05.943253600Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
/* DDL */ select update_TRL_Tables_On_AD_Element_TRL_Update(542976,'fr_CH')
;
-- 2021-03-29T17:23:23.436220100Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Element_Trl SET IsTranslated='Y', Name='Targer Organization', PrintName='Targer Organization',Updated=TO_TIMESTAMP('2021-03-29 20:23:23','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=542976 AND AD_Language='en_GB'
;
-- 2021-03-29T17:23:23.442221500Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
/* DDL */ select update_TRL_Tables_On_AD_Element_TRL_Update(542976,'en_GB')
;
-- 2021-03-29T17:23:36.931838Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Element_Trl SET Name='Target Organization', PrintName='Target Organization',Updated=TO_TIMESTAMP('2021-03-29 20:23:36','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=542976 AND AD_Language='en_GB'
;
-- 2021-03-29T17:23:36.937468800Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
/* DDL */ select update_TRL_Tables_On_AD_Element_TRL_Update(542976,'en_GB')
;
-- 2021-03-29T17:23:45.871866800Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Element_Trl SET IsTranslated='Y', Name='Ziel-Sektion', PrintName='Ziel-Sektion',Updated=TO_TIMESTAMP('2021-03-29 20:23:45','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=542976 AND AD_Language='de_CH'
;
-- 2021-03-29T17:23:45.877217600Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
/* DDL */ select update_TRL_Tables_On_AD_Element_TRL_Update(542976,'de_CH')
;
-- 2021-03-29T17:23:58.125643300Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Element_Trl SET IsTranslated='Y', Name='Ziel-Sektion', PrintName='Ziel-Sektion',Updated=TO_TIMESTAMP('2021-03-29 20:23:58','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=542976 AND AD_Language='de_DE'
;
-- 2021-03-29T17:23:58.130845200Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
/* DDL */ select update_TRL_Tables_On_AD_Element_TRL_Update(542976,'de_DE')
;
-- 2021-03-29T17:23:58.146780300Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
/* DDL */ select update_ad_element_on_ad_element_trl_update(542976,'de_DE')
;
-- 2021-03-29T17:23:58.160291400Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Column SET ColumnName='AD_Org_Target_ID', Name='Ziel-Sektion', Description=NULL, Help=NULL WHERE AD_Element_ID=542976
;
-- 2021-03-29T17:23:58.163138600Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Process_Para SET ColumnName='AD_Org_Target_ID', Name='Ziel-Sektion', Description=NULL, Help=NULL, AD_Element_ID=542976 WHERE UPPER(ColumnName)='AD_ORG_TARGET_ID' AND IsCentrallyMaintained='Y' AND AD_Element_ID IS NULL
;
-- 2021-03-29T17:23:58.166560600Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Process_Para SET ColumnName='AD_Org_Target_ID', Name='Ziel-Sektion', Description=NULL, Help=NULL WHERE AD_Element_ID=542976 AND IsCentrallyMaintained='Y'
;
-- 2021-03-29T17:23:58.170693300Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Field SET Name='Ziel-Sektion', Description=NULL, Help=NULL WHERE (AD_Column_ID IN (SELECT AD_Column_ID FROM AD_Column WHERE AD_Element_ID=542976) AND AD_Name_ID IS NULL ) OR (AD_Name_ID = 542976)
;
-- 2021-03-29T17:23:58.183291900Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_PrintFormatItem pi SET PrintName='Ziel-Sektion', Name='Ziel-Sektion' WHERE IsCentrallyMaintained='Y' AND EXISTS (SELECT * FROM AD_Column c WHERE c.AD_Column_ID=pi.AD_Column_ID AND c.AD_Element_ID=542976)
;
-- 2021-03-29T17:23:58.185750900Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Tab SET Name='Ziel-Sektion', Description=NULL, Help=NULL, CommitWarning = NULL WHERE AD_Element_ID = 542976
;
-- 2021-03-29T17:23:58.189712900Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_WINDOW SET Name='Ziel-Sektion', Description=NULL, Help=NULL WHERE AD_Element_ID = 542976
;
-- 2021-03-29T17:23:58.192480800Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Menu SET Name = 'Ziel-Sektion', Description = NULL, WEBUI_NameBrowse = NULL, WEBUI_NameNew = NULL, WEBUI_NameNewBreadcrumb = NULL WHERE AD_Element_ID = 542976
;
-- 2021-03-29T17:24:09.120696100Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Element_Trl SET IsTranslated='Y', Name='Target Organization', PrintName='Target Organization',Updated=TO_TIMESTAMP('2021-03-29 20:24:09','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=542976 AND AD_Language='en_US'
;
-- 2021-03-29T17:24:09.126264200Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
/* DDL */ select update_TRL_Tables_On_AD_Element_TRL_Update(542976,'en_US')
;
-- 2021-03-29T17:25:37.284255Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_Element (AD_Client_ID,AD_Element_ID,AD_Org_ID,ColumnName,Created,CreatedBy,EntityType,IsActive,Name,PrintName,Updated,UpdatedBy) VALUES (0,578994,0,'M_Product_Membership_ID',TO_TIMESTAMP('2021-03-29 20:25:37','YYYY-MM-DD HH24:MI:SS'),100,'D','Y','Mitgliedschafts-Produkt','Mitgliedschafts-Produkt',TO_TIMESTAMP('2021-03-29 20:25:37','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 2021-03-29T17:25:37.292004600Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_Element_Trl (AD_Language,AD_Element_ID, CommitWarning,Description,Help,Name,PO_Description,PO_Help,PO_Name,PO_PrintName,PrintName,WEBUI_NameBrowse,WEBUI_NameNew,WEBUI_NameNewBreadcrumb, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language, t.AD_Element_ID, t.CommitWarning,t.Description,t.Help,t.Name,t.PO_Description,t.PO_Help,t.PO_Name,t.PO_PrintName,t.PrintName,t.WEBUI_NameBrowse,t.WEBUI_NameNew,t.WEBUI_NameNewBreadcrumb, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Element t WHERE l.IsActive='Y'AND (l.IsSystemLanguage='Y' OR l.IsBaseLanguage='Y') AND t.AD_Element_ID=578994 AND NOT EXISTS (SELECT 1 FROM AD_Element_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Element_ID=t.AD_Element_ID)
;
-- 2021-03-29T17:26:20.541555Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Element_Trl SET IsTranslated='Y', Name='Membership Product', PrintName='Membership Product',Updated=TO_TIMESTAMP('2021-03-29 20:26:20','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=578994 AND AD_Language='en_US'
;
-- 2021-03-29T17:26:20.548952Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
/* DDL */ select update_TRL_Tables_On_AD_Element_TRL_Update(578994,'en_US')
;
-- 2021-03-29T17:26:59.858672100Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Process_Para SET AD_Element_ID=578994, AD_Reference_Value_ID=540272, ColumnName='M_Product_Membership_ID', Description=NULL, Help=NULL, Name='Mitgliedschafts-Produkt',Updated=TO_TIMESTAMP('2021-03-29 20:26:59','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_Para_ID=541947
;
-- 2021-03-29T17:27:27.180974800Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Element_Trl SET IsTranslated='Y', Name='Wechseldatum', PrintName='Wechseldatum',Updated=TO_TIMESTAMP('2021-03-29 20:27:27','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=578875 AND AD_Language='de_CH'
;
-- 2021-03-29T17:27:27.186689200Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
/* DDL */ select update_TRL_Tables_On_AD_Element_TRL_Update(578875,'de_CH')
;
-- 2021-03-29T17:27:31.320515800Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Element_Trl SET IsTranslated='Y', Name='Wechseldatum', PrintName='Wechseldatum',Updated=TO_TIMESTAMP('2021-03-29 20:27:31','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=578875 AND AD_Language='de_DE'
;
-- 2021-03-29T17:27:31.326765500Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
/* DDL */ select update_TRL_Tables_On_AD_Element_TRL_Update(578875,'de_DE')
;
-- 2021-03-29T17:27:31.344205400Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
/* DDL */ select update_ad_element_on_ad_element_trl_update(578875,'de_DE')
;
-- 2021-03-29T17:27:31.354535200Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Column SET ColumnName='Date_OrgChange', Name='Wechseldatum', Description=NULL, Help=NULL WHERE AD_Element_ID=578875
;
-- 2021-03-29T17:27:31.357266Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Process_Para SET ColumnName='Date_OrgChange', Name='Wechseldatum', Description=NULL, Help=NULL, AD_Element_ID=578875 WHERE UPPER(ColumnName)='DATE_ORGCHANGE' AND IsCentrallyMaintained='Y' AND AD_Element_ID IS NULL
;
-- 2021-03-29T17:27:31.359970900Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Process_Para SET ColumnName='Date_OrgChange', Name='Wechseldatum', Description=NULL, Help=NULL WHERE AD_Element_ID=578875 AND IsCentrallyMaintained='Y'
;
-- 2021-03-29T17:27:31.362073600Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Field SET Name='Wechseldatum', Description=NULL, Help=NULL WHERE (AD_Column_ID IN (SELECT AD_Column_ID FROM AD_Column WHERE AD_Element_ID=578875) AND AD_Name_ID IS NULL ) OR (AD_Name_ID = 578875)
;
-- 2021-03-29T17:27:31.375491Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_PrintFormatItem pi SET PrintName='Wechseldatum', Name='Wechseldatum' WHERE IsCentrallyMaintained='Y' AND EXISTS (SELECT * FROM AD_Column c WHERE c.AD_Column_ID=pi.AD_Column_ID AND c.AD_Element_ID=578875)
;
-- 2021-03-29T17:27:31.378670500Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Tab SET Name='Wechseldatum', Description=NULL, Help=NULL, CommitWarning = NULL WHERE AD_Element_ID = 578875
;
-- 2021-03-29T17:27:31.381874600Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_WINDOW SET Name='Wechseldatum', Description=NULL, Help=NULL WHERE AD_Element_ID = 578875
;
-- 2021-03-29T17:27:31.384707100Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Menu SET Name = 'Wechseldatum', Description = NULL, WEBUI_NameBrowse = NULL, WEBUI_NameNew = NULL, WEBUI_NameNewBreadcrumb = NULL WHERE AD_Element_ID = 578875
;
-- 2021-03-29T17:27:46.303733300Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Element_Trl SET IsTranslated='Y', Name='Organization Change Date', PrintName='Organization Change Date',Updated=TO_TIMESTAMP('2021-03-29 20:27:46','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=578875 AND AD_Language='en_US'
;
-- 2021-03-29T17:27:46.308710300Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
/* DDL */ select update_TRL_Tables_On_AD_Element_TRL_Update(578875,'en_US')
;
-- 2021-03-29T17:29:24.564745Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Table_Trl SET Name='Sektionswechsel Log',Updated=TO_TIMESTAMP('2021-03-29 20:29:24','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Language='de_CH' AND AD_Table_ID=541601
;
-- 2021-03-29T17:29:30.556385900Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Table_Trl SET Name='Sektionswechsel Log',Updated=TO_TIMESTAMP('2021-03-29 20:29:30','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Language='de_DE' AND AD_Table_ID=541601
;
-- 2021-03-29T17:29:38.804574800Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Table_Trl SET IsTranslated='Y', Name='Organization Change History',Updated=TO_TIMESTAMP('2021-03-29 20:29:38','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Language='en_US' AND AD_Table_ID=541601
;
-- 2021-03-29T17:29:44.921815800Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Table_Trl SET IsTranslated='Y',Updated=TO_TIMESTAMP('2021-03-29 20:29:44','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Language='de_DE' AND AD_Table_ID=541601
;
-- 2021-03-29T17:29:49.795952900Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Table_Trl SET IsTranslated='Y',Updated=TO_TIMESTAMP('2021-03-29 20:29:49','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Language='de_CH' AND AD_Table_ID=541601
;
-- 2021-03-29T17:30:03.446002900Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Table SET Name='Organization Change History',Updated=TO_TIMESTAMP('2021-03-29 20:30:03','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Table_ID=541601
;
-- 2021-03-29T17:30:25.578595500Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Element_Trl SET IsTranslated='Y', Name='Sektionswechsel Log', PrintName='Sektionswechsel Log',Updated=TO_TIMESTAMP('2021-03-29 20:30:25','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=578832 AND AD_Language='de_CH'
;
-- 2021-03-29T17:30:25.584038100Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
/* DDL */ select update_TRL_Tables_On_AD_Element_TRL_Update(578832,'de_CH')
;
-- 2021-03-29T17:30:29.793766300Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Element_Trl SET IsTranslated='Y', Name='Sektionswechsel Log', PrintName='Sektionswechsel Log',Updated=TO_TIMESTAMP('2021-03-29 20:30:29','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=578832 AND AD_Language='de_DE'
;
-- 2021-03-29T17:30:29.799328600Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
/* DDL */ select update_TRL_Tables_On_AD_Element_TRL_Update(578832,'de_DE')
;
-- 2021-03-29T17:30:29.824790800Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
/* DDL */ select update_ad_element_on_ad_element_trl_update(578832,'de_DE')
;
-- 2021-03-29T17:30:29.835790900Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Column SET ColumnName='AD_OrgChange_History_ID', Name='Sektionswechsel Log', Description=NULL, Help=NULL WHERE AD_Element_ID=578832
;
-- 2021-03-29T17:30:29.838877600Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Process_Para SET ColumnName='AD_OrgChange_History_ID', Name='Sektionswechsel Log', Description=NULL, Help=NULL, AD_Element_ID=578832 WHERE UPPER(ColumnName)='AD_ORGCHANGE_HISTORY_ID' AND IsCentrallyMaintained='Y' AND AD_Element_ID IS NULL
;
-- 2021-03-29T17:30:29.841248500Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Process_Para SET ColumnName='AD_OrgChange_History_ID', Name='Sektionswechsel Log', Description=NULL, Help=NULL WHERE AD_Element_ID=578832 AND IsCentrallyMaintained='Y'
;
-- 2021-03-29T17:30:29.843343Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Field SET Name='Sektionswechsel Log', Description=NULL, Help=NULL WHERE (AD_Column_ID IN (SELECT AD_Column_ID FROM AD_Column WHERE AD_Element_ID=578832) AND AD_Name_ID IS NULL ) OR (AD_Name_ID = 578832)
;
-- 2021-03-29T17:30:29.857331500Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_PrintFormatItem pi SET PrintName='Sektionswechsel Log', Name='Sektionswechsel Log' WHERE IsCentrallyMaintained='Y' AND EXISTS (SELECT * FROM AD_Column c WHERE c.AD_Column_ID=pi.AD_Column_ID AND c.AD_Element_ID=578832)
;
-- 2021-03-29T17:30:29.860130600Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Tab SET Name='Sektionswechsel Log', Description=NULL, Help=NULL, CommitWarning = NULL WHERE AD_Element_ID = 578832
;
-- 2021-03-29T17:30:29.862815600Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_WINDOW SET Name='Sektionswechsel Log', Description=NULL, Help=NULL WHERE AD_Element_ID = 578832
;
-- 2021-03-29T17:30:29.866562900Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Menu SET Name = 'Sektionswechsel Log', Description = NULL, WEBUI_NameBrowse = NULL, WEBUI_NameNew = NULL, WEBUI_NameNewBreadcrumb = NULL WHERE AD_Element_ID = 578832
;
-- 2021-03-29T17:30:43.999427200Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Element_Trl SET IsTranslated='Y', Name='Organization Change History', PrintName='Organization Change History',Updated=TO_TIMESTAMP('2021-03-29 20:30:43','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=578832 AND AD_Language='en_US'
;
-- 2021-03-29T17:30:44.005453900Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
/* DDL */ select update_TRL_Tables_On_AD_Element_TRL_Update(578832,'en_US')
;
-- 2021-03-29T17:32:00.639377700Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Element_Trl SET IsTranslated='Y', Name='Sektions-Mapping', PrintName='Sektions-Mapping',Updated=TO_TIMESTAMP('2021-03-29 20:32:00','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=578815 AND AD_Language='de_CH'
;
-- 2021-03-29T17:32:00.645313800Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
/* DDL */ select update_TRL_Tables_On_AD_Element_TRL_Update(578815,'de_CH')
;
-- 2021-03-29T17:32:03.818493600Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Element_Trl SET IsTranslated='Y', Name='Sektions-Mapping', PrintName='Sektions-Mapping',Updated=TO_TIMESTAMP('2021-03-29 20:32:03','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=578815 AND AD_Language='de_DE'
;
-- 2021-03-29T17:32:03.822681200Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
/* DDL */ select update_TRL_Tables_On_AD_Element_TRL_Update(578815,'de_DE')
;
-- 2021-03-29T17:32:03.841160700Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
/* DDL */ select update_ad_element_on_ad_element_trl_update(578815,'de_DE')
;
-- 2021-03-29T17:32:03.845795300Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Column SET ColumnName='AD_Org_Mapping_ID', Name='Sektions-Mapping', Description=NULL, Help=NULL WHERE AD_Element_ID=578815
;
-- 2021-03-29T17:32:03.850434900Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Process_Para SET ColumnName='AD_Org_Mapping_ID', Name='Sektions-Mapping', Description=NULL, Help=NULL, AD_Element_ID=578815 WHERE UPPER(ColumnName)='AD_ORG_MAPPING_ID' AND IsCentrallyMaintained='Y' AND AD_Element_ID IS NULL
;
-- 2021-03-29T17:32:03.855118800Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Process_Para SET ColumnName='AD_Org_Mapping_ID', Name='Sektions-Mapping', Description=NULL, Help=NULL WHERE AD_Element_ID=578815 AND IsCentrallyMaintained='Y'
;
-- 2021-03-29T17:32:03.858511800Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Field SET Name='Sektions-Mapping', Description=NULL, Help=NULL WHERE (AD_Column_ID IN (SELECT AD_Column_ID FROM AD_Column WHERE AD_Element_ID=578815) AND AD_Name_ID IS NULL ) OR (AD_Name_ID = 578815)
;
-- 2021-03-29T17:32:03.880614300Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_PrintFormatItem pi SET PrintName='Sektions-Mapping', Name='Sektions-Mapping' WHERE IsCentrallyMaintained='Y' AND EXISTS (SELECT * FROM AD_Column c WHERE c.AD_Column_ID=pi.AD_Column_ID AND c.AD_Element_ID=578815)
;
-- 2021-03-29T17:32:03.883692800Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Tab SET Name='Sektions-Mapping', Description=NULL, Help=NULL, CommitWarning = NULL WHERE AD_Element_ID = 578815
;
-- 2021-03-29T17:32:03.886941300Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_WINDOW SET Name='Sektions-Mapping', Description=NULL, Help=NULL WHERE AD_Element_ID = 578815
;
-- 2021-03-29T17:32:03.889147600Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Menu SET Name = 'Sektions-Mapping', Description = NULL, WEBUI_NameBrowse = NULL, WEBUI_NameNew = NULL, WEBUI_NameNewBreadcrumb = NULL WHERE AD_Element_ID = 578815
;
-- 2021-03-29T17:32:14.731680600Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Element_Trl SET Name='Organization Mapping', PrintName='Organization Mapping',Updated=TO_TIMESTAMP('2021-03-29 20:32:14','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=578815 AND AD_Language='en_US'
;
-- 2021-03-29T17:32:14.737112Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
/* DDL */ select update_TRL_Tables_On_AD_Element_TRL_Update(578815,'en_US')
;
-- 2021-03-29T17:33:13.421454100Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Element_Trl SET IsTranslated='Y', Name='Upsprungs-Sektion', PrintName='Upsprungs-Sektion',Updated=TO_TIMESTAMP('2021-03-29 20:33:13','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=578833 AND AD_Language='de_CH'
;
-- 2021-03-29T17:33:13.426975Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
/* DDL */ select update_TRL_Tables_On_AD_Element_TRL_Update(578833,'de_CH')
;
-- 2021-03-29T17:33:17.051186900Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Element_Trl SET IsTranslated='Y', Name='Upsprungs-Sektion', PrintName='Upsprungs-Sektion',Updated=TO_TIMESTAMP('2021-03-29 20:33:17','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=578833 AND AD_Language='de_DE'
;
-- 2021-03-29T17:33:17.056414700Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
/* DDL */ select update_TRL_Tables_On_AD_Element_TRL_Update(578833,'de_DE')
;
-- 2021-03-29T17:33:17.071521Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
/* DDL */ select update_ad_element_on_ad_element_trl_update(578833,'de_DE')
;
-- 2021-03-29T17:33:17.081084900Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Column SET ColumnName='AD_Org_From_ID', Name='Upsprungs-Sektion', Description=NULL, Help=NULL WHERE AD_Element_ID=578833
;
-- 2021-03-29T17:33:17.083861500Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Process_Para SET ColumnName='AD_Org_From_ID', Name='Upsprungs-Sektion', Description=NULL, Help=NULL, AD_Element_ID=578833 WHERE UPPER(ColumnName)='AD_ORG_FROM_ID' AND IsCentrallyMaintained='Y' AND AD_Element_ID IS NULL
;
-- 2021-03-29T17:33:17.086558900Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Process_Para SET ColumnName='AD_Org_From_ID', Name='Upsprungs-Sektion', Description=NULL, Help=NULL WHERE AD_Element_ID=578833 AND IsCentrallyMaintained='Y'
;
-- 2021-03-29T17:33:17.088851100Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Field SET Name='Upsprungs-Sektion', Description=NULL, Help=NULL WHERE (AD_Column_ID IN (SELECT AD_Column_ID FROM AD_Column WHERE AD_Element_ID=578833) AND AD_Name_ID IS NULL ) OR (AD_Name_ID = 578833)
;
-- 2021-03-29T17:33:17.103300600Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_PrintFormatItem pi SET PrintName='Upsprungs-Sektion', Name='Upsprungs-Sektion' WHERE IsCentrallyMaintained='Y' AND EXISTS (SELECT * FROM AD_Column c WHERE c.AD_Column_ID=pi.AD_Column_ID AND c.AD_Element_ID=578833)
;
-- 2021-03-29T17:33:17.106050400Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Tab SET Name='Upsprungs-Sektion', Description=NULL, Help=NULL, CommitWarning = NULL WHERE AD_Element_ID = 578833
;
-- 2021-03-29T17:33:17.108760300Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_WINDOW SET Name='Upsprungs-Sektion', Description=NULL, Help=NULL WHERE AD_Element_ID = 578833
;
-- 2021-03-29T17:33:17.111054500Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Menu SET Name = 'Upsprungs-Sektion', Description = NULL, WEBUI_NameBrowse = NULL, WEBUI_NameNew = NULL, WEBUI_NameNewBreadcrumb = NULL WHERE AD_Element_ID = 578833
;
-- 2021-03-29T17:33:35.216168Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Element_Trl SET IsTranslated='Y', Name='Organization From', PrintName='Organization From',Updated=TO_TIMESTAMP('2021-03-29 20:33:35','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=578833 AND AD_Language='en_US'
;
-- 2021-03-29T17:33:35.218381500Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
/* DDL */ select update_TRL_Tables_On_AD_Element_TRL_Update(578833,'en_US')
;
-- 2021-03-29T17:34:51.008457500Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Element_Trl SET IsTranslated='Y', Name='Ziel-Sektion', PrintName='Ziel-Sektion',Updated=TO_TIMESTAMP('2021-03-29 20:34:50','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=578864 AND AD_Language='de_CH'
;
-- 2021-03-29T17:34:51.013135300Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
/* DDL */ select update_TRL_Tables_On_AD_Element_TRL_Update(578864,'de_CH')
;
-- 2021-03-29T17:34:54.949492300Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Element_Trl SET IsTranslated='Y', Name='Ziel-Sektion', PrintName='Ziel-Sektion',Updated=TO_TIMESTAMP('2021-03-29 20:34:54','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=578864 AND AD_Language='de_DE'
;
-- 2021-03-29T17:34:54.955073200Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
/* DDL */ select update_TRL_Tables_On_AD_Element_TRL_Update(578864,'de_DE')
;
-- 2021-03-29T17:34:54.976436600Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
/* DDL */ select update_ad_element_on_ad_element_trl_update(578864,'de_DE')
;
-- 2021-03-29T17:34:54.981567300Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Column SET ColumnName=NULL, Name='Ziel-Sektion', Description=NULL, Help=NULL WHERE AD_Element_ID=578864
;
-- 2021-03-29T17:34:54.985661700Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Process_Para SET ColumnName=NULL, Name='Ziel-Sektion', Description=NULL, Help=NULL WHERE AD_Element_ID=578864 AND IsCentrallyMaintained='Y'
;
-- 2021-03-29T17:34:54.989802200Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Field SET Name='Ziel-Sektion', Description=NULL, Help=NULL WHERE (AD_Column_ID IN (SELECT AD_Column_ID FROM AD_Column WHERE AD_Element_ID=578864) AND AD_Name_ID IS NULL ) OR (AD_Name_ID = 578864)
;
-- 2021-03-29T17:34:55.003816100Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_PrintFormatItem pi SET PrintName='Ziel-Sektion', Name='Ziel-Sektion' WHERE IsCentrallyMaintained='Y' AND EXISTS (SELECT * FROM AD_Column c WHERE c.AD_Column_ID=pi.AD_Column_ID AND c.AD_Element_ID=578864)
;
-- 2021-03-29T17:34:55.006139300Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Tab SET Name='Ziel-Sektion', Description=NULL, Help=NULL, CommitWarning = NULL WHERE AD_Element_ID = 578864
;
-- 2021-03-29T17:34:55.008905Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_WINDOW SET Name='Ziel-Sektion', Description=NULL, Help=NULL WHERE AD_Element_ID = 578864
;
-- 2021-03-29T17:34:55.011574Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Menu SET Name = 'Ziel-Sektion', Description = NULL, WEBUI_NameBrowse = NULL, WEBUI_NameNew = NULL, WEBUI_NameNewBreadcrumb = NULL WHERE AD_Element_ID = 578864
;
-- 2021-03-29T17:35:04.718327200Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Element_Trl SET Name='Organization To', PrintName='Organization To',Updated=TO_TIMESTAMP('2021-03-29 20:35:04','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=578864 AND AD_Language='en_US'
;
-- 2021-03-29T17:35:04.723643900Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
/* DDL */ select update_TRL_Tables_On_AD_Element_TRL_Update(578864,'en_US')
;
-- 2021-03-29T17:35:10.793775700Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Element_Trl SET IsTranslated='Y',Updated=TO_TIMESTAMP('2021-03-29 20:35:10','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=578864 AND AD_Language='en_US'
;
-- 2021-03-29T17:35:10.798786700Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
/* DDL */ select update_TRL_Tables_On_AD_Element_TRL_Update(578864,'en_US')
;
-- 2021-03-29T17:35:51.943273800Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Element_Trl SET IsTranslated='Y', Name='Upsprungs-Geschäftspartner', PrintName='Upsprungs-Geschäftspartner',Updated=TO_TIMESTAMP('2021-03-29 20:35:51','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=578873 AND AD_Language='de_CH'
;
-- 2021-03-29T17:35:51.946109400Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
/* DDL */ select update_TRL_Tables_On_AD_Element_TRL_Update(578873,'de_CH')
;
-- 2021-03-29T17:35:55.953953500Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Element_Trl SET IsTranslated='Y', Name='Upsprungs-Geschäftspartner', PrintName='Upsprungs-Geschäftspartner',Updated=TO_TIMESTAMP('2021-03-29 20:35:55','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=578873 AND AD_Language='de_DE'
;
-- 2021-03-29T17:35:55.958845200Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
/* DDL */ select update_TRL_Tables_On_AD_Element_TRL_Update(578873,'de_DE')
;
-- 2021-03-29T17:35:55.980213400Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
/* DDL */ select update_ad_element_on_ad_element_trl_update(578873,'de_DE')
;
-- 2021-03-29T17:35:55.984748600Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Column SET ColumnName='C_BPartner_From_ID', Name='Upsprungs-Geschäftspartner', Description=NULL, Help=NULL WHERE AD_Element_ID=578873
;
-- 2021-03-29T17:35:55.988744500Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Process_Para SET ColumnName='C_BPartner_From_ID', Name='Upsprungs-Geschäftspartner', Description=NULL, Help=NULL, AD_Element_ID=578873 WHERE UPPER(ColumnName)='C_BPARTNER_FROM_ID' AND IsCentrallyMaintained='Y' AND AD_Element_ID IS NULL
;
-- 2021-03-29T17:35:55.992061400Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Process_Para SET ColumnName='C_BPartner_From_ID', Name='Upsprungs-Geschäftspartner', Description=NULL, Help=NULL WHERE AD_Element_ID=578873 AND IsCentrallyMaintained='Y'
;
-- 2021-03-29T17:35:55.994775200Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Field SET Name='Upsprungs-Geschäftspartner', Description=NULL, Help=NULL WHERE (AD_Column_ID IN (SELECT AD_Column_ID FROM AD_Column WHERE AD_Element_ID=578873) AND AD_Name_ID IS NULL ) OR (AD_Name_ID = 578873)
;
-- 2021-03-29T17:35:56.015558800Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_PrintFormatItem pi SET PrintName='Upsprungs-Geschäftspartner', Name='Upsprungs-Geschäftspartner' WHERE IsCentrallyMaintained='Y' AND EXISTS (SELECT * FROM AD_Column c WHERE c.AD_Column_ID=pi.AD_Column_ID AND c.AD_Element_ID=578873)
;
-- 2021-03-29T17:35:56.018836900Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Tab SET Name='Upsprungs-Geschäftspartner', Description=NULL, Help=NULL, CommitWarning = NULL WHERE AD_Element_ID = 578873
;
-- 2021-03-29T17:35:56.022731100Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_WINDOW SET Name='Upsprungs-Geschäftspartner', Description=NULL, Help=NULL WHERE AD_Element_ID = 578873
;
-- 2021-03-29T17:35:56.025947Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Menu SET Name = 'Upsprungs-Geschäftspartner', Description = NULL, WEBUI_NameBrowse = NULL, WEBUI_NameNew = NULL, WEBUI_NameNewBreadcrumb = NULL WHERE AD_Element_ID = 578873
;
-- 2021-03-29T17:36:26.913808Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Element_Trl SET IsTranslated='Y', Name='Ziel-Geschäftspartner', PrintName='Ziel-Geschäftspartner',Updated=TO_TIMESTAMP('2021-03-29 20:36:26','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=578874 AND AD_Language='de_CH'
;
-- 2021-03-29T17:36:26.918003700Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
/* DDL */ select update_TRL_Tables_On_AD_Element_TRL_Update(578874,'de_CH')
;
-- 2021-03-29T17:36:31.021774Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Element_Trl SET IsTranslated='Y', Name='Ziel-Geschäftspartner', PrintName='Ziel-Geschäftspartner',Updated=TO_TIMESTAMP('2021-03-29 20:36:31','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=578874 AND AD_Language='de_DE'
;
-- 2021-03-29T17:36:31.026436300Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
/* DDL */ select update_TRL_Tables_On_AD_Element_TRL_Update(578874,'de_DE')
;
-- 2021-03-29T17:36:31.044746100Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
/* DDL */ select update_ad_element_on_ad_element_trl_update(578874,'de_DE')
;
-- 2021-03-29T17:36:31.051024Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Column SET ColumnName='C_BPartner_To_ID', Name='Ziel-Geschäftspartner', Description=NULL, Help=NULL WHERE AD_Element_ID=578874
;
-- 2021-03-29T17:36:31.055674Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Process_Para SET ColumnName='C_BPartner_To_ID', Name='Ziel-Geschäftspartner', Description=NULL, Help=NULL, AD_Element_ID=578874 WHERE UPPER(ColumnName)='C_BPARTNER_TO_ID' AND IsCentrallyMaintained='Y' AND AD_Element_ID IS NULL
;
-- 2021-03-29T17:36:31.060339Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Process_Para SET ColumnName='C_BPartner_To_ID', Name='Ziel-Geschäftspartner', Description=NULL, Help=NULL WHERE AD_Element_ID=578874 AND IsCentrallyMaintained='Y'
;
-- 2021-03-29T17:36:31.064329700Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Field SET Name='Ziel-Geschäftspartner', Description=NULL, Help=NULL WHERE (AD_Column_ID IN (SELECT AD_Column_ID FROM AD_Column WHERE AD_Element_ID=578874) AND AD_Name_ID IS NULL ) OR (AD_Name_ID = 578874)
;
-- 2021-03-29T17:36:31.089595100Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_PrintFormatItem pi SET PrintName='Ziel-Geschäftspartner', Name='Ziel-Geschäftspartner' WHERE IsCentrallyMaintained='Y' AND EXISTS (SELECT * FROM AD_Column c WHERE c.AD_Column_ID=pi.AD_Column_ID AND c.AD_Element_ID=578874)
;
-- 2021-03-29T17:36:31.092738900Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Tab SET Name='Ziel-Geschäftspartner', Description=NULL, Help=NULL, CommitWarning = NULL WHERE AD_Element_ID = 578874
;
-- 2021-03-29T17:36:31.095999800Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_WINDOW SET Name='Ziel-Geschäftspartner', Description=NULL, Help=NULL WHERE AD_Element_ID = 578874
;
-- 2021-03-29T17:36:31.098131Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Menu SET Name = 'Ziel-Geschäftspartner', Description = NULL, WEBUI_NameBrowse = NULL, WEBUI_NameNew = NULL, WEBUI_NameNewBreadcrumb = NULL WHERE AD_Element_ID = 578874
;
-- 2021-03-29T17:37:14.771180Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Process SET Description='Dieser Prozess wird jede Nacht ausgeführt, um Geschäftspartner, die entsprechend dem Sektionswechsel Log an dem jeweiligen Datum deaktivert werden sollen.', Help='Dieser Prozess wird jede Nacht ausgeführt, um Geschäftspartner, die entsprechend dem Sektionswechsel Log an dem jeweiligen Datum deaktivert werden sollen.',Updated=TO_TIMESTAMP('2021-03-29 20:37:14','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_ID=584810
;
-- 2021-03-29T17:37:24.197588100Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Process_Trl SET Description='Dieser Prozess wird jede Nacht ausgeführt, um Geschäftspartner, die entsprechend dem Sektionswechsel Log an dem jeweiligen Datum deaktivert werden sollen.', Help='Dieser Prozess wird jede Nacht ausgeführt, um Geschäftspartner, die entsprechend dem Sektionswechsel Log an dem jeweiligen Datum deaktivert werden sollen.', IsTranslated='Y',Updated=TO_TIMESTAMP('2021-03-29 20:37:24','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Language='de_CH' AND AD_Process_ID=584810
;
-- 2021-03-29T17:37:29.933626Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Process_Trl SET Description='Dieser Prozess wird jede Nacht ausgeführt, um Geschäftspartner, die entsprechend dem Sektionswechsel Log an dem jeweiligen Datum deaktivert werden sollen.', Help='Dieser Prozess wird jede Nacht ausgeführt, um Geschäftspartner, die entsprechend dem Sektionswechsel Log an dem jeweiligen Datum deaktivert werden sollen.', IsTranslated='Y',Updated=TO_TIMESTAMP('2021-03-29 20:37:29','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Language='de_DE' AND AD_Process_ID=584810
;
-- 2021-03-29T17:38:00.497052900Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Process_Trl SET Description='This process is scheduled to be run each night to deactivate bpartners (and their locations, contacts and bank accounts) that were moved to another organization and are scheduled to be deactivated at a given date via Organization Change History.',Updated=TO_TIMESTAMP('2021-03-29 20:38:00','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Language='en_US' AND AD_Process_ID=584810
;
-- 2021-03-29T17:38:05.287692300Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Process_Trl SET Help='This process is scheduled to be run each night to deactivate bpartners (and their locations, contacts and bank accounts) that were moved to another organization and are scheduled to be deactivated at a given date via Organization Change History.',Updated=TO_TIMESTAMP('2021-03-29 20:38:05','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Language='en_US' AND AD_Process_ID=584810
;
-- 2021-03-29T17:38:44.456822400Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Process SET Description='', Help='',Updated=TO_TIMESTAMP('2021-03-29 20:38:44','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_ID=584810
;
-- 2021-03-29T17:38:52.445120500Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Process_Trl SET Description='', Help='',Updated=TO_TIMESTAMP('2021-03-29 20:38:52','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Language='de_CH' AND AD_Process_ID=584810
;
-- 2021-03-29T17:38:55.442836500Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Process_Trl SET Description='', Help='',Updated=TO_TIMESTAMP('2021-03-29 20:38:55','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Language='de_DE' AND AD_Process_ID=584810
;
-- 2021-03-29T17:39:00.635090700Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Process_Trl SET Description='', Help='',Updated=TO_TIMESTAMP('2021-03-29 20:39:00','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Language='en_US' AND AD_Process_ID=584810
;
-- 2021-03-29T17:40:43.850755Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Process SET Description='Dieser Prozess wird jede Nacht ausgeführt, um Geschäftspartner, die entsprechend dem Sektionswechsel Log an dem jeweiligen Datum deaktivert werden sollen.', Help='Dieser Prozess wird jede Nacht ausgeführt, um Geschäftspartner, die entsprechend dem Sektionswechsel Log an dem jeweiligen Datum deaktivert werden sollen.', TechnicalNote='Dieser Prozess wird jede Nacht ausgeführt, um Geschäftspartner, die entsprechend dem Sektionswechsel Log an dem jeweiligen Datum deaktivert werden sollen.',Updated=TO_TIMESTAMP('2021-03-29 20:40:43','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_ID=584814
;
-- 2021-03-29T17:40:57.615745600Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Process_Trl SET Description='Dieser Prozess wird jede Nacht ausgeführt, um Geschäftspartner, die entsprechend dem Sektionswechsel Log an dem jeweiligen Datum deaktivert werden sollen.', Help='Dieser Prozess wird jede Nacht ausgeführt, um Geschäftspartner, die entsprechend dem Sektionswechsel Log an dem jeweiligen Datum deaktivert werden sollen.',Updated=TO_TIMESTAMP('2021-03-29 20:40:57','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Language='de_DE' AND AD_Process_ID=584814
;
-- 2021-03-29T17:41:30.582919300Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Process_Trl SET Description='This process is scheduled to be run each night to deactivate bpartners (and their locations, contacts and bank accounts) that were moved to another organization and are scheduled to be deactivated at a given date via Organization Change History.', Help='This process is scheduled to be run each night to deactivate bpartners (and their locations, contacts and bank accounts) that were moved to another organization and are scheduled to be deactivated at a given date via Organization Change History.', IsTranslated='Y',Updated=TO_TIMESTAMP('2021-03-29 20:41:30','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Language='en_US' AND AD_Process_ID=584814
;
-- 2021-03-29T17:41:46.891214200Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Process_Trl SET IsTranslated='Y',Updated=TO_TIMESTAMP('2021-03-29 20:41:46','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Language='de_DE' AND AD_Process_ID=584814
;
-- 2021-03-29T17:41:50.861441500Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Process_Trl SET IsTranslated='Y',Updated=TO_TIMESTAMP('2021-03-29 20:41:50','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Language='de_CH' AND AD_Process_ID=584814
;
-- 2021-03-29T18:15:16.573523800Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Message SET MsgText='Sektionswechsel von {0} zu {1} durchgeführt am {2}.',Updated=TO_TIMESTAMP('2021-03-29 21:15:16','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Message_ID=545028
; | the_stack |
-- 2017-09-04T10:47:01.557
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_Menu (Action,AD_Client_ID,AD_Menu_ID,AD_Org_ID,AD_Window_ID,Created,CreatedBy,Description,EntityType,InternalName,IsActive,IsCreateNew,IsReadOnly,IsSOTrx,IsSummary,Name,Updated,UpdatedBy,WEBUI_NameBrowse) VALUES ('W',0,540918,0,341,TO_TIMESTAMP('2017-09-04 10:47:01','YYYY-MM-DD HH24:MI:SS'),100,'Geben Sie Eigenverbrauch aus dem Warenbestand ein','de.metas.swat','_Eigenverbrauch','Y','N','N','N','N','Eigenverbrauch',TO_TIMESTAMP('2017-09-04 10:47:01','YYYY-MM-DD HH24:MI:SS'),100,'Eigenverbrauch')
;
-- 2017-09-04T10:47:01.567
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_Menu_Trl (AD_Language,AD_Menu_ID, Description,Name,WEBUI_NameBrowse,WEBUI_NameNew,WEBUI_NameNewBreadcrumb, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Menu_ID, t.Description,t.Name,t.WEBUI_NameBrowse,t.WEBUI_NameNew,t.WEBUI_NameNewBreadcrumb, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Menu t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Menu_ID=540918 AND NOT EXISTS (SELECT 1 FROM AD_Menu_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Menu_ID=t.AD_Menu_ID)
;
-- 2017-09-04T10:47:01.571
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_TreeNodeMM (AD_Client_ID,AD_Org_ID, IsActive,Created,CreatedBy,Updated,UpdatedBy, AD_Tree_ID, Node_ID, Parent_ID, SeqNo) SELECT t.AD_Client_ID,0, 'Y', now(), 100, now(), 100,t.AD_Tree_ID, 540918, 0, 999 FROM AD_Tree t WHERE t.AD_Client_ID=0 AND t.IsActive='Y' AND t.IsAllNodes='Y' AND t.AD_Table_ID=116 AND NOT EXISTS (SELECT * FROM AD_TreeNodeMM e WHERE e.AD_Tree_ID=t.AD_Tree_ID AND Node_ID=540918)
;
-- 2017-09-04T10:47:02.199
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_TreeNodeMM SET Parent_ID=1000016, SeqNo=0, Updated=now(), UpdatedBy=100 WHERE Node_ID=540796 AND AD_Tree_ID=10
;
-- 2017-09-04T10:47:02.201
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_TreeNodeMM SET Parent_ID=1000016, SeqNo=1, Updated=now(), UpdatedBy=100 WHERE Node_ID=540798 AND AD_Tree_ID=10
;
-- 2017-09-04T10:47:02.202
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_TreeNodeMM SET Parent_ID=1000016, SeqNo=2, Updated=now(), UpdatedBy=100 WHERE Node_ID=540797 AND AD_Tree_ID=10
;
-- 2017-09-04T10:47:02.203
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_TreeNodeMM SET Parent_ID=1000016, SeqNo=3, Updated=now(), UpdatedBy=100 WHERE Node_ID=540829 AND AD_Tree_ID=10
;
-- 2017-09-04T10:47:02.204
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_TreeNodeMM SET Parent_ID=1000016, SeqNo=4, Updated=now(), UpdatedBy=100 WHERE Node_ID=540830 AND AD_Tree_ID=10
;
-- 2017-09-04T10:47:02.204
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_TreeNodeMM SET Parent_ID=1000016, SeqNo=5, Updated=now(), UpdatedBy=100 WHERE Node_ID=540831 AND AD_Tree_ID=10
;
-- 2017-09-04T10:47:02.205
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_TreeNodeMM SET Parent_ID=1000016, SeqNo=6, Updated=now(), UpdatedBy=100 WHERE Node_ID=540844 AND AD_Tree_ID=10
;
-- 2017-09-04T10:47:02.206
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_TreeNodeMM SET Parent_ID=1000016, SeqNo=7, Updated=now(), UpdatedBy=100 WHERE Node_ID=540846 AND AD_Tree_ID=10
;
-- 2017-09-04T10:47:02.207
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_TreeNodeMM SET Parent_ID=1000016, SeqNo=8, Updated=now(), UpdatedBy=100 WHERE Node_ID=540900 AND AD_Tree_ID=10
;
-- 2017-09-04T10:47:02.207
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_TreeNodeMM SET Parent_ID=1000016, SeqNo=9, Updated=now(), UpdatedBy=100 WHERE Node_ID=540856 AND AD_Tree_ID=10
;
-- 2017-09-04T10:47:02.208
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_TreeNodeMM SET Parent_ID=1000016, SeqNo=10, Updated=now(), UpdatedBy=100 WHERE Node_ID=540857 AND AD_Tree_ID=10
;
-- 2017-09-04T10:47:02.208
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_TreeNodeMM SET Parent_ID=1000016, SeqNo=11, Updated=now(), UpdatedBy=100 WHERE Node_ID=540860 AND AD_Tree_ID=10
;
-- 2017-09-04T10:47:02.209
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_TreeNodeMM SET Parent_ID=1000016, SeqNo=12, Updated=now(), UpdatedBy=100 WHERE Node_ID=540866 AND AD_Tree_ID=10
;
-- 2017-09-04T10:47:02.209
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_TreeNodeMM SET Parent_ID=1000016, SeqNo=13, Updated=now(), UpdatedBy=100 WHERE Node_ID=1000057 AND AD_Tree_ID=10
;
-- 2017-09-04T10:47:02.210
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_TreeNodeMM SET Parent_ID=1000016, SeqNo=14, Updated=now(), UpdatedBy=100 WHERE Node_ID=1000065 AND AD_Tree_ID=10
;
-- 2017-09-04T10:47:02.212
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_TreeNodeMM SET Parent_ID=1000016, SeqNo=15, Updated=now(), UpdatedBy=100 WHERE Node_ID=1000075 AND AD_Tree_ID=10
;
-- 2017-09-04T10:47:02.213
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_TreeNodeMM SET Parent_ID=1000016, SeqNo=16, Updated=now(), UpdatedBy=100 WHERE Node_ID=540918 AND AD_Tree_ID=10
;
-- 2017-09-04T10:47:04.314
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_TreeNodeMM SET Parent_ID=1000016, SeqNo=0, Updated=now(), UpdatedBy=100 WHERE Node_ID=540796 AND AD_Tree_ID=10
;
-- 2017-09-04T10:47:04.316
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_TreeNodeMM SET Parent_ID=1000016, SeqNo=1, Updated=now(), UpdatedBy=100 WHERE Node_ID=540798 AND AD_Tree_ID=10
;
-- 2017-09-04T10:47:04.316
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_TreeNodeMM SET Parent_ID=1000016, SeqNo=2, Updated=now(), UpdatedBy=100 WHERE Node_ID=540797 AND AD_Tree_ID=10
;
-- 2017-09-04T10:47:04.317
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_TreeNodeMM SET Parent_ID=1000016, SeqNo=3, Updated=now(), UpdatedBy=100 WHERE Node_ID=540829 AND AD_Tree_ID=10
;
-- 2017-09-04T10:47:04.318
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_TreeNodeMM SET Parent_ID=1000016, SeqNo=4, Updated=now(), UpdatedBy=100 WHERE Node_ID=540830 AND AD_Tree_ID=10
;
-- 2017-09-04T10:47:04.318
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_TreeNodeMM SET Parent_ID=1000016, SeqNo=5, Updated=now(), UpdatedBy=100 WHERE Node_ID=540831 AND AD_Tree_ID=10
;
-- 2017-09-04T10:47:04.319
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_TreeNodeMM SET Parent_ID=1000016, SeqNo=6, Updated=now(), UpdatedBy=100 WHERE Node_ID=540844 AND AD_Tree_ID=10
;
-- 2017-09-04T10:47:04.320
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_TreeNodeMM SET Parent_ID=1000016, SeqNo=7, Updated=now(), UpdatedBy=100 WHERE Node_ID=540846 AND AD_Tree_ID=10
;
-- 2017-09-04T10:47:04.321
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_TreeNodeMM SET Parent_ID=1000016, SeqNo=8, Updated=now(), UpdatedBy=100 WHERE Node_ID=540900 AND AD_Tree_ID=10
;
-- 2017-09-04T10:47:04.321
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_TreeNodeMM SET Parent_ID=1000016, SeqNo=9, Updated=now(), UpdatedBy=100 WHERE Node_ID=540856 AND AD_Tree_ID=10
;
-- 2017-09-04T10:47:04.322
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_TreeNodeMM SET Parent_ID=1000016, SeqNo=10, Updated=now(), UpdatedBy=100 WHERE Node_ID=540857 AND AD_Tree_ID=10
;
-- 2017-09-04T10:47:04.323
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_TreeNodeMM SET Parent_ID=1000016, SeqNo=11, Updated=now(), UpdatedBy=100 WHERE Node_ID=540860 AND AD_Tree_ID=10
;
-- 2017-09-04T10:47:04.323
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_TreeNodeMM SET Parent_ID=1000016, SeqNo=12, Updated=now(), UpdatedBy=100 WHERE Node_ID=540866 AND AD_Tree_ID=10
;
-- 2017-09-04T10:47:04.324
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_TreeNodeMM SET Parent_ID=1000016, SeqNo=13, Updated=now(), UpdatedBy=100 WHERE Node_ID=540918 AND AD_Tree_ID=10
;
-- 2017-09-04T10:47:04.324
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_TreeNodeMM SET Parent_ID=1000016, SeqNo=14, Updated=now(), UpdatedBy=100 WHERE Node_ID=1000057 AND AD_Tree_ID=10
;
-- 2017-09-04T10:47:04.325
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_TreeNodeMM SET Parent_ID=1000016, SeqNo=15, Updated=now(), UpdatedBy=100 WHERE Node_ID=1000065 AND AD_Tree_ID=10
;
-- 2017-09-04T10:47:04.326
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_TreeNodeMM SET Parent_ID=1000016, SeqNo=16, Updated=now(), UpdatedBy=100 WHERE Node_ID=1000075 AND AD_Tree_ID=10
;
-- 2017-09-04T10:47:34.630
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_UI_Section (AD_Client_ID,AD_Org_ID,AD_Tab_ID,AD_UI_Section_ID,Created,CreatedBy,IsActive,SeqNo,Updated,UpdatedBy,Value) VALUES (0,0,682,540457,TO_TIMESTAMP('2017-09-04 10:47:34','YYYY-MM-DD HH24:MI:SS'),100,'Y',10,TO_TIMESTAMP('2017-09-04 10:47:34','YYYY-MM-DD HH24:MI:SS'),100,'main')
;
-- 2017-09-04T10:47:34.631
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_UI_Section_Trl (AD_Language,AD_UI_Section_ID, Description,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_UI_Section_ID, t.Description,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_UI_Section t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_UI_Section_ID=540457 AND NOT EXISTS (SELECT 1 FROM AD_UI_Section_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_UI_Section_ID=t.AD_UI_Section_ID)
;
-- 2017-09-04T10:47:34.677
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_UI_Column (AD_Client_ID,AD_Org_ID,AD_UI_Column_ID,AD_UI_Section_ID,Created,CreatedBy,IsActive,SeqNo,Updated,UpdatedBy) VALUES (0,0,540612,540457,TO_TIMESTAMP('2017-09-04 10:47:34','YYYY-MM-DD HH24:MI:SS'),100,'Y',10,TO_TIMESTAMP('2017-09-04 10:47:34','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 2017-09-04T10:47:34.704
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_UI_Column (AD_Client_ID,AD_Org_ID,AD_UI_Column_ID,AD_UI_Section_ID,Created,CreatedBy,IsActive,SeqNo,Updated,UpdatedBy) VALUES (0,0,540613,540457,TO_TIMESTAMP('2017-09-04 10:47:34','YYYY-MM-DD HH24:MI:SS'),100,'Y',20,TO_TIMESTAMP('2017-09-04 10:47:34','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 2017-09-04T10:47:34.745
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_UI_ElementGroup (AD_Client_ID,AD_Org_ID,AD_UI_Column_ID,AD_UI_ElementGroup_ID,Created,CreatedBy,IsActive,Name,SeqNo,UIStyle,Updated,UpdatedBy) VALUES (0,0,540612,541073,TO_TIMESTAMP('2017-09-04 10:47:34','YYYY-MM-DD HH24:MI:SS'),100,'Y','default',10,'primary',TO_TIMESTAMP('2017-09-04 10:47:34','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 2017-09-04T10:47:34.807
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,Created,CreatedBy,Description,Help,IsActive,IsAdvancedField,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,10962,0,682,541073,548028,TO_TIMESTAMP('2017-09-04 10:47:34','YYYY-MM-DD HH24:MI:SS'),100,'Mandant für diese Installation.','Ein Mandant ist eine Firma oder eine juristische Person. Sie können keine Daten über Mandanten hinweg verwenden. .','Y','N','Y','Y','N','Mandant',10,10,0,TO_TIMESTAMP('2017-09-04 10:47:34','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 2017-09-04T10:47:34.849
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,Created,CreatedBy,Description,Help,IsActive,IsAdvancedField,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,10963,0,682,541073,548029,TO_TIMESTAMP('2017-09-04 10:47:34','YYYY-MM-DD HH24:MI:SS'),100,'Organisatorische Einheit des Mandanten','Eine Organisation ist ein Bereich ihres Mandanten - z.B. Laden oder Abteilung. Sie können Daten über Organisationen hinweg gemeinsam verwenden.','Y','N','Y','Y','N','Sektion',20,20,0,TO_TIMESTAMP('2017-09-04 10:47:34','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 2017-09-04T10:47:34.884
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,Created,CreatedBy,Description,Help,IsActive,IsAdvancedField,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,10964,0,682,541073,548030,TO_TIMESTAMP('2017-09-04 10:47:34','YYYY-MM-DD HH24:MI:SS'),100,'Document sequence number of the document','The document number is usually automatically generated by the system and determined by the document type of the document. If the document is not saved, the preliminary number is displayed in "<>".
If the document type of your document has no automatic document sequence defined, the field is empty if you create a new document. This is for documents which usually have an external number (like vendor invoice). If you leave the field empty, the system will generate a document number for you. The document sequence used for this fallback number is defined in the "Maintain Sequence" window with the name "DocumentNo_<TableName>", where TableName is the actual name of the table (e.g. C_Order).','Y','N','Y','Y','N','Beleg Nr.',30,30,0,TO_TIMESTAMP('2017-09-04 10:47:34','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 2017-09-04T10:47:34.918
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,Created,CreatedBy,IsActive,IsAdvancedField,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,10965,0,682,541073,548031,TO_TIMESTAMP('2017-09-04 10:47:34','YYYY-MM-DD HH24:MI:SS'),100,'Y','N','Y','Y','N','Beschreibung',40,40,0,TO_TIMESTAMP('2017-09-04 10:47:34','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 2017-09-04T10:47:34.951
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,Created,CreatedBy,Description,Help,IsActive,IsAdvancedField,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,10966,0,682,541073,548032,TO_TIMESTAMP('2017-09-04 10:47:34','YYYY-MM-DD HH24:MI:SS'),100,'Lager oder Ort für Dienstleistung','Das Lager identifiziert ein einzelnes Lager für Artikel oder einen Standort an dem Dienstleistungen geboten werden.','Y','N','Y','Y','N','Lager',50,50,0,TO_TIMESTAMP('2017-09-04 10:47:34','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 2017-09-04T10:47:34.982
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,Created,CreatedBy,Description,Help,IsActive,IsAdvancedField,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,10968,0,682,541073,548033,TO_TIMESTAMP('2017-09-04 10:47:34','YYYY-MM-DD HH24:MI:SS'),100,'Datum, an dem eine Produkt in oder aus dem Bestand bewegt wurde','"Bewegungs-Datum" bezeichnet das Datum, zu dem das Produkt in oder aus dem Bestand bewegt wurde Dies ist das Ergebnis einer Auslieferung, eines Wareneingangs oder einer Warenbewqegung.','Y','N','Y','Y','N','Bewegungsdatum',60,60,0,TO_TIMESTAMP('2017-09-04 10:47:34','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 2017-09-04T10:47:35.014
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,Created,CreatedBy,Description,Help,IsActive,IsAdvancedField,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,10969,0,682,541073,548034,TO_TIMESTAMP('2017-09-04 10:47:34','YYYY-MM-DD HH24:MI:SS'),100,'Belegart oder Verarbeitungsvorgaben','Die Belegart bestimmt den Nummernkreis und die Vorgaben für die Belegverarbeitung.','Y','N','Y','Y','N','Belegart',70,70,0,TO_TIMESTAMP('2017-09-04 10:47:34','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 2017-09-04T10:47:35.044
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,Created,CreatedBy,Description,Help,IsActive,IsAdvancedField,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,558791,0,682,541073,548035,TO_TIMESTAMP('2017-09-04 10:47:35','YYYY-MM-DD HH24:MI:SS'),100,'Referenz-Nummer des Kunden','The business partner order reference is the order reference for this specific transaction; Often Purchase Order numbers are given to print on Invoices for easier reference. A standard number can be defined in the Business Partner (Customer) window.','Y','N','Y','Y','N','Referenz',80,80,0,TO_TIMESTAMP('2017-09-04 10:47:35','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 2017-09-04T10:47:35.082
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,Created,CreatedBy,Description,Help,IsActive,IsAdvancedField,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,10972,0,682,541073,548036,TO_TIMESTAMP('2017-09-04 10:47:35','YYYY-MM-DD HH24:MI:SS'),100,'Finanzprojekt','Ein Projekt erlaubt, interne oder externe Vorgäng zu verfolgen und zu kontrollieren.','Y','N','Y','Y','N','Projekt',90,90,0,TO_TIMESTAMP('2017-09-04 10:47:35','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 2017-09-04T10:47:35.111
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,Created,CreatedBy,Description,Help,IsActive,IsAdvancedField,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,10973,0,682,541073,548037,TO_TIMESTAMP('2017-09-04 10:47:35','YYYY-MM-DD HH24:MI:SS'),100,'Kostenstelle','Erfassung der zugehörigen Kostenstelle','Y','N','Y','Y','N','Kostenstelle',100,100,0,TO_TIMESTAMP('2017-09-04 10:47:35','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 2017-09-04T10:47:35.141
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,Created,CreatedBy,Description,Help,IsActive,IsAdvancedField,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,10974,0,682,541073,548038,TO_TIMESTAMP('2017-09-04 10:47:35','YYYY-MM-DD HH24:MI:SS'),100,'Marketing Campaign','The Campaign defines a unique marketing program. Projects can be associated with a pre defined Marketing Campaign. You can then report based on a specific Campaign.','Y','N','Y','Y','N','Werbemassnahme',110,110,0,TO_TIMESTAMP('2017-09-04 10:47:35','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 2017-09-04T10:47:35.171
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,Created,CreatedBy,Description,Help,IsActive,IsAdvancedField,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,10975,0,682,541073,548039,TO_TIMESTAMP('2017-09-04 10:47:35','YYYY-MM-DD HH24:MI:SS'),100,'Durchführende oder auslösende Organisation','Die Organisation, die diese Transaktion durchführt oder auslöst (für eine andere Organisation). Die besitzende Organisation muss nicht die durchführende Organisation sein. Dies kann bei zentralisierten Dienstleistungen oder Vorfällen zwischen Organisationen der Fall sein.','Y','N','Y','Y','N','Buchende Organisation',120,120,0,TO_TIMESTAMP('2017-09-04 10:47:35','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 2017-09-04T10:47:35.201
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,Created,CreatedBy,Description,Help,IsActive,IsAdvancedField,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,10976,0,682,541073,548040,TO_TIMESTAMP('2017-09-04 10:47:35','YYYY-MM-DD HH24:MI:SS'),100,'Nutzerdefiniertes Element Nr. 1','Das Nutzerdefinierte Element zeigt die optionalen Elementwerte an, die für diese Kontenkombination definiert sind.','Y','N','Y','Y','N','Nutzer 1',130,130,0,TO_TIMESTAMP('2017-09-04 10:47:35','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 2017-09-04T10:47:35.235
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,Created,CreatedBy,Description,Help,IsActive,IsAdvancedField,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,10977,0,682,541073,548041,TO_TIMESTAMP('2017-09-04 10:47:35','YYYY-MM-DD HH24:MI:SS'),100,'Nutzerdefiniertes Element Nr. 2','Das Nutzerdefinierte Element zeigt die optionalen Elementwerte an, die für diese Kontenkombination definiert sind.','Y','N','Y','Y','N','Nutzer 2',140,140,0,TO_TIMESTAMP('2017-09-04 10:47:35','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 2017-09-04T10:47:35.266
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,Created,CreatedBy,Description,Help,IsActive,IsAdvancedField,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,10978,0,682,541073,548042,TO_TIMESTAMP('2017-09-04 10:47:35','YYYY-MM-DD HH24:MI:SS'),100,'Zeigt an, ob dieser Beleg eine Freigabe braucht','Das Selektionsfeld "Freigabe" zeigt an, dass dieser Beleg eine Freigabe braucht, bevor er verarbeitet werden kann','Y','N','Y','Y','N','Freigegeben',150,150,0,TO_TIMESTAMP('2017-09-04 10:47:35','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 2017-09-04T10:47:35.297
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,Created,CreatedBy,Description,Help,IsActive,IsAdvancedField,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,10979,0,682,541073,548043,TO_TIMESTAMP('2017-09-04 10:47:35','YYYY-MM-DD HH24:MI:SS'),100,'Belegfreigabe-Betrag','Freigabe-Betrag für den Workflow','Y','N','Y','Y','N','Freigabe-Betrag',160,160,0,TO_TIMESTAMP('2017-09-04 10:47:35','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 2017-09-04T10:47:35.324
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,Created,CreatedBy,Description,Help,IsActive,IsAdvancedField,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,10980,0,682,541073,548044,TO_TIMESTAMP('2017-09-04 10:47:35','YYYY-MM-DD HH24:MI:SS'),100,'The current status of the document','The Document Status indicates the status of a document at this time. If you want to change the document status, use the Document Action field','Y','N','Y','Y','N','Belegstatus',170,170,0,TO_TIMESTAMP('2017-09-04 10:47:35','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 2017-09-04T10:47:35.351
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,Created,CreatedBy,Description,IsActive,IsAdvancedField,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,10981,0,682,541073,548045,TO_TIMESTAMP('2017-09-04 10:47:35','YYYY-MM-DD HH24:MI:SS'),100,'Bestandsliste verarbeiten und Bestand aktualisieren','Y','N','Y','Y','N','Bestandsliste verarbeiten',180,180,0,TO_TIMESTAMP('2017-09-04 10:47:35','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 2017-09-04T10:47:35.383
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,Created,CreatedBy,Description,Help,IsActive,IsAdvancedField,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,10982,0,682,541073,548046,TO_TIMESTAMP('2017-09-04 10:47:35','YYYY-MM-DD HH24:MI:SS'),100,'Posting status','The Posted field indicates the status of the Generation of General Ledger Accounting Lines ','Y','N','Y','Y','N','Verbucht',190,190,0,TO_TIMESTAMP('2017-09-04 10:47:35','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 2017-09-04T10:47:35.413
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_UI_Section (AD_Client_ID,AD_Org_ID,AD_Tab_ID,AD_UI_Section_ID,Created,CreatedBy,IsActive,SeqNo,Updated,UpdatedBy,Value) VALUES (0,0,683,540458,TO_TIMESTAMP('2017-09-04 10:47:35','YYYY-MM-DD HH24:MI:SS'),100,'Y',10,TO_TIMESTAMP('2017-09-04 10:47:35','YYYY-MM-DD HH24:MI:SS'),100,'main')
;
-- 2017-09-04T10:47:35.414
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_UI_Section_Trl (AD_Language,AD_UI_Section_ID, Description,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_UI_Section_ID, t.Description,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_UI_Section t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_UI_Section_ID=540458 AND NOT EXISTS (SELECT 1 FROM AD_UI_Section_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_UI_Section_ID=t.AD_UI_Section_ID)
;
-- 2017-09-04T10:47:35.445
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_UI_Column (AD_Client_ID,AD_Org_ID,AD_UI_Column_ID,AD_UI_Section_ID,Created,CreatedBy,IsActive,SeqNo,Updated,UpdatedBy) VALUES (0,0,540614,540458,TO_TIMESTAMP('2017-09-04 10:47:35','YYYY-MM-DD HH24:MI:SS'),100,'Y',10,TO_TIMESTAMP('2017-09-04 10:47:35','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 2017-09-04T10:47:35.478
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_UI_ElementGroup (AD_Client_ID,AD_Org_ID,AD_UI_Column_ID,AD_UI_ElementGroup_ID,Created,CreatedBy,IsActive,Name,SeqNo,UIStyle,Updated,UpdatedBy) VALUES (0,0,540614,541074,TO_TIMESTAMP('2017-09-04 10:47:35','YYYY-MM-DD HH24:MI:SS'),100,'Y','default',10,'primary',TO_TIMESTAMP('2017-09-04 10:47:35','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 2017-09-04T10:47:35.511
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,Created,CreatedBy,Description,Help,IsActive,IsAdvancedField,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,10986,0,683,541074,548047,TO_TIMESTAMP('2017-09-04 10:47:35','YYYY-MM-DD HH24:MI:SS'),100,'Mandant für diese Installation.','Ein Mandant ist eine Firma oder eine juristische Person. Sie können keine Daten über Mandanten hinweg verwenden. .','Y','N','N','Y','N','Mandant',0,10,0,TO_TIMESTAMP('2017-09-04 10:47:35','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 2017-09-04T10:47:35.544
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,Created,CreatedBy,Description,Help,IsActive,IsAdvancedField,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,10987,0,683,541074,548048,TO_TIMESTAMP('2017-09-04 10:47:35','YYYY-MM-DD HH24:MI:SS'),100,'Organisatorische Einheit des Mandanten','Eine Organisation ist ein Bereich ihres Mandanten - z.B. Laden oder Abteilung. Sie können Daten über Organisationen hinweg gemeinsam verwenden.','Y','N','N','Y','N','Sektion',0,20,0,TO_TIMESTAMP('2017-09-04 10:47:35','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 2017-09-04T10:47:35.583
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,Created,CreatedBy,Description,Help,IsActive,IsAdvancedField,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,10988,0,683,541074,548049,TO_TIMESTAMP('2017-09-04 10:47:35','YYYY-MM-DD HH24:MI:SS'),100,'Parameter für eine physische Inventur','Bezeichnet die eindeutigen Parameter für eine physische Inventur','Y','N','N','Y','N','Inventur',0,30,0,TO_TIMESTAMP('2017-09-04 10:47:35','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 2017-09-04T10:47:35.615
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,Created,CreatedBy,Description,Help,IsActive,IsAdvancedField,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,10989,0,683,541074,548050,TO_TIMESTAMP('2017-09-04 10:47:35','YYYY-MM-DD HH24:MI:SS'),100,'Einzelne Zeile in dem Dokument','Indicates the unique line for a document. It will also control the display order of the lines within a document.','Y','N','N','Y','N','Zeile Nr.',0,40,0,TO_TIMESTAMP('2017-09-04 10:47:35','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 2017-09-04T10:47:35.643
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,Created,CreatedBy,Description,Help,IsActive,IsAdvancedField,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,10990,0,683,541074,548051,TO_TIMESTAMP('2017-09-04 10:47:35','YYYY-MM-DD HH24:MI:SS'),100,'Lagerort im Lager','"Lagerort" bezeichnet, wo im Lager ein Produkt aufzufinden ist.','Y','N','N','Y','N','Lagerort',0,50,0,TO_TIMESTAMP('2017-09-04 10:47:35','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 2017-09-04T10:47:35.678
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,Created,CreatedBy,Description,Help,IsActive,IsAdvancedField,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,10991,0,683,541074,548052,TO_TIMESTAMP('2017-09-04 10:47:35','YYYY-MM-DD HH24:MI:SS'),100,'Produkt, Leistung, Artikel','Bezeichnet eine Einheit, die in dieser Organisation gekauft oder verkauft wird.','Y','N','N','Y','N','Produkt',0,60,0,TO_TIMESTAMP('2017-09-04 10:47:35','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 2017-09-04T10:47:35.708
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,Created,CreatedBy,Description,Help,IsActive,IsAdvancedField,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,10992,0,683,541074,548053,TO_TIMESTAMP('2017-09-04 10:47:35','YYYY-MM-DD HH24:MI:SS'),100,'Merkmals Ausprägungen zum Produkt','The values of the actual Product Attribute Instances. The product level attributes are defined on Product level.','Y','N','N','Y','N','Merkmale',0,70,0,TO_TIMESTAMP('2017-09-04 10:47:35','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 2017-09-04T10:47:35.738
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,Created,CreatedBy,Description,Help,IsActive,IsAdvancedField,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,558141,0,683,541074,548054,TO_TIMESTAMP('2017-09-04 10:47:35','YYYY-MM-DD HH24:MI:SS'),100,'Maßeinheit','Eine eindeutige (nicht monetäre) Maßeinheit','Y','N','N','Y','N','Maßeinheit',0,80,0,TO_TIMESTAMP('2017-09-04 10:47:35','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 2017-09-04T10:47:35.807
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_UI_ElementField (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_UI_ElementField_ID,AD_UI_Element_ID,Created,CreatedBy,IsActive,SeqNo,Updated,UpdatedBy) VALUES (0,558142,0,540195,548052,TO_TIMESTAMP('2017-09-04 10:47:35','YYYY-MM-DD HH24:MI:SS'),100,'Y',10,TO_TIMESTAMP('2017-09-04 10:47:35','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 2017-09-04T10:47:35.843
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,Created,CreatedBy,IsActive,IsAdvancedField,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,558375,0,683,541074,548055,TO_TIMESTAMP('2017-09-04 10:47:35','YYYY-MM-DD HH24:MI:SS'),100,'Y','N','N','Y','N','Menge TU',0,90,0,TO_TIMESTAMP('2017-09-04 10:47:35','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 2017-09-04T10:47:35.887
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,Created,CreatedBy,IsActive,IsAdvancedField,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,10995,0,683,541074,548056,TO_TIMESTAMP('2017-09-04 10:47:35','YYYY-MM-DD HH24:MI:SS'),100,'Y','N','N','Y','N','Beschreibung',0,100,0,TO_TIMESTAMP('2017-09-04 10:47:35','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 2017-09-04T10:47:35.919
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,Created,CreatedBy,Description,Help,IsActive,IsAdvancedField,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,10998,0,683,541074,548057,TO_TIMESTAMP('2017-09-04 10:47:35','YYYY-MM-DD HH24:MI:SS'),100,'Internal Use Quantity removed from Inventory','Quantity of product inventory used internally (positive if taken out - negative if returned)','Y','N','N','Y','N','Internal Use Qty',0,110,0,TO_TIMESTAMP('2017-09-04 10:47:35','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 2017-09-04T10:47:35.949
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,Created,CreatedBy,Description,Help,IsActive,IsAdvancedField,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,10997,0,683,541074,548058,TO_TIMESTAMP('2017-09-04 10:47:35','YYYY-MM-DD HH24:MI:SS'),100,'Zusätzliche Kosten','Kosten gibt die Art der zusätzlichen Kosten an (Abwicklung, Fracht, Bankgebühren, ...)','Y','N','N','Y','N','Kosten',0,120,0,TO_TIMESTAMP('2017-09-04 10:47:35','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 2017-09-04T10:47:35.981
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,Created,CreatedBy,Description,Help,IsActive,IsAdvancedField,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,558133,0,683,541074,548059,TO_TIMESTAMP('2017-09-04 10:47:35','YYYY-MM-DD HH24:MI:SS'),100,'Position auf Versand- oder Wareneingangsbeleg','"Versand-/Wareneingangsposition" bezeichnet eine einzelne Zeile/Position auf einem Versand- oder Wareneingangsbeleg.','Y','N','N','Y','N','Versand-/Wareneingangsposition',0,130,0,TO_TIMESTAMP('2017-09-04 10:47:35','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 2017-09-04T10:56:08.235
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_UI_ElementGroup (AD_Client_ID,AD_Org_ID,AD_UI_Column_ID,AD_UI_ElementGroup_ID,Created,CreatedBy,IsActive,Name,SeqNo,UIStyle,Updated,UpdatedBy) VALUES (0,0,540612,541075,TO_TIMESTAMP('2017-09-04 10:56:08','YYYY-MM-DD HH24:MI:SS'),100,'Y','default',10,'primary',TO_TIMESTAMP('2017-09-04 10:56:08','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 2017-09-04T10:56:17.818
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_ElementGroup SET Name='advanced edit', SeqNo=90,Updated=TO_TIMESTAMP('2017-09-04 10:56:17','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_ElementGroup_ID=541073
;
-- 2017-09-04T10:56:56.866
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,Created,CreatedBy,IsActive,IsAdvancedField,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,10965,0,682,541075,548060,TO_TIMESTAMP('2017-09-04 10:56:56','YYYY-MM-DD HH24:MI:SS'),100,'Y','N','Y','N','N','Beschreibung',10,0,0,TO_TIMESTAMP('2017-09-04 10:56:56','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 2017-09-04T10:57:08.842
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,Created,CreatedBy,IsActive,IsAdvancedField,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,558791,0,682,541075,548061,TO_TIMESTAMP('2017-09-04 10:57:08','YYYY-MM-DD HH24:MI:SS'),100,'Y','N','Y','N','N','Referenz',20,0,0,TO_TIMESTAMP('2017-09-04 10:57:08','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 2017-09-04T10:57:21.317
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,Created,CreatedBy,IsActive,IsAdvancedField,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,10973,0,682,541075,548062,TO_TIMESTAMP('2017-09-04 10:57:21','YYYY-MM-DD HH24:MI:SS'),100,'Y','N','Y','N','N','Kostenstelle',30,0,0,TO_TIMESTAMP('2017-09-04 10:57:21','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 2017-09-04T10:57:30.603
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,Created,CreatedBy,IsActive,IsAdvancedField,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,10966,0,682,541075,548063,TO_TIMESTAMP('2017-09-04 10:57:30','YYYY-MM-DD HH24:MI:SS'),100,'Y','N','Y','N','N','Lager',40,0,0,TO_TIMESTAMP('2017-09-04 10:57:30','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 2017-09-04T10:57:52.773
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_UI_ElementGroup (AD_Client_ID,AD_Org_ID,AD_UI_Column_ID,AD_UI_ElementGroup_ID,Created,CreatedBy,IsActive,Name,SeqNo,Updated,UpdatedBy) VALUES (0,0,540613,541076,TO_TIMESTAMP('2017-09-04 10:57:52','YYYY-MM-DD HH24:MI:SS'),100,'Y','doc',10,TO_TIMESTAMP('2017-09-04 10:57:52','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 2017-09-04T10:58:21.682
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,Created,CreatedBy,IsActive,IsAdvancedField,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,10969,0,682,541076,548064,TO_TIMESTAMP('2017-09-04 10:58:21','YYYY-MM-DD HH24:MI:SS'),100,'Y','N','Y','N','N','Belegart',10,0,0,TO_TIMESTAMP('2017-09-04 10:58:21','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 2017-09-04T10:58:32.869
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,Created,CreatedBy,IsActive,IsAdvancedField,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,10964,0,682,541076,548065,TO_TIMESTAMP('2017-09-04 10:58:32','YYYY-MM-DD HH24:MI:SS'),100,'Y','N','Y','N','N','Nr.',20,0,0,TO_TIMESTAMP('2017-09-04 10:58:32','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 2017-09-04T10:58:50.766
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,Created,CreatedBy,IsActive,IsAdvancedField,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,10968,0,682,541076,548066,TO_TIMESTAMP('2017-09-04 10:58:50','YYYY-MM-DD HH24:MI:SS'),100,'Y','N','Y','N','N','Datum',30,0,0,TO_TIMESTAMP('2017-09-04 10:58:50','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 2017-09-04T10:59:10.693
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_UI_ElementGroup (AD_Client_ID,AD_Org_ID,AD_UI_Column_ID,AD_UI_ElementGroup_ID,Created,CreatedBy,IsActive,Name,SeqNo,Updated,UpdatedBy) VALUES (0,0,540613,541077,TO_TIMESTAMP('2017-09-04 10:59:10','YYYY-MM-DD HH24:MI:SS'),100,'Y','flags',20,TO_TIMESTAMP('2017-09-04 10:59:10','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 2017-09-04T10:59:26.842
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,Created,CreatedBy,IsActive,IsAdvancedField,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,10978,0,682,541077,548067,TO_TIMESTAMP('2017-09-04 10:59:26','YYYY-MM-DD HH24:MI:SS'),100,'Y','N','Y','N','N','Freigegeben',10,0,0,TO_TIMESTAMP('2017-09-04 10:59:26','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 2017-09-04T10:59:37.146
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,Created,CreatedBy,IsActive,IsAdvancedField,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,10979,0,682,541077,548068,TO_TIMESTAMP('2017-09-04 10:59:37','YYYY-MM-DD HH24:MI:SS'),100,'Y','N','Y','N','N','Freigabe Betrag',20,0,0,TO_TIMESTAMP('2017-09-04 10:59:37','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 2017-09-04T10:59:42.373
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_UI_ElementGroup (AD_Client_ID,AD_Org_ID,AD_UI_Column_ID,AD_UI_ElementGroup_ID,Created,CreatedBy,IsActive,Name,SeqNo,Updated,UpdatedBy) VALUES (0,0,540613,541078,TO_TIMESTAMP('2017-09-04 10:59:42','YYYY-MM-DD HH24:MI:SS'),100,'Y','org',30,TO_TIMESTAMP('2017-09-04 10:59:42','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 2017-09-04T10:59:50.116
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,Created,CreatedBy,IsActive,IsAdvancedField,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,10963,0,682,541078,548069,TO_TIMESTAMP('2017-09-04 10:59:50','YYYY-MM-DD HH24:MI:SS'),100,'Y','N','Y','N','N','Sektion',10,0,0,TO_TIMESTAMP('2017-09-04 10:59:50','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 2017-09-04T10:59:58.240
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,Created,CreatedBy,IsActive,IsAdvancedField,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,10962,0,682,541078,548070,TO_TIMESTAMP('2017-09-04 10:59:58','YYYY-MM-DD HH24:MI:SS'),100,'Y','N','Y','N','N','Mandant',20,0,0,TO_TIMESTAMP('2017-09-04 10:59:58','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 2017-09-04T11:00:25.574
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_UI_Section (AD_Client_ID,AD_Org_ID,AD_Tab_ID,AD_UI_Section_ID,Created,CreatedBy,IsActive,SeqNo,Updated,UpdatedBy,Value) VALUES (0,0,682,540459,TO_TIMESTAMP('2017-09-04 11:00:25','YYYY-MM-DD HH24:MI:SS'),100,'Y',20,TO_TIMESTAMP('2017-09-04 11:00:25','YYYY-MM-DD HH24:MI:SS'),100,'advanced edit')
;
-- 2017-09-04T11:00:25.575
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_UI_Section_Trl (AD_Language,AD_UI_Section_ID, Description,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_UI_Section_ID, t.Description,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_UI_Section t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_UI_Section_ID=540459 AND NOT EXISTS (SELECT 1 FROM AD_UI_Section_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_UI_Section_ID=t.AD_UI_Section_ID)
;
-- 2017-09-04T11:00:27.510
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_UI_Column (AD_Client_ID,AD_Org_ID,AD_UI_Column_ID,AD_UI_Section_ID,Created,CreatedBy,IsActive,SeqNo,Updated,UpdatedBy) VALUES (0,0,540615,540459,TO_TIMESTAMP('2017-09-04 11:00:27','YYYY-MM-DD HH24:MI:SS'),100,'Y',10,TO_TIMESTAMP('2017-09-04 11:00:27','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 2017-09-04T11:00:45.390
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_ElementGroup SET AD_UI_Column_ID=540615, SeqNo=10,Updated=TO_TIMESTAMP('2017-09-04 11:00:45','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_ElementGroup_ID=541077
;
-- 2017-09-04T11:00:52.187
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_ElementGroup SET SeqNo=20,Updated=TO_TIMESTAMP('2017-09-04 11:00:52','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_ElementGroup_ID=541078
;
-- 2017-09-04T11:01:09.124
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
DELETE FROM AD_UI_Element WHERE AD_UI_Element_ID=548028
;
-- 2017-09-04T11:01:09.136
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
DELETE FROM AD_UI_Element WHERE AD_UI_Element_ID=548029
;
-- 2017-09-04T11:01:09.149
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
DELETE FROM AD_UI_Element WHERE AD_UI_Element_ID=548030
;
-- 2017-09-04T11:01:09.159
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
DELETE FROM AD_UI_Element WHERE AD_UI_Element_ID=548031
;
-- 2017-09-04T11:01:09.171
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
DELETE FROM AD_UI_Element WHERE AD_UI_Element_ID=548032
;
-- 2017-09-04T11:01:09.194
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
DELETE FROM AD_UI_Element WHERE AD_UI_Element_ID=548033
;
-- 2017-09-04T11:01:09.219
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
DELETE FROM AD_UI_Element WHERE AD_UI_Element_ID=548034
;
-- 2017-09-04T11:01:09.230
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
DELETE FROM AD_UI_Element WHERE AD_UI_Element_ID=548035
;
-- 2017-09-04T11:01:18.548
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
DELETE FROM AD_UI_Element WHERE AD_UI_Element_ID=548042
;
-- 2017-09-04T11:01:18.571
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
DELETE FROM AD_UI_Element WHERE AD_UI_Element_ID=548043
;
-- 2017-09-04T11:01:37.255
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
DELETE FROM AD_UI_Element WHERE AD_UI_Element_ID=548046
;
-- 2017-09-04T11:01:49.223
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_ElementGroup SET AD_UI_Column_ID=540615, SeqNo=20,Updated=TO_TIMESTAMP('2017-09-04 11:01:49','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_ElementGroup_ID=541073
;
-- 2017-09-04T11:02:05.636
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET AD_UI_ElementGroup_ID=541073, SeqNo=190,Updated=TO_TIMESTAMP('2017-09-04 11:02:05','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=548067
;
-- 2017-09-04T11:02:11.634
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET AD_UI_ElementGroup_ID=541073, SeqNo=200,Updated=TO_TIMESTAMP('2017-09-04 11:02:11','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=548068
;
-- 2017-09-04T11:02:14.908
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
DELETE FROM AD_UI_ElementGroup WHERE AD_UI_ElementGroup_ID=541077
;
-- 2017-09-04T11:02:19.024
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_ElementGroup SET SeqNo=10,Updated=TO_TIMESTAMP('2017-09-04 11:02:19','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_ElementGroup_ID=541073
;
-- 2017-09-04T11:03:38.055
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayedGrid='N', SeqNoGrid=0,Updated=TO_TIMESTAMP('2017-09-04 11:03:38','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=548045
;
-- 2017-09-04T11:03:38.058
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayedGrid='N', SeqNoGrid=0,Updated=TO_TIMESTAMP('2017-09-04 11:03:38','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=548039
;
-- 2017-09-04T11:03:38.060
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayedGrid='N', SeqNoGrid=0,Updated=TO_TIMESTAMP('2017-09-04 11:03:38','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=548037
;
-- 2017-09-04T11:03:38.061
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayedGrid='N', SeqNoGrid=0,Updated=TO_TIMESTAMP('2017-09-04 11:03:38','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=548040
;
-- 2017-09-04T11:03:38.063
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayedGrid='N', SeqNoGrid=0,Updated=TO_TIMESTAMP('2017-09-04 11:03:38','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=548041
;
-- 2017-09-04T11:03:38.064
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayedGrid='N', SeqNoGrid=0,Updated=TO_TIMESTAMP('2017-09-04 11:03:38','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=548036
;
-- 2017-09-04T11:03:38.065
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayedGrid='N', SeqNoGrid=0,Updated=TO_TIMESTAMP('2017-09-04 11:03:38','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=548038
;
-- 2017-09-04T11:03:38.067
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=10,Updated=TO_TIMESTAMP('2017-09-04 11:03:38','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=548064
;
-- 2017-09-04T11:03:38.069
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=20,Updated=TO_TIMESTAMP('2017-09-04 11:03:38','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=548065
;
-- 2017-09-04T11:03:38.071
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=30,Updated=TO_TIMESTAMP('2017-09-04 11:03:38','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=548066
;
-- 2017-09-04T11:03:38.072
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=40,Updated=TO_TIMESTAMP('2017-09-04 11:03:38','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=548061
;
-- 2017-09-04T11:03:38.073
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=50,Updated=TO_TIMESTAMP('2017-09-04 11:03:38','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=548063
;
-- 2017-09-04T11:03:38.074
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=60,Updated=TO_TIMESTAMP('2017-09-04 11:03:38','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=548060
;
-- 2017-09-04T11:03:38.075
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=70,Updated=TO_TIMESTAMP('2017-09-04 11:03:38','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=548044
;
-- 2017-09-04T11:03:38.076
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=80,Updated=TO_TIMESTAMP('2017-09-04 11:03:38','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=548069
;
-- 2017-09-04T11:03:53.140
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayed_SideList='Y', SeqNo_SideList=10,Updated=TO_TIMESTAMP('2017-09-04 11:03:53','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=548064
;
-- 2017-09-04T11:03:53.143
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayed_SideList='Y', SeqNo_SideList=20,Updated=TO_TIMESTAMP('2017-09-04 11:03:53','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=548065
;
-- 2017-09-04T11:03:53.145
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayed_SideList='Y', SeqNo_SideList=30,Updated=TO_TIMESTAMP('2017-09-04 11:03:53','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=548066
;
-- 2017-09-04T11:03:53.147
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayed_SideList='Y', SeqNo_SideList=40,Updated=TO_TIMESTAMP('2017-09-04 11:03:53','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=548061
;
-- 2017-09-04T11:03:53.148
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayed_SideList='Y', SeqNo_SideList=50,Updated=TO_TIMESTAMP('2017-09-04 11:03:53','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=548069
;
-- 2017-09-04T11:04:08.764
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsAdvancedField='Y',Updated=TO_TIMESTAMP('2017-09-04 11:04:08','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=548044
;
-- 2017-09-04T11:04:09.260
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsAdvancedField='Y',Updated=TO_TIMESTAMP('2017-09-04 11:04:09','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=548037
;
-- 2017-09-04T11:04:09.709
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsAdvancedField='Y',Updated=TO_TIMESTAMP('2017-09-04 11:04:09','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=548039
;
-- 2017-09-04T11:04:10.092
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsAdvancedField='Y',Updated=TO_TIMESTAMP('2017-09-04 11:04:10','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=548040
;
-- 2017-09-04T11:04:10.413
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsAdvancedField='Y',Updated=TO_TIMESTAMP('2017-09-04 11:04:10','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=548041
;
-- 2017-09-04T11:04:10.788
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsAdvancedField='Y',Updated=TO_TIMESTAMP('2017-09-04 11:04:10','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=548045
;
-- 2017-09-04T11:04:11.356
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsAdvancedField='Y',Updated=TO_TIMESTAMP('2017-09-04 11:04:11','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=548038
;
-- 2017-09-04T11:04:11.861
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsAdvancedField='Y',Updated=TO_TIMESTAMP('2017-09-04 11:04:11','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=548036
;
-- 2017-09-04T11:04:12.173
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsAdvancedField='Y',Updated=TO_TIMESTAMP('2017-09-04 11:04:12','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=548067
;
-- 2017-09-04T11:04:13.245
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsAdvancedField='Y',Updated=TO_TIMESTAMP('2017-09-04 11:04:13','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=548068
;
-- 2017-09-04T11:04:42.858
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
DELETE FROM AD_UI_Element WHERE AD_UI_Element_ID=548037
;
-- 2017-09-04T11:10:00.956
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_UI_ElementGroup (AD_Client_ID,AD_Org_ID,AD_UI_Column_ID,AD_UI_ElementGroup_ID,Created,CreatedBy,IsActive,Name,SeqNo,Updated,UpdatedBy) VALUES (0,0,540612,541079,TO_TIMESTAMP('2017-09-04 11:10:00','YYYY-MM-DD HH24:MI:SS'),100,'Y','description',20,TO_TIMESTAMP('2017-09-04 11:10:00','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 2017-09-04T11:10:18.834
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,Created,CreatedBy,IsActive,IsAdvancedField,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,10965,0,682,541079,548071,TO_TIMESTAMP('2017-09-04 11:10:18','YYYY-MM-DD HH24:MI:SS'),100,'Y','N','Y','N','N','Beschreibung',10,0,0,TO_TIMESTAMP('2017-09-04 11:10:18','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 2017-09-04T11:10:25.714
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
DELETE FROM AD_UI_Element WHERE AD_UI_Element_ID=548060
;
-- 2017-09-04T11:10:53.160
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Field SET Name='Nr.',Updated=TO_TIMESTAMP('2017-09-04 11:10:53','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=10964
;
-- 2017-09-04T11:10:57.829
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Field SET Name='Datum',Updated=TO_TIMESTAMP('2017-09-04 11:10:57','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=10968
;
-- 2017-09-04T11:11:35.885
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET WidgetSize='M',Updated=TO_TIMESTAMP('2017-09-04 11:11:35','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=548061
;
-- 2017-09-04T11:11:39.165
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET WidgetSize='S',Updated=TO_TIMESTAMP('2017-09-04 11:11:39','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=548062
;
-- 2017-09-04T11:11:43.178
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET WidgetSize='L',Updated=TO_TIMESTAMP('2017-09-04 11:11:43','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=548063
;
-- 2017-09-04T11:11:51.134
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET WidgetSize='L',Updated=TO_TIMESTAMP('2017-09-04 11:11:51','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=548071
;
-- 2017-09-04T11:11:59.855
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET WidgetSize='M',Updated=TO_TIMESTAMP('2017-09-04 11:11:59','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=548069
;
-- 2017-09-04T11:12:02.896
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET WidgetSize='M',Updated=TO_TIMESTAMP('2017-09-04 11:12:02','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=548070
;
-- 2017-09-04T11:12:12.590
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET WidgetSize='M',Updated=TO_TIMESTAMP('2017-09-04 11:12:12','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=548064
;
-- 2017-09-04T11:12:15.402
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET WidgetSize='S',Updated=TO_TIMESTAMP('2017-09-04 11:12:15','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=548065
;
-- 2017-09-04T11:12:19.517
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET WidgetSize='S',Updated=TO_TIMESTAMP('2017-09-04 11:12:19','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=548066
;
-- 2017-09-04T11:12:56.674
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=50,Updated=TO_TIMESTAMP('2017-09-04 11:12:56','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=548062
;
-- 2017-09-04T11:12:56.677
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=60,Updated=TO_TIMESTAMP('2017-09-04 11:12:56','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=548071
;
-- 2017-09-04T11:12:56.679
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=70,Updated=TO_TIMESTAMP('2017-09-04 11:12:56','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=548063
;
-- 2017-09-04T11:12:56.681
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=80,Updated=TO_TIMESTAMP('2017-09-04 11:12:56','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=548044
;
-- 2017-09-04T11:12:56.684
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=90,Updated=TO_TIMESTAMP('2017-09-04 11:12:56','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=548069
;
-- 2017-09-04T11:14:01.242
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
DELETE FROM AD_UI_Element WHERE AD_UI_Element_ID=548044
;
-- 2017-09-04T11:14:37.600
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,Created,CreatedBy,IsActive,IsAdvancedField,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,10980,0,682,541076,548072,TO_TIMESTAMP('2017-09-04 11:14:37','YYYY-MM-DD HH24:MI:SS'),100,'Y','N','N','N','N','Status',40,0,0,TO_TIMESTAMP('2017-09-04 11:14:37','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 2017-09-04T11:14:49.247
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=80,Updated=TO_TIMESTAMP('2017-09-04 11:14:49','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=548072
;
-- 2017-09-04T11:19:22.716
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayedGrid='N', SeqNoGrid=0,Updated=TO_TIMESTAMP('2017-09-04 11:19:22','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=548049
;
-- 2017-09-04T11:19:22.720
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayedGrid='N', SeqNoGrid=0,Updated=TO_TIMESTAMP('2017-09-04 11:19:22','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=548047
;
-- 2017-09-04T11:19:22.724
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=10,Updated=TO_TIMESTAMP('2017-09-04 11:19:22','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=548050
;
-- 2017-09-04T11:19:22.725
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=20,Updated=TO_TIMESTAMP('2017-09-04 11:19:22','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=548052
;
-- 2017-09-04T11:19:22.727
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=30,Updated=TO_TIMESTAMP('2017-09-04 11:19:22','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=548053
;
-- 2017-09-04T11:19:22.729
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=40,Updated=TO_TIMESTAMP('2017-09-04 11:19:22','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=548055
;
-- 2017-09-04T11:19:22.730
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=50,Updated=TO_TIMESTAMP('2017-09-04 11:19:22','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=548057
;
-- 2017-09-04T11:19:22.734
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=60,Updated=TO_TIMESTAMP('2017-09-04 11:19:22','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=548054
;
-- 2017-09-04T11:19:22.736
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=70,Updated=TO_TIMESTAMP('2017-09-04 11:19:22','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=548051
;
-- 2017-09-04T11:19:22.737
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=80,Updated=TO_TIMESTAMP('2017-09-04 11:19:22','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=548056
;
-- 2017-09-04T11:19:22.743
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=90,Updated=TO_TIMESTAMP('2017-09-04 11:19:22','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=548058
;
-- 2017-09-04T11:19:22.746
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=100,Updated=TO_TIMESTAMP('2017-09-04 11:19:22','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=548059
;
-- 2017-09-04T11:19:22.748
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=110,Updated=TO_TIMESTAMP('2017-09-04 11:19:22','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=548048
;
-- 2017-09-04T11:20:21.488
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,Created,CreatedBy,IsActive,IsAdvancedField,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,558142,0,683,541074,548073,TO_TIMESTAMP('2017-09-04 11:20:21','YYYY-MM-DD HH24:MI:SS'),100,'Y','N','Y','N','N','Packvorschrift',10,0,0,TO_TIMESTAMP('2017-09-04 11:20:21','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 2017-09-04T11:20:25.849
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayed='N', SeqNo=0,Updated=TO_TIMESTAMP('2017-09-04 11:20:25','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=548073
;
-- 2017-09-04T11:20:32.301
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=50,Updated=TO_TIMESTAMP('2017-09-04 11:20:32','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=548073
;
-- 2017-09-04T11:20:32.302
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=60,Updated=TO_TIMESTAMP('2017-09-04 11:20:32','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=548057
;
-- 2017-09-04T11:20:32.310
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=70,Updated=TO_TIMESTAMP('2017-09-04 11:20:32','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=548054
;
-- 2017-09-04T11:20:32.317
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=80,Updated=TO_TIMESTAMP('2017-09-04 11:20:32','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=548051
;
-- 2017-09-04T11:20:32.318
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=90,Updated=TO_TIMESTAMP('2017-09-04 11:20:32','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=548056
;
-- 2017-09-04T11:20:32.320
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=100,Updated=TO_TIMESTAMP('2017-09-04 11:20:32','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=548058
;
-- 2017-09-04T11:20:32.321
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=110,Updated=TO_TIMESTAMP('2017-09-04 11:20:32','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=548059
;
-- 2017-09-04T11:20:32.323
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=120,Updated=TO_TIMESTAMP('2017-09-04 11:20:32','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=548048
;
-- 2017-09-04T11:20:51.118
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Field SET Name='Packvorschrift',Updated=TO_TIMESTAMP('2017-09-04 11:20:51','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=558142
;
-- 2017-09-04T11:21:05.184
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Field SET Name='Menge',Updated=TO_TIMESTAMP('2017-09-04 11:21:05','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=10998
;
-- 2017-09-04T11:21:20.455
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Field_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2017-09-04 11:21:20','YYYY-MM-DD HH24:MI:SS'),Name='Line No.' WHERE AD_Field_ID=10989 AND AD_Language='en_US'
;
-- 2017-09-04T11:21:55.528
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET SeqNo=10,Updated=TO_TIMESTAMP('2017-09-04 11:21:55','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=548050
;
-- 2017-09-04T11:21:58.448
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET SeqNo=20,Updated=TO_TIMESTAMP('2017-09-04 11:21:58','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=548052
;
-- 2017-09-04T11:22:00.225
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET SeqNo=30,Updated=TO_TIMESTAMP('2017-09-04 11:22:00','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=548053
;
-- 2017-09-04T11:22:01.713
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET SeqNo=40,Updated=TO_TIMESTAMP('2017-09-04 11:22:01','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=548055
;
-- 2017-09-04T11:22:03.392
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET SeqNo=50,Updated=TO_TIMESTAMP('2017-09-04 11:22:03','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=548073
;
-- 2017-09-04T11:22:05.370
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET SeqNo=60,Updated=TO_TIMESTAMP('2017-09-04 11:22:05','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=548057
;
-- 2017-09-04T11:22:06.944
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET SeqNo=70,Updated=TO_TIMESTAMP('2017-09-04 11:22:06','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=548054
;
-- 2017-09-04T11:22:08.691
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET SeqNo=80,Updated=TO_TIMESTAMP('2017-09-04 11:22:08','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=548051
;
-- 2017-09-04T11:22:10.436
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET SeqNo=90,Updated=TO_TIMESTAMP('2017-09-04 11:22:10','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=548056
;
-- 2017-09-04T11:22:12.689
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET SeqNo=100,Updated=TO_TIMESTAMP('2017-09-04 11:22:12','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=548058
;
-- 2017-09-04T11:22:14.553
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET SeqNo=110,Updated=TO_TIMESTAMP('2017-09-04 11:22:14','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=548059
;
-- 2017-09-04T11:22:21.559
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET SeqNo=120,Updated=TO_TIMESTAMP('2017-09-04 11:22:21','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=548048
;
-- 2017-09-04T11:22:26.671
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayed='Y', SeqNo=130,Updated=TO_TIMESTAMP('2017-09-04 11:22:26','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=548047
;
-- 2017-09-04T11:22:27.024
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayed='Y',Updated=TO_TIMESTAMP('2017-09-04 11:22:27','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=548050
;
-- 2017-09-04T11:22:27.368
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayed='Y',Updated=TO_TIMESTAMP('2017-09-04 11:22:27','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=548052
;
-- 2017-09-04T11:22:28.064
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayed='Y',Updated=TO_TIMESTAMP('2017-09-04 11:22:28','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=548053
;
-- 2017-09-04T11:22:28.543
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayed='Y',Updated=TO_TIMESTAMP('2017-09-04 11:22:28','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=548055
;
-- 2017-09-04T11:22:28.840
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayed='Y',Updated=TO_TIMESTAMP('2017-09-04 11:22:28','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=548073
;
-- 2017-09-04T11:22:29.145
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayed='Y',Updated=TO_TIMESTAMP('2017-09-04 11:22:29','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=548057
;
-- 2017-09-04T11:22:29.472
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayed='Y',Updated=TO_TIMESTAMP('2017-09-04 11:22:29','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=548054
;
-- 2017-09-04T11:22:29.944
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayed='Y',Updated=TO_TIMESTAMP('2017-09-04 11:22:29','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=548051
;
-- 2017-09-04T11:22:30.336
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayed='Y',Updated=TO_TIMESTAMP('2017-09-04 11:22:30','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=548056
;
-- 2017-09-04T11:22:30.753
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayed='Y',Updated=TO_TIMESTAMP('2017-09-04 11:22:30','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=548058
;
-- 2017-09-04T11:22:31.192
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayed='Y',Updated=TO_TIMESTAMP('2017-09-04 11:22:31','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=548059
;
-- 2017-09-04T11:22:32.366
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayed='Y',Updated=TO_TIMESTAMP('2017-09-04 11:22:32','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=548048
;
-- 2017-09-04T11:31:17.402
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Field_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2017-09-04 11:31:17','YYYY-MM-DD HH24:MI:SS'),Name='No.' WHERE AD_Field_ID=10964 AND AD_Language='en_US'
;
-- 2017-09-04T11:31:32.394
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Field_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2017-09-04 11:31:32','YYYY-MM-DD HH24:MI:SS'),Name='Date' WHERE AD_Field_ID=10968 AND AD_Language='en_US'
;
-- 2017-09-04T11:31:58.450
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Field_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2017-09-04 11:31:58','YYYY-MM-DD HH24:MI:SS'),Name='Attributes' WHERE AD_Field_ID=10992 AND AD_Language='en_US'
;
-- 2017-09-04T11:32:22.795
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Field_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2017-09-04 11:32:22','YYYY-MM-DD HH24:MI:SS'),IsTranslated='Y',Name='Packing Instruction' WHERE AD_Field_ID=558142 AND AD_Language='en_US'
;
-- 2017-09-04T11:32:26.829
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Field_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2017-09-04 11:32:26','YYYY-MM-DD HH24:MI:SS'),Name='Packing' WHERE AD_Field_ID=558142 AND AD_Language='en_US'
;
-- 2017-09-04T11:32:50.179
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Field_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2017-09-04 11:32:50','YYYY-MM-DD HH24:MI:SS'),IsTranslated='Y',Name='UOM',Description='Unit of Measure',Help='' WHERE AD_Field_ID=558141 AND AD_Language='en_US'
;
-- 2017-09-04T11:33:18.476
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Field_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2017-09-04 11:33:18','YYYY-MM-DD HH24:MI:SS'),IsTranslated='Y',Name='Shipment-/Receiptline',Description='',Help='' WHERE AD_Field_ID=558133 AND AD_Language='en_US'
;
-- 2017-09-04T11:33:47.068
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Field_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2017-09-04 11:33:47','YYYY-MM-DD HH24:MI:SS'),IsTranslated='Y',Name='Qty TU' WHERE AD_Field_ID=558375 AND AD_Language='en_US'
;
-- 2017-09-04T11:33:56.764
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Field_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2017-09-04 11:33:56','YYYY-MM-DD HH24:MI:SS'),IsTranslated='Y',Name='Qty' WHERE AD_Field_ID=10998 AND AD_Language='it_CH'
;
-- 2017-09-04T11:34:41.157
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Field_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2017-09-04 11:34:41','YYYY-MM-DD HH24:MI:SS'),IsTranslated='N',Name='Internal Use Qty' WHERE AD_Field_ID=10998 AND AD_Language='it_CH'
;
-- 2017-09-04T11:34:49.173
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Field_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2017-09-04 11:34:49','YYYY-MM-DD HH24:MI:SS'),Name='Qty' WHERE AD_Field_ID=10998 AND AD_Language='en_US'
; | the_stack |
;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!50503 SET NAMES utf8mb4 */;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
DROP TABLE IF EXISTS `ann`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `ann` (
`id` int NOT NULL AUTO_INCREMENT COMMENT '主键',
`title` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '标题',
`content` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '内容',
`status` int NOT NULL COMMENT '0为不显示',
`created_at` int NOT NULL COMMENT '创建于',
`updated_at` int NOT NULL COMMENT '更新于',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `azure`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `azure` (
`id` int NOT NULL AUTO_INCREMENT,
`user_id` int NOT NULL COMMENT '归属用户id',
`az_email` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci COMMENT 'azure登录邮箱',
`az_passwd` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci COMMENT 'azure登录密码',
`az_api` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci COMMENT 'azure账户api参数',
`az_sub` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci COMMENT '订阅信息',
`az_sub_id` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci COMMENT '订阅id',
`az_sub_type` text COLLATE utf8mb4_general_ci COMMENT '订阅类型',
`az_sub_status` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci COMMENT '订阅状态',
`az_sub_updated_at` int DEFAULT NULL COMMENT '订阅状态更新时间',
`az_token` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci COMMENT '访问令牌',
`az_token_updated_at` int DEFAULT NULL COMMENT '访问令牌生成时间',
`user_mark` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci COMMENT '用户备注',
`admin_mark` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci COMMENT '管理员备注',
`providers_register` int DEFAULT '0' COMMENT '是否已注册必要提供商',
`created_at` int NOT NULL COMMENT '账户添加时间',
`updated_at` int NOT NULL COMMENT '最近一次账户资料更新时间',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `azure_server`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `azure_server` (
`id` int NOT NULL AUTO_INCREMENT,
`user_id` int DEFAULT NULL COMMENT '归属用户id',
`account_id` int DEFAULT NULL COMMENT '归属账户id',
`account_email` text COLLATE utf8mb4_general_ci COMMENT '归属账户邮箱',
`name` text COLLATE utf8mb4_general_ci COMMENT '虚拟机名称',
`status` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci COMMENT '虚拟机运行状态',
`location` text COLLATE utf8mb4_general_ci COMMENT '虚拟机地域',
`vm_size` text COLLATE utf8mb4_general_ci COMMENT '虚拟机大小',
`os_offer` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci COMMENT 'os_offer',
`os_sku` text COLLATE utf8mb4_general_ci COMMENT 'os_sku',
`disk_size` text COLLATE utf8mb4_general_ci COMMENT '虚拟机磁盘大小',
`vm_id` text COLLATE utf8mb4_general_ci COMMENT '虚拟机id',
`resource_group` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci COMMENT '资源组',
`at_subscription_id` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci COMMENT '归属订阅',
`ip_address` text COLLATE utf8mb4_general_ci COMMENT '虚拟机ip地址',
`network_interfaces` text COLLATE utf8mb4_general_ci COMMENT '网络接口',
`network_details` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci COMMENT '网络接口详情',
`vm_details` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci COMMENT '虚拟机详情',
`instance_details` text COLLATE utf8mb4_general_ci COMMENT '虚拟机状态信息',
`request_url` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci COMMENT 'api请求url',
`user_remark` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci COMMENT '用户备注',
`admin_remark` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci COMMENT '管理员备注',
`created_at` int NOT NULL COMMENT '创建时间',
`updated_at` int NOT NULL COMMENT '更新时间',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `azure_server_traffic`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `azure_server_traffic` (
`id` int NOT NULL AUTO_INCREMENT,
`u` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '上传流量',
`d` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '下载流量',
`date` text COLLATE utf8mb4_general_ci NOT NULL COMMENT '对应日期',
`uuid` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '虚拟机uuid',
`created_at` int NOT NULL COMMENT '创建时间',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `config`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `config` (
`id` int NOT NULL AUTO_INCREMENT,
`item` text COLLATE utf8mb4_general_ci COMMENT '键',
`value` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci COMMENT '值',
`class` text COLLATE utf8mb4_general_ci COMMENT '类',
`default_value` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci COMMENT '默认值',
`type` text COLLATE utf8mb4_general_ci COMMENT '值类型',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `login_log`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `login_log` (
`id` int NOT NULL AUTO_INCREMENT COMMENT '主键',
`email` text COLLATE utf8mb4_general_ci NOT NULL COMMENT '登录邮箱',
`ip` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'ip地址',
`ip_info` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'ip信息',
`created_at` int NOT NULL COMMENT '登录时间',
`status` int NOT NULL COMMENT '1为成功',
`info` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '备注',
`ua` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '请求ua',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `task`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `task` (
`id` int NOT NULL AUTO_INCREMENT,
`user_id` int NOT NULL COMMENT '提交用户',
`name` text COLLATE utf8mb4_general_ci COMMENT '任务名称',
`status` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci COMMENT '任务状态',
`schedule` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci COMMENT '进度(0-100)',
`current` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci COMMENT '当前进度提示语',
`total` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci COMMENT '总进度提示语',
`created_at` int NOT NULL COMMENT '创建时间',
`updated_at` int NOT NULL COMMENT '更新时间',
`total_time` int DEFAULT NULL COMMENT '任务总耗时',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `user`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `user` (
`id` int NOT NULL AUTO_INCREMENT COMMENT '主键',
`email` varchar(128) NOT NULL COMMENT '邮箱地址',
`passwd` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '密码',
`status` int NOT NULL DEFAULT '1' COMMENT '账户状态',
`notify_email` text COLLATE utf8mb4_general_ci COMMENT '用户通知邮箱',
`notify_tg` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci COMMENT '用户通知tg用户名',
`notify_tgid` text COLLATE utf8mb4_general_ci COMMENT '用户通知tgid',
`is_admin` int NOT NULL DEFAULT '0' COMMENT '管理员权限',
`remark` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci COMMENT '用户备注',
`personalise` text COLLATE utf8mb4_general_ci COMMENT '用户偏好',
`created_at` int NOT NULL COMMENT '创建时间',
`updated_at` int NOT NULL COMMENT '更新时间',
PRIMARY KEY (`id`),
UNIQUE KEY `email` (`email`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `verify`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `verify` (
`id` int NOT NULL AUTO_INCREMENT,
`email` text COLLATE utf8mb4_general_ci NOT NULL COMMENT '邮箱',
`type` text COLLATE utf8mb4_general_ci NOT NULL COMMENT '验证码类型',
`code` text COLLATE utf8mb4_general_ci NOT NULL COMMENT '验证码',
`ip` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '请求ip',
`result` int NOT NULL DEFAULT '0' COMMENT '验证结果',
`created_at` int NOT NULL COMMENT '创建时间',
`expired_at` int NOT NULL COMMENT '过期时间',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; | the_stack |
SET NAMES 'utf8';
UPDATE `PREFIX_configuration` SET `value` = CONCAT('#', `value`) WHERE `name` LIKE 'PS_%_PREFIX' AND `value` NOT LIKE '#%';
UPDATE `PREFIX_configuration_lang` SET `value` = CONCAT('#', `value`) WHERE `id_configuration` IN (SELECT `id_configuration` FROM `PREFIX_configuration` WHERE `name` LIKE 'PS_%_PREFIX') AND `value` NOT LIKE '#%';
ALTER TABLE `PREFIX_orders` CHANGE `invoice_number` `invoice_number` INT( 11 ) UNSIGNED NOT NULL DEFAULT '0',
CHANGE `delivery_number` `delivery_number` INT( 11 ) UNSIGNED NOT NULL DEFAULT '0';
/* taxes-patch */
ALTER TABLE `PREFIX_order_invoice`
CHANGE COLUMN `total_discount_tax_excl` `total_discount_tax_excl` DECIMAL(20,6) NOT NULL DEFAULT '0.00' ,
CHANGE COLUMN `total_discount_tax_incl` `total_discount_tax_incl` DECIMAL(20,6) NOT NULL DEFAULT '0.00' ,
CHANGE COLUMN `total_paid_tax_excl` `total_paid_tax_excl` DECIMAL(20,6) NOT NULL DEFAULT '0.00' ,
CHANGE COLUMN `total_paid_tax_incl` `total_paid_tax_incl` DECIMAL(20,6) NOT NULL DEFAULT '0.00' ,
CHANGE COLUMN `total_products` `total_products` DECIMAL(20,6) NOT NULL DEFAULT '0.00' ,
CHANGE COLUMN `total_products_wt` `total_products_wt` DECIMAL(20,6) NOT NULL DEFAULT '0.00' ,
CHANGE COLUMN `total_shipping_tax_excl` `total_shipping_tax_excl` DECIMAL(20,6) NOT NULL DEFAULT '0.00' ,
CHANGE COLUMN `total_shipping_tax_incl` `total_shipping_tax_incl` DECIMAL(20,6) NOT NULL DEFAULT '0.00' ,
CHANGE COLUMN `total_wrapping_tax_excl` `total_wrapping_tax_excl` DECIMAL(20,6) NOT NULL DEFAULT '0.00' ,
CHANGE COLUMN `total_wrapping_tax_incl` `total_wrapping_tax_incl` DECIMAL(20,6) NOT NULL DEFAULT '0.00' ;
ALTER TABLE `PREFIX_orders` ADD `round_type` TINYINT(1) NOT NULL DEFAULT '1' AFTER `round_mode`;
ALTER TABLE PREFIX_product_tag ADD `id_lang` int(10) unsigned NOT NULL, ADD KEY (id_lang, id_tag);
UPDATE PREFIX_product_tag, PREFIX_tag SET PREFIX_product_tag.id_lang=PREFIX_tag.id_lang WHERE PREFIX_tag.id_tag=PREFIX_product_tag.id_tag;
DROP TABLE IF EXISTS `PREFIX_tag_count`;
CREATE TABLE `PREFIX_tag_count` (
`id_group` int(10) unsigned NOT NULL DEFAULT 0,
`id_tag` int(10) unsigned NOT NULL DEFAULT 0,
`id_lang` int(10) unsigned NOT NULL DEFAULT 0,
`id_shop` int(11) unsigned NOT NULL DEFAULT 0,
`counter` int(10) unsigned NOT NULL DEFAULT 0,
PRIMARY KEY (`id_group`, `id_tag`),
KEY (`id_group`, `id_lang`, `id_shop`, `counter`)
) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8;
REPLACE INTO `PREFIX_tag_count` (id_group, id_tag, id_lang, id_shop, counter)
SELECT cg.id_group, t.id_tag, t.id_lang, ps.id_shop, COUNT(pt.id_tag) AS times
FROM `PREFIX_product_tag` pt
LEFT JOIN `PREFIX_tag` t ON (t.id_tag = pt.id_tag)
LEFT JOIN `PREFIX_product` p ON (p.id_product = pt.id_product)
INNER JOIN `PREFIX_product_shop` product_shop
ON (product_shop.id_product = p.id_product)
JOIN (SELECT DISTINCT id_group FROM `PREFIX_category_group`) cg
JOIN (SELECT DISTINCT id_shop FROM `PREFIX_shop`) ps
WHERE pt.`id_lang` = 1 AND product_shop.`active` = 1
AND EXISTS(SELECT 1 FROM `PREFIX_category_product` cp
LEFT JOIN `PREFIX_category_group` cgo ON (cp.`id_category` = cgo.`id_category`)
WHERE cgo.`id_group` = cg.id_group AND p.`id_product` = cp.`id_product`)
AND product_shop.id_shop = ps.id_shop
GROUP BY pt.id_tag, cg.id_group;
REPLACE INTO `PREFIX_tag_count` (id_group, id_tag, id_lang, id_shop, counter)
SELECT 0, t.id_tag, t.id_lang, ps.id_shop, COUNT(pt.id_tag) AS times
FROM `PREFIX_product_tag` pt
LEFT JOIN `PREFIX_tag` t ON (t.id_tag = pt.id_tag)
LEFT JOIN `PREFIX_product` p ON (p.id_product = pt.id_product)
INNER JOIN `PREFIX_product_shop` product_shop
ON (product_shop.id_product = p.id_product)
JOIN (SELECT DISTINCT id_shop FROM `PREFIX_shop`) ps
WHERE pt.`id_lang` = 1 AND product_shop.`active` = 1
AND product_shop.id_shop = ps.id_shop
GROUP BY pt.id_tag;
/* PHP:alter_ignore_drop_key(shop, id_group_shop); */;
/* PHP:alter_ignore_drop_key(specific_price, id_product_2); */;
/* PHP:alter_ignore_drop_key(hook_module, position); */;
/* PHP:alter_ignore_drop_key(cart_product, PRIMARY); */;
/* PHP:alter_ignore_drop_key(cart_product, cart_product_index); */;
ALTER TABLE `PREFIX_shop_group` ADD KEY `deleted` (`deleted`, `name`);
ALTER TABLE `PREFIX_shop` DROP KEY `id_shop_group`;
ALTER TABLE `PREFIX_shop` ADD KEY `id_shop_group` (`id_shop_group`, `deleted`);
ALTER TABLE `PREFIX_shop_url` DROP KEY `id_shop`;
ALTER TABLE `PREFIX_shop_url` ADD KEY `id_shop` (`id_shop`, `main`);
ALTER TABLE `PREFIX_customization` ADD KEY `id_cart` (`id_cart`);
ALTER TABLE `PREFIX_product_sale` ADD KEY `quantity` (`quantity`);
ALTER TABLE `PREFIX_cart_rule` ADD KEY `id_customer` (`id_customer`, `active`, `date_to`);
ALTER TABLE `PREFIX_cart_rule` ADD KEY `group_restriction` (`group_restriction`, `active`, `date_to`);
ALTER TABLE `PREFIX_hook_module` ADD KEY `position` (`id_shop`, `position`);
ALTER IGNORE TABLE `PREFIX_cart_product` ADD PRIMARY KEY (`id_cart`,`id_product`,`id_product_attribute`,`id_address_delivery`);
ALTER TABLE `PREFIX_cart_product` ADD KEY `id_cart_order` (`id_cart`, `date_add`, `id_product`, `id_product_attribute`);
ALTER TABLE `PREFIX_customization` DROP KEY id_cart;
ALTER IGNORE TABLE `PREFIX_customization` ADD KEY `id_cart_product` (`id_cart`, `id_product`, `id_product_attribute`);
ALTER TABLE `PREFIX_category` DROP KEY nleftright, DROP KEY nleft;
ALTER TABLE `PREFIX_category` ADD KEY `activenleft` (`active`,`nleft`), ADD KEY `activenright` (`active`,`nright`);
ALTER IGNORE TABLE `PREFIX_image_shop` DROP KEY `id_image`, ADD PRIMARY KEY (`id_image`, `id_shop`, `cover`);
ALTER TABLE PREFIX_product_attribute_shop ADD `id_product` int(10) unsigned NOT NULL, ADD KEY `id_product` (`id_product`, `id_shop`, `default_on`);
UPDATE PREFIX_product_attribute_shop, PREFIX_product_attribute
SET PREFIX_product_attribute_shop.id_product=PREFIX_product_attribute.id_product
WHERE PREFIX_product_attribute_shop.id_product_attribute=PREFIX_product_attribute.id_product_attribute;
ALTER TABLE PREFIX_image_shop ADD `id_product` int(10) unsigned NOT NULL, ADD KEY `id_product` (`id_product`, `id_shop`, `cover`);
UPDATE PREFIX_image_shop, PREFIX_image
SET PREFIX_image_shop.id_product=PREFIX_image.id_product
WHERE PREFIX_image_shop.id_image=PREFIX_image.id_image;
ALTER IGNORE TABLE `PREFIX_image_shop` DROP PRIMARY KEY, ADD PRIMARY KEY (`id_image`, `id_shop`);
ALTER TABLE `PREFIX_product_supplier` ADD KEY `id_supplier` (`id_supplier`,`id_product`);
ALTER TABLE `PREFIX_product` DROP KEY `product_manufacturer`;
ALTER TABLE `PREFIX_product` ADD KEY `product_manufacturer` (`id_manufacturer`, `id_product`);
DROP TABLE IF EXISTS `PREFIX_smarty_lazy_cache`;
CREATE TABLE `PREFIX_smarty_lazy_cache` (
`template_hash` varchar(32) NOT NULL DEFAULT '',
`cache_id` varchar(255) NOT NULL DEFAULT '',
`compile_id` varchar(32) NOT NULL DEFAULT '',
`filepath` varchar(255) NOT NULL DEFAULT '',
`last_update` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
PRIMARY KEY (`template_hash`, `cache_id`, `compile_id`)
) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8;
DROP TABLE IF EXISTS `PREFIX_smarty_last_flush`;
CREATE TABLE `PREFIX_smarty_last_flush` (
`type` ENUM('compile', 'template'),
`last_flush` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
PRIMARY KEY (`type`)
) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8;
DROP TABLE IF EXISTS `PREFIX_modules_perfs`;
CREATE TABLE `PREFIX_modules_perfs` (
`id_modules_perfs` int(11) unsigned NOT NULL AUTO_INCREMENT,
`session` int(11) unsigned NOT NULL,
`module` varchar(62) NOT NULL,
`method` varchar(126) NOT NULL,
`time_start` double unsigned NOT NULL,
`time_end` double unsigned NOT NULL,
`memory_start` int unsigned NOT NULL,
`memory_end` int unsigned NOT NULL,
PRIMARY KEY (`id_modules_perfs`),
KEY (`session`)
) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8;
ALTER TABLE `PREFIX_image` CHANGE `cover` `cover` tinyint(1) unsigned NULL DEFAULT NULL;
UPDATE `PREFIX_image` SET `cover`=NULL WHERE `cover`=0;
CREATE TEMPORARY TABLE `image_transform` SELECT `id_product`, COUNT(*) c FROM `PREFIX_image` WHERE `cover`=1 GROUP BY `id_product` HAVING c>1;
UPDATE `image_transform` JOIN `PREFIX_image` USING (`id_product`) SET `PREFIX_image`.`cover`=NULL;
ALTER TABLE `PREFIX_image` DROP KEY `id_product_cover`;
ALTER IGNORE TABLE `PREFIX_image` ADD UNIQUE KEY `id_product_cover` (`id_product`,`cover`);
ALTER TABLE `PREFIX_image_shop` CHANGE `cover` `cover` tinyint(1) unsigned NULL DEFAULT NULL;
UPDATE `PREFIX_image_shop` SET `cover`=NULL WHERE `cover`=0;
CREATE TEMPORARY TABLE `image_shop_transform` SELECT `id_product`, `id_shop`, COUNT(*) c FROM `PREFIX_image_shop` WHERE `cover`=1 GROUP BY `id_product`, `id_shop` HAVING c>1;
UPDATE `image_shop_transform` JOIN `PREFIX_image_shop` USING (`id_product`, `id_shop`) SET `PREFIX_image_shop`.`cover`=NULL;
ALTER TABLE `PREFIX_image_shop` DROP KEY `id_product`;
ALTER IGNORE TABLE `PREFIX_image_shop` ADD UNIQUE KEY `id_product` (`id_product`, `id_shop`, `cover`);
ALTER TABLE `PREFIX_product_attribute` CHANGE `default_on` `default_on` tinyint(1) unsigned NULL DEFAULT NULL;
UPDATE `PREFIX_product_attribute` SET `default_on`=NULL WHERE `default_on`=0;
CREATE TEMPORARY TABLE `attribute_transform` SELECT `id_product`, COUNT(*) c FROM `PREFIX_product_attribute` WHERE `default_on`=1 GROUP BY `id_product` HAVING c>1;
UPDATE `attribute_transform` JOIN `PREFIX_product_attribute` USING (`id_product`) SET `PREFIX_product_attribute`.`default_on`=NULL;
ALTER TABLE `PREFIX_product_attribute` DROP KEY `product_default`;
ALTER IGNORE TABLE `PREFIX_product_attribute` ADD UNIQUE KEY `product_default` (`id_product`,`default_on`);
ALTER TABLE `PREFIX_product_attribute_shop` CHANGE `default_on` `default_on` tinyint(1) unsigned NULL DEFAULT NULL;
UPDATE `PREFIX_product_attribute_shop` SET `default_on`=NULL WHERE `default_on`=0;
CREATE TEMPORARY TABLE `attribute_shop_transform` SELECT `id_product`, `id_shop`, COUNT(*) c FROM `PREFIX_product_attribute_shop` WHERE `default_on`=1 GROUP BY `id_product`, `id_shop` HAVING c>1;
UPDATE `attribute_shop_transform` JOIN `PREFIX_product_attribute_shop` USING (`id_product`, `id_shop`) SET `PREFIX_product_attribute_shop`.`default_on`=NULL;
ALTER TABLE `PREFIX_product_attribute_shop` DROP KEY `id_product`;
ALTER IGNORE TABLE `PREFIX_product_attribute_shop` ADD UNIQUE KEY `id_product` (`id_product`, `id_shop`, `default_on`);
ALTER IGNORE TABLE `PREFIX_product_download` ADD UNIQUE KEY `id_product` (`id_product`);
ALTER TABLE `PREFIX_customer` DROP KEY `id_shop`;
ALTER TABLE `PREFIX_customer` ADD KEY `id_shop` (`id_shop`, `date_add`);
ALTER TABLE `PREFIX_cart` DROP KEY `id_shop`;
ALTER TABLE `PREFIX_cart` ADD KEY `id_shop_2` (`id_shop`,`date_upd`), ADD KEY `id_shop` (`id_shop`,`date_add`);
ALTER TABLE `PREFIX_product_shop` ADD KEY `indexed` (`indexed`, `active`, `id_product`);
UPDATE `PREFIX_product_shop` SET `date_add` = NOW() WHERE `date_add` = "0000-00-00 00:00:00";
INSERT IGNORE INTO `PREFIX_hook` (`id_hook`, `name`, `title`, `description`, `position`, `live_edit`) VALUES
(NULL, 'actionAdminLoginControllerSetMedia', 'Set media on admin login page header', 'This hook is called after adding media to admin login page header', '1', '0'),
(NULL, 'actionOrderEdited', 'Order edited', 'This hook is called when an order is edited.', '1', '0'),
(NULL, 'displayAdminNavBarBeforeEnd', 'Admin Nav-bar before end', 'Called before the end of the nav-bar.', '1', '0'),
(NULL, 'displayAdminAfterHeader', 'Admin after header', 'Hook called just after the header of the backoffice.', '1', '0'),
(NULL, 'displayAdminLogin', 'Admin login', 'Hook called just after login of the backoffice.', '1', '0');
ALTER TABLE `PREFIX_cart_rule` ADD KEY `id_customer_2` (`id_customer`,`active`,`highlight`,`date_to`);
ALTER TABLE `PREFIX_cart_rule` ADD KEY `group_restriction_2` (`group_restriction`,`active`,`highlight`,`date_to`);
ALTER TABLE `PREFIX_configuration_kpi` CHANGE `name` `name` varchar(64);
ALTER TABLE `PREFIX_smarty_lazy_cache` CHANGE `cache_id` `cache_id` varchar(255) NOT NULL DEFAULT '';
TRUNCATE TABLE `PREFIX_smarty_lazy_cache`;
/* Advanced EU Compliance tables */
CREATE TABLE IF NOT EXISTS `PREFIX_cms_role` (
`id_cms_role` int(11) unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(50) NOT NULL,
`id_cms` int(11) unsigned NOT NULL,
PRIMARY KEY (`id_cms_role`, `id_cms`),
UNIQUE KEY `name` (`name`)
) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `PREFIX_cms_role_lang` (
`id_cms_role` int(11) unsigned NOT NULL,
`id_lang` int(11) unsigned NOT NULL,
`id_shop` int(11) unsigned NOT NULL,
`name` varchar(128) DEFAULT NULL,
PRIMARY KEY (`id_cms_role`,`id_lang`, `id_shop`)
) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8;
ALTER TABLE `PREFIX_order_invoice` ADD `company_address` TEXT DEFAULT NULL AFTER `total_wrapping_tax_incl`;
ALTER TABLE `PREFIX_order_invoice` ADD `shop_address` TEXT DEFAULT NULL AFTER `total_wrapping_tax_incl`;
ALTER TABLE `PREFIX_order_invoice` ADD `invoice_address` TEXT DEFAULT NULL AFTER `shop_address`;
ALTER TABLE `PREFIX_order_invoice` ADD `delivery_address` TEXT DEFAULT NULL AFTER `invoice_address`;
INSERT INTO `PREFIX_hook` (`name`, `title`, `description`) VALUES ('displayInvoiceLegalFreeText', 'PDF Invoice - Legal Free Text', 'This hook allows you to modify the legal free text on PDF invoices');
UPDATE `PREFIX_hook` SET position = 0 WHERE name LIKE 'action%';
ALTER IGNORE TABLE `PREFIX_specific_price` ADD UNIQUE KEY `id_product_2` (`id_cart`, `id_product`,`id_shop`,`id_shop_group`,`id_currency`,`id_country`,`id_group`,`id_customer`,`id_product_attribute`,`from_quantity`,`id_specific_price_rule`,`from`,`to`);
INSERT INTO `PREFIX_configuration` (`name`, `value`, `date_add`, `date_upd`)
VALUES ('PS_INVCE_INVOICE_ADDR_RULES', '{"avoid":["vat_number","phone","phone_mobile"]}', NOW(), NOW());
INSERT INTO `PREFIX_configuration` (`name`, `value`, `date_add`, `date_upd`)
VALUES ('PS_INVCE_DELIVERY_ADDR_RULES', '{"avoid":["vat_number","phone","phone_mobile"]}', NOW(), NOW());
ALTER TABLE `PREFIX_pack` ADD KEY `product_item` (`id_product_item`,`id_product_attribute_item`);
ALTER TABLE `PREFIX_supply_order_detail` DROP KEY `id_supply_order`, DROP KEY `id_product`, ADD KEY `id_supply_order` (`id_supply_order`, `id_product`);
ALTER TABLE `PREFIX_carrier` ADD KEY `reference` (`id_reference`, `deleted`, `active`); | the_stack |
-- 2017-09-27T15:25:36.057
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_ElementGroup SET UIStyle='primary',Updated=TO_TIMESTAMP('2017-09-27 15:25:36','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_ElementGroup_ID=540023
;
-- 2017-09-27T15:25:48.123
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_ElementGroup SET UIStyle='primary',Updated=TO_TIMESTAMP('2017-09-27 15:25:48','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_ElementGroup_ID=540024
;
-- 2017-09-27T15:26:02.904
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_ElementGroup SET UIStyle='primary',Updated=TO_TIMESTAMP('2017-09-27 15:26:02','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_ElementGroup_ID=540025
;
-- 2017-09-27T15:26:43.569
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_ElementGroup SET UIStyle='primary',Updated=TO_TIMESTAMP('2017-09-27 15:26:43','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_ElementGroup_ID=540026
;
-- 2017-09-27T15:28:03.587
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Tab SET Name='Rechnungs Steuer',Updated=TO_TIMESTAMP('2017-09-27 15:28:03','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=271
;
-- 2017-09-27T15:33:31.636
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET SeqNo=10,Updated=TO_TIMESTAMP('2017-09-27 15:33:31','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=540738
;
-- 2017-09-27T15:33:33.974
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET SeqNo=20,Updated=TO_TIMESTAMP('2017-09-27 15:33:33','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=540739
;
-- 2017-09-27T15:33:36.390
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET SeqNo=30,Updated=TO_TIMESTAMP('2017-09-27 15:33:36','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=540740
;
-- 2017-09-27T15:33:38.338
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET SeqNo=40,Updated=TO_TIMESTAMP('2017-09-27 15:33:38','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=540741
;
-- 2017-09-27T15:33:40.096
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET SeqNo=50,Updated=TO_TIMESTAMP('2017-09-27 15:33:40','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=540742
;
-- 2017-09-27T15:33:42.397
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET SeqNo=60,Updated=TO_TIMESTAMP('2017-09-27 15:33:42','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=540743
;
-- 2017-09-27T15:33:44.159
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET SeqNo=70,Updated=TO_TIMESTAMP('2017-09-27 15:33:44','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=540744
;
-- 2017-09-27T15:33:46.224
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET SeqNo=80,Updated=TO_TIMESTAMP('2017-09-27 15:33:46','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=540745
;
-- 2017-09-27T15:33:48.064
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET SeqNo=90,Updated=TO_TIMESTAMP('2017-09-27 15:33:48','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=540746
;
-- 2017-09-27T15:33:49.860
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET SeqNo=100,Updated=TO_TIMESTAMP('2017-09-27 15:33:49','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=540747
;
-- 2017-09-27T15:33:52.308
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET SeqNo=110,Updated=TO_TIMESTAMP('2017-09-27 15:33:52','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=540748
;
-- 2017-09-27T15:33:54.848
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET SeqNo=120,Updated=TO_TIMESTAMP('2017-09-27 15:33:54','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=540749
;
-- 2017-09-27T15:33:56.670
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET SeqNo=130,Updated=TO_TIMESTAMP('2017-09-27 15:33:56','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=540750
;
-- 2017-09-27T15:33:58.551
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET SeqNo=140,Updated=TO_TIMESTAMP('2017-09-27 15:33:58','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=540751
;
-- 2017-09-27T15:34:01.651
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET SeqNo=150,Updated=TO_TIMESTAMP('2017-09-27 15:34:01','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=540752
;
-- 2017-09-27T15:34:10.288
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET SeqNo=160,Updated=TO_TIMESTAMP('2017-09-27 15:34:10','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=540753
;
-- 2017-09-27T15:34:12.459
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET SeqNo=170,Updated=TO_TIMESTAMP('2017-09-27 15:34:12','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=540754
;
-- 2017-09-27T15:34:21.752
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET SeqNo=180,Updated=TO_TIMESTAMP('2017-09-27 15:34:21','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=540755
;
-- 2017-09-27T15:34:28.501
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET SeqNo=190,Updated=TO_TIMESTAMP('2017-09-27 15:34:28','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=540756
;
-- 2017-09-27T15:34:38.154
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,AD_UI_ElementType,Created,CreatedBy,IsActive,IsAdvancedField,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,2983,0,270,540023,548928,'F',TO_TIMESTAMP('2017-09-27 15:34:38','YYYY-MM-DD HH24:MI:SS'),100,'Y','N','Y','N','N','Sektion',200,0,0,TO_TIMESTAMP('2017-09-27 15:34:38','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 2017-09-27T15:34:49.436
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,AD_UI_ElementType,Created,CreatedBy,IsActive,IsAdvancedField,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,2982,0,270,540023,548929,'F',TO_TIMESTAMP('2017-09-27 15:34:49','YYYY-MM-DD HH24:MI:SS'),100,'Y','N','Y','N','N','Mandant',210,0,0,TO_TIMESTAMP('2017-09-27 15:34:49','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 2017-09-27T15:34:54.731
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=200,Updated=TO_TIMESTAMP('2017-09-27 15:34:54','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=548928
;
-- 2017-09-27T15:36:08.117
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,AD_UI_ElementType,Created,CreatedBy,IsActive,IsAdvancedField,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,556180,0,270,540023,548930,'F',TO_TIMESTAMP('2017-09-27 15:36:08','YYYY-MM-DD HH24:MI:SS'),100,'Y','N','Y','N','N','Packvorschrift',220,0,0,TO_TIMESTAMP('2017-09-27 15:36:08','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 2017-09-27T15:36:14.578
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET SeqNo=35,Updated=TO_TIMESTAMP('2017-09-27 15:36:14','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=548930
;
-- 2017-09-27T15:36:27.462
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=40,Updated=TO_TIMESTAMP('2017-09-27 15:36:27','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=548930
;
-- 2017-09-27T15:36:27.468
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=50,Updated=TO_TIMESTAMP('2017-09-27 15:36:27','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=540741
;
-- 2017-09-27T15:36:27.473
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=60,Updated=TO_TIMESTAMP('2017-09-27 15:36:27','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=540742
;
-- 2017-09-27T15:36:27.478
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=70,Updated=TO_TIMESTAMP('2017-09-27 15:36:27','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=540743
;
-- 2017-09-27T15:36:27.483
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=80,Updated=TO_TIMESTAMP('2017-09-27 15:36:27','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=540744
;
-- 2017-09-27T15:36:27.487
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=90,Updated=TO_TIMESTAMP('2017-09-27 15:36:27','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=540745
;
-- 2017-09-27T15:36:27.488
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=100,Updated=TO_TIMESTAMP('2017-09-27 15:36:27','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=540746
;
-- 2017-09-27T15:36:27.495
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=110,Updated=TO_TIMESTAMP('2017-09-27 15:36:27','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=540747
;
-- 2017-09-27T15:36:27.496
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=120,Updated=TO_TIMESTAMP('2017-09-27 15:36:27','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=540748
;
-- 2017-09-27T15:36:27.497
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=130,Updated=TO_TIMESTAMP('2017-09-27 15:36:27','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=540749
;
-- 2017-09-27T15:36:27.499
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=140,Updated=TO_TIMESTAMP('2017-09-27 15:36:27','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=540750
;
-- 2017-09-27T15:36:27.500
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=150,Updated=TO_TIMESTAMP('2017-09-27 15:36:27','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=540751
;
-- 2017-09-27T15:36:27.503
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=160,Updated=TO_TIMESTAMP('2017-09-27 15:36:27','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=540752
;
-- 2017-09-27T15:36:27.507
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=170,Updated=TO_TIMESTAMP('2017-09-27 15:36:27','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=540753
;
-- 2017-09-27T15:36:27.510
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=180,Updated=TO_TIMESTAMP('2017-09-27 15:36:27','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=540754
;
-- 2017-09-27T15:36:27.511
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=190,Updated=TO_TIMESTAMP('2017-09-27 15:36:27','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=540755
;
-- 2017-09-27T15:36:27.512
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=200,Updated=TO_TIMESTAMP('2017-09-27 15:36:27','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=540756
;
-- 2017-09-27T15:36:27.513
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=210,Updated=TO_TIMESTAMP('2017-09-27 15:36:27','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=548928
;
-- 2017-09-27T15:36:50.990
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=30,Updated=TO_TIMESTAMP('2017-09-27 15:36:50','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=540755
;
-- 2017-09-27T15:36:50.996
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=40,Updated=TO_TIMESTAMP('2017-09-27 15:36:50','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=540740
;
-- 2017-09-27T15:36:51.002
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=50,Updated=TO_TIMESTAMP('2017-09-27 15:36:51','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=548930
;
-- 2017-09-27T15:36:51.005
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=60,Updated=TO_TIMESTAMP('2017-09-27 15:36:51','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=540741
;
-- 2017-09-27T15:36:51.010
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=70,Updated=TO_TIMESTAMP('2017-09-27 15:36:51','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=540742
;
-- 2017-09-27T15:36:51.013
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=80,Updated=TO_TIMESTAMP('2017-09-27 15:36:51','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=540743
;
-- 2017-09-27T15:36:51.017
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=90,Updated=TO_TIMESTAMP('2017-09-27 15:36:51','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=540744
;
-- 2017-09-27T15:36:51.020
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=100,Updated=TO_TIMESTAMP('2017-09-27 15:36:51','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=540745
;
-- 2017-09-27T15:36:51.023
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=110,Updated=TO_TIMESTAMP('2017-09-27 15:36:51','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=540746
;
-- 2017-09-27T15:36:51.026
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=120,Updated=TO_TIMESTAMP('2017-09-27 15:36:51','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=540747
;
-- 2017-09-27T15:36:51.029
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=130,Updated=TO_TIMESTAMP('2017-09-27 15:36:51','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=540748
;
-- 2017-09-27T15:36:51.032
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=140,Updated=TO_TIMESTAMP('2017-09-27 15:36:51','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=540749
;
-- 2017-09-27T15:36:51.034
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=150,Updated=TO_TIMESTAMP('2017-09-27 15:36:51','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=540750
;
-- 2017-09-27T15:36:51.036
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=160,Updated=TO_TIMESTAMP('2017-09-27 15:36:51','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=540751
;
-- 2017-09-27T15:36:51.037
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=170,Updated=TO_TIMESTAMP('2017-09-27 15:36:51','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=540752
;
-- 2017-09-27T15:36:51.039
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=180,Updated=TO_TIMESTAMP('2017-09-27 15:36:51','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=540753
;
-- 2017-09-27T15:36:51.041
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=190,Updated=TO_TIMESTAMP('2017-09-27 15:36:51','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=540754
;
-- 2017-09-27T15:37:47.660
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=90,Updated=TO_TIMESTAMP('2017-09-27 15:37:47','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=540754
;
-- 2017-09-27T15:37:47.663
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=100,Updated=TO_TIMESTAMP('2017-09-27 15:37:47','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=540753
;
-- 2017-09-27T15:37:47.665
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=110,Updated=TO_TIMESTAMP('2017-09-27 15:37:47','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=540744
;
-- 2017-09-27T15:37:47.667
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=120,Updated=TO_TIMESTAMP('2017-09-27 15:37:47','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=540746
;
-- 2017-09-27T15:37:47.669
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=130,Updated=TO_TIMESTAMP('2017-09-27 15:37:47','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=540747
;
-- 2017-09-27T15:37:47.671
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=140,Updated=TO_TIMESTAMP('2017-09-27 15:37:47','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=540748
;
-- 2017-09-27T15:37:47.673
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=150,Updated=TO_TIMESTAMP('2017-09-27 15:37:47','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=540749
;
-- 2017-09-27T15:37:47.674
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=160,Updated=TO_TIMESTAMP('2017-09-27 15:37:47','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=540750
;
-- 2017-09-27T15:37:47.680
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=170,Updated=TO_TIMESTAMP('2017-09-27 15:37:47','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=540751
;
-- 2017-09-27T15:37:47.681
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=180,Updated=TO_TIMESTAMP('2017-09-27 15:37:47','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=540752
;
-- 2017-09-27T15:37:47.686
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=190,Updated=TO_TIMESTAMP('2017-09-27 15:37:47','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=540745
;
-- 2017-09-27T16:09:06.666
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayedGrid='N', SeqNoGrid=0,Updated=TO_TIMESTAMP('2017-09-27 16:09:06','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=540745
;
-- 2017-09-27T16:09:06.671
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=190,Updated=TO_TIMESTAMP('2017-09-27 16:09:06','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=540756
;
-- 2017-09-27T16:09:06.676
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=200,Updated=TO_TIMESTAMP('2017-09-27 16:09:06','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=548928
;
-- 2017-09-27T16:10:33.921
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET SeqNo=195,Updated=TO_TIMESTAMP('2017-09-27 16:10:33','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=540745
;
-- 2017-09-27T16:11:34.494
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayedGrid='N', SeqNoGrid=0,Updated=TO_TIMESTAMP('2017-09-27 16:11:34','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=540759
;
-- 2017-09-27T16:11:34.495
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=10,Updated=TO_TIMESTAMP('2017-09-27 16:11:34','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=540760
;
-- 2017-09-27T16:11:34.496
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=20,Updated=TO_TIMESTAMP('2017-09-27 16:11:34','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=540761
;
-- 2017-09-27T16:11:34.497
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=30,Updated=TO_TIMESTAMP('2017-09-27 16:11:34','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=540762
;
-- 2017-09-27T16:11:34.498
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=40,Updated=TO_TIMESTAMP('2017-09-27 16:11:34','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=540763
;
-- 2017-09-27T16:11:34.498
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=50,Updated=TO_TIMESTAMP('2017-09-27 16:11:34','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=540764
;
-- 2017-09-27T16:11:34.499
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=60,Updated=TO_TIMESTAMP('2017-09-27 16:11:34','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=540765
;
-- 2017-09-27T16:11:34.500
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=70,Updated=TO_TIMESTAMP('2017-09-27 16:11:34','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=540758
;
-- 2017-09-27T16:12:19.838
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET SeqNo=10,Updated=TO_TIMESTAMP('2017-09-27 16:12:19','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=540760
;
-- 2017-09-27T16:12:21.974
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET SeqNo=20,Updated=TO_TIMESTAMP('2017-09-27 16:12:21','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=540761
;
-- 2017-09-27T16:12:23.664
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET SeqNo=30,Updated=TO_TIMESTAMP('2017-09-27 16:12:23','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=540762
;
-- 2017-09-27T16:12:25.449
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET SeqNo=40,Updated=TO_TIMESTAMP('2017-09-27 16:12:25','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=540763
;
-- 2017-09-27T16:12:27.310
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET SeqNo=50,Updated=TO_TIMESTAMP('2017-09-27 16:12:27','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=540764
;
-- 2017-09-27T16:12:28.943
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET SeqNo=60,Updated=TO_TIMESTAMP('2017-09-27 16:12:28','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=540765
;
-- 2017-09-27T16:12:31.886
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET SeqNo=70,Updated=TO_TIMESTAMP('2017-09-27 16:12:31','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=540758
;
-- 2017-09-27T16:12:38.195
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET SeqNo=80,Updated=TO_TIMESTAMP('2017-09-27 16:12:38','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=540757
;
-- 2017-09-27T16:14:22.101
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayedGrid='N', SeqNoGrid=0,Updated=TO_TIMESTAMP('2017-09-27 16:14:22','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=540768
;
-- 2017-09-27T16:14:22.102
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=10,Updated=TO_TIMESTAMP('2017-09-27 16:14:22','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=540769
;
-- 2017-09-27T16:14:22.103
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=20,Updated=TO_TIMESTAMP('2017-09-27 16:14:22','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=540770
;
-- 2017-09-27T16:14:22.104
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=30,Updated=TO_TIMESTAMP('2017-09-27 16:14:22','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=540771
;
-- 2017-09-27T16:14:22.107
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=40,Updated=TO_TIMESTAMP('2017-09-27 16:14:22','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=540772
;
-- 2017-09-27T16:14:22.108
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=50,Updated=TO_TIMESTAMP('2017-09-27 16:14:22','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=540773
;
-- 2017-09-27T16:14:22.109
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=60,Updated=TO_TIMESTAMP('2017-09-27 16:14:22','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=540774
;
-- 2017-09-27T16:14:22.110
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=70,Updated=TO_TIMESTAMP('2017-09-27 16:14:22','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=540775
;
-- 2017-09-27T16:14:22.112
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=80,Updated=TO_TIMESTAMP('2017-09-27 16:14:22','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=540776
;
-- 2017-09-27T16:14:22.113
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=90,Updated=TO_TIMESTAMP('2017-09-27 16:14:22','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=540767
;
-- 2017-09-27T16:15:31.224
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=10,Updated=TO_TIMESTAMP('2017-09-27 16:15:31','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=540771
;
-- 2017-09-27T16:15:31.228
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=20,Updated=TO_TIMESTAMP('2017-09-27 16:15:31','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=540772
;
-- 2017-09-27T16:15:31.231
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=30,Updated=TO_TIMESTAMP('2017-09-27 16:15:31','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=540773
;
-- 2017-09-27T16:15:31.234
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=40,Updated=TO_TIMESTAMP('2017-09-27 16:15:31','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=540774
;
-- 2017-09-27T16:15:31.253
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=50,Updated=TO_TIMESTAMP('2017-09-27 16:15:31','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=540769
;
-- 2017-09-27T16:15:31.255
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=60,Updated=TO_TIMESTAMP('2017-09-27 16:15:31','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=540770
;
-- 2017-09-27T16:15:31.262
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=70,Updated=TO_TIMESTAMP('2017-09-27 16:15:31','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=540776
;
-- 2017-09-27T16:15:31.265
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=80,Updated=TO_TIMESTAMP('2017-09-27 16:15:31','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=540775
;
-- 2017-09-27T16:16:09.909
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=10,Updated=TO_TIMESTAMP('2017-09-27 16:16:09','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=540779
;
-- 2017-09-27T16:16:09.912
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=20,Updated=TO_TIMESTAMP('2017-09-27 16:16:09','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=540780
;
-- 2017-09-27T16:16:09.915
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=30,Updated=TO_TIMESTAMP('2017-09-27 16:16:09','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=540781
;
-- 2017-09-27T16:16:09.916
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=40,Updated=TO_TIMESTAMP('2017-09-27 16:16:09','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=540782
;
-- 2017-09-27T16:16:09.917
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=50,Updated=TO_TIMESTAMP('2017-09-27 16:16:09','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=540783
;
-- 2017-09-27T16:16:09.919
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=60,Updated=TO_TIMESTAMP('2017-09-27 16:16:09','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=540784
;
-- 2017-09-27T16:16:09.920
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=70,Updated=TO_TIMESTAMP('2017-09-27 16:16:09','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=540785
;
-- 2017-09-27T16:16:09.932
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=80,Updated=TO_TIMESTAMP('2017-09-27 16:16:09','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=540786
;
-- 2017-09-27T16:16:09.935
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=90,Updated=TO_TIMESTAMP('2017-09-27 16:16:09','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=540787
;
-- 2017-09-27T16:16:09.937
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=100,Updated=TO_TIMESTAMP('2017-09-27 16:16:09','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=540778
;
-- 2017-09-27T16:16:22.365
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET SeqNo=10,Updated=TO_TIMESTAMP('2017-09-27 16:16:22','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=540771
;
-- 2017-09-27T16:16:24.302
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET SeqNo=20,Updated=TO_TIMESTAMP('2017-09-27 16:16:24','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=540772
;
-- 2017-09-27T16:16:26.621
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET SeqNo=30,Updated=TO_TIMESTAMP('2017-09-27 16:16:26','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=540773
;
-- 2017-09-27T16:16:28.414
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET SeqNo=40,Updated=TO_TIMESTAMP('2017-09-27 16:16:28','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=540774
;
-- 2017-09-27T16:16:29.989
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET SeqNo=50,Updated=TO_TIMESTAMP('2017-09-27 16:16:29','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=540769
;
-- 2017-09-27T16:16:31.889
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET SeqNo=60,Updated=TO_TIMESTAMP('2017-09-27 16:16:31','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=540770
;
-- 2017-09-27T16:16:33.526
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET SeqNo=70,Updated=TO_TIMESTAMP('2017-09-27 16:16:33','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=540776
;
-- 2017-09-27T16:16:36.190
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET SeqNo=80,Updated=TO_TIMESTAMP('2017-09-27 16:16:36','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=540775
;
-- 2017-09-27T16:16:42.278
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET SeqNo=90,Updated=TO_TIMESTAMP('2017-09-27 16:16:42','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=540767
;
-- 2017-09-27T16:16:54.565
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET SeqNo=100,Updated=TO_TIMESTAMP('2017-09-27 16:16:54','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=540766
;
-- 2017-09-27T16:17:04.927
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayed='N',Updated=TO_TIMESTAMP('2017-09-27 16:17:04','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=540768
; | the_stack |
WITH fk_constraint AS (
SELECT
tc."constraint_catalog" AS parent_constraint_catalog,
tc."constraint_schema" AS parent_constraint_schema,
tc."constraint_name" AS parent_constraint,
CONCAT(tc."constraint_schema", '.', tc."constraint_name") AS parent_constraint_full_name,
CONCAT(tc."constraint_catalog", '.', tc."constraint_schema", '.', tc."constraint_name") AS parent_constraint_full_catalog_name,
tc."table_catalog" AS parent_catalog,
tc.table_schema AS parent_schema,
tc."table_name" AS parent_table,
CONCAT(tc.table_schema, '.', tc."table_name") AS parent_table_full_name,
CONCAT(tc.table_catalog, '.', tc.table_schema, '.', tc."table_name") AS parent_table_full_catalog_name,
tc.constraint_type AS parent_constraint_type,
tc.is_deferrable AS parent_is_deferrable,
tc.initially_deferred AS parent_initially_deferred,
ftc."constraint_catalog" AS child_constraint_catalog,
ftc."constraint_schema" AS child_constraint_schema,
ftc."constraint_name" AS child_constraint,
CONCAT(ftc."constraint_schema", '.', ftc."constraint_name") AS child_constraint_full_name,
CONCAT(ftc."constraint_catalog", '.', ftc."constraint_schema", '.', ftc."constraint_name") AS child_constraint_full_catalog_name,
rc.match_option AS child_constraint_match_option,
rc.update_rule AS child_constraint_update_rule,
rc.delete_rule AS child_constraint_delete_rule,
ftc.table_catalog AS child_catalog,
ftc.table_schema AS child_schema,
ftc."table_name" AS child_table,
CONCAT(ftc.table_schema, '.', ftc."table_name") AS child_table_full_name,
CONCAT(ftc.table_catalog, '.', ftc.table_schema, '.', ftc."table_name") AS child_table_full_catalog_name,
ftc.constraint_type AS child_constraint_type,
ftc.is_deferrable AS child_is_deferrable,
ftc.initially_deferred AS child_initially_deferred
FROM
information_schema.referential_constraints rc
INNER JOIN information_schema.table_constraints ftc ON ftc."constraint_schema" = rc."constraint_schema" AND ftc."constraint_name" = rc."constraint_name" AND ftc."constraint_catalog" = rc."constraint_catalog"
INNER JOIN information_schema.table_constraints tc ON rc.unique_constraint_name = tc."constraint_name"
ORDER BY child_table ASC, parent_table ASC
),
referential_constraint AS (
SELECT
l."child_constraint_full_catalog_name" AS "fullCatalogName", -- leftJoinConstraintFullCatalogName is unique
l."parent_constraint_catalog" AS "leftConstraintCatalog",
l."parent_constraint_schema" AS "leftConstraintSchema",
l."parent_constraint" AS "leftConstraint",
l."parent_constraint_full_name" AS "leftConstraintFullName",
l."parent_constraint_full_catalog_name" AS "leftConstraintFullCatalogName",
l."parent_constraint_type" AS "leftConstraintType",
l."parent_is_deferrable" AS "leftIsDeferrable",
l."parent_initially_deferred" AS "leftInitiallyDeferred",
l."parent_catalog" AS "leftCatalog",
l."parent_schema" AS "leftSchema",
l."parent_table" AS "leftTable",
l."parent_table_full_name" AS "leftTableFullName",
l."parent_table_full_catalog_name" AS "leftTableFullCatalogName",
l."child_constraint_catalog" AS "leftJoinConstraintCatalog",
l."child_constraint_schema" AS "leftJoinConstraintSchema",
l."child_constraint" AS "leftJoinConstraint",
l."child_constraint_full_name" AS "leftJoinConstraintFullName",
l."child_constraint_full_catalog_name" AS "leftJoinConstraintFullCatalogName",
l."child_constraint_type" AS "leftJoinConstraintType",
l."child_constraint_match_option" AS "leftJoinConstraintMatchOption",
l."child_constraint_update_rule" AS "leftJoinConstraintOnUpdate",
l."child_constraint_delete_rule" AS "leftJoinConstraintOnDelete",
l."child_is_deferrable" AS "leftJoinIsDeferrable",
l."child_initially_deferred" AS "leftJoinInitiallyDeferred",
l."child_catalog" AS "joinCatalog",
l."child_schema" AS "joinSchema",
l."child_table" AS "joinTable",
l."child_table_full_name" AS "joinTableFullName",
l."child_table_full_catalog_name" AS "joinTableFullCatalogName",
r."child_constraint_catalog" AS "rightJoinConstraintCatalog",
r."child_constraint_schema" AS "rightJoinConstraintSchema",
r."child_constraint" AS "rightJoinConstraint",
r."child_constraint_full_name" AS "rightJoinConstraintFullName",
r."child_constraint_full_catalog_name" AS "rightJoinConstraintFullCatalogName",
r."child_constraint_type" AS "rightJoinConstraintType",
r."child_constraint_match_option" AS "rightJoinConstraintMatchOption",
r."child_constraint_update_rule" AS "rightJoinConstraintOnUpdate",
r."child_constraint_delete_rule" AS "rightJoinConstraintOnDelete",
r."child_is_deferrable" AS "rightJoinIsDeferrable",
r."child_initially_deferred" AS "rightJoinInitiallyDeferred",
r."parent_constraint_catalog" AS "rightConstraintCatalog",
r."parent_constraint_schema" AS "rightConstraintSchema",
r."parent_constraint" AS "rightConstraint",
r."parent_constraint_full_name" AS "rightConstraintFullName",
r."parent_constraint_full_catalog_name" AS "rightConstraintFullCatalogName",
r."parent_constraint_type" AS "rightConstraintType",
r."parent_is_deferrable" AS "rightIsDeferrable",
r."parent_initially_deferred" AS "rightInitiallyDeferred",
r."parent_catalog" AS "rightCatalog",
r."parent_schema" AS "rightSchema",
r."parent_table" AS "rightTable",
r."parent_table_full_name" AS "rightTableFullName",
r."parent_table_full_catalog_name" AS "rightTableFullCatalogName"
FROM fk_constraint l
LEFT JOIN fk_constraint r ON l."child_schema" = r."child_schema" AND l."child_table" = r."child_table"
AND NOT (l."child_constraint_schema" = r."child_constraint_schema" AND l."child_constraint" = r."child_constraint")
WHERE
l."parent_schema" = ANY($1)
AND l."child_schema" = ANY($1)
AND (r."parent_schema" = ANY($1))
UNION
SELECT
l."child_constraint_full_catalog_name" AS "fullCatalogName", -- leftJoinConstraintFullCatalogName is unique
l."parent_constraint_catalog" AS "leftConstraintCatalog",
l."parent_constraint_schema" AS "leftConstraintSchema",
l."parent_constraint" AS "leftConstraint",
l."parent_constraint_full_name" AS "leftConstraintFullName",
l."parent_constraint_full_catalog_name" AS "leftConstraintFullCatalogName",
l."parent_constraint_type" AS "leftConstraintType",
l."parent_is_deferrable" AS "leftIsDeferrable",
l."parent_initially_deferred" AS "leftInitiallyDeferred",
l."parent_catalog" AS "leftCatalog",
l."parent_schema" AS "leftSchema",
l."parent_table" AS "leftTable",
l."parent_table_full_name" AS "leftTableFullName",
l."parent_table_full_catalog_name" AS "leftTableFullCatalogName",
l."child_constraint_catalog" AS "leftJoinConstraintCatalog",
l."child_constraint_schema" AS "leftJoinConstraintSchema",
l."child_constraint" AS "leftJoinConstraint",
l."child_constraint_full_name" AS "leftJoinConstraintFullName",
l."child_constraint_full_catalog_name" AS "leftJoinConstraintFullCatalogName",
l."child_constraint_type" AS "leftJoinConstraintType",
l."child_constraint_match_option" AS "leftJoinConstraintMatchOption",
l."child_constraint_update_rule" AS "leftJoinConstraintOnUpdate",
l."child_constraint_delete_rule" AS "leftJoinConstraintOnDelete",
l."child_is_deferrable" AS "leftJoinIsDeferrable",
l."child_initially_deferred" AS "leftJoinInitiallyDeferred",
l."child_catalog" AS "joinCatalog",
l."child_schema" AS "joinSchema",
l."child_table" AS "joinTable",
l."child_table_full_name" AS "joinTableFullName",
l."child_table_full_catalog_name" AS "joinTableFullCatalogName",
NULL AS "rightJoinConstraintCatalog",
NULL AS "rightJoinConstraintSchema",
NULL AS "rightJoinConstraint",
NULL AS "rightJoinConstraintFullName",
NULL AS "rightJoinConstraintFullCatalogName",
NULL AS "rightJoinConstraintType",
NULL AS "rightJoinConstraintMatchOption",
NULL AS "rightJoinConstraintOnUpdate",
NULL AS "rightJoinConstraintOnDelete",
NULL AS "rightJoinIsDeferrable",
NULL AS "rightJoinInitiallyDeferred",
NULL AS "rightConstraintCatalog",
NULL AS "rightConstraintSchema",
NULL AS "rightConstraint",
NULL AS "rightConstraintFullName",
NULL AS "rightConstraintFullCatalogName",
NULL AS "rightConstraintType",
NULL AS "rightIsDeferrable",
NULL AS "rightInitiallyDeferred",
NULL AS "rightCatalog",
NULL AS "rightSchema",
NULL AS "rightTable",
NULL AS "rightTableFullName",
NULL AS "rightTableFullCatalogName"
FROM fk_constraint l
WHERE
l."parent_schema" = ANY($1)
AND l."child_schema" = ANY($1)
)
SELECT * FROM referential_constraint
/* Debug Columns
l."parent_constraint" AS "leftConstraint",
l."parent_constraint_type" AS "leftConstraintType",
l."parent_table" AS "leftTable",
l."child_constraint" AS "leftJoinConstraint",
l."child_constraint_type" AS "leftJoinConstraintType",
l."child_table" AS "joinTable",
r."child_constraint" AS "rightJoinConstraint",
r."child_constraint_type" AS "rightJoinConstraintType",
r."parent_constraint" AS "rightConstraint",
r."parent_constraint_type" AS "rightConstraintType",
r."parent_table" AS "rightTable"
*/ | the_stack |
SET statement_timeout = 0;
SET lock_timeout = 0;
SET idle_in_transaction_session_timeout = 0;
SET client_encoding = 'UTF8';
SET standard_conforming_strings = on;
SELECT pg_catalog.set_config('search_path', '', false);
SET check_function_bodies = false;
SET xmloption = content;
SET client_min_messages = warning;
SET row_security = off;
--
-- Name: citext; Type: EXTENSION; Schema: -; Owner: -
--
CREATE EXTENSION IF NOT EXISTS citext WITH SCHEMA public;
--
-- Name: EXTENSION citext; Type: COMMENT; Schema: -; Owner: -
--
COMMENT ON EXTENSION citext IS 'data type for case-insensitive character strings';
--
-- Name: pgcrypto; Type: EXTENSION; Schema: -; Owner: -
--
CREATE EXTENSION IF NOT EXISTS pgcrypto WITH SCHEMA public;
--
-- Name: EXTENSION pgcrypto; Type: COMMENT; Schema: -; Owner: -
--
COMMENT ON EXTENSION pgcrypto IS 'cryptographic functions';
--
-- Name: item_kind; Type: TYPE; Schema: public; Owner: -
--
CREATE TYPE public.item_kind AS ENUM (
'anime',
'manga'
);
SET default_tablespace = '';
SET default_table_access_method = heap;
--
-- Name: active_storage_attachments; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.active_storage_attachments (
id bigint NOT NULL,
name character varying NOT NULL,
record_type character varying NOT NULL,
record_id uuid NOT NULL,
blob_id bigint NOT NULL,
created_at timestamp without time zone NOT NULL
);
--
-- Name: active_storage_attachments_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--
CREATE SEQUENCE public.active_storage_attachments_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
--
-- Name: active_storage_attachments_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--
ALTER SEQUENCE public.active_storage_attachments_id_seq OWNED BY public.active_storage_attachments.id;
--
-- Name: active_storage_blobs; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.active_storage_blobs (
id bigint NOT NULL,
key character varying NOT NULL,
filename character varying NOT NULL,
content_type character varying,
metadata text,
byte_size bigint NOT NULL,
checksum character varying NOT NULL,
created_at timestamp without time zone NOT NULL,
service_name character varying NOT NULL
);
--
-- Name: active_storage_blobs_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--
CREATE SEQUENCE public.active_storage_blobs_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
--
-- Name: active_storage_blobs_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--
ALTER SEQUENCE public.active_storage_blobs_id_seq OWNED BY public.active_storage_blobs.id;
--
-- Name: active_storage_variant_records; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.active_storage_variant_records (
id bigint NOT NULL,
blob_id bigint NOT NULL,
variation_digest character varying NOT NULL
);
--
-- Name: active_storage_variant_records_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--
CREATE SEQUENCE public.active_storage_variant_records_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
--
-- Name: active_storage_variant_records_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--
ALTER SEQUENCE public.active_storage_variant_records_id_seq OWNED BY public.active_storage_variant_records.id;
--
-- Name: activities; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.activities (
id uuid DEFAULT public.gen_random_uuid() NOT NULL,
user_id uuid NOT NULL,
item_id uuid NOT NULL,
date date NOT NULL,
amount integer NOT NULL,
created_at timestamp(6) without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
updated_at timestamp(6) without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL
);
--
-- Name: ar_internal_metadata; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.ar_internal_metadata (
key character varying NOT NULL,
value character varying,
created_at timestamp(6) without time zone NOT NULL,
updated_at timestamp(6) without time zone NOT NULL
);
--
-- Name: crawling_log_entries; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.crawling_log_entries (
id uuid DEFAULT public.gen_random_uuid() NOT NULL,
raw_data jsonb,
checksum character varying,
failure_message character varying,
failure boolean NOT NULL,
created_at timestamp(6) without time zone NOT NULL,
updated_at timestamp(6) without time zone NOT NULL,
user_id uuid,
visited_pages json
);
--
-- Name: entries; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.entries (
id uuid DEFAULT public.gen_random_uuid() NOT NULL,
"timestamp" timestamp without time zone NOT NULL,
amount integer NOT NULL,
user_id uuid NOT NULL,
created_at timestamp(6) without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
updated_at timestamp(6) without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
item_id uuid NOT NULL
);
--
-- Name: items; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.items (
id uuid DEFAULT public.gen_random_uuid() NOT NULL,
mal_id integer NOT NULL,
name character varying NOT NULL,
created_at timestamp(6) without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
updated_at timestamp(6) without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
kind public.item_kind NOT NULL
);
--
-- Name: schema_migrations; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.schema_migrations (
version character varying NOT NULL
);
--
-- Name: subscriptions; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.subscriptions (
id uuid DEFAULT public.gen_random_uuid() NOT NULL,
username character varying,
created_at timestamp(6) without time zone NOT NULL,
updated_at timestamp(6) without time zone NOT NULL,
processed_at timestamp without time zone
);
--
-- Name: users; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.users (
id uuid DEFAULT public.gen_random_uuid() NOT NULL,
username public.citext NOT NULL,
avatar_url character varying,
checksum character varying,
created_at timestamp(6) without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
updated_at timestamp(6) without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
location character varying,
time_zone character varying DEFAULT 'UTC'::character varying NOT NULL,
latitude double precision,
longitude double precision,
count_each_entry_as_an_activity boolean DEFAULT false NOT NULL
);
--
-- Name: active_storage_attachments id; Type: DEFAULT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.active_storage_attachments ALTER COLUMN id SET DEFAULT nextval('public.active_storage_attachments_id_seq'::regclass);
--
-- Name: active_storage_blobs id; Type: DEFAULT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.active_storage_blobs ALTER COLUMN id SET DEFAULT nextval('public.active_storage_blobs_id_seq'::regclass);
--
-- Name: active_storage_variant_records id; Type: DEFAULT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.active_storage_variant_records ALTER COLUMN id SET DEFAULT nextval('public.active_storage_variant_records_id_seq'::regclass);
--
-- Name: active_storage_attachments active_storage_attachments_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.active_storage_attachments
ADD CONSTRAINT active_storage_attachments_pkey PRIMARY KEY (id);
--
-- Name: active_storage_blobs active_storage_blobs_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.active_storage_blobs
ADD CONSTRAINT active_storage_blobs_pkey PRIMARY KEY (id);
--
-- Name: active_storage_variant_records active_storage_variant_records_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.active_storage_variant_records
ADD CONSTRAINT active_storage_variant_records_pkey PRIMARY KEY (id);
--
-- Name: activities activities_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.activities
ADD CONSTRAINT activities_pkey PRIMARY KEY (id);
--
-- Name: ar_internal_metadata ar_internal_metadata_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.ar_internal_metadata
ADD CONSTRAINT ar_internal_metadata_pkey PRIMARY KEY (key);
--
-- Name: crawling_log_entries crawling_log_entries_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.crawling_log_entries
ADD CONSTRAINT crawling_log_entries_pkey PRIMARY KEY (id);
--
-- Name: entries entries_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.entries
ADD CONSTRAINT entries_pkey PRIMARY KEY (id);
--
-- Name: items items_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.items
ADD CONSTRAINT items_pkey PRIMARY KEY (id);
--
-- Name: schema_migrations schema_migrations_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.schema_migrations
ADD CONSTRAINT schema_migrations_pkey PRIMARY KEY (version);
--
-- Name: subscriptions subscriptions_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.subscriptions
ADD CONSTRAINT subscriptions_pkey PRIMARY KEY (id);
--
-- Name: users users_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.users
ADD CONSTRAINT users_pkey PRIMARY KEY (id);
--
-- Name: index_active_storage_attachments_on_blob_id; Type: INDEX; Schema: public; Owner: -
--
CREATE INDEX index_active_storage_attachments_on_blob_id ON public.active_storage_attachments USING btree (blob_id);
--
-- Name: index_active_storage_attachments_uniqueness; Type: INDEX; Schema: public; Owner: -
--
CREATE UNIQUE INDEX index_active_storage_attachments_uniqueness ON public.active_storage_attachments USING btree (record_type, record_id, name, blob_id);
--
-- Name: index_active_storage_blobs_on_key; Type: INDEX; Schema: public; Owner: -
--
CREATE UNIQUE INDEX index_active_storage_blobs_on_key ON public.active_storage_blobs USING btree (key);
--
-- Name: index_active_storage_variant_records_uniqueness; Type: INDEX; Schema: public; Owner: -
--
CREATE UNIQUE INDEX index_active_storage_variant_records_uniqueness ON public.active_storage_variant_records USING btree (blob_id, variation_digest);
--
-- Name: index_activities_on_item_id; Type: INDEX; Schema: public; Owner: -
--
CREATE INDEX index_activities_on_item_id ON public.activities USING btree (item_id);
--
-- Name: index_activities_on_user_id; Type: INDEX; Schema: public; Owner: -
--
CREATE INDEX index_activities_on_user_id ON public.activities USING btree (user_id);
--
-- Name: index_activities_on_user_id_and_item_id_and_date; Type: INDEX; Schema: public; Owner: -
--
CREATE UNIQUE INDEX index_activities_on_user_id_and_item_id_and_date ON public.activities USING btree (user_id, item_id, date);
--
-- Name: index_crawling_log_entries_on_user_id; Type: INDEX; Schema: public; Owner: -
--
CREATE INDEX index_crawling_log_entries_on_user_id ON public.crawling_log_entries USING btree (user_id);
--
-- Name: index_entries_on_item_id; Type: INDEX; Schema: public; Owner: -
--
CREATE INDEX index_entries_on_item_id ON public.entries USING btree (item_id);
--
-- Name: index_entries_on_timestamp; Type: INDEX; Schema: public; Owner: -
--
CREATE INDEX index_entries_on_timestamp ON public.entries USING btree ("timestamp");
--
-- Name: index_entries_on_user_id; Type: INDEX; Schema: public; Owner: -
--
CREATE INDEX index_entries_on_user_id ON public.entries USING btree (user_id);
--
-- Name: index_items_on_mal_id_and_kind; Type: INDEX; Schema: public; Owner: -
--
CREATE UNIQUE INDEX index_items_on_mal_id_and_kind ON public.items USING btree (mal_id, kind);
--
-- Name: index_users_on_username; Type: INDEX; Schema: public; Owner: -
--
CREATE UNIQUE INDEX index_users_on_username ON public.users USING btree (username);
--
-- Name: crawling_log_entries fk_rails_25a097bbfa; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.crawling_log_entries
ADD CONSTRAINT fk_rails_25a097bbfa FOREIGN KEY (user_id) REFERENCES public.users(id);
--
-- Name: activities fk_rails_7e11bb717f; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.activities
ADD CONSTRAINT fk_rails_7e11bb717f FOREIGN KEY (user_id) REFERENCES public.users(id);
--
-- Name: activities fk_rails_98c29480fc; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.activities
ADD CONSTRAINT fk_rails_98c29480fc FOREIGN KEY (item_id) REFERENCES public.items(id);
--
-- Name: active_storage_variant_records fk_rails_993965df05; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.active_storage_variant_records
ADD CONSTRAINT fk_rails_993965df05 FOREIGN KEY (blob_id) REFERENCES public.active_storage_blobs(id);
--
-- Name: entries fk_rails_99dc12d4fd; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.entries
ADD CONSTRAINT fk_rails_99dc12d4fd FOREIGN KEY (user_id) REFERENCES public.users(id);
--
-- Name: active_storage_attachments fk_rails_c3b3935057; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.active_storage_attachments
ADD CONSTRAINT fk_rails_c3b3935057 FOREIGN KEY (blob_id) REFERENCES public.active_storage_blobs(id);
--
-- Name: entries fk_rails_dfa0a673ee; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.entries
ADD CONSTRAINT fk_rails_dfa0a673ee FOREIGN KEY (item_id) REFERENCES public.items(id);
--
-- PostgreSQL database dump complete
--
SET search_path TO "$user", public;
INSERT INTO "schema_migrations" (version) VALUES
('20200201115222'),
('20200201115644'),
('20200201120036'),
('20200202023458'),
('20200229234332'),
('20200301000733'),
('20200306152120'),
('20200328040329'),
('20200328041327'),
('20200328162236'),
('20200328164202'),
('20200328164518'),
('20200329040026'),
('20200329145233'),
('20200404024047'),
('20200603022918'),
('20200619144433'),
('20200920150238'),
('20201002030547'),
('20201206123608'),
('20201210195647'),
('20201210195648'),
('20210214155211'),
('20210214203654'),
('20210307134347'),
('20210526022315'),
('20210622025419'),
('20210629132446'),
('20210711204405'); | the_stack |
-- 26.02.2016 10:54
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_Process (AccessLevel,AD_Client_ID,AD_Org_ID,AD_Process_ID,AllowProcessReRun,Classname,CopyFromProcess,Created,CreatedBy,EntityType,IsActive,IsBetaFunctionality,IsDirectPrint,IsOneInstanceOnly,IsReport,IsServerProcess,JasperReport,JasperReport_Tabular,LockWaitTimeout,Name,RefreshAllAfterExecution,ShowHelp,Statistic_Count,Statistic_Seconds,Type,Updated,UpdatedBy,Value) VALUES ('3',0,0,540662,'Y','org.compiere.report.ReportStarter','N',TO_TIMESTAMP('2016-02-26 10:54:32','YYYY-MM-DD HH24:MI:SS'),100,'de.metas.fresh','Y','N','N','N','Y','N','@PREFIX@de/metas/reports/tax_accounting/report.jasper',NULL,0,'Fibukonto - Kontoblatt','N','Y',0,0,'Java',TO_TIMESTAMP('2016-02-26 10:54:32','YYYY-MM-DD HH24:MI:SS'),100,'Fibukonto - Kontoblatt (Jasper)')
;
-- 26.02.2016 10:54
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_Process_Trl (AD_Language,AD_Process_ID, Description,Help,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Process_ID, t.Description,t.Help,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Process t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Process_ID=540662 AND NOT EXISTS (SELECT * FROM AD_Process_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Process_ID=t.AD_Process_ID)
;
-- 26.02.2016 10:57
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_Process_Para (AD_Client_ID,AD_Element_ID,AD_Org_ID,AD_Process_ID,AD_Process_Para_ID,AD_Reference_ID,ColumnName,Created,CreatedBy,Description,EntityType,FieldLength,Help,IsActive,IsAutocomplete,IsCentrallyMaintained,IsEncrypted,IsMandatory,IsRange,Name,SeqNo,Updated,UpdatedBy) VALUES (0,223,0,540662,540907,19,'C_Year_ID',TO_TIMESTAMP('2016-02-26 10:57:21','YYYY-MM-DD HH24:MI:SS'),100,'Kalenderjahr','de.metas.fresh',0,'"Jahr" bezeichnet ein eindeutiges Jahr eines Kalenders.','Y','N','Y','N','N','N','Jahr',10,TO_TIMESTAMP('2016-02-26 10:57:21','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 26.02.2016 10:57
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_Process_Para_Trl (AD_Language,AD_Process_Para_ID, Description,Help,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Process_Para_ID, t.Description,t.Help,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Process_Para t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Process_Para_ID=540907 AND NOT EXISTS (SELECT * FROM AD_Process_Para_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Process_Para_ID=t.AD_Process_Para_ID)
;
-- 26.02.2016 10:58
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_Process_Para (AD_Client_ID,AD_Element_ID,AD_Org_ID,AD_Process_ID,AD_Process_Para_ID,AD_Reference_ID,AD_Val_Rule_ID,ColumnName,Created,CreatedBy,Description,EntityType,FieldLength,Help,IsActive,IsAutocomplete,IsCentrallyMaintained,IsEncrypted,IsMandatory,IsRange,Name,SeqNo,Updated,UpdatedBy) VALUES (0,206,0,540662,540908,19,199,'C_Period_ID',TO_TIMESTAMP('2016-02-26 10:58:03','YYYY-MM-DD HH24:MI:SS'),100,'Periode des Kalenders','de.metas.fresh',0,'"Periode" bezeichnet einen eklusiven Datumsbereich eines Kalenders.','Y','N','Y','N','Y','N','Periode',20,TO_TIMESTAMP('2016-02-26 10:58:03','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 26.02.2016 10:58
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_Process_Para_Trl (AD_Language,AD_Process_Para_ID, Description,Help,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Process_Para_ID, t.Description,t.Help,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Process_Para t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Process_Para_ID=540908 AND NOT EXISTS (SELECT * FROM AD_Process_Para_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Process_Para_ID=t.AD_Process_Para_ID)
;
-- 26.02.2016 11:05
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_Process_Para (AD_Client_ID,AD_Element_ID,AD_Org_ID,AD_Process_ID,AD_Process_Para_ID,AD_Reference_ID,ColumnName,Created,CreatedBy,EntityType,FieldLength,IsActive,IsAutocomplete,IsCentrallyMaintained,IsEncrypted,IsMandatory,IsRange,Name,SeqNo,Updated,UpdatedBy) VALUES (0,542958,0,540662,540909,19,'C_VAT_Code_ID',TO_TIMESTAMP('2016-02-26 11:05:38','YYYY-MM-DD HH24:MI:SS'),100,'de.metas.acct',0,'Y','N','Y','N','N','N','VAT Code',30,TO_TIMESTAMP('2016-02-26 11:05:38','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 26.02.2016 11:05
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_Process_Para_Trl (AD_Language,AD_Process_Para_ID, Description,Help,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Process_Para_ID, t.Description,t.Help,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Process_Para t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Process_Para_ID=540909 AND NOT EXISTS (SELECT * FROM AD_Process_Para_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Process_Para_ID=t.AD_Process_Para_ID)
;
-- 26.02.2016 11:05
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_Process_Para (AD_Client_ID,AD_Element_ID,AD_Org_ID,AD_Process_ID,AD_Process_Para_ID,AD_Reference_ID,ColumnName,Created,CreatedBy,Description,EntityType,FieldLength,Help,IsActive,IsAutocomplete,IsCentrallyMaintained,IsEncrypted,IsMandatory,IsRange,Name,SeqNo,Updated,UpdatedBy) VALUES (0,148,0,540662,540910,19,'Account_ID',TO_TIMESTAMP('2016-02-26 11:05:57','YYYY-MM-DD HH24:MI:SS'),100,'Verwendetes Konto','de.metas.fresh',0,'Das verwendete (Standard-) Konto','Y','N','Y','N','N','N','Konto',40,TO_TIMESTAMP('2016-02-26 11:05:57','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 26.02.2016 11:05
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_Process_Para_Trl (AD_Language,AD_Process_Para_ID, Description,Help,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Process_Para_ID, t.Description,t.Help,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Process_Para t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Process_Para_ID=540910 AND NOT EXISTS (SELECT * FROM AD_Process_Para_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Process_Para_ID=t.AD_Process_Para_ID)
;
-- 26.02.2016 11:07
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_Menu (Action,AD_Client_ID,AD_Menu_ID,AD_Org_ID,AD_Process_ID,Created,CreatedBy,EntityType,InternalName,IsActive,IsReadOnly,IsSOTrx,IsSummary,Name,Updated,UpdatedBy) VALUES ('R',0,540686,0,540662,TO_TIMESTAMP('2016-02-26 11:07:29','YYYY-MM-DD HH24:MI:SS'),100,'de.metas.fresh','Fibukonto - Kontoblatt (Jasper)','Y','N','N','N','Fibukonto - Kontoblatt',TO_TIMESTAMP('2016-02-26 11:07:29','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 26.02.2016 11:07
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_Menu_Trl (AD_Language,AD_Menu_ID, Description,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Menu_ID, t.Description,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Menu t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Menu_ID=540686 AND NOT EXISTS (SELECT * FROM AD_Menu_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Menu_ID=t.AD_Menu_ID)
;
-- 26.02.2016 11:07
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_TreeNodeMM (AD_Client_ID,AD_Org_ID, IsActive,Created,CreatedBy,Updated,UpdatedBy, AD_Tree_ID, Node_ID, Parent_ID, SeqNo) SELECT t.AD_Client_ID,0, 'Y', now(), 100, now(), 100,t.AD_Tree_ID, 540686, 0, 999 FROM AD_Tree t WHERE t.AD_Client_ID=0 AND t.IsActive='Y' AND t.IsAllNodes='Y' AND t.AD_Table_ID=116 AND NOT EXISTS (SELECT * FROM AD_TreeNodeMM e WHERE e.AD_Tree_ID=t.AD_Tree_ID AND Node_ID=540686)
;
-- 26.02.2016 11:07
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_TreeNodeMM SET Parent_ID=540613, SeqNo=0, Updated=now(), UpdatedBy=100 WHERE Node_ID=540614 AND AD_Tree_ID=10
;
-- 26.02.2016 11:07
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_TreeNodeMM SET Parent_ID=540613, SeqNo=1, Updated=now(), UpdatedBy=100 WHERE Node_ID=540616 AND AD_Tree_ID=10
;
-- 26.02.2016 11:07
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_TreeNodeMM SET Parent_ID=540613, SeqNo=2, Updated=now(), UpdatedBy=100 WHERE Node_ID=540681 AND AD_Tree_ID=10
;
-- 26.02.2016 11:07
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_TreeNodeMM SET Parent_ID=540613, SeqNo=3, Updated=now(), UpdatedBy=100 WHERE Node_ID=540617 AND AD_Tree_ID=10
;
-- 26.02.2016 11:07
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_TreeNodeMM SET Parent_ID=540613, SeqNo=4, Updated=now(), UpdatedBy=100 WHERE Node_ID=540618 AND AD_Tree_ID=10
;
-- 26.02.2016 11:07
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_TreeNodeMM SET Parent_ID=540613, SeqNo=5, Updated=now(), UpdatedBy=100 WHERE Node_ID=540619 AND AD_Tree_ID=10
;
-- 26.02.2016 11:07
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_TreeNodeMM SET Parent_ID=540613, SeqNo=6, Updated=now(), UpdatedBy=100 WHERE Node_ID=540632 AND AD_Tree_ID=10
;
-- 26.02.2016 11:07
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_TreeNodeMM SET Parent_ID=540613, SeqNo=7, Updated=now(), UpdatedBy=100 WHERE Node_ID=540635 AND AD_Tree_ID=10
;
-- 26.02.2016 11:07
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_TreeNodeMM SET Parent_ID=540613, SeqNo=8, Updated=now(), UpdatedBy=100 WHERE Node_ID=540637 AND AD_Tree_ID=10
;
-- 26.02.2016 11:07
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_TreeNodeMM SET Parent_ID=540613, SeqNo=9, Updated=now(), UpdatedBy=100 WHERE Node_ID=540638 AND AD_Tree_ID=10
;
-- 26.02.2016 11:07
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_TreeNodeMM SET Parent_ID=540613, SeqNo=10, Updated=now(), UpdatedBy=100 WHERE Node_ID=540648 AND AD_Tree_ID=10
;
-- 26.02.2016 11:07
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_TreeNodeMM SET Parent_ID=540613, SeqNo=11, Updated=now(), UpdatedBy=100 WHERE Node_ID=540674 AND AD_Tree_ID=10
;
-- 26.02.2016 11:07
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_TreeNodeMM SET Parent_ID=540613, SeqNo=12, Updated=now(), UpdatedBy=100 WHERE Node_ID=540676 AND AD_Tree_ID=10
;
-- 26.02.2016 11:07
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_TreeNodeMM SET Parent_ID=540613, SeqNo=13, Updated=now(), UpdatedBy=100 WHERE Node_ID=540679 AND AD_Tree_ID=10
;
-- 26.02.2016 11:07
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_TreeNodeMM SET Parent_ID=540613, SeqNo=14, Updated=now(), UpdatedBy=100 WHERE Node_ID=540678 AND AD_Tree_ID=10
;
-- 26.02.2016 11:07
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_TreeNodeMM SET Parent_ID=540613, SeqNo=15, Updated=now(), UpdatedBy=100 WHERE Node_ID=540684 AND AD_Tree_ID=10
;
-- 26.02.2016 11:07
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_TreeNodeMM SET Parent_ID=540613, SeqNo=16, Updated=now(), UpdatedBy=100 WHERE Node_ID=540686 AND AD_Tree_ID=10
;
-- 29.02.2016 12:14
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_Process_Para (AD_Client_ID,AD_Element_ID,AD_Org_ID,AD_Process_ID,AD_Process_Para_ID,AD_Reference_ID,ColumnName,Created,CreatedBy,Description,EntityType,FieldLength,Help,IsActive,IsAutocomplete,IsCentrallyMaintained,IsEncrypted,IsMandatory,IsRange,Name,SeqNo,Updated,UpdatedBy) VALUES (0,113,0,540662,540911,19,'AD_Org_ID',TO_TIMESTAMP('2016-02-29 12:14:26','YYYY-MM-DD HH24:MI:SS'),100,'Organisatorische Einheit des Mandanten','de.metas.fresh',0,'Eine Organisation ist ein Bereich ihres Mandanten - z.B. Laden oder Abteilung. Sie können Daten über Organisationen hinweg gemeinsam verwenden.','Y','N','Y','N','N','N','Sektion',25,TO_TIMESTAMP('2016-02-29 12:14:26','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 29.02.2016 12:14
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_Process_Para_Trl (AD_Language,AD_Process_Para_ID, Description,Help,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Process_Para_ID, t.Description,t.Help,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Process_Para t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Process_Para_ID=540911 AND NOT EXISTS (SELECT * FROM AD_Process_Para_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Process_Para_ID=t.AD_Process_Para_ID)
;
-- 29.02.2016 12:15
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_Element (AD_Client_ID,AD_Element_ID,AD_Org_ID,ColumnName,Created,CreatedBy,EntityType,IsActive,Name,PrintName,Updated,UpdatedBy) VALUES (0,543019,0,'showdetails',TO_TIMESTAMP('2016-02-29 12:15:45','YYYY-MM-DD HH24:MI:SS'),100,'D','Y','Show Details','Show Details',TO_TIMESTAMP('2016-02-29 12:15:45','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 29.02.2016 12:15
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_Element_Trl (AD_Language,AD_Element_ID, Description,Help,Name,PO_Description,PO_Help,PO_Name,PO_PrintName,PrintName, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Element_ID, t.Description,t.Help,t.Name,t.PO_Description,t.PO_Help,t.PO_Name,t.PO_PrintName,t.PrintName, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Element t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Element_ID=543019 AND NOT EXISTS (SELECT * FROM AD_Element_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Element_ID=t.AD_Element_ID)
;
-- 29.02.2016 12:16
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_Process_Para (AD_Client_ID,AD_Element_ID,AD_Org_ID,AD_Process_ID,AD_Process_Para_ID,AD_Reference_ID,ColumnName,Created,CreatedBy,EntityType,FieldLength,IsActive,IsAutocomplete,IsCentrallyMaintained,IsEncrypted,IsMandatory,IsRange,Name,SeqNo,Updated,UpdatedBy) VALUES (0,543019,0,540662,540912,20,'showdetails',TO_TIMESTAMP('2016-02-29 12:16:19','YYYY-MM-DD HH24:MI:SS'),100,'de.metas.fresh',0,'Y','N','Y','N','Y','N','Show Details',50,TO_TIMESTAMP('2016-02-29 12:16:19','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 29.02.2016 12:16
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_Process_Para_Trl (AD_Language,AD_Process_Para_ID, Description,Help,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Process_Para_ID, t.Description,t.Help,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Process_Para t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Process_Para_ID=540912 AND NOT EXISTS (SELECT * FROM AD_Process_Para_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Process_Para_ID=t.AD_Process_Para_ID)
;
-- 29.02.2016 15:39
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Process_Para SET DefaultValue='-1',Updated=TO_TIMESTAMP('2016-02-29 15:39:02','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_Para_ID=540911
;
-- 29.02.2016 15:39
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Process_Para SET DefaultValue='Y',Updated=TO_TIMESTAMP('2016-02-29 15:39:14','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_Para_ID=540912
; | the_stack |
-- 2020-02-07T08:15:34.298Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_Element (AD_Client_ID,AD_Element_ID,AD_Org_ID,Created,CreatedBy,EntityType,IsActive,Name,PrintName,Updated,UpdatedBy) VALUES (0,577510,0,TO_TIMESTAMP('2020-02-07 10:15:33','YYYY-MM-DD HH24:MI:SS'),100,'D','Y','Customer Item Statistics','Customer Item Statistics',TO_TIMESTAMP('2020-02-07 10:15:33','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 2020-02-07T08:15:34.310Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_Element_Trl (AD_Language,AD_Element_ID, CommitWarning,Description,Help,Name,PO_Description,PO_Help,PO_Name,PO_PrintName,PrintName,WEBUI_NameBrowse,WEBUI_NameNew,WEBUI_NameNewBreadcrumb, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language, t.AD_Element_ID, t.CommitWarning,t.Description,t.Help,t.Name,t.PO_Description,t.PO_Help,t.PO_Name,t.PO_PrintName,t.PrintName,t.WEBUI_NameBrowse,t.WEBUI_NameNew,t.WEBUI_NameNewBreadcrumb, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Element t WHERE l.IsActive='Y'AND (l.IsSystemLanguage='Y' OR l.IsBaseLanguage='Y') AND t.AD_Element_ID=577510 AND NOT EXISTS (SELECT 1 FROM AD_Element_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Element_ID=t.AD_Element_ID)
;
-- 2020-02-07T08:18:09.041Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Element_Trl SET Name='Debitor Verkaufstatistik', PrintName='Debitor Verkaufstatistik',Updated=TO_TIMESTAMP('2020-02-07 10:18:09','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=577510 AND AD_Language='de_CH'
;
-- 2020-02-07T08:18:09.125Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
/* DDL */ select update_TRL_Tables_On_AD_Element_TRL_Update(577510,'de_CH')
;
-- 2020-02-07T08:18:13.243Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Element_Trl SET Name='Debitor Verkaufstatistik', PrintName='Debitor Verkaufstatistik',Updated=TO_TIMESTAMP('2020-02-07 10:18:13','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=577510 AND AD_Language='de_DE'
;
-- 2020-02-07T08:18:13.244Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
/* DDL */ select update_TRL_Tables_On_AD_Element_TRL_Update(577510,'de_DE')
;
-- 2020-02-07T08:18:13.253Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
/* DDL */ select update_ad_element_on_ad_element_trl_update(577510,'de_DE')
;
-- 2020-02-07T08:18:13.257Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Column SET ColumnName=NULL, Name='Debitor Verkaufstatistik', Description=NULL, Help=NULL WHERE AD_Element_ID=577510
;
-- 2020-02-07T08:18:13.258Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Process_Para SET ColumnName=NULL, Name='Debitor Verkaufstatistik', Description=NULL, Help=NULL WHERE AD_Element_ID=577510 AND IsCentrallyMaintained='Y'
;
-- 2020-02-07T08:18:13.260Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Field SET Name='Debitor Verkaufstatistik', Description=NULL, Help=NULL WHERE (AD_Column_ID IN (SELECT AD_Column_ID FROM AD_Column WHERE AD_Element_ID=577510) AND AD_Name_ID IS NULL ) OR (AD_Name_ID = 577510)
;
-- 2020-02-07T08:18:13.286Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_PrintFormatItem pi SET PrintName='Debitor Verkaufstatistik', Name='Debitor Verkaufstatistik' WHERE IsCentrallyMaintained='Y' AND EXISTS (SELECT * FROM AD_Column c WHERE c.AD_Column_ID=pi.AD_Column_ID AND c.AD_Element_ID=577510)
;
-- 2020-02-07T08:18:13.289Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Tab SET Name='Debitor Verkaufstatistik', Description=NULL, Help=NULL, CommitWarning = NULL WHERE AD_Element_ID = 577510
;
-- 2020-02-07T08:18:13.291Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_WINDOW SET Name='Debitor Verkaufstatistik', Description=NULL, Help=NULL WHERE AD_Element_ID = 577510
;
-- 2020-02-07T08:18:13.293Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Menu SET Name = 'Debitor Verkaufstatistik', Description = NULL, WEBUI_NameBrowse = NULL, WEBUI_NameNew = NULL, WEBUI_NameNewBreadcrumb = NULL WHERE AD_Element_ID = 577510
;
-- 2020-02-07T08:18:16.111Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Element_Trl SET IsTranslated='Y',Updated=TO_TIMESTAMP('2020-02-07 10:18:16','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=577510 AND AD_Language='de_CH'
;
-- 2020-02-07T08:18:16.112Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
/* DDL */ select update_TRL_Tables_On_AD_Element_TRL_Update(577510,'de_CH')
;
-- 2020-02-07T08:18:17.885Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Element_Trl SET IsTranslated='Y',Updated=TO_TIMESTAMP('2020-02-07 10:18:17','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=577510 AND AD_Language='de_DE'
;
-- 2020-02-07T08:18:17.887Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
/* DDL */ select update_TRL_Tables_On_AD_Element_TRL_Update(577510,'de_DE')
;
-- 2020-02-07T08:18:17.903Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
/* DDL */ select update_ad_element_on_ad_element_trl_update(577510,'de_DE')
;
-- 2020-02-07T08:18:24.375Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Element_Trl SET IsTranslated='Y',Updated=TO_TIMESTAMP('2020-02-07 10:18:24','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=577510 AND AD_Language='en_US'
;
-- 2020-02-07T08:18:24.376Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
/* DDL */ select update_TRL_Tables_On_AD_Element_TRL_Update(577510,'en_US')
;
-- 2020-02-07T08:25:11.838Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_Process (AccessLevel,AD_Client_ID,AD_Org_ID,AD_Process_ID,AllowProcessReRun,Classname,CopyFromProcess,Created,CreatedBy,EntityType,IsActive,IsApplySecuritySettings,IsBetaFunctionality,IsDirectPrint,IsOneInstanceOnly,IsReport,IsServerProcess,IsTranslateExcelHeaders,IsUseBPartnerLanguage,LockWaitTimeout,Name,RefreshAllAfterExecution,ShowHelp,Type,Updated,UpdatedBy,Value) VALUES ('3',0,0,584649,'Y','de.metas.impexp.excel.process.ExportToExcelProcess','N',TO_TIMESTAMP('2020-02-07 10:25:11','YYYY-MM-DD HH24:MI:SS'),100,'D','Y','N','N','N','N','N','N','Y','Y',0,'Customer Item Statistics','N','N','Excel',TO_TIMESTAMP('2020-02-07 10:25:11','YYYY-MM-DD HH24:MI:SS'),100,'customerItemStatistics')
;
-- 2020-02-07T08:25:11.842Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_Process_Trl (AD_Language,AD_Process_ID, Description,Help,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language, t.AD_Process_ID, t.Description,t.Help,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Process t WHERE l.IsActive='Y'AND (l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N') AND t.AD_Process_ID=584649 AND NOT EXISTS (SELECT 1 FROM AD_Process_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Process_ID=t.AD_Process_ID)
;
-- 2020-02-07T08:26:14.441Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Process SET SQLStatement='select * from customerItemStatistics()',Updated=TO_TIMESTAMP('2020-02-07 10:26:14','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_ID=584649
;
-- 2020-02-07T08:27:01.280Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Element_Trl SET Name='Debitor Artikel Statistik', PrintName='Debitor Artikel Statistik',Updated=TO_TIMESTAMP('2020-02-07 10:27:01','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=577510 AND AD_Language='de_CH'
;
-- 2020-02-07T08:27:01.282Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
/* DDL */ select update_TRL_Tables_On_AD_Element_TRL_Update(577510,'de_CH')
;
-- 2020-02-07T08:27:05.007Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Element_Trl SET Name='Debitor Artikel Statistik', PrintName='Debitor Artikel Statistik',Updated=TO_TIMESTAMP('2020-02-07 10:27:05','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=577510 AND AD_Language='de_DE'
;
-- 2020-02-07T08:27:05.008Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
/* DDL */ select update_TRL_Tables_On_AD_Element_TRL_Update(577510,'de_DE')
;
-- 2020-02-07T08:27:05.017Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
/* DDL */ select update_ad_element_on_ad_element_trl_update(577510,'de_DE')
;
-- 2020-02-07T08:27:05.019Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Column SET ColumnName=NULL, Name='Debitor Artikel Statistik', Description=NULL, Help=NULL WHERE AD_Element_ID=577510
;
-- 2020-02-07T08:27:05.020Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Process_Para SET ColumnName=NULL, Name='Debitor Artikel Statistik', Description=NULL, Help=NULL WHERE AD_Element_ID=577510 AND IsCentrallyMaintained='Y'
;
-- 2020-02-07T08:27:05.021Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Field SET Name='Debitor Artikel Statistik', Description=NULL, Help=NULL WHERE (AD_Column_ID IN (SELECT AD_Column_ID FROM AD_Column WHERE AD_Element_ID=577510) AND AD_Name_ID IS NULL ) OR (AD_Name_ID = 577510)
;
-- 2020-02-07T08:27:05.033Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_PrintFormatItem pi SET PrintName='Debitor Artikel Statistik', Name='Debitor Artikel Statistik' WHERE IsCentrallyMaintained='Y' AND EXISTS (SELECT * FROM AD_Column c WHERE c.AD_Column_ID=pi.AD_Column_ID AND c.AD_Element_ID=577510)
;
-- 2020-02-07T08:27:05.034Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Tab SET Name='Debitor Artikel Statistik', Description=NULL, Help=NULL, CommitWarning = NULL WHERE AD_Element_ID = 577510
;
-- 2020-02-07T08:27:05.035Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_WINDOW SET Name='Debitor Artikel Statistik', Description=NULL, Help=NULL WHERE AD_Element_ID = 577510
;
-- 2020-02-07T08:27:05.037Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Menu SET Name = 'Debitor Artikel Statistik', Description = NULL, WEBUI_NameBrowse = NULL, WEBUI_NameNew = NULL, WEBUI_NameNewBreadcrumb = NULL WHERE AD_Element_ID = 577510
;
-- 2020-02-07T08:27:51.874Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_Menu (Action,AD_Client_ID,AD_Element_ID,AD_Menu_ID,AD_Org_ID,AD_Process_ID,Created,CreatedBy,EntityType,InternalName,IsActive,IsCreateNew,IsReadOnly,IsSOTrx,IsSummary,Name,Updated,UpdatedBy) VALUES ('P',0,577510,541427,0,584649,TO_TIMESTAMP('2020-02-07 10:27:51','YYYY-MM-DD HH24:MI:SS'),100,'D','customerItemStatistics','Y','N','N','N','N','Debitor Artikel Statistik',TO_TIMESTAMP('2020-02-07 10:27:51','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 2020-02-07T08:27:51.881Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_Menu_Trl (AD_Language,AD_Menu_ID, Description,Name,WEBUI_NameBrowse,WEBUI_NameNew,WEBUI_NameNewBreadcrumb, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language, t.AD_Menu_ID, t.Description,t.Name,t.WEBUI_NameBrowse,t.WEBUI_NameNew,t.WEBUI_NameNewBreadcrumb, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Menu t WHERE l.IsActive='Y'AND (l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N') AND t.AD_Menu_ID=541427 AND NOT EXISTS (SELECT 1 FROM AD_Menu_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Menu_ID=t.AD_Menu_ID)
;
-- 2020-02-07T08:27:51.884Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_TreeNodeMM (AD_Client_ID,AD_Org_ID, IsActive,Created,CreatedBy,Updated,UpdatedBy, AD_Tree_ID, Node_ID, Parent_ID, SeqNo) SELECT t.AD_Client_ID,0, 'Y', now(), 100, now(), 100,t.AD_Tree_ID, 541427, 0, 999 FROM AD_Tree t WHERE t.AD_Client_ID=0 AND t.IsActive='Y' AND t.IsAllNodes='Y' AND t.AD_Table_ID=116 AND NOT EXISTS (SELECT * FROM AD_TreeNodeMM e WHERE e.AD_Tree_ID=t.AD_Tree_ID AND Node_ID=541427)
;
-- 2020-02-07T08:27:51.902Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
/* DDL */ select update_menu_translation_from_ad_element(577510)
;
-- 2020-02-07T08:27:52.495Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_TreeNodeMM SET Parent_ID=1000010, SeqNo=0, Updated=now(), UpdatedBy=100 WHERE Node_ID=541221 AND AD_Tree_ID=10
;
-- 2020-02-07T08:27:52.497Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_TreeNodeMM SET Parent_ID=1000010, SeqNo=1, Updated=now(), UpdatedBy=100 WHERE Node_ID=1000040 AND AD_Tree_ID=10
;
-- 2020-02-07T08:27:52.499Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_TreeNodeMM SET Parent_ID=1000010, SeqNo=2, Updated=now(), UpdatedBy=100 WHERE Node_ID=1000097 AND AD_Tree_ID=10
;
-- 2020-02-07T08:27:52.500Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_TreeNodeMM SET Parent_ID=1000010, SeqNo=3, Updated=now(), UpdatedBy=100 WHERE Node_ID=540855 AND AD_Tree_ID=10
;
-- 2020-02-07T08:27:52.501Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_TreeNodeMM SET Parent_ID=1000010, SeqNo=4, Updated=now(), UpdatedBy=100 WHERE Node_ID=540867 AND AD_Tree_ID=10
;
-- 2020-02-07T08:27:52.502Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_TreeNodeMM SET Parent_ID=1000010, SeqNo=5, Updated=now(), UpdatedBy=100 WHERE Node_ID=541038 AND AD_Tree_ID=10
;
-- 2020-02-07T08:27:52.503Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_TreeNodeMM SET Parent_ID=1000010, SeqNo=6, Updated=now(), UpdatedBy=100 WHERE Node_ID=1000046 AND AD_Tree_ID=10
;
-- 2020-02-07T08:27:52.504Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_TreeNodeMM SET Parent_ID=1000010, SeqNo=7, Updated=now(), UpdatedBy=100 WHERE Node_ID=1000048 AND AD_Tree_ID=10
;
-- 2020-02-07T08:27:52.505Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_TreeNodeMM SET Parent_ID=1000010, SeqNo=8, Updated=now(), UpdatedBy=100 WHERE Node_ID=1000050 AND AD_Tree_ID=10
;
-- 2020-02-07T08:27:52.506Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_TreeNodeMM SET Parent_ID=1000010, SeqNo=9, Updated=now(), UpdatedBy=100 WHERE Node_ID=541226 AND AD_Tree_ID=10
;
-- 2020-02-07T08:27:52.507Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_TreeNodeMM SET Parent_ID=1000010, SeqNo=10, Updated=now(), UpdatedBy=100 WHERE Node_ID=541369 AND AD_Tree_ID=10
;
-- 2020-02-07T08:27:52.508Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_TreeNodeMM SET Parent_ID=1000010, SeqNo=11, Updated=now(), UpdatedBy=100 WHERE Node_ID=541427 AND AD_Tree_ID=10
;
-- 2020-02-07T09:13:57.788Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Process_Trl SET IsTranslated='Y', Name='Debitor Artikel Statistik',Updated=TO_TIMESTAMP('2020-02-07 11:13:57','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Language='de_CH' AND AD_Process_ID=584649
;
-- 2020-02-07T09:14:02.410Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Process_Trl SET IsTranslated='Y',Updated=TO_TIMESTAMP('2020-02-07 11:14:02','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Language='en_US' AND AD_Process_ID=584649
;
-- 2020-02-07T09:14:12.298Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Process SET Name='Debitor Artikel Statistik',Updated=TO_TIMESTAMP('2020-02-07 11:14:12','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_ID=584649
;
-- 2020-02-07T09:14:54.722Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_Process_Para (AD_Client_ID,AD_Element_ID,AD_Org_ID,AD_Process_ID,AD_Process_Para_ID,AD_Reference_ID,ColumnName,Created,CreatedBy,Description,EntityType,FieldLength,Help,IsActive,IsAutocomplete,IsCentrallyMaintained,IsEncrypted,IsMandatory,IsRange,Name,SeqNo,Updated,UpdatedBy) VALUES (0,1581,0,584649,541699,15,'DateFrom',TO_TIMESTAMP('2020-02-07 11:14:54','YYYY-MM-DD HH24:MI:SS'),100,'Startdatum eines Abschnittes','D',0,'Datum von bezeichnet das Startdatum eines Abschnittes','Y','N','Y','N','N','N','Datum von',10,TO_TIMESTAMP('2020-02-07 11:14:54','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 2020-02-07T09:14:54.726Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_Process_Para_Trl (AD_Language,AD_Process_Para_ID, Description,Help,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language, t.AD_Process_Para_ID, t.Description,t.Help,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Process_Para t WHERE l.IsActive='Y'AND (l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N') AND t.AD_Process_Para_ID=541699 AND NOT EXISTS (SELECT 1 FROM AD_Process_Para_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Process_Para_ID=t.AD_Process_Para_ID)
;
-- 2020-02-07T09:15:10.823Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_Process_Para (AD_Client_ID,AD_Element_ID,AD_Org_ID,AD_Process_ID,AD_Process_Para_ID,AD_Reference_ID,ColumnName,Created,CreatedBy,Description,EntityType,FieldLength,Help,IsActive,IsAutocomplete,IsCentrallyMaintained,IsEncrypted,IsMandatory,IsRange,Name,SeqNo,Updated,UpdatedBy) VALUES (0,1582,0,584649,541700,15,'DateTo',TO_TIMESTAMP('2020-02-07 11:15:10','YYYY-MM-DD HH24:MI:SS'),100,'Enddatum eines Abschnittes','D',0,'Datum bis bezeichnet das Enddatum eines Abschnittes (inklusiv)','Y','N','Y','N','N','N','Datum bis',20,TO_TIMESTAMP('2020-02-07 11:15:10','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 2020-02-07T09:15:10.825Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_Process_Para_Trl (AD_Language,AD_Process_Para_ID, Description,Help,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language, t.AD_Process_Para_ID, t.Description,t.Help,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Process_Para t WHERE l.IsActive='Y'AND (l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N') AND t.AD_Process_Para_ID=541700 AND NOT EXISTS (SELECT 1 FROM AD_Process_Para_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Process_Para_ID=t.AD_Process_Para_ID)
;
-- 2020-02-07T09:15:40.403Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_Process_Para (AD_Client_ID,AD_Element_ID,AD_Org_ID,AD_Process_ID,AD_Process_Para_ID,AD_Reference_ID,ColumnName,Created,CreatedBy,Description,EntityType,FieldLength,Help,IsActive,IsAutocomplete,IsCentrallyMaintained,IsEncrypted,IsMandatory,IsRange,Name,SeqNo,Updated,UpdatedBy) VALUES (0,187,0,584649,541701,30,'C_BPartner_ID',TO_TIMESTAMP('2020-02-07 11:15:40','YYYY-MM-DD HH24:MI:SS'),100,'Bezeichnet einen Geschäftspartner','D',0,'Ein Geschäftspartner ist jemand, mit dem Sie interagieren. Dies kann Lieferanten, Kunden, Mitarbeiter oder Handelsvertreter umfassen.','Y','N','Y','N','N','N','Geschäftspartner',30,TO_TIMESTAMP('2020-02-07 11:15:40','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 2020-02-07T09:15:40.404Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_Process_Para_Trl (AD_Language,AD_Process_Para_ID, Description,Help,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language, t.AD_Process_Para_ID, t.Description,t.Help,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Process_Para t WHERE l.IsActive='Y'AND (l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N') AND t.AD_Process_Para_ID=541701 AND NOT EXISTS (SELECT 1 FROM AD_Process_Para_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Process_Para_ID=t.AD_Process_Para_ID)
;
-- 2020-02-07T09:15:57.632Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_Process_Para (AD_Client_ID,AD_Element_ID,AD_Org_ID,AD_Process_ID,AD_Process_Para_ID,AD_Reference_ID,ColumnName,Created,CreatedBy,Description,EntityType,FieldLength,Help,IsActive,IsAutocomplete,IsCentrallyMaintained,IsEncrypted,IsMandatory,IsRange,Name,SeqNo,Updated,UpdatedBy) VALUES (0,454,0,584649,541702,30,'M_Product_ID',TO_TIMESTAMP('2020-02-07 11:15:57','YYYY-MM-DD HH24:MI:SS'),100,'Produkt, Leistung, Artikel','D',0,'Bezeichnet eine Einheit, die in dieser Organisation gekauft oder verkauft wird.','Y','N','Y','N','N','N','Produkt',40,TO_TIMESTAMP('2020-02-07 11:15:57','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 2020-02-07T09:15:57.634Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_Process_Para_Trl (AD_Language,AD_Process_Para_ID, Description,Help,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language, t.AD_Process_Para_ID, t.Description,t.Help,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Process_Para t WHERE l.IsActive='Y'AND (l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N') AND t.AD_Process_Para_ID=541702 AND NOT EXISTS (SELECT 1 FROM AD_Process_Para_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Process_Para_ID=t.AD_Process_Para_ID)
;
-- 2020-02-07T09:16:57.699Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Process SET SQLStatement='select * from customerItemStatistics(''@DateFrom@'', ''@DateTo@, @C_BPartner_ID@, @M_Product_ID@)',Updated=TO_TIMESTAMP('2020-02-07 11:16:57','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_ID=584649
;
-- 2020-02-07T09:44:26.898Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Process SET SQLStatement='select * from customerItemStatistics(''@DateFrom/null@'', ''@DateTo/null@, @C_BPartner_ID/null@, @M_Product_ID/null@)',Updated=TO_TIMESTAMP('2020-02-07 11:44:26','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_ID=584649
;
-- 2020-02-07T09:45:59.040Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Process SET SQLStatement='select * from customerItemStatistics(''@DateFrom/null@'', ''@DateTo/null@'', @C_BPartner_ID/null@, @M_Product_ID/null@)',Updated=TO_TIMESTAMP('2020-02-07 11:45:59','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_ID=584649
;
-- 2020-02-07T09:46:59.960Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Process SET SQLStatement='select * from customerItemStatistics(coalesce(''@DateFrom@'', null) , coalesce(''@DateTo@'', null), @C_BPartner_ID/null@, @M_Product_ID/null@)',Updated=TO_TIMESTAMP('2020-02-07 11:46:59','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_ID=584649
;
-- 2020-02-07T09:49:00.618Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Process SET SQLStatement='select * from customerItemStatistics(''@DateFrom@''::date , ''@DateTo@''::date , @C_BPartner_ID/null@, @M_Product_ID/null@)',Updated=TO_TIMESTAMP('2020-02-07 11:49:00','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_ID=584649
;
-- 2020-02-07T09:49:38.217Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Process_Para SET DefaultValue='null',Updated=TO_TIMESTAMP('2020-02-07 11:49:38','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_Para_ID=541699
;
-- 2020-02-07T09:49:43.401Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Process_Para SET DefaultValue='null',Updated=TO_TIMESTAMP('2020-02-07 11:49:43','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_Para_ID=541700
;
-- 2020-02-07T12:58:42.076Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Process SET Value='CustomerItemStatistics',Updated=TO_TIMESTAMP('2020-02-07 14:58:42','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_ID=584649
;
-- 2020-02-07T12:59:00.505Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Process SET SQLStatement='select * from customerItemStatistics(''@DateFrom@''::date , ''@DateTo@''::date , @C_BPartner_ID/-1@, @M_Product_ID/-1@)',Updated=TO_TIMESTAMP('2020-02-07 14:59:00','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_ID=584649
;
-- 2020-02-07T13:04:57.854Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Process_Para SET DefaultValue='''2999-12-31''',Updated=TO_TIMESTAMP('2020-02-07 15:04:57','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_Para_ID=541699
;
-- 2020-02-07T13:05:03.127Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Process_Para SET DefaultValue='''2999-12-31''',Updated=TO_TIMESTAMP('2020-02-07 15:05:03','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_Para_ID=541700
;
-- 2020-02-07T13:05:15.743Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Process_Para SET DefaultValue='''1900-12-31''',Updated=TO_TIMESTAMP('2020-02-07 15:05:15','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_Para_ID=541699
;
-- 2020-02-07T13:06:34.348Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Process_Para SET DefaultValue='',Updated=TO_TIMESTAMP('2020-02-07 15:06:34','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_Para_ID=541699
;
-- 2020-02-07T13:07:25.284Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Process SET SQLStatement='select * from customerItemStatistics(''@DateFrom/1900-01-01@''::date , ''@DateTo/9999-12-31@''::date , @C_BPartner_ID/-1@, @M_Product_ID/-1@)',Updated=TO_TIMESTAMP('2020-02-07 15:07:25','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_ID=584649
;
-- 2020-02-07T13:08:03.845Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Process_Para SET DefaultValue='',Updated=TO_TIMESTAMP('2020-02-07 15:08:03','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_Para_ID=541700
;
-- 2020-02-11T14:05:33.430Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_Process_Para (AD_Client_ID,AD_Element_ID,AD_Org_ID,AD_Process_ID,AD_Process_Para_ID,AD_Reference_ID,ColumnName,Created,CreatedBy,DefaultValue,Description,EntityType,FieldLength,Help,IsActive,IsAutocomplete,IsCentrallyMaintained,IsEncrypted,IsMandatory,IsRange,Name,SeqNo,Updated,UpdatedBy) VALUES (0,102,0,584649,541710,19,'AD_Client_ID',TO_TIMESTAMP('2020-02-11 16:05:33','YYYY-MM-DD HH24:MI:SS'),100,'@#AD_Client_ID@','Mandant für diese Installation.','D',0,'Ein Mandant ist eine Firma oder eine juristische Person. Sie können keine Daten über Mandanten hinweg verwenden. .','Y','N','Y','N','Y','N','Mandant',50,TO_TIMESTAMP('2020-02-11 16:05:33','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 2020-02-11T14:05:33.439Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_Process_Para_Trl (AD_Language,AD_Process_Para_ID, Description,Help,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language, t.AD_Process_Para_ID, t.Description,t.Help,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Process_Para t WHERE l.IsActive='Y'AND (l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N') AND t.AD_Process_Para_ID=541710 AND NOT EXISTS (SELECT 1 FROM AD_Process_Para_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Process_Para_ID=t.AD_Process_Para_ID)
;
-- 2020-02-11T14:05:54.902Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_Process_Para (AD_Client_ID,AD_Element_ID,AD_Org_ID,AD_Process_ID,AD_Process_Para_ID,AD_Reference_ID,ColumnName,Created,CreatedBy,DefaultValue,Description,EntityType,FieldLength,Help,IsActive,IsAutocomplete,IsCentrallyMaintained,IsEncrypted,IsMandatory,IsRange,Name,SeqNo,Updated,UpdatedBy) VALUES (0,113,0,584649,541711,19,'AD_Org_ID',TO_TIMESTAMP('2020-02-11 16:05:54','YYYY-MM-DD HH24:MI:SS'),100,'@#AD_Org_ID@','Organisatorische Einheit des Mandanten','D',0,'Eine Organisation ist ein Bereich ihres Mandanten - z.B. Laden oder Abteilung. Sie können Daten über Organisationen hinweg gemeinsam verwenden.','Y','N','Y','N','Y','N','Sektion',60,TO_TIMESTAMP('2020-02-11 16:05:54','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 2020-02-11T14:05:54.904Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_Process_Para_Trl (AD_Language,AD_Process_Para_ID, Description,Help,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language, t.AD_Process_Para_ID, t.Description,t.Help,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Process_Para t WHERE l.IsActive='Y'AND (l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N') AND t.AD_Process_Para_ID=541711 AND NOT EXISTS (SELECT 1 FROM AD_Process_Para_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Process_Para_ID=t.AD_Process_Para_ID)
;
-- 2020-02-11T14:06:06.313Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Process_Para SET IsActive='Y', SeqNo=10,Updated=TO_TIMESTAMP('2020-02-11 16:06:06','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_Para_ID=541710
;
-- 2020-02-11T14:06:06.317Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Process_Para SET IsActive='Y', SeqNo=20,Updated=TO_TIMESTAMP('2020-02-11 16:06:06','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_Para_ID=541711
;
-- 2020-02-11T14:06:06.321Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Process_Para SET IsActive='Y', SeqNo=30,Updated=TO_TIMESTAMP('2020-02-11 16:06:06','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_Para_ID=541699
;
-- 2020-02-11T14:06:06.326Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Process_Para SET IsActive='Y', SeqNo=40,Updated=TO_TIMESTAMP('2020-02-11 16:06:06','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_Para_ID=541700
;
-- 2020-02-11T14:06:06.331Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Process_Para SET IsActive='Y', SeqNo=50,Updated=TO_TIMESTAMP('2020-02-11 16:06:06','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_Para_ID=541701
;
-- 2020-02-11T14:06:06.335Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Process_Para SET IsActive='Y', SeqNo=60,Updated=TO_TIMESTAMP('2020-02-11 16:06:06','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_Para_ID=541702
;
-- 2020-02-11T14:06:35.896Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Process SET SQLStatement='select * from customerItemStatistics(@AD_Client_ID, @AD_Org_ID@, ''@DateFrom/1900-01-01@''::date , ''@DateTo/9999-12-31@''::date , @C_BPartner_ID/-1@, @M_Product_ID/-1@)',Updated=TO_TIMESTAMP('2020-02-11 16:06:35','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_ID=584649
;
-- 2020-02-11T14:08:07.662Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Process SET SQLStatement='select * from customerItemStatistics(@AD_Client_ID@, @AD_Org_ID@, ''@DateFrom/1900-01-01@''::date , ''@DateTo/9999-12-31@''::date , @C_BPartner_ID/-1@, @M_Product_ID/-1@)',Updated=TO_TIMESTAMP('2020-02-11 16:08:07','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_ID=584649
;
-- 2020-02-11T14:43:26.282Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_Element (AD_Client_ID,AD_Element_ID,AD_Org_ID,ColumnName,Created,CreatedBy,EntityType,IsActive,Name,PrintName,Updated,UpdatedBy) VALUES (0,577530,0,'SumProductCosts',TO_TIMESTAMP('2020-02-11 16:43:26','YYYY-MM-DD HH24:MI:SS'),100,'D','Y','DB','DB',TO_TIMESTAMP('2020-02-11 16:43:26','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 2020-02-11T14:43:26.286Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_Element_Trl (AD_Language,AD_Element_ID, CommitWarning,Description,Help,Name,PO_Description,PO_Help,PO_Name,PO_PrintName,PrintName,WEBUI_NameBrowse,WEBUI_NameNew,WEBUI_NameNewBreadcrumb, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language, t.AD_Element_ID, t.CommitWarning,t.Description,t.Help,t.Name,t.PO_Description,t.PO_Help,t.PO_Name,t.PO_PrintName,t.PrintName,t.WEBUI_NameBrowse,t.WEBUI_NameNew,t.WEBUI_NameNewBreadcrumb, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Element t WHERE l.IsActive='Y'AND (l.IsSystemLanguage='Y' OR l.IsBaseLanguage='Y') AND t.AD_Element_ID=577530 AND NOT EXISTS (SELECT 1 FROM AD_Element_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Element_ID=t.AD_Element_ID)
;
-- 2020-02-11T14:44:02.527Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Element SET ColumnName='ProductCosts',Updated=TO_TIMESTAMP('2020-02-11 16:44:02','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=577530
;
-- 2020-02-11T14:44:02.534Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Column SET ColumnName='ProductCosts', Name='DB', Description=NULL, Help=NULL WHERE AD_Element_ID=577530
;
-- 2020-02-11T14:44:02.534Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Process_Para SET ColumnName='ProductCosts', Name='DB', Description=NULL, Help=NULL, AD_Element_ID=577530 WHERE UPPER(ColumnName)='PRODUCTCOSTS' AND IsCentrallyMaintained='Y' AND AD_Element_ID IS NULL
;
-- 2020-02-11T14:44:02.537Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Process_Para SET ColumnName='ProductCosts', Name='DB', Description=NULL, Help=NULL WHERE AD_Element_ID=577530 AND IsCentrallyMaintained='Y'
;
-- 2020-02-11T14:45:25.021Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_Element (AD_Client_ID,AD_Element_ID,AD_Org_ID,ColumnName,Created,CreatedBy,EntityType,IsActive,Name,PrintName,Updated,UpdatedBy) VALUES (0,577531,0,'ProductCostsPercent',TO_TIMESTAMP('2020-02-11 16:45:24','YYYY-MM-DD HH24:MI:SS'),100,'D','Y','DB %','DB %',TO_TIMESTAMP('2020-02-11 16:45:24','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 2020-02-11T14:45:25.023Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_Element_Trl (AD_Language,AD_Element_ID, CommitWarning,Description,Help,Name,PO_Description,PO_Help,PO_Name,PO_PrintName,PrintName,WEBUI_NameBrowse,WEBUI_NameNew,WEBUI_NameNewBreadcrumb, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language, t.AD_Element_ID, t.CommitWarning,t.Description,t.Help,t.Name,t.PO_Description,t.PO_Help,t.PO_Name,t.PO_PrintName,t.PrintName,t.WEBUI_NameBrowse,t.WEBUI_NameNew,t.WEBUI_NameNewBreadcrumb, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Element t WHERE l.IsActive='Y'AND (l.IsSystemLanguage='Y' OR l.IsBaseLanguage='Y') AND t.AD_Element_ID=577531 AND NOT EXISTS (SELECT 1 FROM AD_Element_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Element_ID=t.AD_Element_ID)
; | the_stack |
ALTER SESSION SET plscope_settings='identifiers:all, statements:all';
CREATE TABLE my_data (n NUMBER);
CREATE OR REPLACE FUNCTION my_function1
RETURN NUMBER
AUTHID DEFINER
IS
BEGIN
RETURN 1;
END;
/
CREATE OR REPLACE FUNCTION my_function2
RETURN NUMBER
AUTHID DEFINER
IS
BEGIN
RETURN 1;
END;
/
CREATE OR REPLACE PROCEDURE my_procedure (n_in IN NUMBER)
AUTHID DEFINER
IS
l_my_data my_data%ROWTYPE;
BEGIN
SELECT my_function1 ()
INTO l_my_data
FROM my_data
WHERE n = n_in
AND my_function2 () = 0
AND n = (SELECT my_function1 () FROM DUAL);
SELECT COUNT (*)
INTO l_my_data
FROM my_data
WHERE n = n_in;
UPDATE my_data
SET n = my_function2 ()
WHERE n = n_in;
END;
/
-- Show All Identifiers and Statements - ALL_* Version
-- This query unions together rows from ALL_IDENTIFIERS and ALL_STATEMENTS to provide
-- a complete picture of your program unit.
WITH one_obj_name AS (SELECT USER owner, 'MY_PROCEDURE' object_name FROM DUAL)
SELECT plscope_type,
usage_id,
usage_context_id,
LPAD (' ', 2 * (LEVEL - 1)) || usage || ' ' || name usages,
line,
col,
signature
FROM (SELECT 'ID' plscope_type,
ai.object_name,
ai.usage usage,
ai.usage_id,
ai.usage_context_id,
ai.TYPE || ' ' || ai.name name,
ai.line,
ai.col,
signature
FROM all_identifiers ai, one_obj_name
WHERE ai.object_name = one_obj_name.object_name
AND ai.owner = one_obj_name.owner
UNION ALL
SELECT 'ST',
st.object_name,
st.TYPE,
st.usage_id,
st.usage_context_id,
'STATEMENT',
st.line,
st.col,
signature
FROM all_statements st, one_obj_name
WHERE st.object_name = one_obj_name.object_name
AND st.owner = one_obj_name.owner)
START WITH usage_context_id = 0
CONNECT BY PRIOR usage_id = usage_context_id
-- Show All Identifiers and Statements - USER_* Version
WITH one_obj_name AS (SELECT 'MY_PROCEDURE' object_name FROM DUAL)
SELECT plscope_type,
usage_id,
usage_context_id,
LPAD (' ', 2 * (LEVEL - 1)) || usage || ' ' || name usages,
line,
col,
signature
FROM (SELECT 'ID' plscope_type,
ai.object_name,
ai.usage usage,
ai.usage_id,
ai.usage_context_id,
ai.TYPE || ' ' || ai.name name,
ai.line,
ai.col,
signature
FROM user_identifiers ai, one_obj_name
WHERE ai.object_name = one_obj_name.object_name
UNION ALL
SELECT 'ST',
st.object_name,
st.TYPE,
st.usage_id,
st.usage_context_id,
'STATEMENT',
st.line,
st.col,
signature
FROM user_statements st, one_obj_name
WHERE st.object_name = one_obj_name.object_name)
START WITH usage_context_id = 0
CONNECT BY PRIOR usage_id = usage_context_id
-- Find SQL Statements Containing Function Calls - ALL_* Version
/*
Here's the secret sauce. I use subquery refactoring (WITH clause) to create
and then use some data sets: my_prog_unit - specify the program unit of interest
just once; full_set - the full set of statements and identifiers; dml_statements -
the SQL DML statements in the program unit. Then I find all the DML statements
whose full_set tree below it contain a call to a function.
*/
WITH my_prog_unit AS (SELECT USER owner, 'MY_PROCEDURE' object_name FROM DUAL),
full_set
AS (SELECT ai.usage,
ai.usage_id,
ai.usage_context_id,
ai.TYPE,
ai.name
FROM all_identifiers ai, my_prog_unit
WHERE ai.object_name = my_prog_unit.object_name
AND ai.owner = my_prog_unit.owner
UNION ALL
SELECT st.TYPE,
st.usage_id,
st.usage_context_id,
'type',
'name'
FROM all_statements st, my_prog_unit
WHERE st.object_name = my_prog_unit.object_name
AND st.owner = my_prog_unit.owner),
dml_statements
AS (SELECT st.owner, st.object_name, st.line, st.usage_id, st.type
FROM all_statements st, my_prog_unit
WHERE st.object_name = my_prog_unit.object_name
AND st.owner = my_prog_unit.owner
AND st.TYPE IN ('SELECT', 'UPDATE', 'DELETE'))
SELECT st.owner,
st.object_name,
st.line,
st.TYPE,
s.text
FROM dml_statements st, all_source s
WHERE ('CALL', 'FUNCTION') IN ( SELECT fs.usage, fs.TYPE
FROM full_set fs
CONNECT BY PRIOR fs.usage_id =
fs.usage_context_id
START WITH fs.usage_id = st.usage_id)
AND st.line = s.line
AND st.object_name = s.name
AND st.owner = s.owner
-- Find SQL Statements Containing Function Calls - USER_* Version
WITH my_prog_unit AS (SELECT 'MY_PROCEDURE' object_name FROM DUAL),
full_set
AS (SELECT ai.usage,
ai.usage_id,
ai.usage_context_id,
ai.TYPE,
ai.name
FROM user_identifiers ai, my_prog_unit
WHERE ai.object_name = my_prog_unit.object_name
/* Only with ALL_* AND ai.owner = my_prog_unit.owner */
UNION ALL
SELECT st.TYPE,
st.usage_id,
st.usage_context_id,
'type',
'name'
FROM user_statements st, my_prog_unit
WHERE st.object_name = my_prog_unit.object_name
/* Only with ALL_* AND st.owner = my_prog_unit.owner */),
dml_statements
AS (SELECT /* Only with ALL_* st.owner, */ st.object_name, st.line, st.usage_id, st.type
FROM user_statements st, my_prog_unit
WHERE st.object_name = my_prog_unit.object_name
/* Only with ALL_* AND st.owner = my_prog_unit.owner */
AND st.TYPE IN ('SELECT', 'UPDATE', 'DELETE'))
SELECT /* Only with ALL_* st.owner, */
st.object_name,
st.line,
st.TYPE,
s.text
FROM dml_statements st, all_source s
WHERE ('CALL', 'FUNCTION') IN ( SELECT fs.usage, fs.TYPE
FROM full_set fs
CONNECT BY PRIOR fs.usage_id =
fs.usage_context_id
START WITH fs.usage_id = st.usage_id)
AND st.line = s.line
/* Only with ALL_* AND st.owner = s.owner */
AND st.object_name = s.name
-- Across All Schemas, All Program Units
-- Using ALL_* views; will not run in LiveSQL. See next statement.
WITH full_set
AS (SELECT ai.owner,
ai.object_name,
ai.usage,
ai.usage_id,
ai.usage_context_id,
ai.TYPE,
ai.name
FROM all_identifiers ai
UNION ALL
SELECT st.owner,
st.object_name,
st.TYPE,
st.usage_id,
st.usage_context_id,
'type',
'name'
FROM all_statements st),
dml_statements
AS (SELECT st.owner,
st.object_name,
st.line,
st.usage_id,
st.TYPE
FROM all_statements st
WHERE st.TYPE IN ('SELECT', 'UPDATE', 'DELETE'))
SELECT st.owner,
st.object_name,
st.line,
st.TYPE,
s.text
FROM dml_statements st, all_source s
WHERE ('CALL', 'FUNCTION') IN ( SELECT fs.usage, fs.TYPE
FROM full_set fs
CONNECT BY PRIOR fs.usage_id =
fs.usage_context_id
START WITH fs.usage_id = st.usage_id)
AND st.line = s.line
AND st.object_name = s.name
AND st.owner = s.owner
-- Across All Program Units in Your Schema
-- Using USER_* views
WITH full_set
AS (SELECT ai.object_name,
ai.usage,
ai.usage_id,
ai.usage_context_id,
ai.TYPE,
ai.name
FROM user_identifiers ai
UNION ALL
SELECT st.object_name,
st.TYPE,
st.usage_id,
st.usage_context_id,
'type',
'name'
FROM user_statements st),
dml_statements
AS (SELECT st.object_name,
st.line,
st.usage_id,
st.TYPE
FROM user_statements st
WHERE st.TYPE IN ('SELECT', 'UPDATE', 'DELETE'))
SELECT st.object_name,
st.line,
st.TYPE,
s.text
FROM user_statements st, user_source s
WHERE ('CALL', 'FUNCTION') IN ( SELECT fs.usage, fs.TYPE
FROM full_set fs
CONNECT BY PRIOR fs.usage_id =
fs.usage_context_id
START WITH fs.usage_id = st.usage_id)
AND st.line = s.line
AND st.object_name = s.name | the_stack |
SET @sName = 'bx_forum';
SET @sStorageEngine = (SELECT `value` FROM `sys_options` WHERE `name` = 'sys_storage_default');
-- TABLE: entries
CREATE TABLE IF NOT EXISTS `bx_forum_discussions` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`author` int(11) NOT NULL,
`added` int(11) NOT NULL,
`changed` int(11) NOT NULL,
`thumb` int(11) NOT NULL,
`title` varchar(255) NOT NULL,
`cat` int(11) NOT NULL,
`text` text NOT NULL,
`text_comments` text NOT NULL,
`lr_timestamp` int(11) NOT NULL,
`lr_profile_id` int(11) NOT NULL,
`lr_comment_id` int(11) NOT NULL,
`views` int(11) NOT NULL default '0',
`rate` float NOT NULL default '0',
`votes` int(11) NOT NULL default '0',
`score` int(11) NOT NULL default '0',
`sc_up` int(11) NOT NULL default '0',
`sc_down` int(11) NOT NULL default '0',
`favorites` int(11) NOT NULL default '0',
`comments` int(11) NOT NULL default '0',
`reports` int(11) NOT NULL default '0',
`featured` int(11) NOT NULL default '0',
`stick` tinyint(4) NOT NULL DEFAULT '0',
`lock` tinyint(4) NOT NULL DEFAULT '0',
`allow_view_to` int(11) NOT NULL DEFAULT '3',
`status` enum('active','draft','hidden') NOT NULL DEFAULT 'active',
`status_admin` enum('active','hidden') NOT NULL DEFAULT 'active',
PRIMARY KEY (`id`),
FULLTEXT KEY `title_text` (`title`,`text`,`text_comments`),
KEY `lr_timestamp` (`lr_timestamp`)
);
CREATE TABLE IF NOT EXISTS `bx_forum_categories` (
`category` int(11) NOT NULL default '0',
`visible_for_levels` int(11) NOT NULL default '2147483647',
PRIMARY KEY (`category`)
);
-- TABLE: storages & transcoders
CREATE TABLE IF NOT EXISTS `bx_forum_files` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`profile_id` int(10) unsigned NOT NULL,
`remote_id` varchar(128) NOT NULL,
`path` varchar(255) NOT NULL,
`file_name` varchar(255) NOT NULL,
`mime_type` varchar(128) NOT NULL,
`ext` varchar(32) NOT NULL,
`size` int(11) NOT NULL,
`added` int(11) NOT NULL,
`modified` int(11) NOT NULL,
`private` int(11) NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `remote_id` (`remote_id`)
);
CREATE TABLE IF NOT EXISTS `bx_forum_photos_resized` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`profile_id` int(10) unsigned NOT NULL,
`remote_id` varchar(128) NOT NULL,
`path` varchar(255) NOT NULL,
`file_name` varchar(255) NOT NULL,
`mime_type` varchar(128) NOT NULL,
`ext` varchar(32) NOT NULL,
`size` int(11) NOT NULL,
`added` int(11) NOT NULL,
`modified` int(11) NOT NULL,
`private` int(11) NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `remote_id` (`remote_id`)
);
-- TABLE: subscribers
CREATE TABLE IF NOT EXISTS `bx_forum_subscribers` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`initiator` int(11) NOT NULL,
`content` int(11) NOT NULL,
`added` int(10) unsigned NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `initiator` (`initiator`,`content`),
KEY `content` (`content`)
);
-- TABLE: comments
CREATE TABLE IF NOT EXISTS `bx_forum_cmts` (
`cmt_id` int(11) NOT NULL AUTO_INCREMENT,
`cmt_parent_id` int(11) NOT NULL DEFAULT '0',
`cmt_vparent_id` int(11) NOT NULL DEFAULT '0',
`cmt_object_id` int(11) NOT NULL DEFAULT '0',
`cmt_author_id` int(11) NOT NULL DEFAULT '0',
`cmt_level` int(11) NOT NULL DEFAULT '0',
`cmt_text` text NOT NULL,
`cmt_mood` tinyint(4) NOT NULL DEFAULT '0',
`cmt_rate` int(11) NOT NULL DEFAULT '0',
`cmt_rate_count` int(11) NOT NULL DEFAULT '0',
`cmt_time` int(11) unsigned NOT NULL DEFAULT '0',
`cmt_replies` int(11) NOT NULL DEFAULT '0',
PRIMARY KEY (`cmt_id`),
KEY `cmt_object_id` (`cmt_object_id`,`cmt_parent_id`),
FULLTEXT KEY `search_fields` (`cmt_text`)
);
-- TABLE: views
CREATE TABLE `bx_forum_views_track` (
`object_id` int(11) NOT NULL default '0',
`viewer_id` int(11) NOT NULL default '0',
`viewer_nip` int(11) unsigned NOT NULL default '0',
`date` int(11) NOT NULL default '0',
KEY `id` (`object_id`,`viewer_id`,`viewer_nip`)
);
-- TABLE: votes
CREATE TABLE IF NOT EXISTS `bx_forum_votes` (
`object_id` int(11) NOT NULL default '0',
`count` int(11) NOT NULL default '0',
`sum` int(11) NOT NULL default '0',
UNIQUE KEY `object_id` (`object_id`)
);
CREATE TABLE IF NOT EXISTS `bx_forum_votes_track` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`object_id` int(11) NOT NULL default '0',
`author_id` int(11) NOT NULL default '0',
`author_nip` int(11) unsigned NOT NULL default '0',
`value` tinyint(4) NOT NULL default '0',
`date` int(11) NOT NULL default '0',
PRIMARY KEY (`id`),
KEY `vote` (`object_id`, `author_nip`)
);
-- TABLE: metas
CREATE TABLE `bx_forum_meta_keywords` (
`object_id` int(10) unsigned NOT NULL,
`keyword` varchar(255) NOT NULL,
KEY `object_id` (`object_id`),
KEY `keyword` (`keyword`)
);
CREATE TABLE `bx_forum_meta_mentions` (
`object_id` int(10) unsigned NOT NULL,
`profile_id` int(10) unsigned NOT NULL,
KEY `object_id` (`object_id`),
KEY `profile_id` (`profile_id`)
);
-- TABLE: reports
CREATE TABLE IF NOT EXISTS `bx_forum_reports` (
`object_id` int(11) NOT NULL default '0',
`count` int(11) NOT NULL default '0',
UNIQUE KEY `object_id` (`object_id`)
);
CREATE TABLE IF NOT EXISTS `bx_forum_reports_track` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`object_id` int(11) NOT NULL default '0',
`author_id` int(11) NOT NULL default '0',
`author_nip` int(11) unsigned NOT NULL default '0',
`type` varchar(32) NOT NULL default '',
`text` text NOT NULL default '',
`date` int(11) NOT NULL default '0',
PRIMARY KEY (`id`),
KEY `report` (`object_id`, `author_nip`)
);
-- TABLE: favorites
CREATE TABLE `bx_forum_favorites_track` (
`object_id` int(11) NOT NULL default '0',
`author_id` int(11) NOT NULL default '0',
`date` int(11) NOT NULL default '0',
KEY `id` (`object_id`,`author_id`)
);
-- TABLE: scores
CREATE TABLE IF NOT EXISTS `bx_forum_scores` (
`object_id` int(11) NOT NULL default '0',
`count_up` int(11) NOT NULL default '0',
`count_down` int(11) NOT NULL default '0',
UNIQUE KEY `object_id` (`object_id`)
);
CREATE TABLE IF NOT EXISTS `bx_forum_scores_track` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`object_id` int(11) NOT NULL default '0',
`author_id` int(11) NOT NULL default '0',
`author_nip` int(11) unsigned NOT NULL default '0',
`type` varchar(8) NOT NULL default '',
`date` int(11) NOT NULL default '0',
PRIMARY KEY (`id`),
KEY `vote` (`object_id`, `author_nip`)
);
-- STORAGES & TRANSCODERS
INSERT INTO `sys_objects_storage` (`object`, `engine`, `params`, `token_life`, `cache_control`, `levels`, `table_files`, `ext_mode`, `ext_allow`, `ext_deny`, `quota_size`, `current_size`, `quota_number`, `current_number`, `max_file_size`, `ts`) VALUES
('bx_forum_files', @sStorageEngine, '', 360, 2592000, 3, 'bx_forum_files', 'deny-allow', '', 'action,apk,app,bat,bin,cmd,com,command,cpl,csh,exe,gadget,inf,ins,inx,ipa,isu,job,jse,ksh,lnk,msc,msi,msp,mst,osx,out,paf,pif,prg,ps1,reg,rgs,run,sct,shb,shs,u3p,vb,vbe,vbs,vbscript,workflow,ws,wsf', 0, 0, 0, 0, 0, 0),
('bx_forum_files_cmts', @sStorageEngine, '', 360, 2592000, 3, 'bx_forum_files', 'deny-allow', '', 'action,apk,app,bat,bin,cmd,com,command,cpl,csh,exe,gadget,inf,ins,inx,ipa,isu,job,jse,ksh,lnk,msc,msi,msp,mst,osx,out,paf,pif,prg,ps1,reg,rgs,run,sct,shb,shs,u3p,vb,vbe,vbs,vbscript,workflow,ws,wsf', 0, 0, 0, 0, 0, 0),
('bx_forum_photos_resized', @sStorageEngine, '', 360, 2592000, 3, 'bx_forum_photos_resized', 'allow-deny', 'jpg,jpeg,jpe,gif,png', '', 0, 0, 0, 0, 0, 0);
INSERT INTO `sys_objects_transcoder` (`object`, `storage_object`, `source_type`, `source_params`, `private`, `atime_tracking`, `atime_pruning`, `ts`, `override_class_name`, `override_class_file`) VALUES
('bx_forum_preview', 'bx_forum_photos_resized', 'Storage', 'a:1:{s:6:"object";s:14:"bx_forum_files";}', 'no', '1', '2592000', '0', '', ''),
('bx_forum_preview_cmts', 'bx_forum_photos_resized', 'Storage', 'a:1:{s:6:"object";s:19:"bx_forum_files_cmts";}', 'no', '1', '2592000', '0', '', ''),
('bx_forum_gallery', 'bx_forum_photos_resized', 'Storage', 'a:1:{s:6:"object";s:14:"bx_forum_files";}', 'no', '1', '2592000', '0', '', ''),
('bx_forum_cover', 'bx_forum_photos_resized', 'Storage', 'a:1:{s:6:"object";s:14:"bx_forum_files";}', 'no', '1', '2592000', '0', '', '');
INSERT INTO `sys_transcoder_filters` (`transcoder_object`, `filter`, `filter_params`, `order`) VALUES
('bx_forum_preview', 'Resize', 'a:3:{s:1:"w";s:3:"300";s:1:"h";s:3:"200";s:11:"crop_resize";s:1:"1";}', '0'),
('bx_forum_preview_cmts', 'Resize', 'a:4:{s:1:"w";s:3:"100";s:1:"h";s:3:"100";s:13:"square_resize";s:1:"1";s:10:"force_type";s:3:"jpg";}', '0'),
('bx_forum_gallery', 'Resize', 'a:1:{s:1:"w";s:3:"500";}', '0'),
('bx_forum_cover', 'Resize', 'a:1:{s:1:"w";s:4:"2000";}', '0');
-- FORMS
INSERT INTO `sys_objects_form`(`object`, `module`, `title`, `action`, `form_attrs`, `table`, `key`, `uri`, `uri_title`, `submit_name`, `params`, `deletable`, `active`, `override_class_name`, `override_class_file`) VALUES
(@sName, @sName, '_bx_forum_form_entry', '', 'a:1:{s:7:\"enctype\";s:19:\"multipart/form-data\";}', 'bx_forum_discussions', 'id', '', '', 'do_submit', '', 0, 1, 'BxForumFormEntry', 'modules/boonex/forum/classes/BxForumFormEntry.php'),
('bx_forum_search', @sName, '_bx_forum_form_search', '', 'a:1:{s:7:\"enctype\";s:19:\"multipart/form-data\";}', 'bx_forum_discussions', 'id', '', '', 'do_submit', '', 0, 1, 'BxForumFormSearch', 'modules/boonex/forum/classes/BxForumFormSearch.php');
INSERT INTO `sys_form_displays`(`object`, `display_name`, `module`, `view_mode`, `title`) VALUES
(@sName, 'bx_forum_entry_add', @sName, 0, '_bx_forum_form_entry_display_add'),
(@sName, 'bx_forum_entry_delete', @sName, 0, '_bx_forum_form_entry_display_delete'),
(@sName, 'bx_forum_entry_edit', @sName, 0, '_bx_forum_form_entry_display_edit'),
(@sName, 'bx_forum_entry_view', @sName, 1, '_bx_forum_form_entry_display_view'),
('bx_forum_search', 'bx_forum_search_full', @sName, 0, '_bx_forum_form_search_display_full');
INSERT INTO `sys_form_inputs`(`object`, `module`, `name`, `value`, `values`, `checked`, `type`, `caption_system`, `caption`, `info`, `required`, `collapsed`, `html`, `attrs`, `attrs_tr`, `attrs_wrapper`, `checker_func`, `checker_params`, `checker_error`, `db_pass`, `db_params`, `editable`, `deletable`) VALUES
(@sName, @sName, 'allow_view_to', '', '', 0, 'custom', '_bx_forum_form_entry_input_sys_allow_view_to', '_bx_forum_form_entry_input_allow_view_to', '', 1, 0, 0, '', '', '', '', '', '', '', '', 1, 0),
(@sName, @sName, 'delete_confirm', 1, '', 0, 'checkbox', '_bx_forum_form_entry_input_sys_delete_confirm', '_bx_forum_form_entry_input_delete_confirm', '_bx_forum_form_entry_input_delete_confirm_info', 1, 0, 0, '', '', '', 'Avail', '', '_bx_forum_form_entry_input_delete_confirm_error', '', '', 1, 0),
(@sName, @sName, 'do_submit', '_bx_forum_form_entry_input_do_submit', '', 0, 'submit', '_bx_forum_form_entry_input_sys_do_submit', '', '', 0, 0, 0, '', '', '', '', '', '', '', '', 1, 0),
(@sName, @sName, 'text', '', '', 0, 'textarea', '_bx_forum_form_entry_input_sys_text', '_bx_forum_form_entry_input_text', '', 1, 0, 2, '', '', '', 'Avail', '', '_bx_forum_form_entry_input_text_err', 'XssHtml', '', 1, 0),
(@sName, @sName, 'title', '', '', 0, 'text', '_bx_forum_form_entry_input_sys_title', '_bx_forum_form_entry_input_title', '', 1, 0, 0, '', '', '', 'Avail', '', '_bx_forum_form_entry_input_title_err', 'Xss', '', 1, 0),
(@sName, @sName, 'cat', '', '#!bx_forum_cats', 0, 'select', '_bx_forum_form_entry_input_sys_cat', '_bx_forum_form_entry_input_cat', '', 1, 0, 0, '', '', '', 'avail', '', '_bx_forum_form_entry_input_cat_err', 'Xss', '', 1, 0),
(@sName, @sName, 'attachments', 'a:1:{i:0;s:14:"bx_forum_html5";}', 'a:2:{s:15:"bx_forum_simple";s:26:"_sys_uploader_simple_title";s:14:"bx_forum_html5";s:25:"_sys_uploader_html5_title";}', 0, 'files', '_bx_forum_form_entry_input_sys_attachments', '_bx_forum_form_entry_input_attachments', '', 0, 0, 0, '', '', '', '', '', '', '', '', 1, 0),
(@sName, @sName, 'labels', '', '', 0, 'custom', '_sys_form_input_sys_labels', '_sys_form_input_labels', '', 0, 0, 0, '', '', '', '', '', '', '', '', 1, 0),
(@sName, @sName, 'anonymous', '', '', 0, 'switcher', '_sys_form_input_sys_anonymous', '_sys_form_input_anonymous', '', 0, 0, 0, '', '', '', '', '', '', '', '', 1, 0),
(@sName, @sName, 'added', '', '', 0, 'datetime', '_bx_forum_form_entry_input_sys_date_added', '_bx_forum_form_entry_input_date_added', '', 0, 0, 0, '', '', '', '', '', '', '', '', 1, 0),
(@sName, @sName, 'changed', '', '', 0, 'datetime', '_bx_forum_form_entry_input_sys_date_changed', '_bx_forum_form_entry_input_date_changed', '', 0, 0, 0, '', '', '', '', '', '', '', '', 1, 0),
('bx_forum_search', @sName, 'author', '', '', 0, 'custom', '_bx_forum_form_search_input_sys_author', '_bx_forum_form_search_input_author', '', 0, 0, 0, '', '', '', '', '', '', '', '', 1, 0),
('bx_forum_search', @sName, 'category', '', '#!bx_forum_cats', 0, 'select', '_bx_forum_form_search_input_sys_category', '_bx_forum_form_search_input_category', '', 0, 0, 0, '', '', '', '', '', '', '', '', 1, 0),
('bx_forum_search', @sName, 'keyword', '', '', 0, 'text', '_bx_forum_form_search_input_sys_keyword', '_bx_forum_form_search_input_keyword', '', 0, 0, 0, '', '', '', '', '', '', '', '', 1, 0),
('bx_forum_search', @sName, 'do_submit', '_bx_forum_form_search_input_do_submit', '', 0, 'submit', '_bx_forum_form_search_input_sys_do_submit', '', '', 0, 0, 0, '', '', '', '', '', '', '', '', 1, 0);
INSERT INTO `sys_form_display_inputs` (`display_name`, `input_name`, `visible_for_levels`, `active`, `order`) VALUES
('bx_forum_entry_add', 'title', 2147483647, 1, 1),
('bx_forum_entry_add', 'cat', 2147483647, 1, 2),
('bx_forum_entry_add', 'text', 2147483647, 1, 3),
('bx_forum_entry_add', 'attachments', 2147483647, 1, 4),
('bx_forum_entry_add', 'allow_view_to', 2147483647, 1, 5),
('bx_forum_entry_add', 'do_submit', 2147483647, 1, 6),
('bx_forum_entry_edit', 'title', 2147483647, 1, 1),
('bx_forum_entry_edit', 'cat', 2147483647, 1, 2),
('bx_forum_entry_edit', 'text', 2147483647, 1, 3),
('bx_forum_entry_edit', 'attachments', 2147483647, 1, 4),
('bx_forum_entry_edit', 'allow_view_to', 2147483647, 1, 5),
('bx_forum_entry_edit', 'do_submit', 2147483647, 1, 6),
('bx_forum_entry_view', 'title', 2147483647, 1, 1),
('bx_forum_entry_view', 'cat', 2147483647, 1, 2),
('bx_forum_entry_view', 'text', 2147483647, 1, 3),
('bx_forum_entry_delete', 'delete_confirm', 2147483647, 1, 1),
('bx_forum_entry_delete', 'do_submit', 2147483647, 1, 2),
('bx_forum_search_full', 'author', 2147483647, 1, 1),
('bx_forum_search_full', 'category', 2147483647, 1, 2),
('bx_forum_search_full', 'keyword', 2147483647, 1, 3),
('bx_forum_search_full', 'do_submit', 2147483647, 1, 4);
-- PRE-VALUES
INSERT INTO `sys_form_pre_lists`(`key`, `title`, `module`, `use_for_sets`) VALUES
('bx_forum_cats', '_bx_forum_pre_lists_cats', 'bx_forum', '0');
INSERT INTO `sys_form_pre_values`(`Key`, `Value`, `Order`, `LKey`, `LKey2`) VALUES
('bx_forum_cats', '', 0, '_sys_please_select', ''),
('bx_forum_cats', '1', 1, '_bx_forum_cat_General', '');
-- CONTENT INFO
INSERT INTO `sys_objects_content_info` (`name`, `title`, `alert_unit`, `alert_action_add`, `alert_action_update`, `alert_action_delete`, `class_name`, `class_file`) VALUES
(@sName, '_bx_forum', @sName, 'added', 'edited', 'deleted', '', ''),
('bx_forum_cmts', '_bx_forum_cmts', @sName, 'commentPost', 'commentUpdated', 'commentRemoved', 'BxDolContentInfoCmts', '');
INSERT INTO `sys_content_info_grids` (`object`, `grid_object`, `grid_field_id`, `condition`, `selection`) VALUES
(@sName, @sName, 'id', '', 'a:1:{s:4:"sort";a:2:{s:5:"stick";s:4:"desc";s:12:"lr_timestamp";s:4:"desc";}}'),
(@sName, 'bx_forum_administration', 'id', '', ''),
(@sName, 'bx_forum_common', 'id', '', '');
-- SEARCH EXTENDED
INSERT INTO `sys_objects_search_extended` (`object`, `object_content_info`, `module`, `title`, `active`, `class_name`, `class_file`) VALUES
('bx_forum', 'bx_forum', 'bx_forum', '_bx_forum_search_extended', 1, '', ''),
('bx_forum_cmts', 'bx_forum_cmts', 'bx_forum', '_bx_forum_search_extended_cmts', 1, 'BxTemplSearchExtendedCmts', '');
-- REPORTS
INSERT INTO `sys_objects_report` (`name`, `table_main`, `table_track`, `is_on`, `base_url`, `trigger_table`, `trigger_field_id`, `trigger_field_author`, `trigger_field_count`, `class_name`, `class_file`) VALUES
('bx_forum', 'bx_forum_reports', 'bx_forum_reports_track', '1', 'page.php?i=view-discussion&id={object_id}', 'bx_forum_discussions', 'id', 'author', 'reports', '', '');
-- STUDIO: page & widget
INSERT INTO `sys_std_pages`(`index`, `name`, `header`, `caption`, `icon`) VALUES
(3, @sName, '_bx_forum', '_bx_forum', 'bx_forum@modules/boonex/forum/|std-icon.svg');
SET @iPageId = LAST_INSERT_ID();
SET @iParentPageId = (SELECT `id` FROM `sys_std_pages` WHERE `name` = 'home');
SET @iParentPageOrder = (SELECT MAX(`order`) FROM `sys_std_pages_widgets` WHERE `page_id` = @iParentPageId);
INSERT INTO `sys_std_widgets` (`page_id`, `module`, `url`, `click`, `icon`, `caption`, `cnt_notices`, `cnt_actions`) VALUES
(@iPageId, @sName, '{url_studio}module.php?name=bx_forum', '', 'bx_forum@modules/boonex/forum/|std-icon.svg', '_bx_forum', '', 'a:4:{s:6:"module";s:6:"system";s:6:"method";s:11:"get_actions";s:6:"params";a:0:{}s:5:"class";s:18:"TemplStudioModules";}');
INSERT INTO `sys_std_pages_widgets` (`page_id`, `widget_id`, `order`) VALUES
(@iParentPageId, LAST_INSERT_ID(), IF(ISNULL(@iParentPageOrder), 1, @iParentPageOrder + 1)); | the_stack |
SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;
-- ----------------------------
-- Table structure for sys_message
-- ----------------------------
DROP TABLE IF EXISTS `sys_message`;
CREATE TABLE `sys_message` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`message_id` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
`content` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '内容',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of sys_message
-- ----------------------------
INSERT INTO `sys_message` VALUES (2, '169c32ac-6b22-4b4f-9cf6-0917ea4f604c', '我就是我,不一样烟火');
INSERT INTO `sys_message` VALUES (3, '6081ca26-b4c3-4aaf-b30a-7ae0d881650c', '我就是我,不一样烟火');
INSERT INTO `sys_message` VALUES (4, '5c291033-d4d2-4a30-916e-40a366c6482c', '我就是我,不一样烟火');
INSERT INTO `sys_message` VALUES (5, '18a54e32-b87b-414f-a84a-0b77030cb425', '我就是我,不一样烟火');
INSERT INTO `sys_message` VALUES (6, '38e2cbaa-ea9a-4c79-a23b-ddb246d31731', '我就是我,不一样烟火');
INSERT INTO `sys_message` VALUES (7, '4bebe7e4-426b-46f3-a2dd-38f1b6817d91', '我就是我,不一样烟火');
INSERT INTO `sys_message` VALUES (8, '8bbd3419-8de4-41c7-9418-b5558f1e2ebb', '我就是我,不一样烟火');
INSERT INTO `sys_message` VALUES (9, '35dae2f1-41e7-4dd1-835c-b0329259a01b', '我就是我,不一样烟火');
INSERT INTO `sys_message` VALUES (10, '7059b08a-539c-4ffc-8cce-23139f764259', '我就是我,不一样烟火');
INSERT INTO `sys_message` VALUES (11, '2e94df1f-6443-4edc-bfb0-ca58af168e93', '我就是我,不一样烟火');
INSERT INTO `sys_message` VALUES (12, 'df0c9f09-c873-461d-9289-dc406f48ab71', '我就是我,不一样烟火');
INSERT INTO `sys_message` VALUES (13, '25ccd31a-b33e-4d18-8361-8947e183f143', '我就是我,不一样烟火');
INSERT INTO `sys_message` VALUES (14, '442dd5a9-af98-421b-99c5-95648a0ec7db', '我就是我,不一样烟火');
INSERT INTO `sys_message` VALUES (15, 'baf35ee2-d440-4733-af7a-910e424597a0', '我就是我,不一样烟火');
INSERT INTO `sys_message` VALUES (16, 'f6e2a703-519e-4854-be42-193096c72e4f', '我就是我,不一样烟火');
INSERT INTO `sys_message` VALUES (17, '5d7a8a2e-e1aa-4b96-949f-67a3c15a5b97', '我就是我,不一样烟火');
INSERT INTO `sys_message` VALUES (18, '399aca07-27c9-4e4b-921c-d1b7829a650c', '我就是我,不一样烟火');
INSERT INTO `sys_message` VALUES (19, 'a2a6c4e2-6415-4df7-a1f8-579b7c4ccf9e', '我就是我,不一样烟火');
INSERT INTO `sys_message` VALUES (20, '64dd6b7d-cec2-4f7d-92f2-309cc7844f91', '我就是我,不一样烟火');
INSERT INTO `sys_message` VALUES (21, 'd3b5f344-2f00-4fec-94d3-b869650c1aa1', '我就是我,不一样烟火');
INSERT INTO `sys_message` VALUES (22, 'c660eae8-2913-4f47-b25b-498073fc1dc3', '我就是我,不一样烟火');
INSERT INTO `sys_message` VALUES (23, 'b413dcc2-b764-4a22-afcf-ad08d7ebf95a', '我就是我,不一样烟火');
INSERT INTO `sys_message` VALUES (24, 'a546f273-7d79-4529-9442-102b4315cfb0', '我就是我,不一样烟火');
INSERT INTO `sys_message` VALUES (25, '3c148644-23d5-4188-ab19-d6b64c993481', '我就是我,不一样烟火');
INSERT INTO `sys_message` VALUES (26, 'e5eefc5e-0509-4647-a20b-598b695db456', '我就是我,不一样烟火');
INSERT INTO `sys_message` VALUES (27, '5f3dd237-dc04-43a4-ba0a-d5690bcb79d1', '我就是我,不一样烟火');
INSERT INTO `sys_message` VALUES (28, '7604d669-1231-40ee-b44c-4a17830196da', '我就是我,不一样烟火');
INSERT INTO `sys_message` VALUES (29, 'a7ec3796-f499-4996-95d4-08b866804893', '我就是我,不一样烟火');
INSERT INTO `sys_message` VALUES (30, 'a5fe3e8f-1b96-4c22-80ef-30bd8bd80bb4', '我就是我,不一样烟火');
INSERT INTO `sys_message` VALUES (31, '319dc15d-f95d-4be1-a7e3-0bbd893850dd', '我就是我,不一样烟火');
INSERT INTO `sys_message` VALUES (32, '7eace2fb-4443-4d85-a304-bef2ebf2735f', '我就是我,不一样烟火');
INSERT INTO `sys_message` VALUES (33, '17120554-1ab5-4d68-beef-2d8da984287f', '我就是我,不一样烟火');
INSERT INTO `sys_message` VALUES (34, '47b68290-829d-4f40-99f8-acc4f2dd4cc5', '我就是我,不一样烟火');
INSERT INTO `sys_message` VALUES (35, '5362bd48-8972-4b61-917f-b7a712ba96ca', '我就是我,不一样烟火');
INSERT INTO `sys_message` VALUES (36, 'dfa7b4a9-44cf-489b-8649-c74f87a63b69', '我就是我,不一样烟火');
INSERT INTO `sys_message` VALUES (37, 'c12457ca-f033-4553-b7d3-5d0b42b7b5b7', '我就是我,不一样烟火');
INSERT INTO `sys_message` VALUES (38, '4016c1ad-ae98-40e9-8cab-73debf5fa82b', '我就是我,不一样烟火');
INSERT INTO `sys_message` VALUES (39, '44b18831-2055-4ac2-b0d0-0d14edf654f5', '我就是我,不一样烟火');
INSERT INTO `sys_message` VALUES (40, 'f5597108-eb8d-4433-86d9-c8e6d5becaa8', '我就是我,不一样烟火');
INSERT INTO `sys_message` VALUES (41, 'd28027a1-dd79-4735-8c7b-1871ddedf975', '我就是我,不一样烟火');
INSERT INTO `sys_message` VALUES (42, '6e27b8a7-ebec-45a1-b913-133716f3413c', '我就是我,不一样烟火');
INSERT INTO `sys_message` VALUES (43, '17eb1be9-3df4-458d-86a9-adcb9b169022', '我就是我,不一样烟火');
INSERT INTO `sys_message` VALUES (44, 'e131ae50-a05f-41f0-a3fc-13896fc0c4c6', '我就是我,不一样烟火');
INSERT INTO `sys_message` VALUES (45, '106111ac-d561-425e-8d71-34c0e2025180', '我就是我,不一样烟火');
INSERT INTO `sys_message` VALUES (46, '5b1d6c84-1b75-48c6-aa97-a9e351974c03', '我就是我,不一样烟火');
INSERT INTO `sys_message` VALUES (47, '764ff51d-38e9-42ca-8b17-c9037d6e21e1', '我就是我,不一样烟火');
INSERT INTO `sys_message` VALUES (48, '2cdcf4a8-a7c8-491c-b7e1-e74589a3fee9', '我就是我,不一样烟火');
INSERT INTO `sys_message` VALUES (49, '941a033e-004a-47e2-bba0-98c54094d3b8', '我就是我,不一样烟火');
INSERT INTO `sys_message` VALUES (50, '99a5577e-6bc4-453c-bbeb-37d87cc2941a', '我就是我,不一样烟火');
INSERT INTO `sys_message` VALUES (51, 'b5565744-5ba6-46ce-827e-2f6761c54c93', '我就是我,不一样烟火');
INSERT INTO `sys_message` VALUES (52, '445c24cf-4dde-4c9e-b71d-7c1d41390da3', '我就是我,不一样烟火');
INSERT INTO `sys_message` VALUES (53, 'eafbcefe-9d1c-4605-b57b-06edd0e1295e', '我就是我,不一样烟火');
INSERT INTO `sys_message` VALUES (54, '06bf52fc-e166-48c2-9b46-823793dabb74', '我就是我,不一样烟火');
INSERT INTO `sys_message` VALUES (55, '6c72c52e-6c20-468f-875b-062243a3a9d1', '我就是我,不一样烟火');
INSERT INTO `sys_message` VALUES (56, '7333f3ac-490d-4340-8edd-bdb86b9caaef', '我就是我,不一样烟火');
INSERT INTO `sys_message` VALUES (57, 'cf102e75-348c-4206-b65e-eef0dfb39709', '我就是我,不一样烟火');
INSERT INTO `sys_message` VALUES (58, '1fabaa06-131f-4a9a-9265-a6499f673060', '我就是我,不一样烟火');
INSERT INTO `sys_message` VALUES (59, '9c23f62e-3aad-4310-915a-1cd8e9a81f96', '我就是我,不一样烟火');
INSERT INTO `sys_message` VALUES (60, 'ceea68fb-59b5-4205-b01e-c521d6437617', '我就是我,不一样烟火');
INSERT INTO `sys_message` VALUES (61, '106cd465-e9b0-4b06-87ad-55e88f65e5d7', '我就是我,不一样烟火');
INSERT INTO `sys_message` VALUES (62, '1dfc2298-b42b-4b91-9e6a-305c1d95b62d', '我就是我,不一样烟火');
INSERT INTO `sys_message` VALUES (63, '8a791eeb-fc17-474e-996c-1f6ea92ecddc', '我就是我,不一样烟火');
INSERT INTO `sys_message` VALUES (64, 'a58549b9-7ba4-4468-a160-4af86ea90068', '我就是我,不一样烟火');
INSERT INTO `sys_message` VALUES (65, 'aeef4f53-bb48-4027-b1f3-72dfc73be001', '我就是我,不一样烟火');
INSERT INTO `sys_message` VALUES (66, 'c7677066-c5d8-4b9f-90ee-87a8ef71d1bc', '我就是我,不一样烟火');
INSERT INTO `sys_message` VALUES (67, '54e9634a-c15b-48f0-9638-117093f57ec1', '我就是我,不一样烟火');
INSERT INTO `sys_message` VALUES (68, '69fd033c-06c3-4773-ba87-c39bacf53c56', '我就是我,不一样烟火');
INSERT INTO `sys_message` VALUES (69, '82e33b64-dead-4d57-b06e-7baac73b4514', '我就是我,不一样烟火');
INSERT INTO `sys_message` VALUES (70, 'a080c422-30d0-49a4-9535-8d4eae527e84', '我就是我,不一样烟火');
INSERT INTO `sys_message` VALUES (71, 'ce0e720c-31bf-4a47-80ef-640ac5b85d53', '我就是我,不一样烟火');
INSERT INTO `sys_message` VALUES (72, '667d5a26-df8a-4925-ba1e-84baf7564129', '我就是我,不一样烟火');
INSERT INTO `sys_message` VALUES (73, '4156cfce-4a4f-4659-a086-8ffc06b43deb', '我就是我,不一样烟火');
INSERT INTO `sys_message` VALUES (74, 'd803ed41-20fc-43b4-a0c5-dd105c0c7271', '我就是我,不一样烟火');
INSERT INTO `sys_message` VALUES (75, '8d1a8765-836b-4b38-8c90-d08b4c5adf68', '我就是我,不一样烟火');
INSERT INTO `sys_message` VALUES (76, '64d9342d-47a5-4ca1-acde-f67b5104d8bb', '我就是我,不一样烟火');
INSERT INTO `sys_message` VALUES (77, '73be218f-c0d3-4da9-9564-5cabd1803f85', '我就是我,不一样烟火');
INSERT INTO `sys_message` VALUES (78, 'cece7ad6-eae8-4e76-ab55-855ab52ffa1e', '我就是我,不一样烟火');
INSERT INTO `sys_message` VALUES (79, '71441b14-0dab-4bed-803a-251026897714', '我就是我,不一样烟火');
INSERT INTO `sys_message` VALUES (80, '53d90915-5076-4f46-9f28-729564e04f2a', '我就是我,不一样烟火');
INSERT INTO `sys_message` VALUES (81, '13e95be0-2a8c-41e7-96ad-a49c4ffb302d', '我就是我,不一样烟火');
INSERT INTO `sys_message` VALUES (82, 'b8143964-58fa-432c-a991-03c218a016e9', '我就是我,不一样烟火');
INSERT INTO `sys_message` VALUES (83, '845640fe-07ba-419b-9528-bc497ecdf222', '我就是我,不一样烟火');
INSERT INTO `sys_message` VALUES (84, '8e696434-57a2-4ec4-a4f7-c03387eeac30', '我就是我,不一样烟火');
INSERT INTO `sys_message` VALUES (85, 'e142ddff-5942-47ae-a51f-1c091af62680', '我就是我,不一样烟火');
INSERT INTO `sys_message` VALUES (86, '0468b648-47a1-447b-ba01-a9781c3ce3e5', '我就是我,不一样烟火');
INSERT INTO `sys_message` VALUES (87, '6d014ca6-b04c-436e-96f7-436b0ea6642c', '我就是我,不一样烟火');
INSERT INTO `sys_message` VALUES (88, '33a5d348-f62d-44ac-b562-7f08c9d776cc', '我就是我,不一样烟火');
INSERT INTO `sys_message` VALUES (89, 'cbacfddc-9265-4770-8faf-d62b87bf3f92', '我就是我,不一样烟火');
INSERT INTO `sys_message` VALUES (90, '1660a43e-31ff-45eb-be6d-29c4a222dd77', '我就是我,不一样烟火');
INSERT INTO `sys_message` VALUES (91, '9f8becdc-1455-4b1d-89fc-fc17aa0709e3', '我就是我,不一样烟火');
INSERT INTO `sys_message` VALUES (92, '46369f44-d4b7-40e9-9114-19b6bb66fe6d', '我就是我,不一样烟火');
INSERT INTO `sys_message` VALUES (93, '7961488e-ac82-4dad-b800-1e997cee7ae2', '我就是我,不一样烟火');
INSERT INTO `sys_message` VALUES (94, '05412acd-c80e-4744-a94b-7e9684da3f49', '我就是我,不一样烟火');
INSERT INTO `sys_message` VALUES (95, '0b8bb2bd-11e4-4822-83a1-26b6e3ee91e2', '我就是我,不一样烟火');
INSERT INTO `sys_message` VALUES (96, 'ebc84ce2-181e-4ae7-9864-eca28683ca68', '我就是我,不一样烟火');
INSERT INTO `sys_message` VALUES (97, 'eb3309d9-90c2-4aac-91bc-7daf1743f77a', '我就是我,不一样烟火');
INSERT INTO `sys_message` VALUES (98, 'fd0f1cae-e4f8-4b9c-a3c5-863b585618ea', '我就是我,不一样烟火');
INSERT INTO `sys_message` VALUES (99, '77d3a49d-9741-4e67-b584-3816786db559', '我就是我,不一样烟火');
INSERT INTO `sys_message` VALUES (100, '1b56b3d8-da91-4e05-ab49-6b11923b18ba', '我就是我,不一样烟火');
INSERT INTO `sys_message` VALUES (101, 'b8a3c9d8-2682-4b68-980d-ed03f08d00e1', '我就是我,不一样烟火');
INSERT INTO `sys_message` VALUES (102, '913924fd-995c-4383-b257-fcfd51757515', '我就是我,不一样烟火');
INSERT INTO `sys_message` VALUES (103, '430c5732-e373-4888-8cf3-81a91ac646e0', '我就是我,不一样烟火');
INSERT INTO `sys_message` VALUES (104, 'c3aa7059-16eb-4580-a9c8-5d64ab6d3991', '我就是我,不一样烟火');
INSERT INTO `sys_message` VALUES (105, 'c9df15a6-158e-4060-a528-205778f0ec91', '我就是我,不一样烟火');
INSERT INTO `sys_message` VALUES (106, 'eb91638a-4203-4736-9d2a-dbd8e07d09b0', '我就是我,不一样烟火');
INSERT INTO `sys_message` VALUES (107, 'd19a2204-7fe9-439e-9804-6f76f0ba6d8f', '我就是我,不一样烟火');
INSERT INTO `sys_message` VALUES (108, '00610353-b5ed-4a9b-9a71-95245ce5edcf', '我就是我,不一样烟火');
INSERT INTO `sys_message` VALUES (109, 'e55f9452-981a-4344-a533-67290aab7a69', '我就是我,不一样烟火');
INSERT INTO `sys_message` VALUES (110, '91991e25-6f1c-42b0-92e4-d81f281eecaf', '我就是我,不一样烟火');
INSERT INTO `sys_message` VALUES (111, 'f04a6415-1152-4565-9cfc-3d10eef7ad7d', '我就是我,不一样烟火');
INSERT INTO `sys_message` VALUES (112, '27b174e4-264b-4a48-9b5a-d1cc227799b2', '我就是我,不一样烟火');
INSERT INTO `sys_message` VALUES (113, '7df5528b-5fb2-4a65-8ce0-7595a953eb17', '我就是我,不一样烟火');
INSERT INTO `sys_message` VALUES (114, '7f1e6966-a20e-469a-9054-42522987863e', '我就是我,不一样烟火');
INSERT INTO `sys_message` VALUES (115, 'b12659c5-630b-46bc-82fd-834a010806d9', '我就是我,不一样烟火');
INSERT INTO `sys_message` VALUES (116, 'ba28d1bb-0498-4406-a4ce-f5d08632f184', '我就是我,不一样烟火');
INSERT INTO `sys_message` VALUES (117, 'caac8d07-6261-4ffe-87cd-99da9a19f507', '我就是我,不一样烟火');
INSERT INTO `sys_message` VALUES (118, 'b3c0abcb-dc8c-425f-980d-003e22ebb76d', '我就是我,不一样烟火');
INSERT INTO `sys_message` VALUES (119, '4d8958ee-a869-41e3-9b05-aab46031862f', '我就是我,不一样烟火');
INSERT INTO `sys_message` VALUES (120, '600c68ea-efb2-45be-aa43-115c92c6160c', '我就是我,不一样烟火');
INSERT INTO `sys_message` VALUES (121, '4fed720b-e019-4141-931e-46b0569c5390', '我就是我,不一样烟火');
INSERT INTO `sys_message` VALUES (122, 'a6e147ff-b59f-4e48-aa90-241f7224edc2', '我就是我,不一样烟火');
INSERT INTO `sys_message` VALUES (123, '4d3c9298-36c7-4b9e-8747-1395523f630a', '我就是我,不一样烟火');
INSERT INTO `sys_message` VALUES (124, 'd249223a-1752-40fe-b1e9-4f025735fa9d', '我就是我,不一样烟火');
INSERT INTO `sys_message` VALUES (125, 'e4fd66e7-2071-4fb9-8be6-437f47047a0e', '我就是我,不一样烟火');
INSERT INTO `sys_message` VALUES (126, '54f892aa-7c7e-4947-bdfa-a8427f61c9ab', '我就是我,不一样烟火');
INSERT INTO `sys_message` VALUES (127, '6185be77-c6ae-4c1c-aaf1-bcfd383f1f5d', '我就是我,不一样烟火');
INSERT INTO `sys_message` VALUES (128, '67c26698-c6c1-41e9-b6e1-bbc245f311f2', '我就是我,不一样烟火');
INSERT INTO `sys_message` VALUES (129, '9c9ce6b2-9f08-4256-b0ae-c5ae468b0010', '我就是我,不一样烟火');
INSERT INTO `sys_message` VALUES (130, 'c0e85870-f821-4bdd-8692-994e6f2f5b8f', '我就是我,不一样烟火');
INSERT INTO `sys_message` VALUES (131, 'f5525801-ca6a-4996-b6cf-a4332f668adb', '我就是我,不一样烟火');
INSERT INTO `sys_message` VALUES (132, '240ea61d-a083-4fe2-b822-d2fa253017de', '我就是我,不一样烟火');
-- ----------------------------
-- Table structure for sys_message_log
-- ----------------------------
DROP TABLE IF EXISTS `sys_message_log`;
CREATE TABLE `sys_message_log` (
`message_id` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT 'id',
`message` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '消息内容',
`try_Count` int(10) NULL DEFAULT NULL COMMENT '重试次数',
`status` varchar(2) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '状态: 0 -- 发送中,1-- 成功,2 --- 失败',
`is_del` int(2) NULL DEFAULT 0 COMMENT '0/1',
`next_retry` datetime(0) NULL DEFAULT NULL COMMENT '下一次重试的时间',
`create_time` datetime(0) NULL DEFAULT NULL COMMENT '创建时间',
`update_time` datetime(0) NULL DEFAULT NULL COMMENT '更新时间',
PRIMARY KEY (`message_id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of sys_message_log
-- ----------------------------
INSERT INTO `sys_message_log` VALUES ('240ea61d-a083-4fe2-b822-d2fa253017de', '{\"content\":\"我就是我,不一样烟火\",\"id\":132,\"messageId\":\"240ea61d-a083-4fe2-b822-d2fa253017de\"}', 0, '1', 0, '2019-08-09 17:59:31', '2019-08-09 17:58:31', '2019-08-09 17:58:31');
INSERT INTO `sys_message_log` VALUES ('4d3c9298-36c7-4b9e-8747-1395523f630a', '{\"content\":\"我就是我,不一样烟火\",\"id\":123,\"messageId\":\"4d3c9298-36c7-4b9e-8747-1395523f630a\"}', 0, '1', 0, '2019-08-09 17:59:30', '2019-08-09 17:58:30', '2019-08-09 17:58:30');
INSERT INTO `sys_message_log` VALUES ('4d8958ee-a869-41e3-9b05-aab46031862f', '{\"content\":\"我就是我,不一样烟火\",\"id\":119,\"messageId\":\"4d8958ee-a869-41e3-9b05-aab46031862f\"}', 0, '1', 0, '2019-08-09 17:59:29', '2019-08-09 17:58:29', '2019-08-09 17:58:29');
INSERT INTO `sys_message_log` VALUES ('4fed720b-e019-4141-931e-46b0569c5390', '{\"content\":\"我就是我,不一样烟火\",\"id\":121,\"messageId\":\"4fed720b-e019-4141-931e-46b0569c5390\"}', 0, '1', 0, '2019-08-09 17:59:29', '2019-08-09 17:58:29', '2019-08-09 17:58:29');
INSERT INTO `sys_message_log` VALUES ('54f892aa-7c7e-4947-bdfa-a8427f61c9ab', '{\"content\":\"我就是我,不一样烟火\",\"id\":126,\"messageId\":\"54f892aa-7c7e-4947-bdfa-a8427f61c9ab\"}', 1, '1', 0, '2019-08-09 18:00:30', '2019-08-09 17:58:30', '2019-08-09 17:59:30');
INSERT INTO `sys_message_log` VALUES ('600c68ea-efb2-45be-aa43-115c92c6160c', '{\"content\":\"我就是我,不一样烟火\",\"id\":120,\"messageId\":\"600c68ea-efb2-45be-aa43-115c92c6160c\"}', 0, '1', 0, '2019-08-09 17:59:29', '2019-08-09 17:58:29', '2019-08-09 17:58:29');
INSERT INTO `sys_message_log` VALUES ('6185be77-c6ae-4c1c-aaf1-bcfd383f1f5d', '{\"content\":\"我就是我,不一样烟火\",\"id\":127,\"messageId\":\"6185be77-c6ae-4c1c-aaf1-bcfd383f1f5d\"}', 0, '1', 0, '2019-08-09 17:59:30', '2019-08-09 17:58:30', '2019-08-09 17:58:30');
INSERT INTO `sys_message_log` VALUES ('67c26698-c6c1-41e9-b6e1-bbc245f311f2', '{\"content\":\"我就是我,不一样烟火\",\"id\":128,\"messageId\":\"67c26698-c6c1-41e9-b6e1-bbc245f311f2\"}', 0, '1', 0, '2019-08-09 17:59:30', '2019-08-09 17:58:30', '2019-08-09 17:58:30');
INSERT INTO `sys_message_log` VALUES ('9c9ce6b2-9f08-4256-b0ae-c5ae468b0010', '{\"content\":\"我就是我,不一样烟火\",\"id\":129,\"messageId\":\"9c9ce6b2-9f08-4256-b0ae-c5ae468b0010\"}', 0, '1', 0, '2019-08-09 17:59:30', '2019-08-09 17:58:30', '2019-08-09 17:58:30');
INSERT INTO `sys_message_log` VALUES ('a6e147ff-b59f-4e48-aa90-241f7224edc2', '{\"content\":\"我就是我,不一样烟火\",\"id\":122,\"messageId\":\"a6e147ff-b59f-4e48-aa90-241f7224edc2\"}', 0, '1', 0, '2019-08-09 17:59:29', '2019-08-09 17:58:29', '2019-08-09 17:58:29');
INSERT INTO `sys_message_log` VALUES ('b12659c5-630b-46bc-82fd-834a010806d9', '{\"content\":\"我就是我,不一样烟火\",\"id\":115,\"messageId\":\"b12659c5-630b-46bc-82fd-834a010806d9\"}', 0, '1', 0, '2019-08-09 17:59:28', '2019-08-09 17:58:28', '2019-08-09 17:58:28');
INSERT INTO `sys_message_log` VALUES ('b3c0abcb-dc8c-425f-980d-003e22ebb76d', '{\"content\":\"我就是我,不一样烟火\",\"id\":118,\"messageId\":\"b3c0abcb-dc8c-425f-980d-003e22ebb76d\"}', 0, '1', 0, '2019-08-09 17:59:29', '2019-08-09 17:58:29', '2019-08-09 17:58:29');
INSERT INTO `sys_message_log` VALUES ('ba28d1bb-0498-4406-a4ce-f5d08632f184', '{\"content\":\"我就是我,不一样烟火\",\"id\":116,\"messageId\":\"ba28d1bb-0498-4406-a4ce-f5d08632f184\"}', 0, '1', 0, '2019-08-09 17:59:28', '2019-08-09 17:58:28', '2019-08-09 17:58:28');
INSERT INTO `sys_message_log` VALUES ('c0e85870-f821-4bdd-8692-994e6f2f5b8f', '{\"content\":\"我就是我,不一样烟火\",\"id\":130,\"messageId\":\"c0e85870-f821-4bdd-8692-994e6f2f5b8f\"}', 0, '1', 0, '2019-08-09 17:59:31', '2019-08-09 17:58:31', '2019-08-09 17:58:31');
INSERT INTO `sys_message_log` VALUES ('caac8d07-6261-4ffe-87cd-99da9a19f507', '{\"content\":\"我就是我,不一样烟火\",\"id\":117,\"messageId\":\"caac8d07-6261-4ffe-87cd-99da9a19f507\"}', 0, '1', 0, '2019-08-09 17:59:29', '2019-08-09 17:58:29', '2019-08-09 17:58:29');
INSERT INTO `sys_message_log` VALUES ('d249223a-1752-40fe-b1e9-4f025735fa9d', '{\"content\":\"我就是我,不一样烟火\",\"id\":124,\"messageId\":\"d249223a-1752-40fe-b1e9-4f025735fa9d\"}', 0, '1', 0, '2019-08-09 17:59:30', '2019-08-09 17:58:30', '2019-08-09 17:58:30');
INSERT INTO `sys_message_log` VALUES ('e4fd66e7-2071-4fb9-8be6-437f47047a0e', '{\"content\":\"我就是我,不一样烟火\",\"id\":125,\"messageId\":\"e4fd66e7-2071-4fb9-8be6-437f47047a0e\"}', 1, '1', 0, '2019-08-09 18:00:30', '2019-08-09 17:58:30', '2019-08-09 17:59:30');
INSERT INTO `sys_message_log` VALUES ('f5525801-ca6a-4996-b6cf-a4332f668adb', '{\"content\":\"我就是我,不一样烟火\",\"id\":131,\"messageId\":\"f5525801-ca6a-4996-b6cf-a4332f668adb\"}', 0, '1', 0, '2019-08-09 17:59:31', '2019-08-09 17:58:31', '2019-08-09 17:58:31');
SET FOREIGN_KEY_CHECKS = 1; | the_stack |
select * from sometable
=
SELECT *
FROM sometable
select 'foo' as barname,b,c from sometable where c between 1 and 2
=
SELECT 'foo' AS barname
, b
, c
FROM sometable
WHERE c BETWEEN 1 AND 2
select 'foo' as barname,b,c from sometable where c between 1 and 2
=
SELECT 'foo' AS barname, b, c
FROM sometable
WHERE c BETWEEN 1 AND 2
:
{'compact_lists_margin': 80}
select 'foo' as barname,b,c,
(select somevalue
from othertable
where othertable.x = 1 and othertable.y = 2 and othertable.z = 3)
from sometable where c between 1 and 2
=
SELECT 'foo' AS barname
, b
, c
, (SELECT somevalue
FROM othertable
WHERE (othertable.x = 1)
AND (othertable.y = 2)
AND (othertable.z = 3))
FROM sometable
WHERE c BETWEEN 1 AND 2
select 'foo' as barname,b,c,
(select somevalue
from othertable
where othertable.x = 1 and othertable.y = 2 and othertable.z = 3)
from sometable where c between 1 and 2
=
SELECT 'foo' AS barname
, b
, c
, (SELECT somevalue
FROM othertable
WHERE (othertable.x = 1) AND (othertable.y = 2) AND (othertable.z = 3))
FROM sometable
WHERE c BETWEEN 1 AND 2
:
{'compact_lists_margin': 80}
select 'foo' as barname,b,c,
(select somevalue
from othertable
where othertable.x = 1 and othertable.y = 2 and othertable.z = 3)
from sometable where c between 1 and 2
=
SELECT 'foo' AS barname
, b
, c
, (SELECT somevalue
FROM othertable
WHERE (othertable.x = 1)
AND (othertable.y = 2)
AND (othertable.z = 3))
FROM sometable
WHERE c BETWEEN 1 AND 2
:
{'compact_lists_margin': 75}
select 'foo' as barname,b,c,
(select somevalue
from othertable
where othertable.x = 1 and othertable.y = 2 and othertable.z = 3)
from sometable where c between 1 and 2
=
SELECT 'foo' AS barname,
b,
c,
(SELECT somevalue
FROM othertable
WHERE (othertable.x = 1)
AND (othertable.y = 2)
AND (othertable.z = 3))
FROM sometable
WHERE c BETWEEN 1 AND 2
:
{'comma_at_eoln': True}
select 'foo' as barname,b,c from sometable where c between 1 and c.threshold
=
SELECT 'foo' AS barname
, b
, c
FROM sometable
WHERE c BETWEEN 1 AND c.threshold
select somefunc(1, 2, 3)
=
SELECT somefunc(1, 2, 3)
SELECT pe.id
FROM table1 as pe
INNER JOIN table2 AS pr ON pe.project_id = pr.id
LEFT JOIN table3 AS cp ON cp.person_id = pe.id
INNER JOIN table4 AS c ON cp.company_id = c.id
=
SELECT pe.id
FROM table1 AS pe
INNER JOIN table2 AS pr ON pe.project_id = pr.id
LEFT JOIN table3 AS cp ON cp.person_id = pe.id
INNER JOIN table4 AS c ON cp.company_id = c.id
SELECT pe.id
FROM table1 as pe
INNER JOIN table2 AS pr ON pe.project_id = pr.id
LEFT JOIN (table3 AS cp INNER JOIN table4 AS c ON cp.company_id = c.id)
ON cp.person_id = pe.id
=
SELECT pe.id
FROM table1 AS pe
INNER JOIN table2 AS pr ON pe.project_id = pr.id
LEFT JOIN (table3 AS cp
INNER JOIN table4 AS c ON cp.company_id = c.id)
ON cp.person_id = pe.id
SELECT sum(salary) OVER (x), avg(salary) OVER y
FROM empsalary
WINDOW x AS (PARTITION BY depname ORDER BY salary DESC),
y as (order by salary)
=
SELECT sum(salary) OVER (x)
, avg(salary) OVER y
FROM empsalary
WINDOW x AS (PARTITION BY depname
ORDER BY salary DESC)
, y AS (ORDER BY salary)
select c_id
from (select c_id, row_number() over (order by c_d_id) as rn, count(*) over() max_rn
from customer where c_d_id=5) t
where rn = (select floor(random()*(max_rn))+1)
=
SELECT c_id
FROM (SELECT c_id
, row_number() OVER (ORDER BY c_d_id) AS rn
, count(*) OVER () AS max_rn
FROM customer
WHERE c_d_id = 5) AS t
WHERE rn = (SELECT (floor((random() * max_rn)) + 1))
select a.* from a left join (select distinct id from b) as b on a.id = b.id
=
SELECT a.*
FROM a
LEFT JOIN (SELECT DISTINCT id
FROM b) AS b ON a.id = b.id
select a.one,
not a.bool_flag and a.something is null or a.other = 3 as foo,
a.value1 + b.value2 * b.value3 as bar
from sometable as a
where not a.bool_flag2 and a.something2 is null or a.other2 = 3
=
SELECT a.one
, ( ( (NOT a.bool_flag)
AND (a.something IS NULL))
OR (a.other = 3)) AS foo
, a.value1 + ((b.value2 * b.value3)) AS bar
FROM sometable AS a
WHERE (( (NOT a.bool_flag2)
AND (a.something2 IS NULL))
OR (a.other2 = 3))
select p.name, (select format('[%s] %s', count(*), r.name)
from c join r on r.contract_id = c.id
where c.person_id = p.id) as roles
from persons as p
where p.name like 'lele%' and ((select format('[%s] %s', count(*), r.name)
from c join r on r.contract_id = c.id
where c.person_id = p.id) ilike 'manager%')
=
SELECT p.name
, (SELECT format('[%s] %s'
, count(*)
, r.name)
FROM c
INNER JOIN r ON r.contract_id = c.id
WHERE c.person_id = p.id) AS roles
FROM persons AS p
WHERE p.name LIKE 'lele%'
AND (SELECT format('[%s] %s'
, count(*)
, r.name)
FROM c
INNER JOIN r ON (r.contract_id = c.id)
WHERE (c.person_id = p.id)) ILIKE 'manager%'
SELECT
'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijkl'
'mnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890'
=
SELECT 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWX'
'YZabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUV'
'WXYZ1234567890'
:
{'split_string_literals_threshold': 50}
SELECT
'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijkl'
'mnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ
1234567890'
=
SELECT E'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWX'
'YZabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUV'
'WXYZ\n1234567890'
:
{'split_string_literals_threshold': 50}
SELECT '1234567890\abcdefghi'
=
SELECT '1234567890\a'
'bcdefghi'
:
{'split_string_literals_threshold': 11}
SELECT TIMESTAMP '2001-02-16 20:38:40' AT TIME ZONE 'MST'
=
SELECT pg_catalog.timezone('MST'
, CAST('2001-02-16 20:38:40' AS timestamp))
SELECT TIMESTAMP '2001-02-16 20:38:40' AT TIME ZONE 'MST'
=
SELECT CAST('2001-02-16 20:38:40' AS timestamp) AT TIME ZONE 'MST'
:
{'special_functions': True}
SELECT * FROM manufacturers
ORDER BY EXTRACT('year' FROM deliver_date) ASC,
EXTRACT('month' FROM deliver_date) ASC,
EXTRACT('day' FROM deliver_date) ASC
=
SELECT *
FROM manufacturers
ORDER BY pg_catalog.date_part('year', deliver_date) ASC
, pg_catalog.date_part('month', deliver_date) ASC
, pg_catalog.date_part('day', deliver_date) ASC
SELECT * FROM manufacturers
ORDER BY EXTRACT('year' FROM deliver_date) ASC,
EXTRACT(month FROM deliver_date) ASC,
EXTRACT('day' FROM deliver_date) ASC
=
SELECT *
FROM manufacturers
ORDER BY EXTRACT(YEAR FROM deliver_date) ASC
, EXTRACT(MONTH FROM deliver_date) ASC
, EXTRACT(DAY FROM deliver_date) ASC
:
{'special_functions': True}
SELECT (DATE '2001-02-16', DATE '2001-12-21') OVERLAPS
(DATE '2001-10-30', DATE '2002-10-30')
=
SELECT pg_catalog."overlaps"(CAST('2001-02-16' AS date)
, CAST('2001-12-21' AS date)
, CAST('2001-10-30' AS date)
, CAST('2002-10-30' AS date))
SELECT (DATE '2001-02-16', DATE '2001-12-21') OVERLAPS
(DATE '2001-10-30', DATE '2002-10-30')
=
SELECT (CAST('2001-02-16' AS date), CAST('2001-12-21' AS date)) OVERLAPS (CAST('2001-10-30' AS date), CAST('2002-10-30' AS date))
:
{'special_functions': True}
select email from subscribed where email not in (select email from tracks)
=
SELECT email
FROM subscribed
WHERE NOT email IN (SELECT email
FROM tracks)
SELECT true FROM sometable WHERE value = ANY(ARRAY[1,2])
=
SELECT TRUE
FROM sometable
WHERE value = ANY(ARRAY[1, 2])
SELECT false FROM sometable WHERE value != ALL(ARRAY[1,2])
=
SELECT FALSE
FROM sometable
WHERE value <> ALL(ARRAY[1, 2])
select c.name from table_a a, table_b b join table_c c on c.b_id = b.id where a.code = b.code
=
SELECT c.name
FROM table_a AS a
, table_b AS b
INNER JOIN table_c AS c ON c.b_id = b.id
WHERE a.code = b.code
select c.name from table_b b join table_c c on c.b_id = b.id, table_a a where a.code = b.code
=
SELECT c.name
FROM table_b AS b
INNER JOIN table_c AS c ON c.b_id = b.id
, table_a AS a
WHERE a.code = b.code
SELECT id, CASE WHEN (NOT EXISTS (SELECT TRUE FROM aaa WHERE a = 1) or exists (select true from bbb where b = 2)) and id=1 THEN NULL ELSE NOT EXISTS (SELECT TRUE FROM ccc WHERE c = 1) END FROM bar
=
SELECT id
, CASE
WHEN ( (( (NOT EXISTS (SELECT TRUE
FROM aaa
WHERE (a = 1)))
OR EXISTS (SELECT TRUE
FROM bbb
WHERE (b = 2))))
AND (id = 1))
THEN NULL
ELSE NOT EXISTS (SELECT TRUE
FROM ccc
WHERE (c = 1))
END
FROM bar
select case a.a when 1 then 'one' when 2 then 'two' else 'something else' end from a
=
SELECT CASE a.a
WHEN 1
THEN 'one'
WHEN 2
THEN 'two'
ELSE 'something else'
END
FROM a
select case a.a when 1 then (select b from b) when 2 then (select c from c) else (select d from d) end from a
=
SELECT CASE a.a
WHEN 1
THEN (SELECT b
FROM b)
WHEN 2
THEN (SELECT c
FROM c)
ELSE (SELECT d
FROM d)
END
FROM a
(select x from d1 order by y) intersect (select n from d2 group by y limit 3) limit 2
=
(SELECT x
FROM d1
ORDER BY y)
\n\
INTERSECT
\n\
(SELECT n
FROM d2
GROUP BY y
LIMIT 3)
LIMIT 2
/*
header
*/ select /*one*/ 1
/*footer*/
=
/*
header
*/
SELECT /*one*/ 1
/*footer*/\s
:
{'preserve_comments': True}
-- header 1
-- header 2
select /*one*/ 1
/*
long
footer
*/
=
-- header 1
-- header 2
SELECT /*one*/ 1
/*
long
footer
*/\
:
{'preserve_comments': True}
-- header 1
-- header 2
select /*one*/ 1
/*
long
footer
*/
=
/*header 1*/ /*header 2*/ SELECT /*one*/ 1 /*long footer */
:
{'preserve_comments': True, 'raw_stream': True} | the_stack |
-- 2021-03-01T10:54:37.015Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Element_Trl SET Description='', Name='Valuta Datum', PrintName='Valuta Datum',Updated=TO_TIMESTAMP('2021-03-01 12:54:37','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=1487 AND AD_Language='fr_CH'
;
-- 2021-03-01T10:54:37.046Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
/* DDL */ select update_TRL_Tables_On_AD_Element_TRL_Update(1487,'fr_CH')
;
-- 2021-03-01T10:54:44.590Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Element_Trl SET Name='Valuta Date', PrintName='Valuta Date',Updated=TO_TIMESTAMP('2021-03-01 12:54:44','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=1487 AND AD_Language='fr_CH'
;
-- 2021-03-01T10:54:44.591Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
/* DDL */ select update_TRL_Tables_On_AD_Element_TRL_Update(1487,'fr_CH')
;
-- 2021-03-01T10:55:02.296Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Element_Trl SET Description='', Name='Valuta Date', PrintName='Valuta Date',Updated=TO_TIMESTAMP('2021-03-01 12:55:02','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=1487 AND AD_Language='it_CH'
;
-- 2021-03-01T10:55:02.297Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
/* DDL */ select update_TRL_Tables_On_AD_Element_TRL_Update(1487,'it_CH')
;
-- 2021-03-01T10:55:11.002Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Element_Trl SET Description='', Name='Valuta Date', PrintName='Valuta Date',Updated=TO_TIMESTAMP('2021-03-01 12:55:11','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=1487 AND AD_Language='en_GB'
;
-- 2021-03-01T10:55:11.003Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
/* DDL */ select update_TRL_Tables_On_AD_Element_TRL_Update(1487,'en_GB')
;
-- 2021-03-01T10:55:38.144Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Element_Trl SET Description='', Help='', Name='Valuta Date', PrintName='Valuta Date',Updated=TO_TIMESTAMP('2021-03-01 12:55:38','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=1487 AND AD_Language='en_US'
;
-- 2021-03-01T10:55:38.145Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
/* DDL */ select update_TRL_Tables_On_AD_Element_TRL_Update(1487,'en_US')
;
-- 2021-03-01T10:55:39.066Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Element_Trl SET Help='',Updated=TO_TIMESTAMP('2021-03-01 12:55:39','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=1487 AND AD_Language='de_CH'
;
-- 2021-03-01T10:55:39.067Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
/* DDL */ select update_TRL_Tables_On_AD_Element_TRL_Update(1487,'de_CH')
;
-- 2021-03-01T10:55:39.658Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Element_Trl SET Help='',Updated=TO_TIMESTAMP('2021-03-01 12:55:39','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=1487 AND AD_Language='en_GB'
;
-- 2021-03-01T10:55:39.659Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
/* DDL */ select update_TRL_Tables_On_AD_Element_TRL_Update(1487,'en_GB')
;
-- 2021-03-01T10:55:40.372Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Element_Trl SET Help='',Updated=TO_TIMESTAMP('2021-03-01 12:55:40','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=1487 AND AD_Language='it_CH'
;
-- 2021-03-01T10:55:40.373Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
/* DDL */ select update_TRL_Tables_On_AD_Element_TRL_Update(1487,'it_CH')
;
-- 2021-03-01T10:55:41.408Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Element_Trl SET Help='',Updated=TO_TIMESTAMP('2021-03-01 12:55:41','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=1487 AND AD_Language='fr_CH'
;
-- 2021-03-01T10:55:41.409Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
/* DDL */ select update_TRL_Tables_On_AD_Element_TRL_Update(1487,'fr_CH')
;
-- 2021-03-01T10:55:42.127Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Element_Trl SET Help='',Updated=TO_TIMESTAMP('2021-03-01 12:55:42','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=1487 AND AD_Language='nl_NL'
;
-- 2021-03-01T10:55:42.128Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
/* DDL */ select update_TRL_Tables_On_AD_Element_TRL_Update(1487,'nl_NL')
;
-- 2021-03-01T10:55:44.953Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Element_Trl SET Help='',Updated=TO_TIMESTAMP('2021-03-01 12:55:44','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=1487 AND AD_Language='de_DE'
;
-- 2021-03-01T10:55:44.954Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
/* DDL */ select update_TRL_Tables_On_AD_Element_TRL_Update(1487,'de_DE')
;
-- 2021-03-01T10:55:44.979Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
/* DDL */ select update_ad_element_on_ad_element_trl_update(1487,'de_DE')
;
-- 2021-03-01T10:55:44.985Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Column SET ColumnName='ValutaDate', Name='Effektives Datum', Description='Date when money is available', Help='' WHERE AD_Element_ID=1487
;
-- 2021-03-01T10:55:44.987Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Process_Para SET ColumnName='ValutaDate', Name='Effektives Datum', Description='Date when money is available', Help='', AD_Element_ID=1487 WHERE UPPER(ColumnName)='VALUTADATE' AND IsCentrallyMaintained='Y' AND AD_Element_ID IS NULL
;
-- 2021-03-01T10:55:44.991Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Process_Para SET ColumnName='ValutaDate', Name='Effektives Datum', Description='Date when money is available', Help='' WHERE AD_Element_ID=1487 AND IsCentrallyMaintained='Y'
;
-- 2021-03-01T10:55:44.991Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Field SET Name='Effektives Datum', Description='Date when money is available', Help='' WHERE (AD_Column_ID IN (SELECT AD_Column_ID FROM AD_Column WHERE AD_Element_ID=1487) AND AD_Name_ID IS NULL ) OR (AD_Name_ID = 1487)
;
-- 2021-03-01T10:55:45.029Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Tab SET Name='Effektives Datum', Description='Date when money is available', Help='', CommitWarning = NULL WHERE AD_Element_ID = 1487
;
-- 2021-03-01T10:55:45.031Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_WINDOW SET Name='Effektives Datum', Description='Date when money is available', Help='' WHERE AD_Element_ID = 1487
;
-- 2021-03-01T10:55:45.031Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Menu SET Name = 'Effektives Datum', Description = 'Date when money is available', WEBUI_NameBrowse = NULL, WEBUI_NameNew = NULL, WEBUI_NameNewBreadcrumb = NULL WHERE AD_Element_ID = 1487
;
-- 2021-03-01T10:55:47.123Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Element_Trl SET Description='',Updated=TO_TIMESTAMP('2021-03-01 12:55:47','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=1487 AND AD_Language='de_CH'
;
-- 2021-03-01T10:55:47.123Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
/* DDL */ select update_TRL_Tables_On_AD_Element_TRL_Update(1487,'de_CH')
;
-- 2021-03-01T10:55:49.148Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Element_Trl SET Description='',Updated=TO_TIMESTAMP('2021-03-01 12:55:49','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=1487 AND AD_Language='nl_NL'
;
-- 2021-03-01T10:55:49.149Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
/* DDL */ select update_TRL_Tables_On_AD_Element_TRL_Update(1487,'nl_NL')
;
-- 2021-03-01T10:56:08.633Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Element_Trl SET Description='',Updated=TO_TIMESTAMP('2021-03-01 12:56:08','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=1487 AND AD_Language='de_DE'
;
-- 2021-03-01T10:56:08.633Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
/* DDL */ select update_TRL_Tables_On_AD_Element_TRL_Update(1487,'de_DE')
;
-- 2021-03-01T10:56:08.638Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
/* DDL */ select update_ad_element_on_ad_element_trl_update(1487,'de_DE')
;
-- 2021-03-01T10:56:08.639Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Column SET ColumnName='ValutaDate', Name='Effektives Datum', Description='', Help='' WHERE AD_Element_ID=1487
;
-- 2021-03-01T10:56:08.640Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Process_Para SET ColumnName='ValutaDate', Name='Effektives Datum', Description='', Help='', AD_Element_ID=1487 WHERE UPPER(ColumnName)='VALUTADATE' AND IsCentrallyMaintained='Y' AND AD_Element_ID IS NULL
;
-- 2021-03-01T10:56:08.640Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Process_Para SET ColumnName='ValutaDate', Name='Effektives Datum', Description='', Help='' WHERE AD_Element_ID=1487 AND IsCentrallyMaintained='Y'
;
-- 2021-03-01T10:56:08.641Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Field SET Name='Effektives Datum', Description='', Help='' WHERE (AD_Column_ID IN (SELECT AD_Column_ID FROM AD_Column WHERE AD_Element_ID=1487) AND AD_Name_ID IS NULL ) OR (AD_Name_ID = 1487)
;
-- 2021-03-01T10:56:08.656Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Tab SET Name='Effektives Datum', Description='', Help='', CommitWarning = NULL WHERE AD_Element_ID = 1487
;
-- 2021-03-01T10:56:08.657Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_WINDOW SET Name='Effektives Datum', Description='', Help='' WHERE AD_Element_ID = 1487
;
-- 2021-03-01T10:56:08.658Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Menu SET Name = 'Effektives Datum', Description = '', WEBUI_NameBrowse = NULL, WEBUI_NameNew = NULL, WEBUI_NameNewBreadcrumb = NULL WHERE AD_Element_ID = 1487
;
-- 2021-03-01T10:56:17.123Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Element_Trl SET Name='Valuta Date', PrintName='Valuta Date',Updated=TO_TIMESTAMP('2021-03-01 12:56:17','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=1487 AND AD_Language='nl_NL'
;
-- 2021-03-01T10:56:17.123Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
/* DDL */ select update_TRL_Tables_On_AD_Element_TRL_Update(1487,'nl_NL')
;
-- 2021-03-01T10:56:32.367Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Element_Trl SET Name='Valuta Datum', PrintName='Valuta Datum',Updated=TO_TIMESTAMP('2021-03-01 12:56:32','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=1487 AND AD_Language='de_CH'
;
-- 2021-03-01T10:56:32.368Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
/* DDL */ select update_TRL_Tables_On_AD_Element_TRL_Update(1487,'de_CH')
;
-- 2021-03-01T10:56:37.778Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Element_Trl SET Name='Valuta Datum', PrintName='Valuta Datum',Updated=TO_TIMESTAMP('2021-03-01 12:56:37','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=1487 AND AD_Language='de_DE'
;
-- 2021-03-01T10:56:37.778Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
/* DDL */ select update_TRL_Tables_On_AD_Element_TRL_Update(1487,'de_DE')
;
-- 2021-03-01T10:56:37.783Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
/* DDL */ select update_ad_element_on_ad_element_trl_update(1487,'de_DE')
;
-- 2021-03-01T10:56:37.795Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Column SET ColumnName='ValutaDate', Name='Valuta Datum', Description='', Help='' WHERE AD_Element_ID=1487
;
-- 2021-03-01T10:56:37.797Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Process_Para SET ColumnName='ValutaDate', Name='Valuta Datum', Description='', Help='', AD_Element_ID=1487 WHERE UPPER(ColumnName)='VALUTADATE' AND IsCentrallyMaintained='Y' AND AD_Element_ID IS NULL
;
-- 2021-03-01T10:56:37.799Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Process_Para SET ColumnName='ValutaDate', Name='Valuta Datum', Description='', Help='' WHERE AD_Element_ID=1487 AND IsCentrallyMaintained='Y'
;
-- 2021-03-01T10:56:37.800Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Field SET Name='Valuta Datum', Description='', Help='' WHERE (AD_Column_ID IN (SELECT AD_Column_ID FROM AD_Column WHERE AD_Element_ID=1487) AND AD_Name_ID IS NULL ) OR (AD_Name_ID = 1487)
;
-- 2021-03-01T10:56:37.812Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_PrintFormatItem pi SET PrintName='Valuta Datum', Name='Valuta Datum' WHERE IsCentrallyMaintained='Y' AND EXISTS (SELECT * FROM AD_Column c WHERE c.AD_Column_ID=pi.AD_Column_ID AND c.AD_Element_ID=1487)
;
-- 2021-03-01T10:56:37.815Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Tab SET Name='Valuta Datum', Description='', Help='', CommitWarning = NULL WHERE AD_Element_ID = 1487
;
-- 2021-03-01T10:56:37.816Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_WINDOW SET Name='Valuta Datum', Description='', Help='' WHERE AD_Element_ID = 1487
;
-- 2021-03-01T10:56:37.817Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Menu SET Name = 'Valuta Datum', Description = '', WEBUI_NameBrowse = NULL, WEBUI_NameNew = NULL, WEBUI_NameNewBreadcrumb = NULL WHERE AD_Element_ID = 1487
;
-- 2021-03-01T10:57:19.244Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Element_Trl SET Description='', Name='Effective date', PrintName='Effective date',Updated=TO_TIMESTAMP('2021-03-01 12:57:19','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=2300 AND AD_Language='en_GB'
;
-- 2021-03-01T10:57:19.245Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
/* DDL */ select update_TRL_Tables_On_AD_Element_TRL_Update(2300,'en_GB')
;
-- 2021-03-01T10:57:20.476Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Element_Trl SET Description='',Updated=TO_TIMESTAMP('2021-03-01 12:57:20','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=2300 AND AD_Language='de_CH'
;
-- 2021-03-01T10:57:20.477Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
/* DDL */ select update_TRL_Tables_On_AD_Element_TRL_Update(2300,'de_CH')
;
-- 2021-03-01T10:57:21.554Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Element_Trl SET Description='',Updated=TO_TIMESTAMP('2021-03-01 12:57:21','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=2300 AND AD_Language='en_US'
;
-- 2021-03-01T10:57:21.554Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
/* DDL */ select update_TRL_Tables_On_AD_Element_TRL_Update(2300,'en_US')
;
-- 2021-03-01T10:57:22.260Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Element_Trl SET Description='',Updated=TO_TIMESTAMP('2021-03-01 12:57:22','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=2300 AND AD_Language='nl_NL'
;
-- 2021-03-01T10:57:22.261Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
/* DDL */ select update_TRL_Tables_On_AD_Element_TRL_Update(2300,'nl_NL')
;
-- 2021-03-01T10:57:23.113Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Element_Trl SET Description='',Updated=TO_TIMESTAMP('2021-03-01 12:57:23','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=2300 AND AD_Language='de_DE'
;
-- 2021-03-01T10:57:23.114Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
/* DDL */ select update_TRL_Tables_On_AD_Element_TRL_Update(2300,'de_DE')
;
-- 2021-03-01T10:57:23.121Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
/* DDL */ select update_ad_element_on_ad_element_trl_update(2300,'de_DE')
;
-- 2021-03-01T10:57:23.123Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Column SET ColumnName='StatementLineDate', Name='Valuta Datum', Description='', Help=NULL WHERE AD_Element_ID=2300
;
-- 2021-03-01T10:57:23.124Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Process_Para SET ColumnName='StatementLineDate', Name='Valuta Datum', Description='', Help=NULL, AD_Element_ID=2300 WHERE UPPER(ColumnName)='STATEMENTLINEDATE' AND IsCentrallyMaintained='Y' AND AD_Element_ID IS NULL
;
-- 2021-03-01T10:57:23.125Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Process_Para SET ColumnName='StatementLineDate', Name='Valuta Datum', Description='', Help=NULL WHERE AD_Element_ID=2300 AND IsCentrallyMaintained='Y'
;
-- 2021-03-01T10:57:23.125Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Field SET Name='Valuta Datum', Description='', Help=NULL WHERE (AD_Column_ID IN (SELECT AD_Column_ID FROM AD_Column WHERE AD_Element_ID=2300) AND AD_Name_ID IS NULL ) OR (AD_Name_ID = 2300)
;
-- 2021-03-01T10:57:23.150Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Tab SET Name='Valuta Datum', Description='', Help=NULL, CommitWarning = NULL WHERE AD_Element_ID = 2300
;
-- 2021-03-01T10:57:23.151Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_WINDOW SET Name='Valuta Datum', Description='', Help=NULL WHERE AD_Element_ID = 2300
;
-- 2021-03-01T10:57:23.152Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Menu SET Name = 'Valuta Datum', Description = '', WEBUI_NameBrowse = NULL, WEBUI_NameNew = NULL, WEBUI_NameNewBreadcrumb = NULL WHERE AD_Element_ID = 2300
;
-- 2021-03-01T10:57:23.709Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Element_Trl SET Description='',Updated=TO_TIMESTAMP('2021-03-01 12:57:23','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=2300 AND AD_Language='it_CH'
;
-- 2021-03-01T10:57:23.710Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
/* DDL */ select update_TRL_Tables_On_AD_Element_TRL_Update(2300,'it_CH')
;
-- 2021-03-01T10:57:33.727Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Element_Trl SET Description='', Name='Effective date', PrintName='Effective date',Updated=TO_TIMESTAMP('2021-03-01 12:57:33','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=2300 AND AD_Language='fr_CH'
;
-- 2021-03-01T10:57:33.728Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
/* DDL */ select update_TRL_Tables_On_AD_Element_TRL_Update(2300,'fr_CH')
;
-- 2021-03-01T10:57:41.085Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Element_Trl SET Name='Effective date', PrintName='Effective date',Updated=TO_TIMESTAMP('2021-03-01 12:57:41','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=2300 AND AD_Language='it_CH'
;
-- 2021-03-01T10:57:41.085Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
/* DDL */ select update_TRL_Tables_On_AD_Element_TRL_Update(2300,'it_CH')
;
-- 2021-03-01T10:57:43.216Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Element_Trl SET Name='Effective date',Updated=TO_TIMESTAMP('2021-03-01 12:57:43','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=2300 AND AD_Language='en_US'
;
-- 2021-03-01T10:57:43.217Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
/* DDL */ select update_TRL_Tables_On_AD_Element_TRL_Update(2300,'en_US')
;
-- 2021-03-01T10:57:58.177Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Element_Trl SET Name='Effective date',Updated=TO_TIMESTAMP('2021-03-01 12:57:58','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=2300 AND AD_Language='nl_NL'
;
-- 2021-03-01T10:57:58.178Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
/* DDL */ select update_TRL_Tables_On_AD_Element_TRL_Update(2300,'nl_NL')
;
-- 2021-03-01T10:58:01.089Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Element_Trl SET Name='Effektives Datum',Updated=TO_TIMESTAMP('2021-03-01 12:58:01','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=2300 AND AD_Language='de_CH'
;
-- 2021-03-01T10:58:01.090Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
/* DDL */ select update_TRL_Tables_On_AD_Element_TRL_Update(2300,'de_CH')
;
-- 2021-03-01T10:58:04.837Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Element_Trl SET Name='Effektives Datum',Updated=TO_TIMESTAMP('2021-03-01 12:58:04','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=2300 AND AD_Language='de_DE'
;
-- 2021-03-01T10:58:04.838Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
/* DDL */ select update_TRL_Tables_On_AD_Element_TRL_Update(2300,'de_DE')
;
-- 2021-03-01T10:58:04.842Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
/* DDL */ select update_ad_element_on_ad_element_trl_update(2300,'de_DE')
;
-- 2021-03-01T10:58:04.842Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Column SET ColumnName='StatementLineDate', Name='Effektives Datum', Description='', Help=NULL WHERE AD_Element_ID=2300
;
-- 2021-03-01T10:58:04.843Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Process_Para SET ColumnName='StatementLineDate', Name='Effektives Datum', Description='', Help=NULL, AD_Element_ID=2300 WHERE UPPER(ColumnName)='STATEMENTLINEDATE' AND IsCentrallyMaintained='Y' AND AD_Element_ID IS NULL
;
-- 2021-03-01T10:58:04.844Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Process_Para SET ColumnName='StatementLineDate', Name='Effektives Datum', Description='', Help=NULL WHERE AD_Element_ID=2300 AND IsCentrallyMaintained='Y'
;
-- 2021-03-01T10:58:04.844Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Field SET Name='Effektives Datum', Description='', Help=NULL WHERE (AD_Column_ID IN (SELECT AD_Column_ID FROM AD_Column WHERE AD_Element_ID=2300) AND AD_Name_ID IS NULL ) OR (AD_Name_ID = 2300)
;
-- 2021-03-01T10:58:04.856Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_PrintFormatItem pi SET PrintName='Valuta Datum', Name='Effektives Datum' WHERE IsCentrallyMaintained='Y' AND EXISTS (SELECT * FROM AD_Column c WHERE c.AD_Column_ID=pi.AD_Column_ID AND c.AD_Element_ID=2300)
;
-- 2021-03-01T10:58:04.856Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Tab SET Name='Effektives Datum', Description='', Help=NULL, CommitWarning = NULL WHERE AD_Element_ID = 2300
;
-- 2021-03-01T10:58:04.857Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_WINDOW SET Name='Effektives Datum', Description='', Help=NULL WHERE AD_Element_ID = 2300
;
-- 2021-03-01T10:58:04.858Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Menu SET Name = 'Effektives Datum', Description = '', WEBUI_NameBrowse = NULL, WEBUI_NameNew = NULL, WEBUI_NameNewBreadcrumb = NULL WHERE AD_Element_ID = 2300
;
-- 2021-03-01T10:58:06.129Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Element_Trl SET PrintName='Effektives Datum',Updated=TO_TIMESTAMP('2021-03-01 12:58:06','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=2300 AND AD_Language='de_CH'
;
-- 2021-03-01T10:58:06.129Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
/* DDL */ select update_TRL_Tables_On_AD_Element_TRL_Update(2300,'de_CH')
;
-- 2021-03-01T10:58:11.529Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Element_Trl SET PrintName='Effektives Datum',Updated=TO_TIMESTAMP('2021-03-01 12:58:11','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=2300 AND AD_Language='de_DE'
;
-- 2021-03-01T10:58:11.530Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
/* DDL */ select update_TRL_Tables_On_AD_Element_TRL_Update(2300,'de_DE')
;
-- 2021-03-01T10:58:11.535Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
/* DDL */ select update_ad_element_on_ad_element_trl_update(2300,'de_DE')
;
-- 2021-03-01T10:58:11.536Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_PrintFormatItem pi SET PrintName='Effektives Datum', Name='Effektives Datum' WHERE IsCentrallyMaintained='Y' AND EXISTS (SELECT * FROM AD_Column c WHERE c.AD_Column_ID=pi.AD_Column_ID AND c.AD_Element_ID=2300)
;
-- 2021-03-01T10:58:13.531Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Element_Trl SET PrintName='Effective date',Updated=TO_TIMESTAMP('2021-03-01 12:58:13','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=2300 AND AD_Language='en_US'
;
-- 2021-03-01T10:58:13.532Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
/* DDL */ select update_TRL_Tables_On_AD_Element_TRL_Update(2300,'en_US')
;
-- 2021-03-01T10:58:15.122Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Element_Trl SET PrintName='Effective date',Updated=TO_TIMESTAMP('2021-03-01 12:58:15','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=2300 AND AD_Language='nl_NL'
;
-- 2021-03-01T10:58:15.123Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
/* DDL */ select update_TRL_Tables_On_AD_Element_TRL_Update(2300,'nl_NL')
; | the_stack |
-- 2018-05-26T11:06:14.921
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET AD_UI_ElementGroup_ID=540474, SeqNo=70,Updated=TO_TIMESTAMP('2018-05-26 11:06:14','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=544612
;
-- 2018-05-26T11:06:38.338
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET AD_UI_ElementGroup_ID=540474, SeqNo=80,Updated=TO_TIMESTAMP('2018-05-26 11:06:38','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=544615
;
-- 2018-05-26T11:06:54.897
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET AD_UI_ElementGroup_ID=540474, SeqNo=90,Updated=TO_TIMESTAMP('2018-05-26 11:06:54','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=544611
;
-- 2018-05-26T11:07:30.141
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET AD_UI_ElementGroup_ID=540476, SeqNo=160,Updated=TO_TIMESTAMP('2018-05-26 11:07:30','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=551466
;
-- 2018-05-26T11:07:51.399
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET AD_UI_ElementGroup_ID=540476, SeqNo=170,Updated=TO_TIMESTAMP('2018-05-26 11:07:51','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=544602
;
-- 2018-05-26T11:07:59.499
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET AD_UI_ElementGroup_ID=540476, SeqNo=180,Updated=TO_TIMESTAMP('2018-05-26 11:07:59','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=544603
;
-- 2018-05-26T11:08:09.044
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsAdvancedField='N',Updated=TO_TIMESTAMP('2018-05-26 11:08:09','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=544615
;
-- 2018-05-26T11:08:09.463
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsAdvancedField='N',Updated=TO_TIMESTAMP('2018-05-26 11:08:09','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=544612
;
-- 2018-05-26T11:08:11.179
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsAdvancedField='N',Updated=TO_TIMESTAMP('2018-05-26 11:08:11','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=544611
;
-- 2018-05-26T11:08:19.628
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
DELETE FROM AD_UI_ElementGroup WHERE AD_UI_ElementGroup_ID=540475
;
-- 2018-05-26T11:08:30.301
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsAdvancedField='Y',Updated=TO_TIMESTAMP('2018-05-26 11:08:30','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=551466
;
-- 2018-05-26T11:08:30.814
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsAdvancedField='Y',Updated=TO_TIMESTAMP('2018-05-26 11:08:30','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=544603
;
-- 2018-05-26T11:08:32.451
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsAdvancedField='Y',Updated=TO_TIMESTAMP('2018-05-26 11:08:32','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=544602
;
-- 2018-05-26T11:11:42.393
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET AD_UI_ElementGroup_ID=540473, SeqNo=40,Updated=TO_TIMESTAMP('2018-05-26 11:11:42','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=544611
;
-- 2018-05-26T11:14:18.527
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET AD_UI_ElementGroup_ID=540476, SeqNo=190,Updated=TO_TIMESTAMP('2018-05-26 11:14:18','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=551467
;
-- 2018-05-26T11:15:00.276
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsAdvancedField='Y',Updated=TO_TIMESTAMP('2018-05-26 11:15:00','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=551467
;
-- 2018-05-26T11:15:32.885
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET SeqNo=10,Updated=TO_TIMESTAMP('2018-05-26 11:15:32','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=544603
;
-- 2018-05-26T11:15:44.148
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET SeqNo=20,Updated=TO_TIMESTAMP('2018-05-26 11:15:44','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=551466
;
-- 2018-05-26T11:16:05.170
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET SeqNo=30,Updated=TO_TIMESTAMP('2018-05-26 11:16:05','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=551467
;
-- 2018-05-26T11:16:17.539
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET SeqNo=40,Updated=TO_TIMESTAMP('2018-05-26 11:16:17','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=544606
;
-- 2018-05-26T11:16:22.202
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET SeqNo=50,Updated=TO_TIMESTAMP('2018-05-26 11:16:22','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=544607
;
-- 2018-05-26T11:16:26.965
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET SeqNo=60,Updated=TO_TIMESTAMP('2018-05-26 11:16:26','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=544608
;
-- 2018-05-26T11:16:32.010
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET SeqNo=70,Updated=TO_TIMESTAMP('2018-05-26 11:16:32','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=544609
;
-- 2018-05-26T11:16:35.248
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
DELETE FROM AD_UI_Element WHERE AD_UI_Element_ID=544610
;
-- 2018-05-26T11:16:52.709
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET SeqNo=90,Updated=TO_TIMESTAMP('2018-05-26 11:16:52','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=551447
;
-- 2018-05-26T11:17:02.736
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET SeqNo=100,Updated=TO_TIMESTAMP('2018-05-26 11:17:02','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=544602
;
-- 2018-05-26T11:17:08.573
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET SeqNo=110,Updated=TO_TIMESTAMP('2018-05-26 11:17:08','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=544604
;
-- 2018-05-26T11:17:13.650
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET SeqNo=120,Updated=TO_TIMESTAMP('2018-05-26 11:17:13','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=544613
;
-- 2018-05-26T11:17:17.013
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET SeqNo=130,Updated=TO_TIMESTAMP('2018-05-26 11:17:17','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=544614
;
-- 2018-05-26T11:17:20.414
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET SeqNo=140,Updated=TO_TIMESTAMP('2018-05-26 11:17:20','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=544616
;
-- 2018-05-26T11:17:24.017
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET SeqNo=150,Updated=TO_TIMESTAMP('2018-05-26 11:17:24','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=544617
;
-- 2018-05-26T11:18:11.032
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_ElementGroup SET UIStyle='primary',Updated=TO_TIMESTAMP('2018-05-26 11:18:11','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_ElementGroup_ID=540476
;
-- 2018-05-26T11:23:00.386
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Field SET Name='Archiv im Dateisystem speichern',Updated=TO_TIMESTAMP('2018-05-26 11:23:00','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=50184
;
-- 2018-05-26T11:23:16.622
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Field SET Name='Anhänge im Dateisystem speichern',Updated=TO_TIMESTAMP('2018-05-26 11:23:16','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=50158
;
-- 2018-05-26T11:23:26.153
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Field SET Name='Windows Pfad Anhänge',Updated=TO_TIMESTAMP('2018-05-26 11:23:26','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=50159
;
-- 2018-05-26T11:23:37.834
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Field SET Name='Unix Phad Anhänge',Updated=TO_TIMESTAMP('2018-05-26 11:23:37','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=50160
;
-- 2018-05-26T11:23:46.149
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Field SET Name='Windows Pfad Archiv',Updated=TO_TIMESTAMP('2018-05-26 11:23:46','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=50185
;
-- 2018-05-26T11:23:55.359
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Field SET Name='Unix Pfad Archiv',Updated=TO_TIMESTAMP('2018-05-26 11:23:55','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=50186
;
-- 2018-05-26T11:24:36.482
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Field SET Name='Modell Validierungs Klassen',Updated=TO_TIMESTAMP('2018-05-26 11:24:36','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=11024
;
-- 2018-05-26T11:24:47.781
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Field SET Name='SMTP Anmeldung',Updated=TO_TIMESTAMP('2018-05-26 11:24:47','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=5887
;
-- 2018-05-26T11:24:50.850
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Field SET Name='EMail Server',Updated=TO_TIMESTAMP('2018-05-26 11:24:50','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=3813
;
-- 2018-05-26T11:24:53.897
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Field SET Name='Anfrage Nutzer',Updated=TO_TIMESTAMP('2018-05-26 11:24:53','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=5163
;
-- 2018-05-26T11:24:56.607
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Field SET Name='Anfrage Verzeichnis',Updated=TO_TIMESTAMP('2018-05-26 11:24:56','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=5162
;
-- 2018-05-26T11:25:02.662
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Field SET Name='Passwort Anfrage Nutzer',Updated=TO_TIMESTAMP('2018-05-26 11:25:02','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=5164
;
-- 2018-05-26T11:25:07.029
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Field SET Name='Replizierung Strategie',Updated=TO_TIMESTAMP('2018-05-26 11:25:07','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=54680
;
-- 2018-05-26T11:25:17.645
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Field SET Name='Dokumenten Verzeichnis',Updated=TO_TIMESTAMP('2018-05-26 11:25:17','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=12103
;
-- 2018-05-26T11:26:05.963
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Field SET Name='Anfrage EMail',Updated=TO_TIMESTAMP('2018-05-26 11:26:05','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=5161
; | the_stack |
-- Operator Classes defined in the 4.0 Catalog:
--
-- Note: There are a couple operator classes that cannot be built with
-- the definition that exists within the catalog, including
-- cidr_ops : operators are over "inet", but should be "cidr"
-- varchar_pattern_ops : operators are over "text", but should be "varchar"
-- varchar_ops : operators are over "text", but should be "varchar"
--
-- To deal with this the test manually changes the type these operators
-- are over and replaces them with the type referred to in the operator,
-- this in turn requires the operators not to be "Default". The checks
-- on operators must take this into account.
--
-- Derived via the following SQL run within a 4.0 catalog
--
/*
\o /tmp/opclass
SELECT 'CREATE OPERATOR CLASS ' || quote_ident(opcname) || ' '
|| case when t.typname = 'varchar' then ' FOR TYPE upg_catalog.text '
when t.typname = 'cidr' then ' FOR TYPE upg_catalog.inet '
else case when opcdefault then 'DEFAULT ' else '' end
|| 'FOR TYPE upg_catalog.' || quote_ident(t.typname) || ' '
end
|| 'USING ' || amname || ' '
|| E'AS\n'
|| array_to_string(array(
SELECT ' '||kind||' '||strategy||' '||name||'('||param||')'||option
FROM (
SELECT amopclaid as classid,
amopsubtype as subtype,
0 as sort,
amopstrategy as strategy,
'OPERATOR' as kind,
'upg_catalog.' || op.oprname as name,
'upg_catalog.' || t1.typname
|| ', upg_catalog.'
|| t2.typname as param,
case when amopreqcheck then ' RECHECK' else '' end as option
FROM pg_amop amop
join pg_operator op on (amopopr = op.oid)
left join pg_type t1 on (op.oprleft = t1.oid)
left join pg_type t2 on (op.oprright = t2.oid)
UNION ALL
SELECT amopclaid as classid,
amprocsubtype as subtype,
1 as sort,
amprocnum as opstrategy,
'FUNCTION' as opkind,
'upg_catalog.' || quote_ident(p.proname) as name,
coalesce(array_to_string(array(
SELECT case when typname = 'internal'
then 'pg_catalog.'
else 'upg_catalog.' end || quote_ident(typname)
FROM pg_type t, generate_series(1, pronargs) i
WHERE t.oid = proargtypes[i-1]
ORDER BY i), ', '), '') as param,
'' as option
FROM pg_amproc amproc
join pg_proc p on (amproc.amproc = p.oid)
) q
WHERE classid = opc.oid -- correlate to outer query block
ORDER BY subtype, sort, strategy), E',\n')
|| coalesce(E',\n STORAGE ' || quote_ident(keytype.typname), '') || ';'
FROM pg_opclass opc
join pg_type t on (opc.opcintype = t.oid)
join pg_am am on (opc.opcamid = am.oid)
join pg_namespace n on (opc.opcnamespace = n.oid)
left join pg_type keytype on (opc.opckeytype = keytype.oid)
WHERE n.nspname = 'pg_catalog';
*/
CREATE OPERATOR CLASS bool_ops DEFAULT FOR TYPE upg_catalog.bool USING bitmap AS
OPERATOR 1 upg_catalog.<(upg_catalog.bool, upg_catalog.bool),
OPERATOR 2 upg_catalog.<=(upg_catalog.bool, upg_catalog.bool),
OPERATOR 3 upg_catalog.=(upg_catalog.bool, upg_catalog.bool),
OPERATOR 4 upg_catalog.>=(upg_catalog.bool, upg_catalog.bool),
OPERATOR 5 upg_catalog.>(upg_catalog.bool, upg_catalog.bool),
FUNCTION 1 upg_catalog.btboolcmp(upg_catalog.bool, upg_catalog.bool);
CREATE OPERATOR CLASS bool_ops DEFAULT FOR TYPE upg_catalog.bool USING hash AS
OPERATOR 1 upg_catalog.=(upg_catalog.bool, upg_catalog.bool),
FUNCTION 1 upg_catalog.hashchar(upg_catalog."char");
CREATE OPERATOR CLASS bool_ops DEFAULT FOR TYPE upg_catalog.bool USING btree AS
OPERATOR 1 upg_catalog.<(upg_catalog.bool, upg_catalog.bool),
OPERATOR 2 upg_catalog.<=(upg_catalog.bool, upg_catalog.bool),
OPERATOR 3 upg_catalog.=(upg_catalog.bool, upg_catalog.bool),
OPERATOR 4 upg_catalog.>=(upg_catalog.bool, upg_catalog.bool),
OPERATOR 5 upg_catalog.>(upg_catalog.bool, upg_catalog.bool),
FUNCTION 1 upg_catalog.btboolcmp(upg_catalog.bool, upg_catalog.bool);
CREATE OPERATOR CLASS bytea_ops DEFAULT FOR TYPE upg_catalog.bytea USING bitmap AS
OPERATOR 1 upg_catalog.<(upg_catalog.bytea, upg_catalog.bytea),
OPERATOR 2 upg_catalog.<=(upg_catalog.bytea, upg_catalog.bytea),
OPERATOR 3 upg_catalog.=(upg_catalog.bytea, upg_catalog.bytea),
OPERATOR 4 upg_catalog.>=(upg_catalog.bytea, upg_catalog.bytea),
OPERATOR 5 upg_catalog.>(upg_catalog.bytea, upg_catalog.bytea),
FUNCTION 1 upg_catalog.byteacmp(upg_catalog.bytea, upg_catalog.bytea);
CREATE OPERATOR CLASS bytea_ops DEFAULT FOR TYPE upg_catalog.bytea USING hash AS
OPERATOR 1 upg_catalog.=(upg_catalog.bytea, upg_catalog.bytea),
FUNCTION 1 upg_catalog.hashvarlena(pg_catalog.internal);
CREATE OPERATOR CLASS bytea_ops DEFAULT FOR TYPE upg_catalog.bytea USING btree AS
OPERATOR 1 upg_catalog.<(upg_catalog.bytea, upg_catalog.bytea),
OPERATOR 2 upg_catalog.<=(upg_catalog.bytea, upg_catalog.bytea),
OPERATOR 3 upg_catalog.=(upg_catalog.bytea, upg_catalog.bytea),
OPERATOR 4 upg_catalog.>=(upg_catalog.bytea, upg_catalog.bytea),
OPERATOR 5 upg_catalog.>(upg_catalog.bytea, upg_catalog.bytea),
FUNCTION 1 upg_catalog.byteacmp(upg_catalog.bytea, upg_catalog.bytea);
CREATE OPERATOR CLASS char_ops DEFAULT FOR TYPE upg_catalog."char" USING bitmap AS
OPERATOR 1 upg_catalog.<(upg_catalog.char, upg_catalog.char),
OPERATOR 2 upg_catalog.<=(upg_catalog.char, upg_catalog.char),
OPERATOR 3 upg_catalog.=(upg_catalog.char, upg_catalog.char),
OPERATOR 4 upg_catalog.>=(upg_catalog.char, upg_catalog.char),
OPERATOR 5 upg_catalog.>(upg_catalog.char, upg_catalog.char),
FUNCTION 1 upg_catalog.btcharcmp(upg_catalog."char", upg_catalog."char");
CREATE OPERATOR CLASS char_ops DEFAULT FOR TYPE upg_catalog."char" USING hash AS
OPERATOR 1 upg_catalog.=(upg_catalog.char, upg_catalog.char),
FUNCTION 1 upg_catalog.hashchar(upg_catalog."char");
CREATE OPERATOR CLASS char_ops DEFAULT FOR TYPE upg_catalog."char" USING btree AS
OPERATOR 1 upg_catalog.<(upg_catalog.char, upg_catalog.char),
OPERATOR 2 upg_catalog.<=(upg_catalog.char, upg_catalog.char),
OPERATOR 3 upg_catalog.=(upg_catalog.char, upg_catalog.char),
OPERATOR 4 upg_catalog.>=(upg_catalog.char, upg_catalog.char),
OPERATOR 5 upg_catalog.>(upg_catalog.char, upg_catalog.char),
FUNCTION 1 upg_catalog.btcharcmp(upg_catalog."char", upg_catalog."char");
CREATE OPERATOR CLASS name_pattern_ops FOR TYPE upg_catalog.name USING bitmap AS
OPERATOR 1 upg_catalog.~<~(upg_catalog.name, upg_catalog.name),
OPERATOR 2 upg_catalog.~<=~(upg_catalog.name, upg_catalog.name),
OPERATOR 3 upg_catalog.~=~(upg_catalog.name, upg_catalog.name),
OPERATOR 4 upg_catalog.~>=~(upg_catalog.name, upg_catalog.name),
OPERATOR 5 upg_catalog.~>~(upg_catalog.name, upg_catalog.name),
FUNCTION 1 upg_catalog.btname_pattern_cmp(upg_catalog.name, upg_catalog.name);
CREATE OPERATOR CLASS name_ops DEFAULT FOR TYPE upg_catalog.name USING bitmap AS
OPERATOR 1 upg_catalog.<(upg_catalog.name, upg_catalog.name),
OPERATOR 2 upg_catalog.<=(upg_catalog.name, upg_catalog.name),
OPERATOR 3 upg_catalog.=(upg_catalog.name, upg_catalog.name),
OPERATOR 4 upg_catalog.>=(upg_catalog.name, upg_catalog.name),
OPERATOR 5 upg_catalog.>(upg_catalog.name, upg_catalog.name),
FUNCTION 1 upg_catalog.btnamecmp(upg_catalog.name, upg_catalog.name);
CREATE OPERATOR CLASS name_pattern_ops FOR TYPE upg_catalog.name USING hash AS
OPERATOR 1 upg_catalog.~=~(upg_catalog.name, upg_catalog.name),
FUNCTION 1 upg_catalog.hashname(upg_catalog.name);
CREATE OPERATOR CLASS name_pattern_ops FOR TYPE upg_catalog.name USING btree AS
OPERATOR 1 upg_catalog.~<~(upg_catalog.name, upg_catalog.name),
OPERATOR 2 upg_catalog.~<=~(upg_catalog.name, upg_catalog.name),
OPERATOR 3 upg_catalog.~=~(upg_catalog.name, upg_catalog.name),
OPERATOR 4 upg_catalog.~>=~(upg_catalog.name, upg_catalog.name),
OPERATOR 5 upg_catalog.~>~(upg_catalog.name, upg_catalog.name),
FUNCTION 1 upg_catalog.btname_pattern_cmp(upg_catalog.name, upg_catalog.name);
CREATE OPERATOR CLASS name_ops DEFAULT FOR TYPE upg_catalog.name USING hash AS
OPERATOR 1 upg_catalog.=(upg_catalog.name, upg_catalog.name),
FUNCTION 1 upg_catalog.hashname(upg_catalog.name);
CREATE OPERATOR CLASS name_ops DEFAULT FOR TYPE upg_catalog.name USING btree AS
OPERATOR 1 upg_catalog.<(upg_catalog.name, upg_catalog.name),
OPERATOR 2 upg_catalog.<=(upg_catalog.name, upg_catalog.name),
OPERATOR 3 upg_catalog.=(upg_catalog.name, upg_catalog.name),
OPERATOR 4 upg_catalog.>=(upg_catalog.name, upg_catalog.name),
OPERATOR 5 upg_catalog.>(upg_catalog.name, upg_catalog.name),
FUNCTION 1 upg_catalog.btnamecmp(upg_catalog.name, upg_catalog.name);
CREATE OPERATOR CLASS int8_ops DEFAULT FOR TYPE upg_catalog.int8 USING bitmap AS
OPERATOR 1 upg_catalog.<(upg_catalog.int8, upg_catalog.int8),
OPERATOR 2 upg_catalog.<=(upg_catalog.int8, upg_catalog.int8),
OPERATOR 3 upg_catalog.=(upg_catalog.int8, upg_catalog.int8),
OPERATOR 4 upg_catalog.>=(upg_catalog.int8, upg_catalog.int8),
OPERATOR 5 upg_catalog.>(upg_catalog.int8, upg_catalog.int8),
FUNCTION 1 upg_catalog.btint8cmp(upg_catalog.int8, upg_catalog.int8),
OPERATOR 1 upg_catalog.<(upg_catalog.int8, upg_catalog.int2),
OPERATOR 2 upg_catalog.<=(upg_catalog.int8, upg_catalog.int2),
OPERATOR 3 upg_catalog.=(upg_catalog.int8, upg_catalog.int2),
OPERATOR 4 upg_catalog.>=(upg_catalog.int8, upg_catalog.int2),
OPERATOR 5 upg_catalog.>(upg_catalog.int8, upg_catalog.int2),
FUNCTION 1 upg_catalog.btint82cmp(upg_catalog.int8, upg_catalog.int2),
OPERATOR 1 upg_catalog.<(upg_catalog.int8, upg_catalog.int4),
OPERATOR 2 upg_catalog.<=(upg_catalog.int8, upg_catalog.int4),
OPERATOR 3 upg_catalog.=(upg_catalog.int8, upg_catalog.int4),
OPERATOR 4 upg_catalog.>=(upg_catalog.int8, upg_catalog.int4),
OPERATOR 5 upg_catalog.>(upg_catalog.int8, upg_catalog.int4),
FUNCTION 1 upg_catalog.btint84cmp(upg_catalog.int8, upg_catalog.int4);
CREATE OPERATOR CLASS int8_ops DEFAULT FOR TYPE upg_catalog.int8 USING hash AS
OPERATOR 1 upg_catalog.=(upg_catalog.int8, upg_catalog.int8),
FUNCTION 1 upg_catalog.hashint8(upg_catalog.int8);
CREATE OPERATOR CLASS int8_ops DEFAULT FOR TYPE upg_catalog.int8 USING btree AS
OPERATOR 1 upg_catalog.<(upg_catalog.int8, upg_catalog.int8),
OPERATOR 2 upg_catalog.<=(upg_catalog.int8, upg_catalog.int8),
OPERATOR 3 upg_catalog.=(upg_catalog.int8, upg_catalog.int8),
OPERATOR 4 upg_catalog.>=(upg_catalog.int8, upg_catalog.int8),
OPERATOR 5 upg_catalog.>(upg_catalog.int8, upg_catalog.int8),
FUNCTION 1 upg_catalog.btint8cmp(upg_catalog.int8, upg_catalog.int8),
OPERATOR 1 upg_catalog.<(upg_catalog.int8, upg_catalog.int2),
OPERATOR 2 upg_catalog.<=(upg_catalog.int8, upg_catalog.int2),
OPERATOR 3 upg_catalog.=(upg_catalog.int8, upg_catalog.int2),
OPERATOR 4 upg_catalog.>=(upg_catalog.int8, upg_catalog.int2),
OPERATOR 5 upg_catalog.>(upg_catalog.int8, upg_catalog.int2),
FUNCTION 1 upg_catalog.btint82cmp(upg_catalog.int8, upg_catalog.int2),
OPERATOR 1 upg_catalog.<(upg_catalog.int8, upg_catalog.int4),
OPERATOR 2 upg_catalog.<=(upg_catalog.int8, upg_catalog.int4),
OPERATOR 3 upg_catalog.=(upg_catalog.int8, upg_catalog.int4),
OPERATOR 4 upg_catalog.>=(upg_catalog.int8, upg_catalog.int4),
OPERATOR 5 upg_catalog.>(upg_catalog.int8, upg_catalog.int4),
FUNCTION 1 upg_catalog.btint84cmp(upg_catalog.int8, upg_catalog.int4);
CREATE OPERATOR CLASS int2_ops DEFAULT FOR TYPE upg_catalog.int2 USING bitmap AS
OPERATOR 1 upg_catalog.<(upg_catalog.int2, upg_catalog.int2),
OPERATOR 2 upg_catalog.<=(upg_catalog.int2, upg_catalog.int2),
OPERATOR 3 upg_catalog.=(upg_catalog.int2, upg_catalog.int2),
OPERATOR 4 upg_catalog.>=(upg_catalog.int2, upg_catalog.int2),
OPERATOR 5 upg_catalog.>(upg_catalog.int2, upg_catalog.int2),
FUNCTION 1 upg_catalog.btint2cmp(upg_catalog.int2, upg_catalog.int2),
OPERATOR 1 upg_catalog.<(upg_catalog.int2, upg_catalog.int8),
OPERATOR 2 upg_catalog.<=(upg_catalog.int2, upg_catalog.int8),
OPERATOR 3 upg_catalog.=(upg_catalog.int2, upg_catalog.int8),
OPERATOR 4 upg_catalog.>=(upg_catalog.int2, upg_catalog.int8),
OPERATOR 5 upg_catalog.>(upg_catalog.int2, upg_catalog.int8),
FUNCTION 1 upg_catalog.btint28cmp(upg_catalog.int2, upg_catalog.int8),
OPERATOR 1 upg_catalog.<(upg_catalog.int2, upg_catalog.int4),
OPERATOR 2 upg_catalog.<=(upg_catalog.int2, upg_catalog.int4),
OPERATOR 3 upg_catalog.=(upg_catalog.int2, upg_catalog.int4),
OPERATOR 4 upg_catalog.>=(upg_catalog.int2, upg_catalog.int4),
OPERATOR 5 upg_catalog.>(upg_catalog.int2, upg_catalog.int4),
FUNCTION 1 upg_catalog.btint24cmp(upg_catalog.int2, upg_catalog.int4);
CREATE OPERATOR CLASS int2_ops DEFAULT FOR TYPE upg_catalog.int2 USING hash AS
OPERATOR 1 upg_catalog.=(upg_catalog.int2, upg_catalog.int2),
FUNCTION 1 upg_catalog.hashint2(upg_catalog.int2);
CREATE OPERATOR CLASS int2_ops DEFAULT FOR TYPE upg_catalog.int2 USING btree AS
OPERATOR 1 upg_catalog.<(upg_catalog.int2, upg_catalog.int2),
OPERATOR 2 upg_catalog.<=(upg_catalog.int2, upg_catalog.int2),
OPERATOR 3 upg_catalog.=(upg_catalog.int2, upg_catalog.int2),
OPERATOR 4 upg_catalog.>=(upg_catalog.int2, upg_catalog.int2),
OPERATOR 5 upg_catalog.>(upg_catalog.int2, upg_catalog.int2),
FUNCTION 1 upg_catalog.btint2cmp(upg_catalog.int2, upg_catalog.int2),
OPERATOR 1 upg_catalog.<(upg_catalog.int2, upg_catalog.int8),
OPERATOR 2 upg_catalog.<=(upg_catalog.int2, upg_catalog.int8),
OPERATOR 3 upg_catalog.=(upg_catalog.int2, upg_catalog.int8),
OPERATOR 4 upg_catalog.>=(upg_catalog.int2, upg_catalog.int8),
OPERATOR 5 upg_catalog.>(upg_catalog.int2, upg_catalog.int8),
FUNCTION 1 upg_catalog.btint28cmp(upg_catalog.int2, upg_catalog.int8),
OPERATOR 1 upg_catalog.<(upg_catalog.int2, upg_catalog.int4),
OPERATOR 2 upg_catalog.<=(upg_catalog.int2, upg_catalog.int4),
OPERATOR 3 upg_catalog.=(upg_catalog.int2, upg_catalog.int4),
OPERATOR 4 upg_catalog.>=(upg_catalog.int2, upg_catalog.int4),
OPERATOR 5 upg_catalog.>(upg_catalog.int2, upg_catalog.int4),
FUNCTION 1 upg_catalog.btint24cmp(upg_catalog.int2, upg_catalog.int4);
CREATE OPERATOR CLASS int2vector_ops DEFAULT FOR TYPE upg_catalog.int2vector USING hash AS
OPERATOR 1 upg_catalog.=(upg_catalog.int2vector, upg_catalog.int2vector),
FUNCTION 1 upg_catalog.hashint2vector(upg_catalog.int2vector);
CREATE OPERATOR CLASS int4_ops DEFAULT FOR TYPE upg_catalog.int4 USING bitmap AS
OPERATOR 1 upg_catalog.<(upg_catalog.int4, upg_catalog.int4),
OPERATOR 2 upg_catalog.<=(upg_catalog.int4, upg_catalog.int4),
OPERATOR 3 upg_catalog.=(upg_catalog.int4, upg_catalog.int4),
OPERATOR 4 upg_catalog.>=(upg_catalog.int4, upg_catalog.int4),
OPERATOR 5 upg_catalog.>(upg_catalog.int4, upg_catalog.int4),
FUNCTION 1 upg_catalog.btint4cmp(upg_catalog.int4, upg_catalog.int4),
OPERATOR 1 upg_catalog.<(upg_catalog.int4, upg_catalog.int8),
OPERATOR 2 upg_catalog.<=(upg_catalog.int4, upg_catalog.int8),
OPERATOR 3 upg_catalog.=(upg_catalog.int4, upg_catalog.int8),
OPERATOR 4 upg_catalog.>=(upg_catalog.int4, upg_catalog.int8),
OPERATOR 5 upg_catalog.>(upg_catalog.int4, upg_catalog.int8),
FUNCTION 1 upg_catalog.btint42cmp(upg_catalog.int4, upg_catalog.int2),
OPERATOR 1 upg_catalog.<(upg_catalog.int4, upg_catalog.int2),
OPERATOR 2 upg_catalog.<=(upg_catalog.int4, upg_catalog.int2),
OPERATOR 3 upg_catalog.=(upg_catalog.int4, upg_catalog.int2),
OPERATOR 4 upg_catalog.>=(upg_catalog.int4, upg_catalog.int2),
OPERATOR 5 upg_catalog.>(upg_catalog.int4, upg_catalog.int2),
FUNCTION 1 upg_catalog.btint48cmp(upg_catalog.int4, upg_catalog.int8);
CREATE OPERATOR CLASS int4_ops DEFAULT FOR TYPE upg_catalog.int4 USING hash AS
OPERATOR 1 upg_catalog.=(upg_catalog.int4, upg_catalog.int4),
FUNCTION 1 upg_catalog.hashint4(upg_catalog.int4);
CREATE OPERATOR CLASS int4_ops DEFAULT FOR TYPE upg_catalog.int4 USING btree AS
OPERATOR 1 upg_catalog.<(upg_catalog.int4, upg_catalog.int4),
OPERATOR 2 upg_catalog.<=(upg_catalog.int4, upg_catalog.int4),
OPERATOR 3 upg_catalog.=(upg_catalog.int4, upg_catalog.int4),
OPERATOR 4 upg_catalog.>=(upg_catalog.int4, upg_catalog.int4),
OPERATOR 5 upg_catalog.>(upg_catalog.int4, upg_catalog.int4),
FUNCTION 1 upg_catalog.btint4cmp(upg_catalog.int4, upg_catalog.int4),
OPERATOR 1 upg_catalog.<(upg_catalog.int4, upg_catalog.int8),
OPERATOR 2 upg_catalog.<=(upg_catalog.int4, upg_catalog.int8),
OPERATOR 3 upg_catalog.=(upg_catalog.int4, upg_catalog.int8),
OPERATOR 4 upg_catalog.>=(upg_catalog.int4, upg_catalog.int8),
OPERATOR 5 upg_catalog.>(upg_catalog.int4, upg_catalog.int8),
FUNCTION 1 upg_catalog.btint48cmp(upg_catalog.int4, upg_catalog.int8),
OPERATOR 1 upg_catalog.<(upg_catalog.int4, upg_catalog.int2),
OPERATOR 2 upg_catalog.<=(upg_catalog.int4, upg_catalog.int2),
OPERATOR 3 upg_catalog.=(upg_catalog.int4, upg_catalog.int2),
OPERATOR 4 upg_catalog.>=(upg_catalog.int4, upg_catalog.int2),
OPERATOR 5 upg_catalog.>(upg_catalog.int4, upg_catalog.int2),
FUNCTION 1 upg_catalog.btint42cmp(upg_catalog.int4, upg_catalog.int2);
CREATE OPERATOR CLASS text_pattern_ops FOR TYPE upg_catalog.text USING bitmap AS
OPERATOR 1 upg_catalog.~<~(upg_catalog.text, upg_catalog.text),
OPERATOR 2 upg_catalog.~<=~(upg_catalog.text, upg_catalog.text),
OPERATOR 3 upg_catalog.~=~(upg_catalog.text, upg_catalog.text),
OPERATOR 4 upg_catalog.~>=~(upg_catalog.text, upg_catalog.text),
OPERATOR 5 upg_catalog.~>~(upg_catalog.text, upg_catalog.text),
FUNCTION 1 upg_catalog.bttext_pattern_cmp(upg_catalog.text, upg_catalog.text);
CREATE OPERATOR CLASS text_ops DEFAULT FOR TYPE upg_catalog.text USING bitmap AS
OPERATOR 1 upg_catalog.<(upg_catalog.text, upg_catalog.text),
OPERATOR 2 upg_catalog.<=(upg_catalog.text, upg_catalog.text),
OPERATOR 3 upg_catalog.=(upg_catalog.text, upg_catalog.text),
OPERATOR 4 upg_catalog.>=(upg_catalog.text, upg_catalog.text),
OPERATOR 5 upg_catalog.>(upg_catalog.text, upg_catalog.text),
FUNCTION 1 upg_catalog.bttextcmp(upg_catalog.text, upg_catalog.text);
CREATE OPERATOR CLASS text_pattern_ops FOR TYPE upg_catalog.text USING hash AS
OPERATOR 1 upg_catalog.~=~(upg_catalog.text, upg_catalog.text),
FUNCTION 1 upg_catalog.hashvarlena(pg_catalog.internal);
CREATE OPERATOR CLASS text_pattern_ops FOR TYPE upg_catalog.text USING btree AS
OPERATOR 1 upg_catalog.~<~(upg_catalog.text, upg_catalog.text),
OPERATOR 2 upg_catalog.~<=~(upg_catalog.text, upg_catalog.text),
OPERATOR 3 upg_catalog.~=~(upg_catalog.text, upg_catalog.text),
OPERATOR 4 upg_catalog.~>=~(upg_catalog.text, upg_catalog.text),
OPERATOR 5 upg_catalog.~>~(upg_catalog.text, upg_catalog.text),
FUNCTION 1 upg_catalog.bttext_pattern_cmp(upg_catalog.text, upg_catalog.text);
CREATE OPERATOR CLASS text_ops DEFAULT FOR TYPE upg_catalog.text USING hash AS
OPERATOR 1 upg_catalog.=(upg_catalog.text, upg_catalog.text),
FUNCTION 1 upg_catalog.hashtext(upg_catalog.text);
CREATE OPERATOR CLASS text_ops DEFAULT FOR TYPE upg_catalog.text USING btree AS
OPERATOR 1 upg_catalog.<(upg_catalog.text, upg_catalog.text),
OPERATOR 2 upg_catalog.<=(upg_catalog.text, upg_catalog.text),
OPERATOR 3 upg_catalog.=(upg_catalog.text, upg_catalog.text),
OPERATOR 4 upg_catalog.>=(upg_catalog.text, upg_catalog.text),
OPERATOR 5 upg_catalog.>(upg_catalog.text, upg_catalog.text),
FUNCTION 1 upg_catalog.bttextcmp(upg_catalog.text, upg_catalog.text);
CREATE OPERATOR CLASS oid_ops DEFAULT FOR TYPE upg_catalog.oid USING bitmap AS
OPERATOR 1 upg_catalog.<(upg_catalog.oid, upg_catalog.oid),
OPERATOR 2 upg_catalog.<=(upg_catalog.oid, upg_catalog.oid),
OPERATOR 3 upg_catalog.=(upg_catalog.oid, upg_catalog.oid),
OPERATOR 4 upg_catalog.>=(upg_catalog.oid, upg_catalog.oid),
OPERATOR 5 upg_catalog.>(upg_catalog.oid, upg_catalog.oid),
FUNCTION 1 upg_catalog.btoidcmp(upg_catalog.oid, upg_catalog.oid);
CREATE OPERATOR CLASS oid_ops DEFAULT FOR TYPE upg_catalog.oid USING hash AS
OPERATOR 1 upg_catalog.=(upg_catalog.oid, upg_catalog.oid),
FUNCTION 1 upg_catalog.hashoid(upg_catalog.oid);
CREATE OPERATOR CLASS oid_ops DEFAULT FOR TYPE upg_catalog.oid USING btree AS
OPERATOR 1 upg_catalog.<(upg_catalog.oid, upg_catalog.oid),
OPERATOR 2 upg_catalog.<=(upg_catalog.oid, upg_catalog.oid),
OPERATOR 3 upg_catalog.=(upg_catalog.oid, upg_catalog.oid),
OPERATOR 4 upg_catalog.>=(upg_catalog.oid, upg_catalog.oid),
OPERATOR 5 upg_catalog.>(upg_catalog.oid, upg_catalog.oid),
FUNCTION 1 upg_catalog.btoidcmp(upg_catalog.oid, upg_catalog.oid);
CREATE OPERATOR CLASS tid_ops DEFAULT FOR TYPE upg_catalog.tid USING btree AS
OPERATOR 1 upg_catalog.<(upg_catalog.tid, upg_catalog.tid),
OPERATOR 2 upg_catalog.<=(upg_catalog.tid, upg_catalog.tid),
OPERATOR 3 upg_catalog.=(upg_catalog.tid, upg_catalog.tid),
OPERATOR 4 upg_catalog.>=(upg_catalog.tid, upg_catalog.tid),
OPERATOR 5 upg_catalog.>(upg_catalog.tid, upg_catalog.tid),
FUNCTION 1 upg_catalog.bttidcmp(upg_catalog.tid, upg_catalog.tid);
CREATE OPERATOR CLASS xid_ops DEFAULT FOR TYPE upg_catalog.xid USING hash AS
OPERATOR 1 upg_catalog.=(upg_catalog.xid, upg_catalog.xid),
FUNCTION 1 upg_catalog.hashint4(upg_catalog.int4);
CREATE OPERATOR CLASS cid_ops DEFAULT FOR TYPE upg_catalog.cid USING hash AS
OPERATOR 1 upg_catalog.=(upg_catalog.cid, upg_catalog.cid),
FUNCTION 1 upg_catalog.hashint4(upg_catalog.int4);
CREATE OPERATOR CLASS oidvector_ops DEFAULT FOR TYPE upg_catalog.oidvector USING bitmap AS
OPERATOR 1 upg_catalog.<(upg_catalog.oidvector, upg_catalog.oidvector),
OPERATOR 2 upg_catalog.<=(upg_catalog.oidvector, upg_catalog.oidvector),
OPERATOR 3 upg_catalog.=(upg_catalog.oidvector, upg_catalog.oidvector),
OPERATOR 4 upg_catalog.>=(upg_catalog.oidvector, upg_catalog.oidvector),
OPERATOR 5 upg_catalog.>(upg_catalog.oidvector, upg_catalog.oidvector),
FUNCTION 1 upg_catalog.btoidvectorcmp(upg_catalog.oidvector, upg_catalog.oidvector);
CREATE OPERATOR CLASS oidvector_ops DEFAULT FOR TYPE upg_catalog.oidvector USING hash AS
OPERATOR 1 upg_catalog.=(upg_catalog.oidvector, upg_catalog.oidvector),
FUNCTION 1 upg_catalog.hashoidvector(upg_catalog.oidvector);
CREATE OPERATOR CLASS oidvector_ops DEFAULT FOR TYPE upg_catalog.oidvector USING btree AS
OPERATOR 1 upg_catalog.<(upg_catalog.oidvector, upg_catalog.oidvector),
OPERATOR 2 upg_catalog.<=(upg_catalog.oidvector, upg_catalog.oidvector),
OPERATOR 3 upg_catalog.=(upg_catalog.oidvector, upg_catalog.oidvector),
OPERATOR 4 upg_catalog.>=(upg_catalog.oidvector, upg_catalog.oidvector),
OPERATOR 5 upg_catalog.>(upg_catalog.oidvector, upg_catalog.oidvector),
FUNCTION 1 upg_catalog.btoidvectorcmp(upg_catalog.oidvector, upg_catalog.oidvector);
CREATE OPERATOR CLASS box_ops DEFAULT FOR TYPE upg_catalog.box USING gist AS
OPERATOR 1 upg_catalog.<<(upg_catalog.box, upg_catalog.box),
OPERATOR 2 upg_catalog.&<(upg_catalog.box, upg_catalog.box),
OPERATOR 3 upg_catalog.&&(upg_catalog.box, upg_catalog.box),
OPERATOR 4 upg_catalog.&>(upg_catalog.box, upg_catalog.box),
OPERATOR 5 upg_catalog.>>(upg_catalog.box, upg_catalog.box),
OPERATOR 6 upg_catalog.~=(upg_catalog.box, upg_catalog.box),
OPERATOR 7 upg_catalog.@>(upg_catalog.box, upg_catalog.box),
OPERATOR 8 upg_catalog.<@(upg_catalog.box, upg_catalog.box),
OPERATOR 9 upg_catalog.&<|(upg_catalog.box, upg_catalog.box),
OPERATOR 10 upg_catalog.<<|(upg_catalog.box, upg_catalog.box),
OPERATOR 11 upg_catalog.|>>(upg_catalog.box, upg_catalog.box),
OPERATOR 12 upg_catalog.|&>(upg_catalog.box, upg_catalog.box),
OPERATOR 13 upg_catalog.~(upg_catalog.box, upg_catalog.box),
OPERATOR 14 upg_catalog.@(upg_catalog.box, upg_catalog.box),
FUNCTION 1 upg_catalog.gist_box_consistent(pg_catalog.internal, upg_catalog.box, upg_catalog.int4),
FUNCTION 2 upg_catalog.gist_box_union(pg_catalog.internal, pg_catalog.internal),
FUNCTION 3 upg_catalog.gist_box_compress(pg_catalog.internal),
FUNCTION 4 upg_catalog.gist_box_decompress(pg_catalog.internal),
FUNCTION 5 upg_catalog.gist_box_penalty(pg_catalog.internal, pg_catalog.internal, pg_catalog.internal),
FUNCTION 6 upg_catalog.gist_box_picksplit(pg_catalog.internal, pg_catalog.internal),
FUNCTION 7 upg_catalog.gist_box_same(upg_catalog.box, upg_catalog.box, pg_catalog.internal);
CREATE OPERATOR CLASS poly_ops DEFAULT FOR TYPE upg_catalog.polygon USING gist AS
OPERATOR 1 upg_catalog.<<(upg_catalog.polygon, upg_catalog.polygon) RECHECK,
OPERATOR 2 upg_catalog.&<(upg_catalog.polygon, upg_catalog.polygon) RECHECK,
OPERATOR 3 upg_catalog.&&(upg_catalog.polygon, upg_catalog.polygon) RECHECK,
OPERATOR 4 upg_catalog.&>(upg_catalog.polygon, upg_catalog.polygon) RECHECK,
OPERATOR 5 upg_catalog.>>(upg_catalog.polygon, upg_catalog.polygon) RECHECK,
OPERATOR 6 upg_catalog.~=(upg_catalog.polygon, upg_catalog.polygon) RECHECK,
OPERATOR 7 upg_catalog.@>(upg_catalog.polygon, upg_catalog.polygon) RECHECK,
OPERATOR 8 upg_catalog.<@(upg_catalog.polygon, upg_catalog.polygon) RECHECK,
OPERATOR 9 upg_catalog.&<|(upg_catalog.polygon, upg_catalog.polygon) RECHECK,
OPERATOR 10 upg_catalog.<<|(upg_catalog.polygon, upg_catalog.polygon) RECHECK,
OPERATOR 11 upg_catalog.|>>(upg_catalog.polygon, upg_catalog.polygon) RECHECK,
OPERATOR 12 upg_catalog.|&>(upg_catalog.polygon, upg_catalog.polygon) RECHECK,
OPERATOR 13 upg_catalog.~(upg_catalog.polygon, upg_catalog.polygon) RECHECK,
OPERATOR 14 upg_catalog.@(upg_catalog.polygon, upg_catalog.polygon) RECHECK,
FUNCTION 1 upg_catalog.gist_poly_consistent(pg_catalog.internal, upg_catalog.polygon, upg_catalog.int4),
FUNCTION 2 upg_catalog.gist_box_union(pg_catalog.internal, pg_catalog.internal),
FUNCTION 3 upg_catalog.gist_poly_compress(pg_catalog.internal),
FUNCTION 4 upg_catalog.gist_box_decompress(pg_catalog.internal),
FUNCTION 5 upg_catalog.gist_box_penalty(pg_catalog.internal, pg_catalog.internal, pg_catalog.internal),
FUNCTION 6 upg_catalog.gist_box_picksplit(pg_catalog.internal, pg_catalog.internal),
FUNCTION 7 upg_catalog.gist_box_same(upg_catalog.box, upg_catalog.box, pg_catalog.internal),
STORAGE box;
CREATE OPERATOR CLASS float4_ops DEFAULT FOR TYPE upg_catalog.float4 USING bitmap AS
OPERATOR 1 upg_catalog.<(upg_catalog.float4, upg_catalog.float4),
OPERATOR 2 upg_catalog.<=(upg_catalog.float4, upg_catalog.float4),
OPERATOR 3 upg_catalog.=(upg_catalog.float4, upg_catalog.float4),
OPERATOR 4 upg_catalog.>=(upg_catalog.float4, upg_catalog.float4),
OPERATOR 5 upg_catalog.>(upg_catalog.float4, upg_catalog.float4),
FUNCTION 1 upg_catalog.btfloat4cmp(upg_catalog.float4, upg_catalog.float4),
OPERATOR 1 upg_catalog.<(upg_catalog.float4, upg_catalog.float8),
OPERATOR 2 upg_catalog.<=(upg_catalog.float4, upg_catalog.float8),
OPERATOR 3 upg_catalog.=(upg_catalog.float4, upg_catalog.float8),
OPERATOR 4 upg_catalog.>=(upg_catalog.float4, upg_catalog.float8),
OPERATOR 5 upg_catalog.>(upg_catalog.float4, upg_catalog.float8),
FUNCTION 1 upg_catalog.btfloat48cmp(upg_catalog.float4, upg_catalog.float8);
CREATE OPERATOR CLASS float4_ops DEFAULT FOR TYPE upg_catalog.float4 USING hash AS
OPERATOR 1 upg_catalog.=(upg_catalog.float4, upg_catalog.float4),
FUNCTION 1 upg_catalog.hashfloat4(upg_catalog.float4);
CREATE OPERATOR CLASS float4_ops DEFAULT FOR TYPE upg_catalog.float4 USING btree AS
OPERATOR 1 upg_catalog.<(upg_catalog.float4, upg_catalog.float4),
OPERATOR 2 upg_catalog.<=(upg_catalog.float4, upg_catalog.float4),
OPERATOR 3 upg_catalog.=(upg_catalog.float4, upg_catalog.float4),
OPERATOR 4 upg_catalog.>=(upg_catalog.float4, upg_catalog.float4),
OPERATOR 5 upg_catalog.>(upg_catalog.float4, upg_catalog.float4),
FUNCTION 1 upg_catalog.btfloat4cmp(upg_catalog.float4, upg_catalog.float4),
OPERATOR 1 upg_catalog.<(upg_catalog.float4, upg_catalog.float8),
OPERATOR 2 upg_catalog.<=(upg_catalog.float4, upg_catalog.float8),
OPERATOR 3 upg_catalog.=(upg_catalog.float4, upg_catalog.float8),
OPERATOR 4 upg_catalog.>=(upg_catalog.float4, upg_catalog.float8),
OPERATOR 5 upg_catalog.>(upg_catalog.float4, upg_catalog.float8),
FUNCTION 1 upg_catalog.btfloat48cmp(upg_catalog.float4, upg_catalog.float8);
CREATE OPERATOR CLASS float8_ops DEFAULT FOR TYPE upg_catalog.float8 USING bitmap AS
OPERATOR 1 upg_catalog.<(upg_catalog.float8, upg_catalog.float8),
OPERATOR 2 upg_catalog.<=(upg_catalog.float8, upg_catalog.float8),
OPERATOR 3 upg_catalog.=(upg_catalog.float8, upg_catalog.float8),
OPERATOR 4 upg_catalog.>=(upg_catalog.float8, upg_catalog.float8),
OPERATOR 5 upg_catalog.>(upg_catalog.float8, upg_catalog.float8),
FUNCTION 1 upg_catalog.btfloat8cmp(upg_catalog.float8, upg_catalog.float8),
OPERATOR 1 upg_catalog.<(upg_catalog.float8, upg_catalog.float4),
OPERATOR 2 upg_catalog.<=(upg_catalog.float8, upg_catalog.float4),
OPERATOR 3 upg_catalog.=(upg_catalog.float8, upg_catalog.float4),
OPERATOR 4 upg_catalog.>=(upg_catalog.float8, upg_catalog.float4),
OPERATOR 5 upg_catalog.>(upg_catalog.float8, upg_catalog.float4),
FUNCTION 1 upg_catalog.btfloat84cmp(upg_catalog.float8, upg_catalog.float4);
CREATE OPERATOR CLASS float8_ops DEFAULT FOR TYPE upg_catalog.float8 USING hash AS
OPERATOR 1 upg_catalog.=(upg_catalog.float8, upg_catalog.float8),
FUNCTION 1 upg_catalog.hashfloat8(upg_catalog.float8);
CREATE OPERATOR CLASS float8_ops DEFAULT FOR TYPE upg_catalog.float8 USING btree AS
OPERATOR 1 upg_catalog.<(upg_catalog.float8, upg_catalog.float8),
OPERATOR 2 upg_catalog.<=(upg_catalog.float8, upg_catalog.float8),
OPERATOR 3 upg_catalog.=(upg_catalog.float8, upg_catalog.float8),
OPERATOR 4 upg_catalog.>=(upg_catalog.float8, upg_catalog.float8),
OPERATOR 5 upg_catalog.>(upg_catalog.float8, upg_catalog.float8),
FUNCTION 1 upg_catalog.btfloat8cmp(upg_catalog.float8, upg_catalog.float8),
OPERATOR 1 upg_catalog.<(upg_catalog.float8, upg_catalog.float4),
OPERATOR 2 upg_catalog.<=(upg_catalog.float8, upg_catalog.float4),
OPERATOR 3 upg_catalog.=(upg_catalog.float8, upg_catalog.float4),
OPERATOR 4 upg_catalog.>=(upg_catalog.float8, upg_catalog.float4),
OPERATOR 5 upg_catalog.>(upg_catalog.float8, upg_catalog.float4),
FUNCTION 1 upg_catalog.btfloat84cmp(upg_catalog.float8, upg_catalog.float4);
CREATE OPERATOR CLASS abstime_ops DEFAULT FOR TYPE upg_catalog.abstime USING bitmap AS
OPERATOR 1 upg_catalog.<(upg_catalog.abstime, upg_catalog.abstime),
OPERATOR 2 upg_catalog.<=(upg_catalog.abstime, upg_catalog.abstime),
OPERATOR 3 upg_catalog.=(upg_catalog.abstime, upg_catalog.abstime),
OPERATOR 4 upg_catalog.>=(upg_catalog.abstime, upg_catalog.abstime),
OPERATOR 5 upg_catalog.>(upg_catalog.abstime, upg_catalog.abstime),
FUNCTION 1 upg_catalog.btabstimecmp(upg_catalog.abstime, upg_catalog.abstime);
CREATE OPERATOR CLASS abstime_ops DEFAULT FOR TYPE upg_catalog.abstime USING hash AS
OPERATOR 1 upg_catalog.=(upg_catalog.abstime, upg_catalog.abstime),
FUNCTION 1 upg_catalog.hashint4(upg_catalog.int4);
CREATE OPERATOR CLASS abstime_ops DEFAULT FOR TYPE upg_catalog.abstime USING btree AS
OPERATOR 1 upg_catalog.<(upg_catalog.abstime, upg_catalog.abstime),
OPERATOR 2 upg_catalog.<=(upg_catalog.abstime, upg_catalog.abstime),
OPERATOR 3 upg_catalog.=(upg_catalog.abstime, upg_catalog.abstime),
OPERATOR 4 upg_catalog.>=(upg_catalog.abstime, upg_catalog.abstime),
OPERATOR 5 upg_catalog.>(upg_catalog.abstime, upg_catalog.abstime),
FUNCTION 1 upg_catalog.btabstimecmp(upg_catalog.abstime, upg_catalog.abstime);
CREATE OPERATOR CLASS reltime_ops DEFAULT FOR TYPE upg_catalog.reltime USING bitmap AS
OPERATOR 1 upg_catalog.<(upg_catalog.reltime, upg_catalog.reltime),
OPERATOR 2 upg_catalog.<=(upg_catalog.reltime, upg_catalog.reltime),
OPERATOR 3 upg_catalog.=(upg_catalog.reltime, upg_catalog.reltime),
OPERATOR 4 upg_catalog.>=(upg_catalog.reltime, upg_catalog.reltime),
OPERATOR 5 upg_catalog.>(upg_catalog.reltime, upg_catalog.reltime),
FUNCTION 1 upg_catalog.btreltimecmp(upg_catalog.reltime, upg_catalog.reltime);
CREATE OPERATOR CLASS reltime_ops DEFAULT FOR TYPE upg_catalog.reltime USING btree AS
OPERATOR 1 upg_catalog.<(upg_catalog.reltime, upg_catalog.reltime),
OPERATOR 2 upg_catalog.<=(upg_catalog.reltime, upg_catalog.reltime),
OPERATOR 3 upg_catalog.=(upg_catalog.reltime, upg_catalog.reltime),
OPERATOR 4 upg_catalog.>=(upg_catalog.reltime, upg_catalog.reltime),
OPERATOR 5 upg_catalog.>(upg_catalog.reltime, upg_catalog.reltime),
FUNCTION 1 upg_catalog.btreltimecmp(upg_catalog.reltime, upg_catalog.reltime);
CREATE OPERATOR CLASS reltime_ops DEFAULT FOR TYPE upg_catalog.reltime USING hash AS
OPERATOR 1 upg_catalog.=(upg_catalog.reltime, upg_catalog.reltime),
FUNCTION 1 upg_catalog.hashint4(upg_catalog.int4);
CREATE OPERATOR CLASS tinterval_ops DEFAULT FOR TYPE upg_catalog.tinterval USING bitmap AS
OPERATOR 1 upg_catalog.<(upg_catalog.tinterval, upg_catalog.tinterval),
OPERATOR 2 upg_catalog.<=(upg_catalog.tinterval, upg_catalog.tinterval),
OPERATOR 3 upg_catalog.=(upg_catalog.tinterval, upg_catalog.tinterval),
OPERATOR 4 upg_catalog.>=(upg_catalog.tinterval, upg_catalog.tinterval),
OPERATOR 5 upg_catalog.>(upg_catalog.tinterval, upg_catalog.tinterval),
FUNCTION 1 upg_catalog.bttintervalcmp(upg_catalog.tinterval, upg_catalog.tinterval);
CREATE OPERATOR CLASS tinterval_ops DEFAULT FOR TYPE upg_catalog.tinterval USING btree AS
OPERATOR 1 upg_catalog.<(upg_catalog.tinterval, upg_catalog.tinterval),
OPERATOR 2 upg_catalog.<=(upg_catalog.tinterval, upg_catalog.tinterval),
OPERATOR 3 upg_catalog.=(upg_catalog.tinterval, upg_catalog.tinterval),
OPERATOR 4 upg_catalog.>=(upg_catalog.tinterval, upg_catalog.tinterval),
OPERATOR 5 upg_catalog.>(upg_catalog.tinterval, upg_catalog.tinterval),
FUNCTION 1 upg_catalog.bttintervalcmp(upg_catalog.tinterval, upg_catalog.tinterval);
CREATE OPERATOR CLASS circle_ops DEFAULT FOR TYPE upg_catalog.circle USING gist AS
OPERATOR 1 upg_catalog.<<(upg_catalog.circle, upg_catalog.circle) RECHECK,
OPERATOR 2 upg_catalog.&<(upg_catalog.circle, upg_catalog.circle) RECHECK,
OPERATOR 3 upg_catalog.&&(upg_catalog.circle, upg_catalog.circle) RECHECK,
OPERATOR 4 upg_catalog.&>(upg_catalog.circle, upg_catalog.circle) RECHECK,
OPERATOR 5 upg_catalog.>>(upg_catalog.circle, upg_catalog.circle) RECHECK,
OPERATOR 6 upg_catalog.~=(upg_catalog.circle, upg_catalog.circle) RECHECK,
OPERATOR 7 upg_catalog.@>(upg_catalog.circle, upg_catalog.circle) RECHECK,
OPERATOR 8 upg_catalog.<@(upg_catalog.circle, upg_catalog.circle) RECHECK,
OPERATOR 9 upg_catalog.&<|(upg_catalog.circle, upg_catalog.circle) RECHECK,
OPERATOR 10 upg_catalog.<<|(upg_catalog.circle, upg_catalog.circle) RECHECK,
OPERATOR 11 upg_catalog.|>>(upg_catalog.circle, upg_catalog.circle) RECHECK,
OPERATOR 12 upg_catalog.|&>(upg_catalog.circle, upg_catalog.circle) RECHECK,
OPERATOR 13 upg_catalog.~(upg_catalog.circle, upg_catalog.circle) RECHECK,
OPERATOR 14 upg_catalog.@(upg_catalog.circle, upg_catalog.circle) RECHECK,
FUNCTION 1 upg_catalog.gist_circle_consistent(pg_catalog.internal, upg_catalog.circle, upg_catalog.int4),
FUNCTION 2 upg_catalog.gist_box_union(pg_catalog.internal, pg_catalog.internal),
FUNCTION 3 upg_catalog.gist_circle_compress(pg_catalog.internal),
FUNCTION 4 upg_catalog.gist_box_decompress(pg_catalog.internal),
FUNCTION 5 upg_catalog.gist_box_penalty(pg_catalog.internal, pg_catalog.internal, pg_catalog.internal),
FUNCTION 6 upg_catalog.gist_box_picksplit(pg_catalog.internal, pg_catalog.internal),
FUNCTION 7 upg_catalog.gist_box_same(upg_catalog.box, upg_catalog.box, pg_catalog.internal),
STORAGE box;
CREATE OPERATOR CLASS money_ops DEFAULT FOR TYPE upg_catalog.money USING bitmap AS
OPERATOR 1 upg_catalog.<(upg_catalog.money, upg_catalog.money),
OPERATOR 2 upg_catalog.<=(upg_catalog.money, upg_catalog.money),
OPERATOR 3 upg_catalog.=(upg_catalog.money, upg_catalog.money),
OPERATOR 4 upg_catalog.>=(upg_catalog.money, upg_catalog.money),
OPERATOR 5 upg_catalog.>(upg_catalog.money, upg_catalog.money),
FUNCTION 1 upg_catalog.cash_cmp(upg_catalog.money, upg_catalog.money);
CREATE OPERATOR CLASS money_ops DEFAULT FOR TYPE upg_catalog.money USING btree AS
OPERATOR 1 upg_catalog.<(upg_catalog.money, upg_catalog.money),
OPERATOR 2 upg_catalog.<=(upg_catalog.money, upg_catalog.money),
OPERATOR 3 upg_catalog.=(upg_catalog.money, upg_catalog.money),
OPERATOR 4 upg_catalog.>=(upg_catalog.money, upg_catalog.money),
OPERATOR 5 upg_catalog.>(upg_catalog.money, upg_catalog.money),
FUNCTION 1 upg_catalog.cash_cmp(upg_catalog.money, upg_catalog.money);
CREATE OPERATOR CLASS _money_ops DEFAULT FOR TYPE upg_catalog._money USING gin AS
OPERATOR 1 upg_catalog.&&(upg_catalog.anyarray, upg_catalog.anyarray),
OPERATOR 2 upg_catalog.@>(upg_catalog.anyarray, upg_catalog.anyarray),
OPERATOR 3 upg_catalog.<@(upg_catalog.anyarray, upg_catalog.anyarray) RECHECK,
OPERATOR 4 upg_catalog.=(upg_catalog.anyarray, upg_catalog.anyarray) RECHECK,
FUNCTION 1 upg_catalog.cash_cmp(upg_catalog.money, upg_catalog.money),
FUNCTION 2 upg_catalog.ginarrayextract(upg_catalog.anyarray, pg_catalog.internal),
FUNCTION 3 upg_catalog.ginarrayextract(upg_catalog.anyarray, pg_catalog.internal),
FUNCTION 4 upg_catalog.ginarrayconsistent(pg_catalog.internal, upg_catalog.int2, pg_catalog.internal),
STORAGE money;
CREATE OPERATOR CLASS macaddr_ops DEFAULT FOR TYPE upg_catalog.macaddr USING bitmap AS
OPERATOR 1 upg_catalog.<(upg_catalog.macaddr, upg_catalog.macaddr),
OPERATOR 2 upg_catalog.<=(upg_catalog.macaddr, upg_catalog.macaddr),
OPERATOR 3 upg_catalog.=(upg_catalog.macaddr, upg_catalog.macaddr),
OPERATOR 4 upg_catalog.>=(upg_catalog.macaddr, upg_catalog.macaddr),
OPERATOR 5 upg_catalog.>(upg_catalog.macaddr, upg_catalog.macaddr),
FUNCTION 1 upg_catalog.macaddr_cmp(upg_catalog.macaddr, upg_catalog.macaddr);
CREATE OPERATOR CLASS macaddr_ops DEFAULT FOR TYPE upg_catalog.macaddr USING hash AS
OPERATOR 1 upg_catalog.=(upg_catalog.macaddr, upg_catalog.macaddr),
FUNCTION 1 upg_catalog.hashmacaddr(upg_catalog.macaddr);
CREATE OPERATOR CLASS macaddr_ops DEFAULT FOR TYPE upg_catalog.macaddr USING btree AS
OPERATOR 1 upg_catalog.<(upg_catalog.macaddr, upg_catalog.macaddr),
OPERATOR 2 upg_catalog.<=(upg_catalog.macaddr, upg_catalog.macaddr),
OPERATOR 3 upg_catalog.=(upg_catalog.macaddr, upg_catalog.macaddr),
OPERATOR 4 upg_catalog.>=(upg_catalog.macaddr, upg_catalog.macaddr),
OPERATOR 5 upg_catalog.>(upg_catalog.macaddr, upg_catalog.macaddr),
FUNCTION 1 upg_catalog.macaddr_cmp(upg_catalog.macaddr, upg_catalog.macaddr);
CREATE OPERATOR CLASS inet_ops DEFAULT FOR TYPE upg_catalog.inet USING bitmap AS
OPERATOR 1 upg_catalog.<(upg_catalog.inet, upg_catalog.inet),
OPERATOR 2 upg_catalog.<=(upg_catalog.inet, upg_catalog.inet),
OPERATOR 3 upg_catalog.=(upg_catalog.inet, upg_catalog.inet),
OPERATOR 4 upg_catalog.>=(upg_catalog.inet, upg_catalog.inet),
OPERATOR 5 upg_catalog.>(upg_catalog.inet, upg_catalog.inet),
FUNCTION 1 upg_catalog.network_cmp(upg_catalog.inet, upg_catalog.inet);
CREATE OPERATOR CLASS inet_ops DEFAULT FOR TYPE upg_catalog.inet USING hash AS
OPERATOR 1 upg_catalog.=(upg_catalog.inet, upg_catalog.inet),
FUNCTION 1 upg_catalog.hashinet(upg_catalog.inet);
CREATE OPERATOR CLASS inet_ops DEFAULT FOR TYPE upg_catalog.inet USING btree AS
OPERATOR 1 upg_catalog.<(upg_catalog.inet, upg_catalog.inet),
OPERATOR 2 upg_catalog.<=(upg_catalog.inet, upg_catalog.inet),
OPERATOR 3 upg_catalog.=(upg_catalog.inet, upg_catalog.inet),
OPERATOR 4 upg_catalog.>=(upg_catalog.inet, upg_catalog.inet),
OPERATOR 5 upg_catalog.>(upg_catalog.inet, upg_catalog.inet),
FUNCTION 1 upg_catalog.network_cmp(upg_catalog.inet, upg_catalog.inet);
CREATE OPERATOR CLASS cidr_ops FOR TYPE upg_catalog.inet USING bitmap AS
OPERATOR 1 upg_catalog.<(upg_catalog.inet, upg_catalog.inet),
OPERATOR 2 upg_catalog.<=(upg_catalog.inet, upg_catalog.inet),
OPERATOR 3 upg_catalog.=(upg_catalog.inet, upg_catalog.inet),
OPERATOR 4 upg_catalog.>=(upg_catalog.inet, upg_catalog.inet),
OPERATOR 5 upg_catalog.>(upg_catalog.inet, upg_catalog.inet),
FUNCTION 1 upg_catalog.network_cmp(upg_catalog.inet, upg_catalog.inet);
CREATE OPERATOR CLASS cidr_ops FOR TYPE upg_catalog.inet USING hash AS
OPERATOR 1 upg_catalog.=(upg_catalog.inet, upg_catalog.inet),
FUNCTION 1 upg_catalog.hashinet(upg_catalog.inet);
CREATE OPERATOR CLASS cidr_ops FOR TYPE upg_catalog.inet USING btree AS
OPERATOR 1 upg_catalog.<(upg_catalog.inet, upg_catalog.inet),
OPERATOR 2 upg_catalog.<=(upg_catalog.inet, upg_catalog.inet),
OPERATOR 3 upg_catalog.=(upg_catalog.inet, upg_catalog.inet),
OPERATOR 4 upg_catalog.>=(upg_catalog.inet, upg_catalog.inet),
OPERATOR 5 upg_catalog.>(upg_catalog.inet, upg_catalog.inet),
FUNCTION 1 upg_catalog.network_cmp(upg_catalog.inet, upg_catalog.inet);
CREATE OPERATOR CLASS _bool_ops DEFAULT FOR TYPE upg_catalog._bool USING gin AS
OPERATOR 1 upg_catalog.&&(upg_catalog.anyarray, upg_catalog.anyarray),
OPERATOR 2 upg_catalog.@>(upg_catalog.anyarray, upg_catalog.anyarray),
OPERATOR 3 upg_catalog.<@(upg_catalog.anyarray, upg_catalog.anyarray) RECHECK,
OPERATOR 4 upg_catalog.=(upg_catalog.anyarray, upg_catalog.anyarray) RECHECK,
FUNCTION 1 upg_catalog.btboolcmp(upg_catalog.bool, upg_catalog.bool),
FUNCTION 2 upg_catalog.ginarrayextract(upg_catalog.anyarray, pg_catalog.internal),
FUNCTION 3 upg_catalog.ginarrayextract(upg_catalog.anyarray, pg_catalog.internal),
FUNCTION 4 upg_catalog.ginarrayconsistent(pg_catalog.internal, upg_catalog.int2, pg_catalog.internal),
STORAGE bool;
CREATE OPERATOR CLASS _bytea_ops DEFAULT FOR TYPE upg_catalog._bytea USING gin AS
OPERATOR 1 upg_catalog.&&(upg_catalog.anyarray, upg_catalog.anyarray),
OPERATOR 2 upg_catalog.@>(upg_catalog.anyarray, upg_catalog.anyarray),
OPERATOR 3 upg_catalog.<@(upg_catalog.anyarray, upg_catalog.anyarray) RECHECK,
OPERATOR 4 upg_catalog.=(upg_catalog.anyarray, upg_catalog.anyarray) RECHECK,
FUNCTION 1 upg_catalog.byteacmp(upg_catalog.bytea, upg_catalog.bytea),
FUNCTION 2 upg_catalog.ginarrayextract(upg_catalog.anyarray, pg_catalog.internal),
FUNCTION 3 upg_catalog.ginarrayextract(upg_catalog.anyarray, pg_catalog.internal),
FUNCTION 4 upg_catalog.ginarrayconsistent(pg_catalog.internal, upg_catalog.int2, pg_catalog.internal),
STORAGE bytea;
CREATE OPERATOR CLASS _char_ops DEFAULT FOR TYPE upg_catalog._char USING gin AS
OPERATOR 1 upg_catalog.&&(upg_catalog.anyarray, upg_catalog.anyarray),
OPERATOR 2 upg_catalog.@>(upg_catalog.anyarray, upg_catalog.anyarray),
OPERATOR 3 upg_catalog.<@(upg_catalog.anyarray, upg_catalog.anyarray) RECHECK,
OPERATOR 4 upg_catalog.=(upg_catalog.anyarray, upg_catalog.anyarray) RECHECK,
FUNCTION 1 upg_catalog.btcharcmp(upg_catalog."char", upg_catalog."char"),
FUNCTION 2 upg_catalog.ginarrayextract(upg_catalog.anyarray, pg_catalog.internal),
FUNCTION 3 upg_catalog.ginarrayextract(upg_catalog.anyarray, pg_catalog.internal),
FUNCTION 4 upg_catalog.ginarrayconsistent(pg_catalog.internal, upg_catalog.int2, pg_catalog.internal),
STORAGE "char";
CREATE OPERATOR CLASS _name_ops DEFAULT FOR TYPE upg_catalog._name USING gin AS
OPERATOR 1 upg_catalog.&&(upg_catalog.anyarray, upg_catalog.anyarray),
OPERATOR 2 upg_catalog.@>(upg_catalog.anyarray, upg_catalog.anyarray),
OPERATOR 3 upg_catalog.<@(upg_catalog.anyarray, upg_catalog.anyarray) RECHECK,
OPERATOR 4 upg_catalog.=(upg_catalog.anyarray, upg_catalog.anyarray) RECHECK,
FUNCTION 1 upg_catalog.btnamecmp(upg_catalog.name, upg_catalog.name),
FUNCTION 2 upg_catalog.ginarrayextract(upg_catalog.anyarray, pg_catalog.internal),
FUNCTION 3 upg_catalog.ginarrayextract(upg_catalog.anyarray, pg_catalog.internal),
FUNCTION 4 upg_catalog.ginarrayconsistent(pg_catalog.internal, upg_catalog.int2, pg_catalog.internal),
STORAGE name;
CREATE OPERATOR CLASS _int2_ops DEFAULT FOR TYPE upg_catalog._int2 USING gin AS
OPERATOR 1 upg_catalog.&&(upg_catalog.anyarray, upg_catalog.anyarray),
OPERATOR 2 upg_catalog.@>(upg_catalog.anyarray, upg_catalog.anyarray),
OPERATOR 3 upg_catalog.<@(upg_catalog.anyarray, upg_catalog.anyarray) RECHECK,
OPERATOR 4 upg_catalog.=(upg_catalog.anyarray, upg_catalog.anyarray) RECHECK,
FUNCTION 1 upg_catalog.btint2cmp(upg_catalog.int2, upg_catalog.int2),
FUNCTION 2 upg_catalog.ginarrayextract(upg_catalog.anyarray, pg_catalog.internal),
FUNCTION 3 upg_catalog.ginarrayextract(upg_catalog.anyarray, pg_catalog.internal),
FUNCTION 4 upg_catalog.ginarrayconsistent(pg_catalog.internal, upg_catalog.int2, pg_catalog.internal),
STORAGE int2;
CREATE OPERATOR CLASS _int4_ops DEFAULT FOR TYPE upg_catalog._int4 USING gin AS
OPERATOR 1 upg_catalog.&&(upg_catalog.anyarray, upg_catalog.anyarray),
OPERATOR 2 upg_catalog.@>(upg_catalog.anyarray, upg_catalog.anyarray),
OPERATOR 3 upg_catalog.<@(upg_catalog.anyarray, upg_catalog.anyarray) RECHECK,
OPERATOR 4 upg_catalog.=(upg_catalog.anyarray, upg_catalog.anyarray) RECHECK,
FUNCTION 1 upg_catalog.btint4cmp(upg_catalog.int4, upg_catalog.int4),
FUNCTION 2 upg_catalog.ginarrayextract(upg_catalog.anyarray, pg_catalog.internal),
FUNCTION 3 upg_catalog.ginarrayextract(upg_catalog.anyarray, pg_catalog.internal),
FUNCTION 4 upg_catalog.ginarrayconsistent(pg_catalog.internal, upg_catalog.int2, pg_catalog.internal),
STORAGE int4;
CREATE OPERATOR CLASS _text_ops DEFAULT FOR TYPE upg_catalog._text USING gin AS
OPERATOR 1 upg_catalog.&&(upg_catalog.anyarray, upg_catalog.anyarray),
OPERATOR 2 upg_catalog.@>(upg_catalog.anyarray, upg_catalog.anyarray),
OPERATOR 3 upg_catalog.<@(upg_catalog.anyarray, upg_catalog.anyarray) RECHECK,
OPERATOR 4 upg_catalog.=(upg_catalog.anyarray, upg_catalog.anyarray) RECHECK,
FUNCTION 1 upg_catalog.bttextcmp(upg_catalog.text, upg_catalog.text),
FUNCTION 2 upg_catalog.ginarrayextract(upg_catalog.anyarray, pg_catalog.internal),
FUNCTION 3 upg_catalog.ginarrayextract(upg_catalog.anyarray, pg_catalog.internal),
FUNCTION 4 upg_catalog.ginarrayconsistent(pg_catalog.internal, upg_catalog.int2, pg_catalog.internal),
STORAGE text;
CREATE OPERATOR CLASS _oid_ops DEFAULT FOR TYPE upg_catalog._oid USING gin AS
OPERATOR 1 upg_catalog.&&(upg_catalog.anyarray, upg_catalog.anyarray),
OPERATOR 2 upg_catalog.@>(upg_catalog.anyarray, upg_catalog.anyarray),
OPERATOR 3 upg_catalog.<@(upg_catalog.anyarray, upg_catalog.anyarray) RECHECK,
OPERATOR 4 upg_catalog.=(upg_catalog.anyarray, upg_catalog.anyarray) RECHECK,
FUNCTION 1 upg_catalog.btoidcmp(upg_catalog.oid, upg_catalog.oid),
FUNCTION 2 upg_catalog.ginarrayextract(upg_catalog.anyarray, pg_catalog.internal),
FUNCTION 3 upg_catalog.ginarrayextract(upg_catalog.anyarray, pg_catalog.internal),
FUNCTION 4 upg_catalog.ginarrayconsistent(pg_catalog.internal, upg_catalog.int2, pg_catalog.internal),
STORAGE oid;
CREATE OPERATOR CLASS _oidvector_ops DEFAULT FOR TYPE upg_catalog._oidvector USING gin AS
OPERATOR 1 upg_catalog.&&(upg_catalog.anyarray, upg_catalog.anyarray),
OPERATOR 2 upg_catalog.@>(upg_catalog.anyarray, upg_catalog.anyarray),
OPERATOR 3 upg_catalog.<@(upg_catalog.anyarray, upg_catalog.anyarray) RECHECK,
OPERATOR 4 upg_catalog.=(upg_catalog.anyarray, upg_catalog.anyarray) RECHECK,
FUNCTION 1 upg_catalog.btoidvectorcmp(upg_catalog.oidvector, upg_catalog.oidvector),
FUNCTION 2 upg_catalog.ginarrayextract(upg_catalog.anyarray, pg_catalog.internal),
FUNCTION 3 upg_catalog.ginarrayextract(upg_catalog.anyarray, pg_catalog.internal),
FUNCTION 4 upg_catalog.ginarrayconsistent(pg_catalog.internal, upg_catalog.int2, pg_catalog.internal),
STORAGE oidvector;
CREATE OPERATOR CLASS _bpchar_ops DEFAULT FOR TYPE upg_catalog._bpchar USING gin AS
OPERATOR 1 upg_catalog.&&(upg_catalog.anyarray, upg_catalog.anyarray),
OPERATOR 2 upg_catalog.@>(upg_catalog.anyarray, upg_catalog.anyarray),
OPERATOR 3 upg_catalog.<@(upg_catalog.anyarray, upg_catalog.anyarray) RECHECK,
OPERATOR 4 upg_catalog.=(upg_catalog.anyarray, upg_catalog.anyarray) RECHECK,
FUNCTION 1 upg_catalog.bpcharcmp(upg_catalog.bpchar, upg_catalog.bpchar),
FUNCTION 2 upg_catalog.ginarrayextract(upg_catalog.anyarray, pg_catalog.internal),
FUNCTION 3 upg_catalog.ginarrayextract(upg_catalog.anyarray, pg_catalog.internal),
FUNCTION 4 upg_catalog.ginarrayconsistent(pg_catalog.internal, upg_catalog.int2, pg_catalog.internal),
STORAGE bpchar;
CREATE OPERATOR CLASS _varchar_ops DEFAULT FOR TYPE upg_catalog._varchar USING gin AS
OPERATOR 1 upg_catalog.&&(upg_catalog.anyarray, upg_catalog.anyarray),
OPERATOR 2 upg_catalog.@>(upg_catalog.anyarray, upg_catalog.anyarray),
OPERATOR 3 upg_catalog.<@(upg_catalog.anyarray, upg_catalog.anyarray) RECHECK,
OPERATOR 4 upg_catalog.=(upg_catalog.anyarray, upg_catalog.anyarray) RECHECK,
FUNCTION 1 upg_catalog.bttextcmp(upg_catalog.text, upg_catalog.text),
FUNCTION 2 upg_catalog.ginarrayextract(upg_catalog.anyarray, pg_catalog.internal),
FUNCTION 3 upg_catalog.ginarrayextract(upg_catalog.anyarray, pg_catalog.internal),
FUNCTION 4 upg_catalog.ginarrayconsistent(pg_catalog.internal, upg_catalog.int2, pg_catalog.internal),
STORAGE "varchar";
CREATE OPERATOR CLASS _int8_ops DEFAULT FOR TYPE upg_catalog._int8 USING gin AS
OPERATOR 1 upg_catalog.&&(upg_catalog.anyarray, upg_catalog.anyarray),
OPERATOR 2 upg_catalog.@>(upg_catalog.anyarray, upg_catalog.anyarray),
OPERATOR 3 upg_catalog.<@(upg_catalog.anyarray, upg_catalog.anyarray) RECHECK,
OPERATOR 4 upg_catalog.=(upg_catalog.anyarray, upg_catalog.anyarray) RECHECK,
FUNCTION 1 upg_catalog.btint8cmp(upg_catalog.int8, upg_catalog.int8),
FUNCTION 2 upg_catalog.ginarrayextract(upg_catalog.anyarray, pg_catalog.internal),
FUNCTION 3 upg_catalog.ginarrayextract(upg_catalog.anyarray, pg_catalog.internal),
FUNCTION 4 upg_catalog.ginarrayconsistent(pg_catalog.internal, upg_catalog.int2, pg_catalog.internal),
STORAGE int8;
CREATE OPERATOR CLASS _float4_ops DEFAULT FOR TYPE upg_catalog._float4 USING gin AS
OPERATOR 1 upg_catalog.&&(upg_catalog.anyarray, upg_catalog.anyarray),
OPERATOR 2 upg_catalog.@>(upg_catalog.anyarray, upg_catalog.anyarray),
OPERATOR 3 upg_catalog.<@(upg_catalog.anyarray, upg_catalog.anyarray) RECHECK,
OPERATOR 4 upg_catalog.=(upg_catalog.anyarray, upg_catalog.anyarray) RECHECK,
FUNCTION 1 upg_catalog.btfloat4cmp(upg_catalog.float4, upg_catalog.float4),
FUNCTION 2 upg_catalog.ginarrayextract(upg_catalog.anyarray, pg_catalog.internal),
FUNCTION 3 upg_catalog.ginarrayextract(upg_catalog.anyarray, pg_catalog.internal),
FUNCTION 4 upg_catalog.ginarrayconsistent(pg_catalog.internal, upg_catalog.int2, pg_catalog.internal),
STORAGE float4;
CREATE OPERATOR CLASS _float8_ops DEFAULT FOR TYPE upg_catalog._float8 USING gin AS
OPERATOR 1 upg_catalog.&&(upg_catalog.anyarray, upg_catalog.anyarray),
OPERATOR 2 upg_catalog.@>(upg_catalog.anyarray, upg_catalog.anyarray),
OPERATOR 3 upg_catalog.<@(upg_catalog.anyarray, upg_catalog.anyarray) RECHECK,
OPERATOR 4 upg_catalog.=(upg_catalog.anyarray, upg_catalog.anyarray) RECHECK,
FUNCTION 1 upg_catalog.btfloat8cmp(upg_catalog.float8, upg_catalog.float8),
FUNCTION 2 upg_catalog.ginarrayextract(upg_catalog.anyarray, pg_catalog.internal),
FUNCTION 3 upg_catalog.ginarrayextract(upg_catalog.anyarray, pg_catalog.internal),
FUNCTION 4 upg_catalog.ginarrayconsistent(pg_catalog.internal, upg_catalog.int2, pg_catalog.internal),
STORAGE float8;
CREATE OPERATOR CLASS _abstime_ops DEFAULT FOR TYPE upg_catalog._abstime USING gin AS
OPERATOR 1 upg_catalog.&&(upg_catalog.anyarray, upg_catalog.anyarray),
OPERATOR 2 upg_catalog.@>(upg_catalog.anyarray, upg_catalog.anyarray),
OPERATOR 3 upg_catalog.<@(upg_catalog.anyarray, upg_catalog.anyarray) RECHECK,
OPERATOR 4 upg_catalog.=(upg_catalog.anyarray, upg_catalog.anyarray) RECHECK,
FUNCTION 1 upg_catalog.btabstimecmp(upg_catalog.abstime, upg_catalog.abstime),
FUNCTION 2 upg_catalog.ginarrayextract(upg_catalog.anyarray, pg_catalog.internal),
FUNCTION 3 upg_catalog.ginarrayextract(upg_catalog.anyarray, pg_catalog.internal),
FUNCTION 4 upg_catalog.ginarrayconsistent(pg_catalog.internal, upg_catalog.int2, pg_catalog.internal),
STORAGE abstime;
CREATE OPERATOR CLASS _reltime_ops DEFAULT FOR TYPE upg_catalog._reltime USING gin AS
OPERATOR 1 upg_catalog.&&(upg_catalog.anyarray, upg_catalog.anyarray),
OPERATOR 2 upg_catalog.@>(upg_catalog.anyarray, upg_catalog.anyarray),
OPERATOR 3 upg_catalog.<@(upg_catalog.anyarray, upg_catalog.anyarray) RECHECK,
OPERATOR 4 upg_catalog.=(upg_catalog.anyarray, upg_catalog.anyarray) RECHECK,
FUNCTION 1 upg_catalog.btreltimecmp(upg_catalog.reltime, upg_catalog.reltime),
FUNCTION 2 upg_catalog.ginarrayextract(upg_catalog.anyarray, pg_catalog.internal),
FUNCTION 3 upg_catalog.ginarrayextract(upg_catalog.anyarray, pg_catalog.internal),
FUNCTION 4 upg_catalog.ginarrayconsistent(pg_catalog.internal, upg_catalog.int2, pg_catalog.internal),
STORAGE reltime;
CREATE OPERATOR CLASS _tinterval_ops DEFAULT FOR TYPE upg_catalog._tinterval USING gin AS
OPERATOR 1 upg_catalog.&&(upg_catalog.anyarray, upg_catalog.anyarray),
OPERATOR 2 upg_catalog.@>(upg_catalog.anyarray, upg_catalog.anyarray),
OPERATOR 3 upg_catalog.<@(upg_catalog.anyarray, upg_catalog.anyarray) RECHECK,
OPERATOR 4 upg_catalog.=(upg_catalog.anyarray, upg_catalog.anyarray) RECHECK,
FUNCTION 1 upg_catalog.bttintervalcmp(upg_catalog.tinterval, upg_catalog.tinterval),
FUNCTION 2 upg_catalog.ginarrayextract(upg_catalog.anyarray, pg_catalog.internal),
FUNCTION 3 upg_catalog.ginarrayextract(upg_catalog.anyarray, pg_catalog.internal),
FUNCTION 4 upg_catalog.ginarrayconsistent(pg_catalog.internal, upg_catalog.int2, pg_catalog.internal),
STORAGE tinterval;
CREATE OPERATOR CLASS aclitem_ops DEFAULT FOR TYPE upg_catalog.aclitem USING hash AS
OPERATOR 1 upg_catalog.=(upg_catalog.aclitem, upg_catalog.aclitem),
FUNCTION 1 upg_catalog.hash_aclitem(upg_catalog.aclitem);
CREATE OPERATOR CLASS _macaddr_ops DEFAULT FOR TYPE upg_catalog._macaddr USING gin AS
OPERATOR 1 upg_catalog.&&(upg_catalog.anyarray, upg_catalog.anyarray),
OPERATOR 2 upg_catalog.@>(upg_catalog.anyarray, upg_catalog.anyarray),
OPERATOR 3 upg_catalog.<@(upg_catalog.anyarray, upg_catalog.anyarray) RECHECK,
OPERATOR 4 upg_catalog.=(upg_catalog.anyarray, upg_catalog.anyarray) RECHECK,
FUNCTION 1 upg_catalog.macaddr_cmp(upg_catalog.macaddr, upg_catalog.macaddr),
FUNCTION 2 upg_catalog.ginarrayextract(upg_catalog.anyarray, pg_catalog.internal),
FUNCTION 3 upg_catalog.ginarrayextract(upg_catalog.anyarray, pg_catalog.internal),
FUNCTION 4 upg_catalog.ginarrayconsistent(pg_catalog.internal, upg_catalog.int2, pg_catalog.internal),
STORAGE macaddr;
CREATE OPERATOR CLASS _inet_ops DEFAULT FOR TYPE upg_catalog._inet USING gin AS
OPERATOR 1 upg_catalog.&&(upg_catalog.anyarray, upg_catalog.anyarray),
OPERATOR 2 upg_catalog.@>(upg_catalog.anyarray, upg_catalog.anyarray),
OPERATOR 3 upg_catalog.<@(upg_catalog.anyarray, upg_catalog.anyarray) RECHECK,
OPERATOR 4 upg_catalog.=(upg_catalog.anyarray, upg_catalog.anyarray) RECHECK,
FUNCTION 1 upg_catalog.network_cmp(upg_catalog.inet, upg_catalog.inet),
FUNCTION 2 upg_catalog.ginarrayextract(upg_catalog.anyarray, pg_catalog.internal),
FUNCTION 3 upg_catalog.ginarrayextract(upg_catalog.anyarray, pg_catalog.internal),
FUNCTION 4 upg_catalog.ginarrayconsistent(pg_catalog.internal, upg_catalog.int2, pg_catalog.internal),
STORAGE inet;
CREATE OPERATOR CLASS _cidr_ops DEFAULT FOR TYPE upg_catalog._cidr USING gin AS
OPERATOR 1 upg_catalog.&&(upg_catalog.anyarray, upg_catalog.anyarray),
OPERATOR 2 upg_catalog.@>(upg_catalog.anyarray, upg_catalog.anyarray),
OPERATOR 3 upg_catalog.<@(upg_catalog.anyarray, upg_catalog.anyarray) RECHECK,
OPERATOR 4 upg_catalog.=(upg_catalog.anyarray, upg_catalog.anyarray) RECHECK,
FUNCTION 1 upg_catalog.network_cmp(upg_catalog.inet, upg_catalog.inet),
FUNCTION 2 upg_catalog.ginarrayextract(upg_catalog.anyarray, pg_catalog.internal),
FUNCTION 3 upg_catalog.ginarrayextract(upg_catalog.anyarray, pg_catalog.internal),
FUNCTION 4 upg_catalog.ginarrayconsistent(pg_catalog.internal, upg_catalog.int2, pg_catalog.internal),
STORAGE cidr;
CREATE OPERATOR CLASS bpchar_pattern_ops FOR TYPE upg_catalog.bpchar USING bitmap AS
OPERATOR 1 upg_catalog.~<~(upg_catalog.bpchar, upg_catalog.bpchar),
OPERATOR 2 upg_catalog.~<=~(upg_catalog.bpchar, upg_catalog.bpchar),
OPERATOR 3 upg_catalog.~=~(upg_catalog.bpchar, upg_catalog.bpchar),
OPERATOR 4 upg_catalog.~>=~(upg_catalog.bpchar, upg_catalog.bpchar),
OPERATOR 5 upg_catalog.~>~(upg_catalog.bpchar, upg_catalog.bpchar),
FUNCTION 1 upg_catalog.btbpchar_pattern_cmp(upg_catalog.bpchar, upg_catalog.bpchar);
CREATE OPERATOR CLASS bpchar_ops DEFAULT FOR TYPE upg_catalog.bpchar USING bitmap AS
OPERATOR 1 upg_catalog.<(upg_catalog.bpchar, upg_catalog.bpchar),
OPERATOR 2 upg_catalog.<=(upg_catalog.bpchar, upg_catalog.bpchar),
OPERATOR 3 upg_catalog.=(upg_catalog.bpchar, upg_catalog.bpchar),
OPERATOR 4 upg_catalog.>=(upg_catalog.bpchar, upg_catalog.bpchar),
OPERATOR 5 upg_catalog.>(upg_catalog.bpchar, upg_catalog.bpchar),
FUNCTION 1 upg_catalog.bpcharcmp(upg_catalog.bpchar, upg_catalog.bpchar);
CREATE OPERATOR CLASS bpchar_pattern_ops FOR TYPE upg_catalog.bpchar USING hash AS
OPERATOR 1 upg_catalog.~=~(upg_catalog.bpchar, upg_catalog.bpchar),
FUNCTION 1 upg_catalog.hashvarlena(pg_catalog.internal);
CREATE OPERATOR CLASS bpchar_pattern_ops FOR TYPE upg_catalog.bpchar USING btree AS
OPERATOR 1 upg_catalog.~<~(upg_catalog.bpchar, upg_catalog.bpchar),
OPERATOR 2 upg_catalog.~<=~(upg_catalog.bpchar, upg_catalog.bpchar),
OPERATOR 3 upg_catalog.~=~(upg_catalog.bpchar, upg_catalog.bpchar),
OPERATOR 4 upg_catalog.~>=~(upg_catalog.bpchar, upg_catalog.bpchar),
OPERATOR 5 upg_catalog.~>~(upg_catalog.bpchar, upg_catalog.bpchar),
FUNCTION 1 upg_catalog.btbpchar_pattern_cmp(upg_catalog.bpchar, upg_catalog.bpchar);
CREATE OPERATOR CLASS bpchar_ops DEFAULT FOR TYPE upg_catalog.bpchar USING hash AS
OPERATOR 1 upg_catalog.=(upg_catalog.bpchar, upg_catalog.bpchar),
FUNCTION 1 upg_catalog.hashbpchar(upg_catalog.bpchar);
CREATE OPERATOR CLASS bpchar_ops DEFAULT FOR TYPE upg_catalog.bpchar USING btree AS
OPERATOR 1 upg_catalog.<(upg_catalog.bpchar, upg_catalog.bpchar),
OPERATOR 2 upg_catalog.<=(upg_catalog.bpchar, upg_catalog.bpchar),
OPERATOR 3 upg_catalog.=(upg_catalog.bpchar, upg_catalog.bpchar),
OPERATOR 4 upg_catalog.>=(upg_catalog.bpchar, upg_catalog.bpchar),
OPERATOR 5 upg_catalog.>(upg_catalog.bpchar, upg_catalog.bpchar),
FUNCTION 1 upg_catalog.bpcharcmp(upg_catalog.bpchar, upg_catalog.bpchar);
CREATE OPERATOR CLASS varchar_pattern_ops FOR TYPE upg_catalog.text USING bitmap AS
OPERATOR 1 upg_catalog.~<~(upg_catalog.text, upg_catalog.text),
OPERATOR 2 upg_catalog.~<=~(upg_catalog.text, upg_catalog.text),
OPERATOR 3 upg_catalog.~=~(upg_catalog.text, upg_catalog.text),
OPERATOR 4 upg_catalog.~>=~(upg_catalog.text, upg_catalog.text),
OPERATOR 5 upg_catalog.~>~(upg_catalog.text, upg_catalog.text),
FUNCTION 1 upg_catalog.bttext_pattern_cmp(upg_catalog.text, upg_catalog.text);
CREATE OPERATOR CLASS varchar_ops FOR TYPE upg_catalog.text USING bitmap AS
OPERATOR 1 upg_catalog.<(upg_catalog.text, upg_catalog.text),
OPERATOR 2 upg_catalog.<=(upg_catalog.text, upg_catalog.text),
OPERATOR 3 upg_catalog.=(upg_catalog.text, upg_catalog.text),
OPERATOR 4 upg_catalog.>=(upg_catalog.text, upg_catalog.text),
OPERATOR 5 upg_catalog.>(upg_catalog.text, upg_catalog.text),
FUNCTION 1 upg_catalog.bttextcmp(upg_catalog.text, upg_catalog.text);
CREATE OPERATOR CLASS varchar_pattern_ops FOR TYPE upg_catalog.text USING hash AS
OPERATOR 1 upg_catalog.~=~(upg_catalog.text, upg_catalog.text),
FUNCTION 1 upg_catalog.hashvarlena(pg_catalog.internal);
CREATE OPERATOR CLASS varchar_pattern_ops FOR TYPE upg_catalog.text USING btree AS
OPERATOR 1 upg_catalog.~<~(upg_catalog.text, upg_catalog.text),
OPERATOR 2 upg_catalog.~<=~(upg_catalog.text, upg_catalog.text),
OPERATOR 3 upg_catalog.~=~(upg_catalog.text, upg_catalog.text),
OPERATOR 4 upg_catalog.~>=~(upg_catalog.text, upg_catalog.text),
OPERATOR 5 upg_catalog.~>~(upg_catalog.text, upg_catalog.text),
FUNCTION 1 upg_catalog.bttext_pattern_cmp(upg_catalog.text, upg_catalog.text);
CREATE OPERATOR CLASS varchar_ops FOR TYPE upg_catalog.text USING hash AS
OPERATOR 1 upg_catalog.=(upg_catalog.text, upg_catalog.text),
FUNCTION 1 upg_catalog.hashtext(upg_catalog.text);
CREATE OPERATOR CLASS varchar_ops FOR TYPE upg_catalog.text USING btree AS
OPERATOR 1 upg_catalog.<(upg_catalog.text, upg_catalog.text),
OPERATOR 2 upg_catalog.<=(upg_catalog.text, upg_catalog.text),
OPERATOR 3 upg_catalog.=(upg_catalog.text, upg_catalog.text),
OPERATOR 4 upg_catalog.>=(upg_catalog.text, upg_catalog.text),
OPERATOR 5 upg_catalog.>(upg_catalog.text, upg_catalog.text),
FUNCTION 1 upg_catalog.bttextcmp(upg_catalog.text, upg_catalog.text);
CREATE OPERATOR CLASS date_ops DEFAULT FOR TYPE upg_catalog.date USING bitmap AS
OPERATOR 1 upg_catalog.<(upg_catalog.date, upg_catalog.date),
OPERATOR 2 upg_catalog.<=(upg_catalog.date, upg_catalog.date),
OPERATOR 3 upg_catalog.=(upg_catalog.date, upg_catalog.date),
OPERATOR 4 upg_catalog.>=(upg_catalog.date, upg_catalog.date),
OPERATOR 5 upg_catalog.>(upg_catalog.date, upg_catalog.date),
FUNCTION 1 upg_catalog.date_cmp(upg_catalog.date, upg_catalog.date),
OPERATOR 1 upg_catalog.<(upg_catalog.date, upg_catalog.timestamp),
OPERATOR 2 upg_catalog.<=(upg_catalog.date, upg_catalog.timestamp),
OPERATOR 3 upg_catalog.=(upg_catalog.date, upg_catalog.timestamp),
OPERATOR 4 upg_catalog.>=(upg_catalog.date, upg_catalog.timestamp),
OPERATOR 5 upg_catalog.>(upg_catalog.date, upg_catalog.timestamp),
FUNCTION 1 upg_catalog.date_cmp_timestamp(upg_catalog.date, upg_catalog."timestamp"),
OPERATOR 1 upg_catalog.<(upg_catalog.date, upg_catalog.timestamptz),
OPERATOR 2 upg_catalog.<=(upg_catalog.date, upg_catalog.timestamptz),
OPERATOR 3 upg_catalog.=(upg_catalog.date, upg_catalog.timestamptz),
OPERATOR 4 upg_catalog.>=(upg_catalog.date, upg_catalog.timestamptz),
OPERATOR 5 upg_catalog.>(upg_catalog.date, upg_catalog.timestamptz),
FUNCTION 1 upg_catalog.date_cmp_timestamptz(upg_catalog.date, upg_catalog.timestamptz);
CREATE OPERATOR CLASS date_ops DEFAULT FOR TYPE upg_catalog.date USING hash AS
OPERATOR 1 upg_catalog.=(upg_catalog.date, upg_catalog.date),
FUNCTION 1 upg_catalog.hashint4(upg_catalog.int4);
CREATE OPERATOR CLASS date_ops DEFAULT FOR TYPE upg_catalog.date USING btree AS
OPERATOR 1 upg_catalog.<(upg_catalog.date, upg_catalog.date),
OPERATOR 2 upg_catalog.<=(upg_catalog.date, upg_catalog.date),
OPERATOR 3 upg_catalog.=(upg_catalog.date, upg_catalog.date),
OPERATOR 4 upg_catalog.>=(upg_catalog.date, upg_catalog.date),
OPERATOR 5 upg_catalog.>(upg_catalog.date, upg_catalog.date),
FUNCTION 1 upg_catalog.date_cmp(upg_catalog.date, upg_catalog.date),
OPERATOR 1 upg_catalog.<(upg_catalog.date, upg_catalog.timestamp),
OPERATOR 2 upg_catalog.<=(upg_catalog.date, upg_catalog.timestamp),
OPERATOR 3 upg_catalog.=(upg_catalog.date, upg_catalog.timestamp),
OPERATOR 4 upg_catalog.>=(upg_catalog.date, upg_catalog.timestamp),
OPERATOR 5 upg_catalog.>(upg_catalog.date, upg_catalog.timestamp),
FUNCTION 1 upg_catalog.date_cmp_timestamp(upg_catalog.date, upg_catalog."timestamp"),
OPERATOR 1 upg_catalog.<(upg_catalog.date, upg_catalog.timestamptz),
OPERATOR 2 upg_catalog.<=(upg_catalog.date, upg_catalog.timestamptz),
OPERATOR 3 upg_catalog.=(upg_catalog.date, upg_catalog.timestamptz),
OPERATOR 4 upg_catalog.>=(upg_catalog.date, upg_catalog.timestamptz),
OPERATOR 5 upg_catalog.>(upg_catalog.date, upg_catalog.timestamptz),
FUNCTION 1 upg_catalog.date_cmp_timestamptz(upg_catalog.date, upg_catalog.timestamptz);
CREATE OPERATOR CLASS time_ops DEFAULT FOR TYPE upg_catalog."time" USING bitmap AS
OPERATOR 1 upg_catalog.<(upg_catalog.time, upg_catalog.time),
OPERATOR 2 upg_catalog.<=(upg_catalog.time, upg_catalog.time),
OPERATOR 3 upg_catalog.=(upg_catalog.time, upg_catalog.time),
OPERATOR 4 upg_catalog.>=(upg_catalog.time, upg_catalog.time),
OPERATOR 5 upg_catalog.>(upg_catalog.time, upg_catalog.time),
FUNCTION 1 upg_catalog.time_cmp(upg_catalog."time", upg_catalog."time");
CREATE OPERATOR CLASS time_ops DEFAULT FOR TYPE upg_catalog."time" USING hash AS
OPERATOR 1 upg_catalog.=(upg_catalog.time, upg_catalog.time),
FUNCTION 1 upg_catalog.hashfloat8(upg_catalog.float8);
CREATE OPERATOR CLASS time_ops DEFAULT FOR TYPE upg_catalog."time" USING btree AS
OPERATOR 1 upg_catalog.<(upg_catalog.time, upg_catalog.time),
OPERATOR 2 upg_catalog.<=(upg_catalog.time, upg_catalog.time),
OPERATOR 3 upg_catalog.=(upg_catalog.time, upg_catalog.time),
OPERATOR 4 upg_catalog.>=(upg_catalog.time, upg_catalog.time),
OPERATOR 5 upg_catalog.>(upg_catalog.time, upg_catalog.time),
FUNCTION 1 upg_catalog.time_cmp(upg_catalog."time", upg_catalog."time");
CREATE OPERATOR CLASS timestamp_ops DEFAULT FOR TYPE upg_catalog."timestamp" USING bitmap AS
OPERATOR 1 upg_catalog.<(upg_catalog.timestamp, upg_catalog.timestamp),
OPERATOR 2 upg_catalog.<=(upg_catalog.timestamp, upg_catalog.timestamp),
OPERATOR 3 upg_catalog.=(upg_catalog.timestamp, upg_catalog.timestamp),
OPERATOR 4 upg_catalog.>=(upg_catalog.timestamp, upg_catalog.timestamp),
OPERATOR 5 upg_catalog.>(upg_catalog.timestamp, upg_catalog.timestamp),
FUNCTION 1 upg_catalog.timestamp_cmp(upg_catalog."timestamp", upg_catalog."timestamp"),
OPERATOR 1 upg_catalog.<(upg_catalog.timestamp, upg_catalog.date),
OPERATOR 2 upg_catalog.<=(upg_catalog.timestamp, upg_catalog.date),
OPERATOR 3 upg_catalog.=(upg_catalog.timestamp, upg_catalog.date),
OPERATOR 4 upg_catalog.>=(upg_catalog.timestamp, upg_catalog.date),
OPERATOR 5 upg_catalog.>(upg_catalog.timestamp, upg_catalog.date),
FUNCTION 1 upg_catalog.timestamp_cmp_date(upg_catalog."timestamp", upg_catalog.date),
OPERATOR 1 upg_catalog.<(upg_catalog.timestamp, upg_catalog.timestamptz),
OPERATOR 2 upg_catalog.<=(upg_catalog.timestamp, upg_catalog.timestamptz),
OPERATOR 3 upg_catalog.=(upg_catalog.timestamp, upg_catalog.timestamptz),
OPERATOR 4 upg_catalog.>=(upg_catalog.timestamp, upg_catalog.timestamptz),
OPERATOR 5 upg_catalog.>(upg_catalog.timestamp, upg_catalog.timestamptz),
FUNCTION 1 upg_catalog.timestamp_cmp_timestamptz(upg_catalog."timestamp", upg_catalog.timestamptz);
CREATE OPERATOR CLASS timestamp_ops DEFAULT FOR TYPE upg_catalog."timestamp" USING hash AS
OPERATOR 1 upg_catalog.=(upg_catalog.timestamp, upg_catalog.timestamp),
FUNCTION 1 upg_catalog.hashfloat8(upg_catalog.float8);
CREATE OPERATOR CLASS timestamp_ops DEFAULT FOR TYPE upg_catalog."timestamp" USING btree AS
OPERATOR 1 upg_catalog.<(upg_catalog.timestamp, upg_catalog.timestamp),
OPERATOR 2 upg_catalog.<=(upg_catalog.timestamp, upg_catalog.timestamp),
OPERATOR 3 upg_catalog.=(upg_catalog.timestamp, upg_catalog.timestamp),
OPERATOR 4 upg_catalog.>=(upg_catalog.timestamp, upg_catalog.timestamp),
OPERATOR 5 upg_catalog.>(upg_catalog.timestamp, upg_catalog.timestamp),
FUNCTION 1 upg_catalog.timestamp_cmp(upg_catalog."timestamp", upg_catalog."timestamp"),
OPERATOR 1 upg_catalog.<(upg_catalog.timestamp, upg_catalog.date),
OPERATOR 2 upg_catalog.<=(upg_catalog.timestamp, upg_catalog.date),
OPERATOR 3 upg_catalog.=(upg_catalog.timestamp, upg_catalog.date),
OPERATOR 4 upg_catalog.>=(upg_catalog.timestamp, upg_catalog.date),
OPERATOR 5 upg_catalog.>(upg_catalog.timestamp, upg_catalog.date),
FUNCTION 1 upg_catalog.timestamp_cmp_date(upg_catalog."timestamp", upg_catalog.date),
OPERATOR 1 upg_catalog.<(upg_catalog.timestamp, upg_catalog.timestamptz),
OPERATOR 2 upg_catalog.<=(upg_catalog.timestamp, upg_catalog.timestamptz),
OPERATOR 3 upg_catalog.=(upg_catalog.timestamp, upg_catalog.timestamptz),
OPERATOR 4 upg_catalog.>=(upg_catalog.timestamp, upg_catalog.timestamptz),
OPERATOR 5 upg_catalog.>(upg_catalog.timestamp, upg_catalog.timestamptz),
FUNCTION 1 upg_catalog.timestamp_cmp_timestamptz(upg_catalog."timestamp", upg_catalog.timestamptz);
CREATE OPERATOR CLASS _timestamp_ops DEFAULT FOR TYPE upg_catalog._timestamp USING gin AS
OPERATOR 1 upg_catalog.&&(upg_catalog.anyarray, upg_catalog.anyarray),
OPERATOR 2 upg_catalog.@>(upg_catalog.anyarray, upg_catalog.anyarray),
OPERATOR 3 upg_catalog.<@(upg_catalog.anyarray, upg_catalog.anyarray) RECHECK,
OPERATOR 4 upg_catalog.=(upg_catalog.anyarray, upg_catalog.anyarray) RECHECK,
FUNCTION 1 upg_catalog.timestamp_cmp(upg_catalog."timestamp", upg_catalog."timestamp"),
FUNCTION 2 upg_catalog.ginarrayextract(upg_catalog.anyarray, pg_catalog.internal),
FUNCTION 3 upg_catalog.ginarrayextract(upg_catalog.anyarray, pg_catalog.internal),
FUNCTION 4 upg_catalog.ginarrayconsistent(pg_catalog.internal, upg_catalog.int2, pg_catalog.internal),
STORAGE "timestamp";
CREATE OPERATOR CLASS _date_ops DEFAULT FOR TYPE upg_catalog._date USING gin AS
OPERATOR 1 upg_catalog.&&(upg_catalog.anyarray, upg_catalog.anyarray),
OPERATOR 2 upg_catalog.@>(upg_catalog.anyarray, upg_catalog.anyarray),
OPERATOR 3 upg_catalog.<@(upg_catalog.anyarray, upg_catalog.anyarray) RECHECK,
OPERATOR 4 upg_catalog.=(upg_catalog.anyarray, upg_catalog.anyarray) RECHECK,
FUNCTION 1 upg_catalog.date_cmp(upg_catalog.date, upg_catalog.date),
FUNCTION 2 upg_catalog.ginarrayextract(upg_catalog.anyarray, pg_catalog.internal),
FUNCTION 3 upg_catalog.ginarrayextract(upg_catalog.anyarray, pg_catalog.internal),
FUNCTION 4 upg_catalog.ginarrayconsistent(pg_catalog.internal, upg_catalog.int2, pg_catalog.internal),
STORAGE date;
CREATE OPERATOR CLASS _time_ops DEFAULT FOR TYPE upg_catalog._time USING gin AS
OPERATOR 1 upg_catalog.&&(upg_catalog.anyarray, upg_catalog.anyarray),
OPERATOR 2 upg_catalog.@>(upg_catalog.anyarray, upg_catalog.anyarray),
OPERATOR 3 upg_catalog.<@(upg_catalog.anyarray, upg_catalog.anyarray) RECHECK,
OPERATOR 4 upg_catalog.=(upg_catalog.anyarray, upg_catalog.anyarray) RECHECK,
FUNCTION 1 upg_catalog.time_cmp(upg_catalog."time", upg_catalog."time"),
FUNCTION 2 upg_catalog.ginarrayextract(upg_catalog.anyarray, pg_catalog.internal),
FUNCTION 3 upg_catalog.ginarrayextract(upg_catalog.anyarray, pg_catalog.internal),
FUNCTION 4 upg_catalog.ginarrayconsistent(pg_catalog.internal, upg_catalog.int2, pg_catalog.internal),
STORAGE "time";
CREATE OPERATOR CLASS timestamptz_ops DEFAULT FOR TYPE upg_catalog.timestamptz USING bitmap AS
OPERATOR 1 upg_catalog.<(upg_catalog.timestamptz, upg_catalog.timestamptz),
OPERATOR 2 upg_catalog.<=(upg_catalog.timestamptz, upg_catalog.timestamptz),
OPERATOR 3 upg_catalog.=(upg_catalog.timestamptz, upg_catalog.timestamptz),
OPERATOR 4 upg_catalog.>=(upg_catalog.timestamptz, upg_catalog.timestamptz),
OPERATOR 5 upg_catalog.>(upg_catalog.timestamptz, upg_catalog.timestamptz),
FUNCTION 1 upg_catalog.timestamptz_cmp(upg_catalog.timestamptz, upg_catalog.timestamptz),
OPERATOR 1 upg_catalog.<(upg_catalog.timestamptz, upg_catalog.date),
OPERATOR 2 upg_catalog.<=(upg_catalog.timestamptz, upg_catalog.date),
OPERATOR 3 upg_catalog.=(upg_catalog.timestamptz, upg_catalog.date),
OPERATOR 4 upg_catalog.>=(upg_catalog.timestamptz, upg_catalog.date),
OPERATOR 5 upg_catalog.>(upg_catalog.timestamptz, upg_catalog.date),
FUNCTION 1 upg_catalog.timestamptz_cmp_date(upg_catalog.timestamptz, upg_catalog.date),
OPERATOR 1 upg_catalog.<(upg_catalog.timestamptz, upg_catalog.timestamp),
OPERATOR 2 upg_catalog.<=(upg_catalog.timestamptz, upg_catalog.timestamp),
OPERATOR 3 upg_catalog.=(upg_catalog.timestamptz, upg_catalog.timestamp),
OPERATOR 4 upg_catalog.>=(upg_catalog.timestamptz, upg_catalog.timestamp),
OPERATOR 5 upg_catalog.>(upg_catalog.timestamptz, upg_catalog.timestamp),
FUNCTION 1 upg_catalog.timestamptz_cmp_timestamp(upg_catalog.timestamptz, upg_catalog."timestamp");
CREATE OPERATOR CLASS timestamptz_ops DEFAULT FOR TYPE upg_catalog.timestamptz USING hash AS
OPERATOR 1 upg_catalog.=(upg_catalog.timestamptz, upg_catalog.timestamptz),
FUNCTION 1 upg_catalog.hashfloat8(upg_catalog.float8);
CREATE OPERATOR CLASS timestamptz_ops DEFAULT FOR TYPE upg_catalog.timestamptz USING btree AS
OPERATOR 1 upg_catalog.<(upg_catalog.timestamptz, upg_catalog.timestamptz),
OPERATOR 2 upg_catalog.<=(upg_catalog.timestamptz, upg_catalog.timestamptz),
OPERATOR 3 upg_catalog.=(upg_catalog.timestamptz, upg_catalog.timestamptz),
OPERATOR 4 upg_catalog.>=(upg_catalog.timestamptz, upg_catalog.timestamptz),
OPERATOR 5 upg_catalog.>(upg_catalog.timestamptz, upg_catalog.timestamptz),
FUNCTION 1 upg_catalog.timestamptz_cmp(upg_catalog.timestamptz, upg_catalog.timestamptz),
OPERATOR 1 upg_catalog.<(upg_catalog.timestamptz, upg_catalog.date),
OPERATOR 2 upg_catalog.<=(upg_catalog.timestamptz, upg_catalog.date),
OPERATOR 3 upg_catalog.=(upg_catalog.timestamptz, upg_catalog.date),
OPERATOR 4 upg_catalog.>=(upg_catalog.timestamptz, upg_catalog.date),
OPERATOR 5 upg_catalog.>(upg_catalog.timestamptz, upg_catalog.date),
FUNCTION 1 upg_catalog.timestamptz_cmp_date(upg_catalog.timestamptz, upg_catalog.date),
OPERATOR 1 upg_catalog.<(upg_catalog.timestamptz, upg_catalog.timestamp),
OPERATOR 2 upg_catalog.<=(upg_catalog.timestamptz, upg_catalog.timestamp),
OPERATOR 3 upg_catalog.=(upg_catalog.timestamptz, upg_catalog.timestamp),
OPERATOR 4 upg_catalog.>=(upg_catalog.timestamptz, upg_catalog.timestamp),
OPERATOR 5 upg_catalog.>(upg_catalog.timestamptz, upg_catalog.timestamp),
FUNCTION 1 upg_catalog.timestamptz_cmp_timestamp(upg_catalog.timestamptz, upg_catalog."timestamp");
CREATE OPERATOR CLASS _timestamptz_ops DEFAULT FOR TYPE upg_catalog._timestamptz USING gin AS
OPERATOR 1 upg_catalog.&&(upg_catalog.anyarray, upg_catalog.anyarray),
OPERATOR 2 upg_catalog.@>(upg_catalog.anyarray, upg_catalog.anyarray),
OPERATOR 3 upg_catalog.<@(upg_catalog.anyarray, upg_catalog.anyarray) RECHECK,
OPERATOR 4 upg_catalog.=(upg_catalog.anyarray, upg_catalog.anyarray) RECHECK,
FUNCTION 1 upg_catalog.timestamptz_cmp(upg_catalog.timestamptz, upg_catalog.timestamptz),
FUNCTION 2 upg_catalog.ginarrayextract(upg_catalog.anyarray, pg_catalog.internal),
FUNCTION 3 upg_catalog.ginarrayextract(upg_catalog.anyarray, pg_catalog.internal),
FUNCTION 4 upg_catalog.ginarrayconsistent(pg_catalog.internal, upg_catalog.int2, pg_catalog.internal),
STORAGE timestamptz;
CREATE OPERATOR CLASS interval_ops DEFAULT FOR TYPE upg_catalog."interval" USING bitmap AS
OPERATOR 1 upg_catalog.<(upg_catalog.interval, upg_catalog.interval),
OPERATOR 2 upg_catalog.<=(upg_catalog.interval, upg_catalog.interval),
OPERATOR 3 upg_catalog.=(upg_catalog.interval, upg_catalog.interval),
OPERATOR 4 upg_catalog.>=(upg_catalog.interval, upg_catalog.interval),
OPERATOR 5 upg_catalog.>(upg_catalog.interval, upg_catalog.interval),
FUNCTION 1 upg_catalog.interval_cmp(upg_catalog."interval", upg_catalog."interval");
CREATE OPERATOR CLASS interval_ops DEFAULT FOR TYPE upg_catalog."interval" USING hash AS
OPERATOR 1 upg_catalog.=(upg_catalog.interval, upg_catalog.interval),
FUNCTION 1 upg_catalog.interval_hash(upg_catalog."interval");
CREATE OPERATOR CLASS interval_ops DEFAULT FOR TYPE upg_catalog."interval" USING btree AS
OPERATOR 1 upg_catalog.<(upg_catalog.interval, upg_catalog.interval),
OPERATOR 2 upg_catalog.<=(upg_catalog.interval, upg_catalog.interval),
OPERATOR 3 upg_catalog.=(upg_catalog.interval, upg_catalog.interval),
OPERATOR 4 upg_catalog.>=(upg_catalog.interval, upg_catalog.interval),
OPERATOR 5 upg_catalog.>(upg_catalog.interval, upg_catalog.interval),
FUNCTION 1 upg_catalog.interval_cmp(upg_catalog."interval", upg_catalog."interval");
CREATE OPERATOR CLASS _interval_ops DEFAULT FOR TYPE upg_catalog._interval USING gin AS
OPERATOR 1 upg_catalog.&&(upg_catalog.anyarray, upg_catalog.anyarray),
OPERATOR 2 upg_catalog.@>(upg_catalog.anyarray, upg_catalog.anyarray),
OPERATOR 3 upg_catalog.<@(upg_catalog.anyarray, upg_catalog.anyarray) RECHECK,
OPERATOR 4 upg_catalog.=(upg_catalog.anyarray, upg_catalog.anyarray) RECHECK,
FUNCTION 1 upg_catalog.interval_cmp(upg_catalog."interval", upg_catalog."interval"),
FUNCTION 2 upg_catalog.ginarrayextract(upg_catalog.anyarray, pg_catalog.internal),
FUNCTION 3 upg_catalog.ginarrayextract(upg_catalog.anyarray, pg_catalog.internal),
FUNCTION 4 upg_catalog.ginarrayconsistent(pg_catalog.internal, upg_catalog.int2, pg_catalog.internal),
STORAGE "interval";
CREATE OPERATOR CLASS _numeric_ops DEFAULT FOR TYPE upg_catalog._numeric USING gin AS
OPERATOR 1 upg_catalog.&&(upg_catalog.anyarray, upg_catalog.anyarray),
OPERATOR 2 upg_catalog.@>(upg_catalog.anyarray, upg_catalog.anyarray),
OPERATOR 3 upg_catalog.<@(upg_catalog.anyarray, upg_catalog.anyarray) RECHECK,
OPERATOR 4 upg_catalog.=(upg_catalog.anyarray, upg_catalog.anyarray) RECHECK,
FUNCTION 1 upg_catalog.numeric_cmp(upg_catalog."numeric", upg_catalog."numeric"),
FUNCTION 2 upg_catalog.ginarrayextract(upg_catalog.anyarray, pg_catalog.internal),
FUNCTION 3 upg_catalog.ginarrayextract(upg_catalog.anyarray, pg_catalog.internal),
FUNCTION 4 upg_catalog.ginarrayconsistent(pg_catalog.internal, upg_catalog.int2, pg_catalog.internal),
STORAGE "numeric";
CREATE OPERATOR CLASS timetz_ops DEFAULT FOR TYPE upg_catalog.timetz USING bitmap AS
OPERATOR 1 upg_catalog.<(upg_catalog.timetz, upg_catalog.timetz),
OPERATOR 2 upg_catalog.<=(upg_catalog.timetz, upg_catalog.timetz),
OPERATOR 3 upg_catalog.=(upg_catalog.timetz, upg_catalog.timetz),
OPERATOR 4 upg_catalog.>=(upg_catalog.timetz, upg_catalog.timetz),
OPERATOR 5 upg_catalog.>(upg_catalog.timetz, upg_catalog.timetz),
FUNCTION 1 upg_catalog.timetz_cmp(upg_catalog.timetz, upg_catalog.timetz);
CREATE OPERATOR CLASS timetz_ops DEFAULT FOR TYPE upg_catalog.timetz USING hash AS
OPERATOR 1 upg_catalog.=(upg_catalog.timetz, upg_catalog.timetz),
FUNCTION 1 upg_catalog.timetz_hash(upg_catalog.timetz);
CREATE OPERATOR CLASS timetz_ops DEFAULT FOR TYPE upg_catalog.timetz USING btree AS
OPERATOR 1 upg_catalog.<(upg_catalog.timetz, upg_catalog.timetz),
OPERATOR 2 upg_catalog.<=(upg_catalog.timetz, upg_catalog.timetz),
OPERATOR 3 upg_catalog.=(upg_catalog.timetz, upg_catalog.timetz),
OPERATOR 4 upg_catalog.>=(upg_catalog.timetz, upg_catalog.timetz),
OPERATOR 5 upg_catalog.>(upg_catalog.timetz, upg_catalog.timetz),
FUNCTION 1 upg_catalog.timetz_cmp(upg_catalog.timetz, upg_catalog.timetz);
CREATE OPERATOR CLASS _timetz_ops DEFAULT FOR TYPE upg_catalog._timetz USING gin AS
OPERATOR 1 upg_catalog.&&(upg_catalog.anyarray, upg_catalog.anyarray),
OPERATOR 2 upg_catalog.@>(upg_catalog.anyarray, upg_catalog.anyarray),
OPERATOR 3 upg_catalog.<@(upg_catalog.anyarray, upg_catalog.anyarray) RECHECK,
OPERATOR 4 upg_catalog.=(upg_catalog.anyarray, upg_catalog.anyarray) RECHECK,
FUNCTION 1 upg_catalog.timetz_cmp(upg_catalog.timetz, upg_catalog.timetz),
FUNCTION 2 upg_catalog.ginarrayextract(upg_catalog.anyarray, pg_catalog.internal),
FUNCTION 3 upg_catalog.ginarrayextract(upg_catalog.anyarray, pg_catalog.internal),
FUNCTION 4 upg_catalog.ginarrayconsistent(pg_catalog.internal, upg_catalog.int2, pg_catalog.internal),
STORAGE timetz;
CREATE OPERATOR CLASS bit_ops DEFAULT FOR TYPE upg_catalog."bit" USING bitmap AS
OPERATOR 1 upg_catalog.<(upg_catalog.bit, upg_catalog.bit),
OPERATOR 2 upg_catalog.<=(upg_catalog.bit, upg_catalog.bit),
OPERATOR 3 upg_catalog.=(upg_catalog.bit, upg_catalog.bit),
OPERATOR 4 upg_catalog.>=(upg_catalog.bit, upg_catalog.bit),
OPERATOR 5 upg_catalog.>(upg_catalog.bit, upg_catalog.bit),
FUNCTION 1 upg_catalog.bitcmp(upg_catalog."bit", upg_catalog."bit");
CREATE OPERATOR CLASS bit_ops DEFAULT FOR TYPE upg_catalog."bit" USING btree AS
OPERATOR 1 upg_catalog.<(upg_catalog.bit, upg_catalog.bit),
OPERATOR 2 upg_catalog.<=(upg_catalog.bit, upg_catalog.bit),
OPERATOR 3 upg_catalog.=(upg_catalog.bit, upg_catalog.bit),
OPERATOR 4 upg_catalog.>=(upg_catalog.bit, upg_catalog.bit),
OPERATOR 5 upg_catalog.>(upg_catalog.bit, upg_catalog.bit),
FUNCTION 1 upg_catalog.bitcmp(upg_catalog."bit", upg_catalog."bit");
CREATE OPERATOR CLASS _bit_ops DEFAULT FOR TYPE upg_catalog._bit USING gin AS
OPERATOR 1 upg_catalog.&&(upg_catalog.anyarray, upg_catalog.anyarray),
OPERATOR 2 upg_catalog.@>(upg_catalog.anyarray, upg_catalog.anyarray),
OPERATOR 3 upg_catalog.<@(upg_catalog.anyarray, upg_catalog.anyarray) RECHECK,
OPERATOR 4 upg_catalog.=(upg_catalog.anyarray, upg_catalog.anyarray) RECHECK,
FUNCTION 1 upg_catalog.bitcmp(upg_catalog."bit", upg_catalog."bit"),
FUNCTION 2 upg_catalog.ginarrayextract(upg_catalog.anyarray, pg_catalog.internal),
FUNCTION 3 upg_catalog.ginarrayextract(upg_catalog.anyarray, pg_catalog.internal),
FUNCTION 4 upg_catalog.ginarrayconsistent(pg_catalog.internal, upg_catalog.int2, pg_catalog.internal),
STORAGE "bit";
CREATE OPERATOR CLASS varbit_ops DEFAULT FOR TYPE upg_catalog.varbit USING bitmap AS
OPERATOR 1 upg_catalog.<(upg_catalog.varbit, upg_catalog.varbit),
OPERATOR 2 upg_catalog.<=(upg_catalog.varbit, upg_catalog.varbit),
OPERATOR 3 upg_catalog.=(upg_catalog.varbit, upg_catalog.varbit),
OPERATOR 4 upg_catalog.>=(upg_catalog.varbit, upg_catalog.varbit),
OPERATOR 5 upg_catalog.>(upg_catalog.varbit, upg_catalog.varbit),
FUNCTION 1 upg_catalog.varbitcmp(upg_catalog.varbit, upg_catalog.varbit);
CREATE OPERATOR CLASS varbit_ops DEFAULT FOR TYPE upg_catalog.varbit USING btree AS
OPERATOR 1 upg_catalog.<(upg_catalog.varbit, upg_catalog.varbit),
OPERATOR 2 upg_catalog.<=(upg_catalog.varbit, upg_catalog.varbit),
OPERATOR 3 upg_catalog.=(upg_catalog.varbit, upg_catalog.varbit),
OPERATOR 4 upg_catalog.>=(upg_catalog.varbit, upg_catalog.varbit),
OPERATOR 5 upg_catalog.>(upg_catalog.varbit, upg_catalog.varbit),
FUNCTION 1 upg_catalog.varbitcmp(upg_catalog.varbit, upg_catalog.varbit);
CREATE OPERATOR CLASS _varbit_ops DEFAULT FOR TYPE upg_catalog._varbit USING gin AS
OPERATOR 1 upg_catalog.&&(upg_catalog.anyarray, upg_catalog.anyarray),
OPERATOR 2 upg_catalog.@>(upg_catalog.anyarray, upg_catalog.anyarray),
OPERATOR 3 upg_catalog.<@(upg_catalog.anyarray, upg_catalog.anyarray) RECHECK,
OPERATOR 4 upg_catalog.=(upg_catalog.anyarray, upg_catalog.anyarray) RECHECK,
FUNCTION 1 upg_catalog.varbitcmp(upg_catalog.varbit, upg_catalog.varbit),
FUNCTION 2 upg_catalog.ginarrayextract(upg_catalog.anyarray, pg_catalog.internal),
FUNCTION 3 upg_catalog.ginarrayextract(upg_catalog.anyarray, pg_catalog.internal),
FUNCTION 4 upg_catalog.ginarrayconsistent(pg_catalog.internal, upg_catalog.int2, pg_catalog.internal),
STORAGE varbit;
CREATE OPERATOR CLASS numeric_ops DEFAULT FOR TYPE upg_catalog."numeric" USING bitmap AS
OPERATOR 1 upg_catalog.<(upg_catalog.numeric, upg_catalog.numeric),
OPERATOR 2 upg_catalog.<=(upg_catalog.numeric, upg_catalog.numeric),
OPERATOR 3 upg_catalog.=(upg_catalog.numeric, upg_catalog.numeric),
OPERATOR 4 upg_catalog.>=(upg_catalog.numeric, upg_catalog.numeric),
OPERATOR 5 upg_catalog.>(upg_catalog.numeric, upg_catalog.numeric),
FUNCTION 1 upg_catalog.numeric_cmp(upg_catalog."numeric", upg_catalog."numeric");
CREATE OPERATOR CLASS numeric_ops DEFAULT FOR TYPE upg_catalog."numeric" USING hash AS
OPERATOR 1 upg_catalog.=(upg_catalog.numeric, upg_catalog.numeric),
FUNCTION 1 upg_catalog.hash_numeric(upg_catalog."numeric");
CREATE OPERATOR CLASS numeric_ops DEFAULT FOR TYPE upg_catalog."numeric" USING btree AS
OPERATOR 1 upg_catalog.<(upg_catalog.numeric, upg_catalog.numeric),
OPERATOR 2 upg_catalog.<=(upg_catalog.numeric, upg_catalog.numeric),
OPERATOR 3 upg_catalog.=(upg_catalog.numeric, upg_catalog.numeric),
OPERATOR 4 upg_catalog.>=(upg_catalog.numeric, upg_catalog.numeric),
OPERATOR 5 upg_catalog.>(upg_catalog.numeric, upg_catalog.numeric),
FUNCTION 1 upg_catalog.numeric_cmp(upg_catalog."numeric", upg_catalog."numeric");
CREATE OPERATOR CLASS xlogloc_ops DEFAULT FOR TYPE upg_catalog.gpxlogloc USING btree AS
OPERATOR 1 upg_catalog.<(upg_catalog.gpxlogloc, upg_catalog.gpxlogloc),
OPERATOR 2 upg_catalog.<=(upg_catalog.gpxlogloc, upg_catalog.gpxlogloc),
OPERATOR 3 upg_catalog.=(upg_catalog.gpxlogloc, upg_catalog.gpxlogloc),
OPERATOR 4 upg_catalog.>=(upg_catalog.gpxlogloc, upg_catalog.gpxlogloc),
OPERATOR 5 upg_catalog.>(upg_catalog.gpxlogloc, upg_catalog.gpxlogloc),
FUNCTION 1 upg_catalog.btgpxlogloccmp(upg_catalog.gpxlogloc, upg_catalog.gpxlogloc);
CREATE OPERATOR CLASS array_ops DEFAULT FOR TYPE upg_catalog.anyarray USING bitmap AS
OPERATOR 1 upg_catalog.<(upg_catalog.anyarray, upg_catalog.anyarray),
OPERATOR 2 upg_catalog.<=(upg_catalog.anyarray, upg_catalog.anyarray),
OPERATOR 3 upg_catalog.=(upg_catalog.anyarray, upg_catalog.anyarray),
OPERATOR 4 upg_catalog.>=(upg_catalog.anyarray, upg_catalog.anyarray),
OPERATOR 5 upg_catalog.>(upg_catalog.anyarray, upg_catalog.anyarray),
FUNCTION 1 upg_catalog.btarraycmp(upg_catalog.anyarray, upg_catalog.anyarray);
CREATE OPERATOR CLASS array_ops DEFAULT FOR TYPE upg_catalog.anyarray USING btree AS
OPERATOR 1 upg_catalog.<(upg_catalog.anyarray, upg_catalog.anyarray),
OPERATOR 2 upg_catalog.<=(upg_catalog.anyarray, upg_catalog.anyarray),
OPERATOR 3 upg_catalog.=(upg_catalog.anyarray, upg_catalog.anyarray),
OPERATOR 4 upg_catalog.>=(upg_catalog.anyarray, upg_catalog.anyarray),
OPERATOR 5 upg_catalog.>(upg_catalog.anyarray, upg_catalog.anyarray),
FUNCTION 1 upg_catalog.btarraycmp(upg_catalog.anyarray, upg_catalog.anyarray); | the_stack |
SET NAMES utf8;
USE bkdata_basic;
-- 数据模型设计相关表
CREATE TABLE IF NOT EXISTS `dmm_model_info` (
model_id int(11) NOT NULL AUTO_INCREMENT COMMENT '模型ID',
model_name varchar(255) NOT NULL COMMENT '模型名称,英文字母加下划线,全局唯一',
model_alias varchar(255) NOT NULL COMMENT '模型别名',
model_type varchar(32) NOT NULL COMMENT '模型类型,可选事实表、维度表',
project_id int(11) NOT NULL COMMENT '项目ID',
description text NULL COMMENT '模型描述',
publish_status varchar(32) NOT NULL COMMENT '发布状态,可选 developing/published/re-developing',
active_status varchar(32) NOT NULL DEFAULT 'active' COMMENT '可用状态, active/disabled/conflicting',
# 主表信息
table_name varchar(255) NOT NULL COMMENT '主表名称',
table_alias varchar(255) NOT NULL COMMENT '主表别名',
step_id int(11) NOT NULL DEFAULT 0 COMMENT '模型构建&发布完成步骤',
latest_version_id varchar(64) NULL COMMENT '模型最新发布版本ID',
created_by varchar(50) NOT NULL COMMENT '创建者',
created_at timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
updated_by varchar(50) DEFAULT NULL COMMENT '更新者',
updated_at timestamp NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
PRIMARY KEY (`model_id`),
CONSTRAINT `dmm_model_info_unique_model_name` UNIQUE(model_name)
)ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='数据模型主表';
CREATE TABLE IF NOT EXISTS `dmm_model_top` (
id int(11) NOT NULL AUTO_INCREMENT COMMENT '主键Id',
model_id int(11) NOT NULL COMMENT '模型ID',
created_by varchar(50) NOT NULL COMMENT '创建者',
created_at timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
updated_by varchar(50) DEFAULT NULL COMMENT '更新者',
updated_at timestamp NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='数据模型用户置顶表';
CREATE TABLE IF NOT EXISTS `dmm_model_field` (
id int(11) NOT NULL AUTO_INCREMENT COMMENT '自增ID',
model_id int(11) NOT NULL COMMENT '模型ID',
field_name varchar(255) NOT NULL COMMENT '字段名称',
field_alias varchar(255) NOT NULL COMMENT '字段别名',
field_type varchar(32) NOT NULL COMMENT '数据类型,可选 long/int/...',
field_category varchar(32) NOT NULL COMMENT '字段类型,可选维度、度量',
is_primary_key tinyint(1) NOT NULL DEFAULT 0 COMMENT '是否是主键 0:否,1:是',
description text NULL COMMENT '字段描述',
/*
-- constraint_id COMMENT '字段约束,可选值范围/正则/邮箱/电话/...',
-- constraint_content COMMENT '约束参数,主要包括修正方式、单位、Range 大小值',
-- 示例
{
"op": "OR",
"groups": [
{
"op": "AND",
"items": [
{"constraint_id": "", "constraint_content": ""},
{"constraint_id": "", "constraint_content": ""}
]
},
{
"op": "OR",
"items": [
{"constraint_id": "", "constraint_content": ""},
{"constraint_id": "", "constraint_content": ""}
]
}
]
}
*/
field_constraint_content text NULL COMMENT '字段约束',
/*
-- clean_option COMMENT '字段清洗选项,可选 SQL、映射表',
-- clean_content COMMENT '字段清洗内容'
-- 示例
{
clean_option: 'SQL',
clean_content: 'case ... when ... case ... when ...'
}
*/
field_clean_content text NULL COMMENT '清洗规则',
origin_fields text NULL COMMENT '计算来源字段,若有计算逻辑,则该字段有效',
field_index int(11) NOT NULL COMMENT '字段位置',
source_model_id int(11) NULL COMMENT '来源模型,若有则为扩展字段,目前仅针对维度扩展字段使用',
source_field_name varchar(255) NULL COMMENT '来源字段,若有则为扩展字段,目前仅针对维度扩展字段使用',
created_by varchar(50) NOT NULL COMMENT '创建者',
created_at timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
updated_by varchar(50) DEFAULT NULL COMMENT '更新者',
updated_at timestamp NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
PRIMARY KEY (`id`),
CONSTRAINT `dmm_model_field_unique_model_field` UNIQUE(model_id, field_name)
)ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='数据模型字段表';
CREATE TABLE IF NOT EXISTS `dmm_model_relation` (
id int(11) NOT NULL AUTO_INCREMENT COMMENT '自增ID',
model_id int(11) NOT NULL COMMENT '模型ID',
field_name varchar(255) NOT NULL COMMENT '字段名称',
related_model_id int(11) NOT NULL COMMENT '关联模型ID',
related_field_name varchar(255) NOT NULL COMMENT '关联字段名称',
related_method varchar(32) NOT NULL COMMENT '关联方式,可选 left-join/inner-join/right-join',
created_by varchar(50) NOT NULL COMMENT '创建者',
created_at timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
updated_by varchar(50) DEFAULT NULL COMMENT '更新者',
updated_at timestamp NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
PRIMARY KEY (`id`),
CONSTRAINT `dmm_model_relation_unique_model_relation` UNIQUE(model_id, related_model_id)
)ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='数据模型关系表';
CREATE TABLE IF NOT EXISTS `dmm_model_calculation_atom` (
model_id int(11) NOT NULL COMMENT '模型ID',
project_id int(11) NOT NULL COMMENT '项目ID',
calculation_atom_name varchar(255) NOT NULL COMMENT '统计口径名称,要求英文字母加下划线',
calculation_atom_alias varchar(255) NOT NULL COMMENT '统计口径别名',
origin_fields text NULL COMMENT '计算来源字段,若有计算逻辑,则该字段有效',
description text NULL COMMENT '统计口径描述',
field_type varchar(32) NOT NULL COMMENT '字段类型',
/*
-- table 示例(表单)
{
'option': 'TABLE',
'content': {
'calculation_field': 'price',
'calculation_function': 'sum'
}
}
-- SQL 示例
{
'option': 'SQL',
'content': {
'calculation_formula': 'sum(price)'
}
}
*/
-- 用于前端展示
calculation_content text NOT NULL COMMENT '统计方式',
calculation_formula text NOT NULL COMMENT '统计SQL,例如:sum(price)',
created_by varchar(50) NOT NULL COMMENT '创建者',
created_at timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
updated_by varchar(50) DEFAULT NULL COMMENT '更新者',
updated_at timestamp NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
PRIMARY KEY (`calculation_atom_name`)
)ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='数据模型统计口径表';
CREATE TABLE IF NOT EXISTS `dmm_model_calculation_atom_image` (
id int(11) NOT NULL AUTO_INCREMENT COMMENT '主键Id',
model_id int(11) NOT NULL COMMENT '模型ID',
project_id int(11) NOT NULL COMMENT '项目ID',
calculation_atom_name varchar(255) NOT NULL COMMENT '统计口径名称,要求英文字母加下划线',
created_by varchar(50) NOT NULL COMMENT '创建者',
created_at timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
updated_by varchar(50) DEFAULT NULL COMMENT '更新者',
updated_at timestamp NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
PRIMARY KEY (`id`),
CONSTRAINT `calculation_atom_image_unique_model_id_calculation_atom_name` UNIQUE(model_id, calculation_atom_name)
)ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='数据模型统计口径影像表,对集市中统计口径的引用';
CREATE TABLE IF NOT EXISTS `dmm_model_indicator` (
model_id int(11) NOT NULL COMMENT '模型ID',
project_id int(11) NOT NULL COMMENT '项目ID',
indicator_name varchar(255) NOT NULL COMMENT '指标名称,要求英文字母加下划线,不可修改,全局唯一',
indicator_alias varchar(255) NOT NULL COMMENT '指标别名',
description text NULL COMMENT '指标描述',
calculation_atom_name varchar(255) NOT NULL COMMENT '统计口径名称',
aggregation_fields text NOT NULL COMMENT '聚合字段列表,使用逗号隔开',
filter_formula text NULL COMMENT '过滤SQL,例如:system="android" AND area="sea"',
condition_fields text NULL COMMENT '过滤字段,若有过滤逻辑,则该字段有效',
scheduling_type varchar(32) NOT NULL COMMENT '计算类型,可选 stream、batch',
scheduling_content text NOT NULL COMMENT '调度内容',
parent_indicator_name varchar(255) NULL COMMENT '默认为NULL,表示直接从明细表里派生,不为NULL,标识从其他指标派生',
created_by varchar(50) NOT NULL COMMENT '创建者',
created_at timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
updated_by varchar(50) DEFAULT NULL COMMENT '更新者',
updated_at timestamp NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
PRIMARY KEY (`indicator_name`)
)ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='数据模型指标表';
CREATE TABLE IF NOT EXISTS `dmm_model_release` (
version_id varchar(64) NOT NULL COMMENT '模型版本ID',
version_log text NOT NULL COMMENT '模型版本日志',
model_id int(11) NOT NULL COMMENT '模型ID',
/*
-- 示例
{
"model_id": 23,
"model_name": "fact_item_flow_15",
"model_alias": "道具流水表",
"description": "道具流水",
"table_name": "fact_item_flow_15",
"table_alias": "道具流水表",
"tags": [
{
"tag_alias": "xx",
"tag_code": "yy"
}
],
"publish_status": "developing",
"active_status": "active",
"created_by": "xx",
"created_at": "2020-10-14 16:20:10",
"updated_by": "xx",
"updated_at": "2020-11-07 22:05:53",
"model_type": "fact_table",
"step_id": 4,
"project_id": 4,
"model_detail": {
"fields": [],
"calculation_atoms": [],
"model_relation": [],
"indicators": [],
}
}
*/
model_content text NOT NULL COMMENT '模型版本内容',
created_by varchar(50) NOT NULL COMMENT '创建者',
created_at timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
updated_by varchar(50) DEFAULT NULL COMMENT '更新者',
updated_at timestamp NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
PRIMARY KEY (`version_id`)
)ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='数据模型发布版本';
-- 字典表
CREATE TABLE IF NOT EXISTS `dmm_field_constraint_config` (
constraint_index int(11) NOT NULL COMMENT '约束index',
constraint_id varchar(64) NOT NULL COMMENT '字段约束ID',
constraint_type varchar(32) NOT NULL COMMENT '约束类型,可选general/specific',
group_type varchar(32) NOT NULL COMMENT '约束分组',
constraint_name varchar(64) NOT NULL COMMENT '约束名称',
constraint_value text NULL COMMENT '约束规则,与数据质量打通,用于生成质量检测规则',
/*
-- type COMMENT '类型校验',
-- content COMMENT '内容校验'
-- 示例
{
"type": "string_validator",
"content": {
"regex": "^(\(|\[)(\-)?\d+\,(\-)?\d+(\)|\])$"
}
}
*/
validator text NULL COMMENT '约束规则校验',
description text NULL COMMENT '字段约束说明',
editable tinyint(1) NOT NULL COMMENT '是否可以编辑 0:不可编辑,1:可以编辑',
allow_field_type text NULL COMMENT '允许的字段数据类型',
PRIMARY KEY (`constraint_id`)
)ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='字段约束表';
INSERT INTO `dmm_field_constraint_config` VALUES
(1,'eq','general',0,'=','1','{"content": null, "type": "number_validator"}',NULL,1,'["int", "long", "double", "float"]'),
(2,'not_eq','general',0,'!=','1','{"content": null, "type": "number_validator"}',NULL,1,'["int", "long", "double", "float"]'),
(3,'gt','general',0,'>','1','{"content": null, "type": "number_validator"}',NULL,1,'["int", "long", "double", "float"]'),
(4,'lt','general',0,'<','1','{"content": null, "type": "number_validator"}',NULL,1,'["int", "long", "double", "float"]'),
(5,'gte','general',0,'>=','1','{"content": null, "type": "number_validator"}',NULL,1,'["int", "long", "double", "float"]'),
(6,'lte','general',0,'<=','1','{"content": null, "type": "number_validator"}',NULL,1,'["int", "long", "double", "float"]'),
(7,'str_eq','general',0,'等于','qq','{"content": null, "type": "string_validator"}',NULL,1,'["string"]'),
(8,'str_not_eq','general',0,'不等于','qq','{"content": null, "type": "string_validator"}',NULL,1,'["string"]'),
(9,'strat_with','general',0,'开头是','http','{"content": null, "type": "string_validator"}',NULL,1,'["string"]'),
(10,'end_with','general',0,'结尾是','.com','{"content": null, "type": "string_validator"}',NULL,1,'["string"]'),
(11,'include','general',0,'包含','http','{"content": null, "type": "string_validator"}',NULL,1,'["string"]'),
(12,'not_include','general',0,'不包含','http','{"content": null, "type": "string_validator"}',NULL,1,'["string"]'),
(13,'not_null','general',0,'非空',NULL,NULL,NULL,0,'["int", "long", "double", "float", "string"]'),
(14,'value_enum','general',1,'枚举值','1,2,3','{"content": {"regex": "^[a-zA-Z0-9_\\\\u4e00-\\\\u9fa5]+(\\\\,(\\\\s)?[a-zA-Z0-9_\\\\u4e00-\\\\u9fa5]+)*$"}, "type": "string_validator"}','is one of',1,'["int", "long", "double", "float", "string"]'),
(15,'reverse_value_enum','general',1,'反向枚举值','1,2,3','{"content": {"regex": "^[a-zA-Z0-9_\\\\u4e00-\\\\u9fa5]+(\\\\,(\\\\s)?[a-zA-Z0-9_\\\\u4e00-\\\\u9fa5]+)*$"}, "type": "string_validator"}','is not one of',1,'["int", "long", "double", "float", "string"]'),
(16,'regex','general',1,'正则表达式','^[0-9]{1,2}$','{"content": null, "type": "regex_validator"}',NULL,1,'["int", "long", "double", "float", "string"]'),
(17,'email_format','specific',1,'邮箱','^[A-Za-z0-9\u4e00-\u9fa5]+@[a-zA-Z0-9_-]+(\.[a-zA-Z0-9_-]+)+$',NULL,NULL,0,'["string"]'),
(18,'tel_number_format','specific',1,'中国地区移动电话','^((\+86|86|\[86\]|\(86\)|\+086|086|\[086\]|\(086\)|\+0086|0086|\[0086\]|\(0086\))\s)?([1]|[1])[345678][0-9]{9}$',NULL,NULL,0,'["string"]'),
(19,'id_number_format','specific',1,'中国身份证号','^([1-9]\d{5}[12]\d{3}(0[1-9]|1[012])(0[1-9]|[12][0-9]|3[01])\d{3}[0-9xX])$',NULL,NULL,0,'["string"]'),
(20,'ip_format','specific',1,'IP地址','^((?:(?:25[0-5]|2[0-4]\\d|[01]?\\d?\\d)\\.){3}(?:25[0-5]|2[0-4]\\d|[01]?\\d?\\d))$',NULL,NULL,0,'["string"]'),
(21,'qq_format','specific',1,'QQ号码','^[1-9][0-9]{4,}$',NULL,NULL,0,'["string"]'),
(22,'post_code_format',1,'specific','中国邮政编码','^[1-9]{1}(\d+){5}$',NULL,NULL,0,'["string"]'),
(23,'url_format','specific',1,'网址','(http[s]?:\/\/|[a-zA-Z0-9]{1,}\.{1}|\b)(?:\w{1,}\.{1}){1,5}(?:com|org|edu|gov|uk|net|ca|de|jp|fr|au|us|ru|ch|it|nl|se|no|es|mil|iq|io|ac|ly|sm){1}(?:\/[a-zA-Z0-9]{1,})*',NULL,NULL,0,'["string"]');
CREATE TABLE IF NOT EXISTS `dmm_calculation_function_config` (
function_name varchar(64) NOT NULL COMMENT 'SQL 统计函数名称',
output_type varchar(32) NOT NULL COMMENT '输出字段类型',
allow_field_type text NOT NULL COMMENT '允许被聚合字段的数据类型',
PRIMARY KEY (`function_name`)
)ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='SQL 统计函数表';
INSERT INTO `dmm_calculation_function_config` VALUES
('sum','long','["int", "long", "double", "float"]'),
('count','long','["int", "long", "double", "float", "string"]'),
('count_distinct','long','["int", "long", "double", "float", "string"]'),
('avg','long','["int", "long", "double", "float"]'),
('max','long','["int", "long", "double", "float"]'),
('min','long','["int", "long", "double", "float"]');
CREATE TABLE IF NOT EXISTS `dmm_model_user_operation_log` (
id int(11) NOT NULL AUTO_INCREMENT COMMENT '自增ID',
model_id int(11) NOT NULL COMMENT '模型ID',
object_type varchar(32) NOT NULL COMMENT '操作对象类型',
object_operation varchar(32) NOT NULL COMMENT '操作类型',
object_id varchar(255) NOT NULL COMMENT '操作对象ID',
object_name varchar(255) NOT NULL COMMENT '操作对象英文名',
object_alias varchar(255) NOT NULL COMMENT '操作对象中文名',
content_before_change text NULL COMMENT '操作前的模型内容',
content_after_change text NULL COMMENT '操作后的模型内容',
created_by varchar(50) NOT NULL COMMENT '创建者',
created_at timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
extra text NULL COMMENT '附加信息',
PRIMARY KEY (`id`)
)ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='数据模型用户操作流水记录'; | the_stack |
-- Synchronize Terminology
/*
-- take account of the output for these two selects
SELECT DISTINCT columnname, NAME, description, HELP, entitytype
FROM AD_COLUMN c
WHERE NOT EXISTS (SELECT 1
FROM AD_ELEMENT e
WHERE UPPER (c.columnname) = UPPER (e.columnname));
SELECT DISTINCT columnname, NAME, description, HELP, entitytype
FROM AD_PROCESS_PARA p
WHERE NOT EXISTS (SELECT 1
FROM AD_ELEMENT e
WHERE UPPER (p.columnname) = UPPER (e.columnname));
*/
-- execute
INSERT INTO AD_ELEMENT_TRL
(ad_element_id, AD_LANGUAGE, ad_client_id, ad_org_id, isactive,
created, createdby, updated, updatedby, NAME, printname,
description, HELP, istranslated)
SELECT m.ad_element_id, l.AD_LANGUAGE, m.ad_client_id, m.ad_org_id,
m.isactive, m.created, m.createdby, m.updated, m.updatedby, m.NAME,
m.printname, m.description, m.HELP, 'N'
FROM AD_ELEMENT m, AD_LANGUAGE l
WHERE l.isactive = 'Y'
AND l.issystemlanguage = 'Y'
AND ad_element_id || AD_LANGUAGE NOT IN (
SELECT ad_element_id || AD_LANGUAGE
FROM AD_ELEMENT_TRL);
UPDATE AD_COLUMN
SET ad_element_id = (SELECT ad_element_id
FROM AD_ELEMENT e
WHERE UPPER (AD_COLUMN.columnname) = UPPER (e.columnname))
WHERE ad_element_id IS NULL;
DELETE FROM AD_ELEMENT_TRL
WHERE ad_element_id IN (
SELECT ad_element_id
FROM AD_ELEMENT e
WHERE NOT EXISTS (
SELECT 1
FROM AD_COLUMN c
WHERE UPPER (e.columnname) =
UPPER (c.columnname))
AND NOT EXISTS (
SELECT 1
FROM AD_PROCESS_PARA p
WHERE UPPER (e.columnname) =
UPPER (p.columnname)));
DELETE FROM AD_ELEMENT
WHERE AD_Element_ID >= 1000000 AND NOT EXISTS (SELECT 1
FROM AD_COLUMN c
WHERE UPPER (AD_ELEMENT.columnname) = UPPER (c.columnname))
AND NOT EXISTS (SELECT 1
FROM AD_PROCESS_PARA p
WHERE UPPER (AD_ELEMENT.columnname) = UPPER (p.columnname));
UPDATE AD_COLUMN
SET columnname =
(SELECT columnname
FROM AD_ELEMENT e
WHERE AD_COLUMN.ad_element_id = e.ad_element_id),
NAME =
(SELECT NAME
FROM AD_ELEMENT e
WHERE AD_COLUMN.ad_element_id = e.ad_element_id),
description =
(SELECT description
FROM AD_ELEMENT e
WHERE AD_COLUMN.ad_element_id = e.ad_element_id),
HELP =
(SELECT HELP
FROM AD_ELEMENT e
WHERE AD_COLUMN.ad_element_id = e.ad_element_id),
updated = current_timestamp
WHERE EXISTS (
SELECT 1
FROM AD_ELEMENT e
WHERE AD_COLUMN.ad_element_id = e.ad_element_id
AND ( AD_COLUMN.columnname <> e.columnname
OR AD_COLUMN.NAME <> e.NAME
OR COALESCE (AD_COLUMN.description, ' ') <> COALESCE (e.description, ' ')
OR COALESCE (AD_COLUMN.HELP, ' ') <> COALESCE (e.HELP, ' ')
));
UPDATE AD_FIELD
SET NAME =
(SELECT e.NAME
FROM AD_ELEMENT e, AD_COLUMN c
WHERE e.ad_element_id = c.ad_element_id
AND c.ad_column_id = AD_FIELD.ad_column_id),
description =
(SELECT e.description
FROM AD_ELEMENT e, AD_COLUMN c
WHERE e.ad_element_id = c.ad_element_id
AND c.ad_column_id = AD_FIELD.ad_column_id),
HELP =
(SELECT e.HELP
FROM AD_ELEMENT e, AD_COLUMN c
WHERE e.ad_element_id = c.ad_element_id
AND c.ad_column_id = AD_FIELD.ad_column_id),
updated = current_timestamp
WHERE AD_FIELD.iscentrallymaintained = 'Y'
AND AD_FIELD.isactive = 'Y'
AND EXISTS (
SELECT 1
FROM AD_ELEMENT e, AD_COLUMN c
WHERE AD_FIELD.ad_column_id = c.ad_column_id
AND c.ad_element_id = e.ad_element_id
AND c.ad_process_id IS NULL
AND ( AD_FIELD.NAME <> e.NAME
OR COALESCE (AD_FIELD.description, ' ') <> COALESCE (e.description, ' ')
OR COALESCE (AD_FIELD.HELP, ' ') <> COALESCE (e.HELP, ' ')
));
UPDATE AD_FIELD_TRL
SET NAME =
(SELECT e.NAME
FROM AD_ELEMENT_TRL e, AD_COLUMN c, AD_FIELD f
WHERE e.AD_LANGUAGE = AD_FIELD_TRL.AD_LANGUAGE
AND e.ad_element_id = c.ad_element_id
AND c.ad_column_id = f.ad_column_id
AND f.ad_field_id = AD_FIELD_TRL.ad_field_id),
description =
(SELECT e.description
FROM AD_ELEMENT_TRL e, AD_COLUMN c, AD_FIELD f
WHERE e.AD_LANGUAGE = AD_FIELD_TRL.AD_LANGUAGE
AND e.ad_element_id = c.ad_element_id
AND c.ad_column_id = f.ad_column_id
AND f.ad_field_id = AD_FIELD_TRL.ad_field_id),
HELP =
(SELECT e.HELP
FROM AD_ELEMENT_TRL e, AD_COLUMN c, AD_FIELD f
WHERE e.AD_LANGUAGE = AD_FIELD_TRL.AD_LANGUAGE
AND e.ad_element_id = c.ad_element_id
AND c.ad_column_id = f.ad_column_id
AND f.ad_field_id = AD_FIELD_TRL.ad_field_id),
istranslated =
(SELECT e.istranslated
FROM AD_ELEMENT_TRL e, AD_COLUMN c, AD_FIELD f
WHERE e.AD_LANGUAGE = AD_FIELD_TRL.AD_LANGUAGE
AND e.ad_element_id = c.ad_element_id
AND c.ad_column_id = f.ad_column_id
AND f.ad_field_id = AD_FIELD_TRL.ad_field_id),
updated = current_timestamp
WHERE EXISTS (
SELECT 1
FROM AD_FIELD f, AD_ELEMENT_TRL e, AD_COLUMN c
WHERE AD_FIELD_TRL.ad_field_id = f.ad_field_id
AND f.ad_column_id = c.ad_column_id
AND c.ad_element_id = e.ad_element_id
AND c.ad_process_id IS NULL
AND AD_FIELD_TRL.AD_LANGUAGE = e.AD_LANGUAGE
AND f.iscentrallymaintained = 'Y'
AND f.isactive = 'Y'
AND ( AD_FIELD_TRL.NAME <> e.NAME
OR COALESCE (AD_FIELD_TRL.description, ' ') <> COALESCE (e.description, ' ')
OR COALESCE (AD_FIELD_TRL.HELP, ' ') <> COALESCE (e.HELP, ' ')
));
UPDATE AD_FIELD
SET NAME =
(SELECT e.po_name
FROM AD_ELEMENT e, AD_COLUMN c
WHERE e.ad_element_id = c.ad_element_id
AND c.ad_column_id = AD_FIELD.ad_column_id),
description =
(SELECT e.po_description
FROM AD_ELEMENT e, AD_COLUMN c
WHERE e.ad_element_id = c.ad_element_id
AND c.ad_column_id = AD_FIELD.ad_column_id),
HELP =
(SELECT e.po_help
FROM AD_ELEMENT e, AD_COLUMN c
WHERE e.ad_element_id = c.ad_element_id
AND c.ad_column_id = AD_FIELD.ad_column_id),
updated = current_timestamp
WHERE AD_FIELD.iscentrallymaintained = 'Y'
AND AD_FIELD.isactive = 'Y'
AND EXISTS (
SELECT 1
FROM AD_ELEMENT e, AD_COLUMN c
WHERE AD_FIELD.ad_column_id = c.ad_column_id
AND c.ad_element_id = e.ad_element_id
AND c.ad_process_id IS NULL
AND ( AD_FIELD.NAME <> e.po_name
OR COALESCE (AD_FIELD.description, ' ') <> COALESCE (e.po_description, ' ')
OR COALESCE (AD_FIELD.HELP, ' ') <> COALESCE (e.po_help, ' ')
)
AND e.po_name IS NOT NULL)
AND EXISTS (
SELECT 1
FROM AD_TAB t, AD_WINDOW w
WHERE AD_FIELD.ad_tab_id = t.ad_tab_id
AND t.ad_window_id = w.ad_window_id
AND w.issotrx = 'N');
UPDATE AD_FIELD_TRL
SET NAME =
(SELECT e.po_name
FROM AD_ELEMENT_TRL e, AD_COLUMN c, AD_FIELD f
WHERE e.AD_LANGUAGE = AD_FIELD_TRL.AD_LANGUAGE
AND e.ad_element_id = c.ad_element_id
AND c.ad_column_id = f.ad_column_id
AND f.ad_field_id = AD_FIELD_TRL.ad_field_id),
description =
(SELECT e.po_description
FROM AD_ELEMENT_TRL e, AD_COLUMN c, AD_FIELD f
WHERE e.AD_LANGUAGE = AD_FIELD_TRL.AD_LANGUAGE
AND e.ad_element_id = c.ad_element_id
AND c.ad_column_id = f.ad_column_id
AND f.ad_field_id = AD_FIELD_TRL.ad_field_id),
HELP =
(SELECT e.po_help
FROM AD_ELEMENT_TRL e, AD_COLUMN c, AD_FIELD f
WHERE e.AD_LANGUAGE = AD_FIELD_TRL.AD_LANGUAGE
AND e.ad_element_id = c.ad_element_id
AND c.ad_column_id = f.ad_column_id
AND f.ad_field_id = AD_FIELD_TRL.ad_field_id),
istranslated =
(SELECT e.istranslated
FROM AD_ELEMENT_TRL e, AD_COLUMN c, AD_FIELD f
WHERE e.AD_LANGUAGE = AD_FIELD_TRL.AD_LANGUAGE
AND e.ad_element_id = c.ad_element_id
AND c.ad_column_id = f.ad_column_id
AND f.ad_field_id = AD_FIELD_TRL.ad_field_id),
updated = current_timestamp
WHERE EXISTS (
SELECT 1
FROM AD_FIELD f, AD_ELEMENT_TRL e, AD_COLUMN c
WHERE AD_FIELD_TRL.ad_field_id = f.ad_field_id
AND f.ad_column_id = c.ad_column_id
AND c.ad_element_id = e.ad_element_id
AND c.ad_process_id IS NULL
AND AD_FIELD_TRL.AD_LANGUAGE = e.AD_LANGUAGE
AND f.iscentrallymaintained = 'Y'
AND f.isactive = 'Y'
AND ( AD_FIELD_TRL.NAME <> e.po_name
OR COALESCE (AD_FIELD_TRL.description, ' ') <> COALESCE (e.po_description, ' ')
OR COALESCE (AD_FIELD_TRL.HELP, ' ') <> COALESCE (e.po_help, ' ')
)
AND e.po_name IS NOT NULL)
AND EXISTS (
SELECT 1
FROM AD_FIELD f, AD_TAB t, AD_WINDOW w
WHERE AD_FIELD_TRL.ad_field_id = f.ad_field_id
AND f.ad_tab_id = t.ad_tab_id
AND t.ad_window_id = w.ad_window_id
AND w.issotrx = 'N');
UPDATE AD_FIELD
SET NAME =
(SELECT p.NAME
FROM AD_PROCESS p, AD_COLUMN c
WHERE p.ad_process_id = c.ad_process_id
AND c.ad_column_id = AD_FIELD.ad_column_id),
description =
(SELECT p.description
FROM AD_PROCESS p, AD_COLUMN c
WHERE p.ad_process_id = c.ad_process_id
AND c.ad_column_id = AD_FIELD.ad_column_id),
HELP =
(SELECT p.HELP
FROM AD_PROCESS p, AD_COLUMN c
WHERE p.ad_process_id = c.ad_process_id
AND c.ad_column_id = AD_FIELD.ad_column_id),
updated = current_timestamp
WHERE AD_FIELD.iscentrallymaintained = 'Y'
AND AD_FIELD.isactive = 'Y'
AND EXISTS (
SELECT 1
FROM AD_PROCESS p, AD_COLUMN c
WHERE c.ad_process_id = p.ad_process_id
AND AD_FIELD.ad_column_id = c.ad_column_id
AND ( AD_FIELD.NAME <> p.NAME
OR COALESCE (AD_FIELD.description, ' ') <> COALESCE (p.description, ' ')
OR COALESCE (AD_FIELD.HELP, ' ') <> COALESCE (p.HELP, ' ')
));
UPDATE AD_FIELD_TRL
SET NAME =
(SELECT p.NAME
FROM AD_PROCESS_TRL p, AD_COLUMN c, AD_FIELD f
WHERE p.ad_process_id = c.ad_process_id
AND c.ad_column_id = f.ad_column_id
AND f.ad_field_id = AD_FIELD_TRL.ad_field_id
AND p.AD_LANGUAGE = AD_FIELD_TRL.AD_LANGUAGE),
description =
(SELECT p.description
FROM AD_PROCESS_TRL p, AD_COLUMN c, AD_FIELD f
WHERE p.ad_process_id = c.ad_process_id
AND c.ad_column_id = f.ad_column_id
AND f.ad_field_id = AD_FIELD_TRL.ad_field_id
AND p.AD_LANGUAGE = AD_FIELD_TRL.AD_LANGUAGE),
HELP =
(SELECT p.HELP
FROM AD_PROCESS_TRL p, AD_COLUMN c, AD_FIELD f
WHERE p.ad_process_id = c.ad_process_id
AND c.ad_column_id = f.ad_column_id
AND f.ad_field_id = AD_FIELD_TRL.ad_field_id
AND p.AD_LANGUAGE = AD_FIELD_TRL.AD_LANGUAGE),
istranslated =
(SELECT p.istranslated
FROM AD_PROCESS_TRL p, AD_COLUMN c, AD_FIELD f
WHERE p.ad_process_id = c.ad_process_id
AND c.ad_column_id = f.ad_column_id
AND f.ad_field_id = AD_FIELD_TRL.ad_field_id
AND p.AD_LANGUAGE = AD_FIELD_TRL.AD_LANGUAGE),
updated = current_timestamp
WHERE EXISTS (
SELECT 1
FROM AD_PROCESS_TRL p, AD_COLUMN c, AD_FIELD f
WHERE c.ad_process_id = p.ad_process_id
AND f.ad_column_id = c.ad_column_id
AND f.ad_field_id = AD_FIELD_TRL.ad_field_id
AND p.AD_LANGUAGE = AD_FIELD_TRL.AD_LANGUAGE
AND f.iscentrallymaintained = 'Y'
AND f.isactive = 'Y'
AND ( AD_FIELD_TRL.NAME <> p.NAME
OR COALESCE (AD_FIELD_TRL.description, ' ') <> COALESCE (p.description, ' ')
OR COALESCE (AD_FIELD_TRL.HELP, ' ') <> COALESCE (p.HELP, ' ')
));
/*
-- check for element errors
SELECT UPPER (e.columnname), COUNT (*)
FROM AD_ELEMENT e
GROUP BY UPPER (e.columnname)
HAVING COUNT (*) > 1;
SELECT ROWID, ad_element_id, columnname,
(SELECT COUNT (*)
FROM AD_COLUMN c
WHERE c.ad_element_id = AD_ELEMENT.ad_element_id) cnt
FROM AD_ELEMENT
WHERE UPPER (columnname) IN (SELECT UPPER (e.columnname)
FROM AD_ELEMENT e
GROUP BY UPPER (e.columnname)
HAVING COUNT (*) > 1)
ORDER BY UPPER (columnname), columnname;
*/
UPDATE AD_PROCESS_PARA
SET columnname = (SELECT e.columnname
FROM AD_ELEMENT e
-- WHERE UPPER (e.columnname) = UPPER (AD_PROCESS_PARA.columnname))
WHERE e.columnname = AD_PROCESS_PARA.columnname) -- Temporary patch Fixed Assets are broking it
WHERE AD_PROCESS_PARA.iscentrallymaintained = 'Y'
AND AD_PROCESS_PARA.isactive = 'Y'
AND EXISTS (
SELECT 1
FROM AD_ELEMENT e
WHERE UPPER (e.columnname) = UPPER (AD_PROCESS_PARA.columnname)
AND e.columnname <> AD_PROCESS_PARA.columnname);
UPDATE AD_PROCESS_PARA
SET iscentrallymaintained = 'N'
WHERE iscentrallymaintained <> 'N'
AND NOT EXISTS (SELECT 1
FROM AD_ELEMENT e
WHERE AD_PROCESS_PARA.columnname = e.columnname);
UPDATE AD_PROCESS_PARA
SET NAME = (SELECT e.NAME
FROM AD_ELEMENT e
WHERE e.columnname = AD_PROCESS_PARA.columnname),
description = (SELECT e.description
FROM AD_ELEMENT e
WHERE e.columnname = AD_PROCESS_PARA.columnname),
HELP = (SELECT e.HELP
FROM AD_ELEMENT e
WHERE e.columnname = AD_PROCESS_PARA.columnname),
updated = current_timestamp
WHERE AD_PROCESS_PARA.iscentrallymaintained = 'Y'
AND AD_PROCESS_PARA.isactive = 'Y'
AND EXISTS (
SELECT 1
FROM AD_ELEMENT e
WHERE e.columnname = AD_PROCESS_PARA.columnname
AND ( AD_PROCESS_PARA.NAME <> e.NAME
OR COALESCE (AD_PROCESS_PARA.description, ' ') <> COALESCE (e.description, ' ')
OR COALESCE (AD_PROCESS_PARA.HELP, ' ') <> COALESCE (e.HELP, ' ')
));
UPDATE AD_PROCESS_PARA_TRL
SET NAME =
(SELECT et.NAME
FROM AD_ELEMENT_TRL et, AD_ELEMENT e, AD_PROCESS_PARA f
WHERE et.AD_LANGUAGE = AD_PROCESS_PARA_TRL.AD_LANGUAGE
AND et.ad_element_id = e.ad_element_id
AND e.columnname = f.columnname
AND f.ad_process_para_id = AD_PROCESS_PARA_TRL.ad_process_para_id),
description =
(SELECT et.description
FROM AD_ELEMENT_TRL et, AD_ELEMENT e, AD_PROCESS_PARA f
WHERE et.AD_LANGUAGE = AD_PROCESS_PARA_TRL.AD_LANGUAGE
AND et.ad_element_id = e.ad_element_id
AND e.columnname = f.columnname
AND f.ad_process_para_id = AD_PROCESS_PARA_TRL.ad_process_para_id),
HELP =
(SELECT et.HELP
FROM AD_ELEMENT_TRL et, AD_ELEMENT e, AD_PROCESS_PARA f
WHERE et.AD_LANGUAGE = AD_PROCESS_PARA_TRL.AD_LANGUAGE
AND et.ad_element_id = e.ad_element_id
AND e.columnname = f.columnname
AND f.ad_process_para_id = AD_PROCESS_PARA_TRL.ad_process_para_id),
istranslated =
(SELECT et.istranslated
FROM AD_ELEMENT_TRL et, AD_ELEMENT e, AD_PROCESS_PARA f
WHERE et.AD_LANGUAGE = AD_PROCESS_PARA_TRL.AD_LANGUAGE
AND et.ad_element_id = e.ad_element_id
AND e.columnname = f.columnname
AND f.ad_process_para_id = AD_PROCESS_PARA_TRL.ad_process_para_id),
updated = current_timestamp
WHERE EXISTS (
SELECT 1
FROM AD_ELEMENT_TRL et, AD_ELEMENT e, AD_PROCESS_PARA f
WHERE et.AD_LANGUAGE = AD_PROCESS_PARA_TRL.AD_LANGUAGE
AND et.ad_element_id = e.ad_element_id
AND e.columnname = f.columnname
AND f.ad_process_para_id = AD_PROCESS_PARA_TRL.ad_process_para_id
AND f.iscentrallymaintained = 'Y'
AND f.isactive = 'Y'
AND ( AD_PROCESS_PARA_TRL.NAME <> et.NAME
OR COALESCE (AD_PROCESS_PARA_TRL.description, ' ') <> COALESCE (et.description, ' ')
OR COALESCE (AD_PROCESS_PARA_TRL.HELP, ' ') <> COALESCE (et.HELP, ' ')
));
UPDATE AD_WF_NODE
SET NAME = (SELECT w.NAME
FROM AD_WINDOW w
WHERE w.ad_window_id = AD_WF_NODE.ad_window_id),
description = (SELECT w.description
FROM AD_WINDOW w
WHERE w.ad_window_id = AD_WF_NODE.ad_window_id),
HELP = (SELECT w.HELP
FROM AD_WINDOW w
WHERE w.ad_window_id = AD_WF_NODE.ad_window_id)
WHERE AD_WF_NODE.iscentrallymaintained = 'Y'
AND EXISTS (
SELECT 1
FROM AD_WINDOW w
WHERE w.ad_window_id = AD_WF_NODE.ad_window_id
AND ( w.NAME <> AD_WF_NODE.NAME
OR COALESCE (w.description, ' ') <> COALESCE (AD_WF_NODE.description, ' ')
OR COALESCE (w.HELP, ' ') <> COALESCE (AD_WF_NODE.HELP, ' ')
));
UPDATE AD_WF_NODE_TRL
SET NAME =
(SELECT t.NAME
FROM AD_WINDOW_TRL t, AD_WF_NODE n
WHERE AD_WF_NODE_TRL.ad_wf_node_id = n.ad_wf_node_id
AND n.ad_window_id = t.ad_window_id
AND AD_WF_NODE_TRL.AD_LANGUAGE = t.AD_LANGUAGE),
description =
(SELECT t.description
FROM AD_WINDOW_TRL t, AD_WF_NODE n
WHERE AD_WF_NODE_TRL.ad_wf_node_id = n.ad_wf_node_id
AND n.ad_window_id = t.ad_window_id
AND AD_WF_NODE_TRL.AD_LANGUAGE = t.AD_LANGUAGE),
HELP =
(SELECT t.HELP
FROM AD_WINDOW_TRL t, AD_WF_NODE n
WHERE AD_WF_NODE_TRL.ad_wf_node_id = n.ad_wf_node_id
AND n.ad_window_id = t.ad_window_id
AND AD_WF_NODE_TRL.AD_LANGUAGE = t.AD_LANGUAGE)
WHERE EXISTS (
SELECT 1
FROM AD_WINDOW_TRL t, AD_WF_NODE n
WHERE AD_WF_NODE_TRL.ad_wf_node_id = n.ad_wf_node_id
AND n.ad_window_id = t.ad_window_id
AND AD_WF_NODE_TRL.AD_LANGUAGE = t.AD_LANGUAGE
AND n.iscentrallymaintained = 'Y'
AND n.isactive = 'Y'
AND ( AD_WF_NODE_TRL.NAME <> t.NAME
OR COALESCE (AD_WF_NODE_TRL.description, ' ') <> COALESCE (t.description, ' ')
OR COALESCE (AD_WF_NODE_TRL.HELP, ' ') <> COALESCE (t.HELP, ' ')
));
UPDATE AD_WF_NODE
SET NAME =
(SELECT f.NAME
FROM AD_FORM f
WHERE f.ad_form_id = AD_WF_NODE.ad_form_id),
description =
(SELECT f.description
FROM AD_FORM f
WHERE f.ad_form_id = AD_WF_NODE.ad_form_id),
HELP =
(SELECT f.HELP
FROM AD_FORM f
WHERE f.ad_form_id = AD_WF_NODE.ad_form_id)
WHERE AD_WF_NODE.iscentrallymaintained = 'Y'
AND EXISTS (
SELECT 1
FROM AD_FORM f
WHERE f.ad_form_id = AD_WF_NODE.ad_form_id
AND ( f.NAME <> AD_WF_NODE.NAME
OR COALESCE (f.description, ' ') <> COALESCE (AD_WF_NODE.description, ' ')
OR COALESCE (f.HELP, ' ') <> COALESCE (AD_WF_NODE.HELP, ' ')
));
UPDATE AD_WF_NODE_TRL
SET NAME =
(SELECT t.NAME
FROM AD_FORM_TRL t, AD_WF_NODE n
WHERE AD_WF_NODE_TRL.ad_wf_node_id = n.ad_wf_node_id
AND n.ad_form_id = t.ad_form_id
AND AD_WF_NODE_TRL.AD_LANGUAGE = t.AD_LANGUAGE),
description =
(SELECT t.description
FROM AD_FORM_TRL t, AD_WF_NODE n
WHERE AD_WF_NODE_TRL.ad_wf_node_id = n.ad_wf_node_id
AND n.ad_form_id = t.ad_form_id
AND AD_WF_NODE_TRL.AD_LANGUAGE = t.AD_LANGUAGE),
HELP =
(SELECT t.HELP
FROM AD_FORM_TRL t, AD_WF_NODE n
WHERE AD_WF_NODE_TRL.ad_wf_node_id = n.ad_wf_node_id
AND n.ad_form_id = t.ad_form_id
AND AD_WF_NODE_TRL.AD_LANGUAGE = t.AD_LANGUAGE)
WHERE EXISTS (
SELECT 1
FROM AD_FORM_TRL t, AD_WF_NODE n
WHERE AD_WF_NODE_TRL.ad_wf_node_id = n.ad_wf_node_id
AND n.ad_form_id = t.ad_form_id
AND AD_WF_NODE_TRL.AD_LANGUAGE = t.AD_LANGUAGE
AND n.iscentrallymaintained = 'Y'
AND n.isactive = 'Y'
AND ( AD_WF_NODE_TRL.NAME <> t.NAME
OR COALESCE (AD_WF_NODE_TRL.description, ' ') <> COALESCE (t.description, ' ')
OR COALESCE (AD_WF_NODE_TRL.HELP, ' ') <> COALESCE (t.HELP, ' ')
));
UPDATE AD_WF_NODE
SET NAME =
(SELECT f.NAME
FROM AD_PROCESS f
WHERE f.ad_process_id = AD_WF_NODE.ad_process_id),
description =
(SELECT f.description
FROM AD_PROCESS f
WHERE f.ad_process_id = AD_WF_NODE.ad_process_id),
HELP =
(SELECT f.HELP
FROM AD_PROCESS f
WHERE f.ad_process_id = AD_WF_NODE.ad_process_id)
WHERE AD_WF_NODE.iscentrallymaintained = 'Y'
AND EXISTS (
SELECT 1
FROM AD_PROCESS f
WHERE f.ad_process_id = AD_WF_NODE.ad_process_id
AND ( f.NAME <> AD_WF_NODE.NAME
OR COALESCE (f.description, ' ') <> COALESCE (AD_WF_NODE.description, ' ')
OR COALESCE (f.HELP, ' ') <> COALESCE (AD_WF_NODE.HELP, ' ')
));
UPDATE AD_WF_NODE_TRL
SET NAME =
(SELECT t.NAME
FROM AD_PROCESS_TRL t, AD_WF_NODE n
WHERE AD_WF_NODE_TRL.ad_wf_node_id = n.ad_wf_node_id
AND n.ad_process_id = t.ad_process_id
AND AD_WF_NODE_TRL.AD_LANGUAGE = t.AD_LANGUAGE),
description =
(SELECT t.description
FROM AD_PROCESS_TRL t, AD_WF_NODE n
WHERE AD_WF_NODE_TRL.ad_wf_node_id = n.ad_wf_node_id
AND n.ad_process_id = t.ad_process_id
AND AD_WF_NODE_TRL.AD_LANGUAGE = t.AD_LANGUAGE),
HELP =
(SELECT t.HELP
FROM AD_PROCESS_TRL t, AD_WF_NODE n
WHERE AD_WF_NODE_TRL.ad_wf_node_id = n.ad_wf_node_id
AND n.ad_process_id = t.ad_process_id
AND AD_WF_NODE_TRL.AD_LANGUAGE = t.AD_LANGUAGE)
WHERE EXISTS (
SELECT 1
FROM AD_PROCESS_TRL t, AD_WF_NODE n
WHERE AD_WF_NODE_TRL.ad_wf_node_id = n.ad_wf_node_id
AND n.ad_process_id = t.ad_process_id
AND AD_WF_NODE_TRL.AD_LANGUAGE = t.AD_LANGUAGE
AND n.iscentrallymaintained = 'Y'
AND n.isactive = 'Y'
AND ( AD_WF_NODE_TRL.NAME <> t.NAME
OR COALESCE (AD_WF_NODE_TRL.description, ' ') <> COALESCE (t.description, ' ')
OR COALESCE (AD_WF_NODE_TRL.HELP, ' ') <> COALESCE (t.HELP, ' ')
));
UPDATE AD_PRINTFORMATITEM
SET NAME =
(SELECT e.NAME
FROM AD_ELEMENT e, AD_COLUMN c
WHERE e.ad_element_id = c.ad_element_id
AND c.ad_column_id = AD_PRINTFORMATITEM.ad_column_id)
WHERE AD_PRINTFORMATITEM.iscentrallymaintained = 'Y'
AND EXISTS (
SELECT 1
FROM AD_ELEMENT e, AD_COLUMN c
WHERE e.ad_element_id = c.ad_element_id
AND c.ad_column_id = AD_PRINTFORMATITEM.ad_column_id
AND e.NAME <> AD_PRINTFORMATITEM.NAME)
AND EXISTS (
SELECT 1
FROM AD_CLIENT
WHERE ad_client_id = AD_PRINTFORMATITEM.ad_client_id
AND ismultilingualdocument = 'Y');
UPDATE AD_PRINTFORMATITEM
SET printname =
(SELECT e.printname
FROM AD_ELEMENT e, AD_COLUMN c
WHERE e.ad_element_id = c.ad_element_id
AND c.ad_column_id = AD_PRINTFORMATITEM.ad_column_id)
WHERE AD_PRINTFORMATITEM.iscentrallymaintained = 'Y'
AND EXISTS (
SELECT 1
FROM AD_ELEMENT e, AD_COLUMN c, AD_PRINTFORMAT pf
WHERE e.ad_element_id = c.ad_element_id
AND c.ad_column_id = AD_PRINTFORMATITEM.ad_column_id
AND LENGTH (AD_PRINTFORMATITEM.printname) > 0
AND e.printname <> AD_PRINTFORMATITEM.printname
AND pf.ad_printformat_id = AD_PRINTFORMATITEM.ad_printformat_id
AND pf.isform = 'N'
AND istablebased = 'Y')
AND EXISTS (
SELECT 1
FROM AD_CLIENT
WHERE ad_client_id = AD_PRINTFORMATITEM.ad_client_id
AND ismultilingualdocument = 'Y');
UPDATE AD_PRINTFORMATITEM_TRL
SET printname =
(SELECT e.printname
FROM AD_ELEMENT_TRL e, AD_COLUMN c, AD_PRINTFORMATITEM pfi
WHERE e.AD_LANGUAGE = AD_PRINTFORMATITEM_TRL.AD_LANGUAGE
AND e.ad_element_id = c.ad_element_id
AND c.ad_column_id = pfi.ad_column_id
AND pfi.ad_printformatitem_id = AD_PRINTFORMATITEM_TRL.ad_printformatitem_id)
WHERE EXISTS (
SELECT 1
FROM AD_ELEMENT_TRL e,
AD_COLUMN c,
AD_PRINTFORMATITEM pfi,
AD_PRINTFORMAT pf
WHERE e.AD_LANGUAGE = AD_PRINTFORMATITEM_TRL.AD_LANGUAGE
AND e.ad_element_id = c.ad_element_id
AND c.ad_column_id = pfi.ad_column_id
AND pfi.ad_printformatitem_id = AD_PRINTFORMATITEM_TRL.ad_printformatitem_id
AND pfi.iscentrallymaintained = 'Y'
AND LENGTH (pfi.printname) > 0
AND (e.printname <> AD_PRINTFORMATITEM_TRL.printname OR AD_PRINTFORMATITEM_TRL.printname IS NULL)
AND pf.ad_printformat_id = pfi.ad_printformat_id
AND pf.isform = 'N'
AND istablebased = 'Y')
AND EXISTS (
SELECT 1
FROM AD_CLIENT
WHERE ad_client_id = AD_PRINTFORMATITEM_TRL.ad_client_id
AND ismultilingualdocument = 'Y');
UPDATE AD_PRINTFORMATITEM_TRL
SET printname =
(SELECT pfi.printname
FROM AD_PRINTFORMATITEM pfi
WHERE pfi.ad_printformatitem_id = AD_PRINTFORMATITEM_TRL.ad_printformatitem_id)
WHERE EXISTS (
SELECT 1
FROM AD_PRINTFORMATITEM pfi, AD_PRINTFORMAT pf
WHERE pfi.ad_printformatitem_id = AD_PRINTFORMATITEM_TRL.ad_printformatitem_id
AND pfi.iscentrallymaintained = 'Y'
AND LENGTH (pfi.printname) > 0
AND pfi.printname <> AD_PRINTFORMATITEM_TRL.printname
AND pf.ad_printformat_id = pfi.ad_printformat_id
AND pf.isform = 'N'
AND pf.istablebased = 'Y')
AND EXISTS (
SELECT 1
FROM AD_CLIENT
WHERE ad_client_id = AD_PRINTFORMATITEM_TRL.ad_client_id
AND ismultilingualdocument = 'N');
UPDATE AD_PRINTFORMATITEM_TRL
SET printname = NULL
WHERE printname IS NOT NULL
AND EXISTS (
SELECT 1
FROM AD_PRINTFORMATITEM pfi
WHERE pfi.ad_printformatitem_id = AD_PRINTFORMATITEM_TRL.ad_printformatitem_id
AND pfi.iscentrallymaintained = 'Y'
AND (LENGTH (pfi.printname) = 0 OR pfi.printname IS NULL));
UPDATE AD_MENU
SET NAME = (SELECT NAME
FROM AD_WINDOW w
WHERE AD_MENU.ad_window_id = w.ad_window_id),
description = (SELECT description
FROM AD_WINDOW w
WHERE AD_MENU.ad_window_id = w.ad_window_id)
WHERE ad_window_id IS NOT NULL AND action = 'W';
UPDATE AD_MENU_TRL
SET NAME =
(SELECT wt.NAME
FROM AD_WINDOW_TRL wt, AD_MENU m
WHERE AD_MENU_TRL.ad_menu_id = m.ad_menu_id
AND m.ad_window_id = wt.ad_window_id
AND AD_MENU_TRL.AD_LANGUAGE = wt.AD_LANGUAGE),
description =
(SELECT wt.description
FROM AD_WINDOW_TRL wt, AD_MENU m
WHERE AD_MENU_TRL.ad_menu_id = m.ad_menu_id
AND m.ad_window_id = wt.ad_window_id
AND AD_MENU_TRL.AD_LANGUAGE = wt.AD_LANGUAGE),
istranslated =
(SELECT wt.istranslated
FROM AD_WINDOW_TRL wt, AD_MENU m
WHERE AD_MENU_TRL.ad_menu_id = m.ad_menu_id
AND m.ad_window_id = wt.ad_window_id
AND AD_MENU_TRL.AD_LANGUAGE = wt.AD_LANGUAGE)
WHERE EXISTS (
SELECT 1
FROM AD_WINDOW_TRL wt, AD_MENU m
WHERE AD_MENU_TRL.ad_menu_id = m.ad_menu_id
AND m.ad_window_id = wt.ad_window_id
AND AD_MENU_TRL.AD_LANGUAGE = wt.AD_LANGUAGE
AND m.ad_window_id IS NOT NULL
AND m.action = 'W');
UPDATE AD_MENU
SET NAME = (SELECT p.NAME
FROM AD_PROCESS p
WHERE AD_MENU.ad_process_id = p.ad_process_id),
description = (SELECT p.description
FROM AD_PROCESS p
WHERE AD_MENU.ad_process_id = p.ad_process_id)
WHERE AD_MENU.ad_process_id IS NOT NULL AND AD_MENU.action IN ('R', 'P');
UPDATE AD_MENU_TRL
SET NAME =
(SELECT pt.NAME
FROM AD_PROCESS_TRL pt, AD_MENU m
WHERE AD_MENU_TRL.ad_menu_id = m.ad_menu_id
AND m.ad_process_id = pt.ad_process_id
AND AD_MENU_TRL.AD_LANGUAGE = pt.AD_LANGUAGE),
description =
(SELECT pt.description
FROM AD_PROCESS_TRL pt, AD_MENU m
WHERE AD_MENU_TRL.ad_menu_id = m.ad_menu_id
AND m.ad_process_id = pt.ad_process_id
AND AD_MENU_TRL.AD_LANGUAGE = pt.AD_LANGUAGE),
istranslated =
(SELECT pt.istranslated
FROM AD_PROCESS_TRL pt, AD_MENU m
WHERE AD_MENU_TRL.ad_menu_id = m.ad_menu_id
AND m.ad_process_id = pt.ad_process_id
AND AD_MENU_TRL.AD_LANGUAGE = pt.AD_LANGUAGE)
WHERE EXISTS (
SELECT 1
FROM AD_PROCESS_TRL pt, AD_MENU m
WHERE AD_MENU_TRL.ad_menu_id = m.ad_menu_id
AND m.ad_process_id = pt.ad_process_id
AND AD_MENU_TRL.AD_LANGUAGE = pt.AD_LANGUAGE
AND m.ad_process_id IS NOT NULL
AND action IN ('R', 'P'));
UPDATE AD_MENU
SET NAME = (SELECT NAME
FROM AD_FORM f
WHERE AD_MENU.ad_form_id = f.ad_form_id),
description = (SELECT description
FROM AD_FORM f
WHERE AD_MENU.ad_form_id = f.ad_form_id)
WHERE ad_form_id IS NOT NULL AND action = 'X';
UPDATE AD_MENU_TRL
SET NAME =
(SELECT ft.NAME
FROM AD_FORM_TRL ft, AD_MENU m
WHERE AD_MENU_TRL.ad_menu_id = m.ad_menu_id
AND m.ad_form_id = ft.ad_form_id
AND AD_MENU_TRL.AD_LANGUAGE = ft.AD_LANGUAGE),
description =
(SELECT ft.description
FROM AD_FORM_TRL ft, AD_MENU m
WHERE AD_MENU_TRL.ad_menu_id = m.ad_menu_id
AND m.ad_form_id = ft.ad_form_id
AND AD_MENU_TRL.AD_LANGUAGE = ft.AD_LANGUAGE),
istranslated =
(SELECT ft.istranslated
FROM AD_FORM_TRL ft, AD_MENU m
WHERE AD_MENU_TRL.ad_menu_id = m.ad_menu_id
AND m.ad_form_id = ft.ad_form_id
AND AD_MENU_TRL.AD_LANGUAGE = ft.AD_LANGUAGE)
WHERE EXISTS (
SELECT 1
FROM AD_FORM_TRL ft, AD_MENU m
WHERE AD_MENU_TRL.ad_menu_id = m.ad_menu_id
AND m.ad_form_id = ft.ad_form_id
AND AD_MENU_TRL.AD_LANGUAGE = ft.AD_LANGUAGE
AND m.ad_form_id IS NOT NULL
AND action = 'X');
UPDATE AD_MENU
SET NAME = (SELECT p.NAME
FROM AD_WORKFLOW p
WHERE AD_MENU.ad_workflow_id = p.ad_workflow_id),
description = (SELECT p.description
FROM AD_WORKFLOW p
WHERE AD_MENU.ad_workflow_id = p.ad_workflow_id)
WHERE AD_MENU.ad_workflow_id IS NOT NULL AND AD_MENU.action = 'F';
UPDATE AD_MENU_TRL
SET NAME =
(SELECT pt.NAME
FROM AD_WORKFLOW_TRL pt, AD_MENU m
WHERE AD_MENU_TRL.ad_menu_id = m.ad_menu_id
AND m.ad_workflow_id = pt.ad_workflow_id
AND AD_MENU_TRL.AD_LANGUAGE = pt.AD_LANGUAGE),
description =
(SELECT pt.description
FROM AD_WORKFLOW_TRL pt, AD_MENU m
WHERE AD_MENU_TRL.ad_menu_id = m.ad_menu_id
AND m.ad_workflow_id = pt.ad_workflow_id
AND AD_MENU_TRL.AD_LANGUAGE = pt.AD_LANGUAGE),
istranslated =
(SELECT pt.istranslated
FROM AD_WORKFLOW_TRL pt, AD_MENU m
WHERE AD_MENU_TRL.ad_menu_id = m.ad_menu_id
AND m.ad_workflow_id = pt.ad_workflow_id
AND AD_MENU_TRL.AD_LANGUAGE = pt.AD_LANGUAGE)
WHERE EXISTS (
SELECT 1
FROM AD_WORKFLOW_TRL pt, AD_MENU m
WHERE AD_MENU_TRL.ad_menu_id = m.ad_menu_id
AND m.ad_workflow_id = pt.ad_workflow_id
AND AD_MENU_TRL.AD_LANGUAGE = pt.AD_LANGUAGE
AND m.ad_workflow_id IS NOT NULL
AND action = 'F');
UPDATE AD_MENU
SET NAME = (SELECT NAME
FROM AD_TASK f
WHERE AD_MENU.ad_task_id = f.ad_task_id),
description = (SELECT description
FROM AD_TASK f
WHERE AD_MENU.ad_task_id = f.ad_task_id)
WHERE ad_task_id IS NOT NULL AND action = 'T';
UPDATE AD_MENU_TRL
SET NAME =
(SELECT ft.NAME
FROM AD_TASK_TRL ft, AD_MENU m
WHERE AD_MENU_TRL.ad_menu_id = m.ad_menu_id
AND m.ad_task_id = ft.ad_task_id
AND AD_MENU_TRL.AD_LANGUAGE = ft.AD_LANGUAGE),
description =
(SELECT ft.description
FROM AD_TASK_TRL ft, AD_MENU m
WHERE AD_MENU_TRL.ad_menu_id = m.ad_menu_id
AND m.ad_task_id = ft.ad_task_id
AND AD_MENU_TRL.AD_LANGUAGE = ft.AD_LANGUAGE),
istranslated =
(SELECT ft.istranslated
FROM AD_TASK_TRL ft, AD_MENU m
WHERE AD_MENU_TRL.ad_menu_id = m.ad_menu_id
AND m.ad_task_id = ft.ad_task_id
AND AD_MENU_TRL.AD_LANGUAGE = ft.AD_LANGUAGE)
WHERE EXISTS (
SELECT 1
FROM AD_TASK_TRL ft, AD_MENU m
WHERE AD_MENU_TRL.ad_menu_id = m.ad_menu_id
AND m.ad_task_id = ft.ad_task_id
AND AD_MENU_TRL.AD_LANGUAGE = ft.AD_LANGUAGE
AND m.ad_task_id IS NOT NULL
AND action = 'T');
UPDATE AD_COLUMN
SET NAME =
(SELECT e.NAME
FROM AD_ELEMENT e
WHERE AD_COLUMN.ad_element_id = e.ad_element_id),
description =
(SELECT e.description
FROM AD_ELEMENT e
WHERE AD_COLUMN.ad_element_id = e.ad_element_id),
HELP =
(SELECT e.HELP
FROM AD_ELEMENT e
WHERE AD_COLUMN.ad_element_id = e.ad_element_id)
WHERE EXISTS (SELECT 1
FROM AD_ELEMENT e
WHERE AD_COLUMN.ad_element_id = e.ad_element_id AND AD_COLUMN.NAME <> e.NAME);
UPDATE AD_COLUMN_TRL
SET NAME =
(SELECT e.NAME
FROM AD_COLUMN c INNER JOIN AD_ELEMENT_TRL e
ON (c.ad_element_id = e.ad_element_id)
WHERE AD_COLUMN_TRL.ad_column_id = c.ad_column_id
AND AD_COLUMN_TRL.AD_LANGUAGE = e.AD_LANGUAGE)
WHERE EXISTS (
SELECT 1
FROM AD_COLUMN c INNER JOIN AD_ELEMENT_TRL e
ON (c.ad_element_id = e.ad_element_id)
WHERE AD_COLUMN_TRL.ad_column_id = c.ad_column_id
AND AD_COLUMN_TRL.AD_LANGUAGE = e.AD_LANGUAGE
AND AD_COLUMN_TRL.NAME <> e.NAME);
UPDATE AD_TABLE
SET NAME =
(SELECT e.NAME
FROM AD_ELEMENT e
WHERE AD_TABLE.tablename || '_ID' = e.columnname),
description =
(SELECT e.description
FROM AD_ELEMENT e
WHERE AD_TABLE.tablename || '_ID' = e.columnname)
WHERE EXISTS (SELECT 1
FROM AD_ELEMENT e
WHERE AD_TABLE.tablename || '_ID' = e.columnname AND AD_TABLE.NAME <> e.NAME);
UPDATE AD_TABLE_TRL
SET NAME =
(SELECT e.NAME
FROM AD_TABLE t INNER JOIN AD_ELEMENT ex
ON (t.tablename || '_ID' = ex.columnname)
INNER JOIN AD_ELEMENT_TRL e
ON (ex.ad_element_id = e.ad_element_id)
WHERE AD_TABLE_TRL.ad_table_id = t.ad_table_id
AND AD_TABLE_TRL.AD_LANGUAGE = e.AD_LANGUAGE)
WHERE EXISTS (
SELECT 1
FROM AD_TABLE t INNER JOIN AD_ELEMENT ex
ON (t.tablename || '_ID' = ex.columnname)
INNER JOIN AD_ELEMENT_TRL e
ON (ex.ad_element_id = e.ad_element_id)
WHERE AD_TABLE_TRL.ad_table_id = t.ad_table_id
AND AD_TABLE_TRL.AD_LANGUAGE = e.AD_LANGUAGE
AND AD_TABLE_TRL.NAME <> e.NAME);
UPDATE AD_TABLE
SET NAME =
(SELECT e.NAME || ' Trl'
FROM AD_ELEMENT e
WHERE SUBSTR (AD_TABLE.tablename, 1, LENGTH (AD_TABLE.tablename) - 4) || '_ID' =
e.columnname),
description =
(SELECT e.description
FROM AD_ELEMENT e
WHERE SUBSTR (AD_TABLE.tablename, 1, LENGTH (AD_TABLE.tablename) - 4) || '_ID' =
e.columnname)
WHERE tablename LIKE '%_Trl'
AND EXISTS (
SELECT 1
FROM AD_ELEMENT e
WHERE SUBSTR (AD_TABLE.tablename, 1, LENGTH (AD_TABLE.tablename) - 4) || '_ID' =
e.columnname
AND AD_TABLE.NAME <> e.NAME);
UPDATE AD_TABLE_TRL
SET NAME =
(SELECT e.NAME || ' **'
FROM AD_TABLE t INNER JOIN AD_ELEMENT ex
ON (SUBSTR (t.tablename, 1, LENGTH (t.tablename) - 4)
|| '_ID' = ex.columnname
)
INNER JOIN AD_ELEMENT_TRL e
ON (ex.ad_element_id = e.ad_element_id)
WHERE AD_TABLE_TRL.ad_table_id = t.ad_table_id
AND AD_TABLE_TRL.AD_LANGUAGE = e.AD_LANGUAGE)
WHERE EXISTS (
SELECT 1
FROM AD_TABLE t INNER JOIN AD_ELEMENT ex
ON (SUBSTR (t.tablename, 1, LENGTH (t.tablename) - 4)
|| '_ID' = ex.columnname
)
INNER JOIN AD_ELEMENT_TRL e
ON (ex.ad_element_id = e.ad_element_id)
WHERE AD_TABLE_TRL.ad_table_id = t.ad_table_id
AND AD_TABLE_TRL.AD_LANGUAGE = e.AD_LANGUAGE
AND t.tablename LIKE '%_Trl'
AND AD_TABLE_TRL.NAME <> e.NAME);
COMMIT ; | the_stack |
-----------------------------------------------------------------------
-- Oracle Machine Learning for SQL (OML4SQL) 19c
--
-- Clustering - Expectation-Maximization Algorithm - dmemdemo.sql
--
-- Copyright (c) 2020 Oracle Corporation and/or its affilitiates.
--
-- The Universal Permissive License (UPL), Version 1.0
--
-- https://oss.oracle.com/licenses/upl/
-----------------------------------------------------------------------
SET serveroutput ON
SET trimspool ON
SET pages 10000
SET linesize 140
SET echo ON
-----------------------------------------------------------------------
-- SAMPLE PROBLEM
-----------------------------------------------------------------------
-- Segment the demographic data into 10 clusters and study the individual
-- clusters.
-----------------------------------------------------------------------
-- SET UP AND ANALYZE THE DATA
-----------------------------------------------------------------------
-- The data for this sample is composed from base tables in SH Schema
-- (See Sample Schema Documentation) and presented through these views:
-- mining_data_build_parallel_v (build data)
-- mining_data_test_parallel_v (test data)
-- mining_data_apply_parallel_v (apply data)
-- (See dmsh.sql for view definitions).
--
-----------
-- ANALYSIS
-----------
-- For clustering using EM, perform the following on mining data.
--
-- 1. Use Data Auto Preparation
--
-----------------------------------------------------------------------
-- BUILD THE MODEL
-----------------------------------------------------------------------
-- Cleanup old model with same name for repeat runs
BEGIN DBMS_DATA_MINING.DROP_MODEL('EM_SH_Clus_sample');
EXCEPTION WHEN OTHERS THEN NULL; END;
/
-------------------
-- SPECIFY SETTINGS
--
-- Cleanup old settings table for repeat runs
BEGIN EXECUTE IMMEDIATE 'DROP TABLE em_sh_sample_settings';
EXCEPTION WHEN OTHERS THEN NULL; END;
/
-- K-Means is the default Clustering algorithm. For this sample,
-- we skip specification of any overrides to defaults
--
-- Uncomment the appropriate sections of the code below for
-- changing settings values.
--
set echo on
CREATE TABLE em_sh_sample_settings (
setting_name VARCHAR2(30),
setting_value VARCHAR2(4000));
BEGIN
INSERT INTO em_sh_sample_settings (setting_name, setting_value) VALUES
(dbms_data_mining.algo_name, dbms_data_mining.algo_expectation_maximization);
INSERT INTO em_sh_sample_settings (setting_name, setting_value) VALUES
(dbms_data_mining.prep_auto,dbms_data_mining.prep_auto_on);
-- Other examples of overrides are:
-- (dbms_data_mining.emcs_num_components,15);
-- (dbms_data_mining.clus_num_clusters,5);
-- (dbms_data_mining.emcs_cluster_comp_enable,
-- dbms_data_mining.emcs_cluster_comp_disable);
-- (dbms_data_mining.emcs_attribute_filter,
-- dbms_data_mining.emcs_attr_filter_disable);
-- (dbms_data_mining.emcs_linkage_function,
-- dbms_data_mining.emcs_linkage_average);
-- (dbms_data_mining.emcs_num_iterations,200);
-- (dbms_data_mining.emcs_loglike_improvement,1e-10);
END;
/
---------------------
-- CREATE A NEW MODEL
--
BEGIN
DBMS_DATA_MINING.CREATE_MODEL(
model_name => 'EM_SH_Clus_sample',
mining_function => dbms_data_mining.clustering,
data_table_name => 'mining_data_build_parallel_v',
case_id_column_name => 'cust_id',
settings_table_name => 'em_sh_sample_settings');
END;
/
-------------------------
-- DISPLAY MODEL SETTINGS
--
column setting_name format a30
column setting_value format a30
SELECT setting_name, setting_value
FROM user_mining_model_settings
WHERE model_name = 'EM_SH_CLUS_SAMPLE'
ORDER BY setting_name;
--------------------------
-- DISPLAY MODEL SIGNATURE
--
column attribute_name format a40
column attribute_type format a20
SELECT attribute_name, attribute_type
FROM user_mining_model_attributes
WHERE model_name = 'EM_SH_CLUS_SAMPLE'
ORDER BY attribute_name;
-------------------------
-- DISPLAY MODEL METADATA
--
column mining_function format a20
column algorithm format a30
SELECT mining_function, algorithm
FROM user_mining_models
WHERE model_name = 'EM_SH_CLUS_SAMPLE';
------------------------
-- DISPLAY MODEL DETAILS
--
-- Get a list of model views
col view_name format a30
col view_type format a50
SELECT view_name, view_type FROM user_mining_model_views
WHERE model_name='EM_SH_CLUS_SAMPLE'
ORDER BY view_name;
-- Attribute importance
-- 2D attributes are ranked based on their interactions with other attributes.
-- The ranking is based on the scaled pairwise Kullback-Leibler divergence.
col attribute_name format a25
col attribute_name_1 format a25
col attribute_name_2 format a25
col attribute_importance_value format 999.9999
col dependency format 999.9999
SELECT attribute_name, attribute_importance_value, attribute_rank
FROM DM$VIEM_SH_CLUS_sample ORDER BY attribute_rank;
SELECT * FROM (
SELECT attribute_name_1, attribute_name_2, dependency
FROM DM$VBEM_SH_CLUS_sample
WHERE attribute_name_1 < attribute_name_2 ORDER BY dependency desc)
WHERE ROWNUM < 11;
-- Cluster details are best seen in pieces - based on the kind of
-- associations and groupings that are needed to be observed.
--
-- CLUSTERS
-- For each cluster_id, provides the number of records in the cluster,
-- the parent cluster id, the level in the hierarchy, and dispersion -
-- which is a measure of the quality of the cluster, and computationally,
-- the sum of square errors.
--
SELECT cluster_id clu_id, record_count rec_cnt, parent, tree_level
FROM DM$VDEM_SH_CLUS_SAMPLE
ORDER BY cluster_id;
-- TAXONOMY
--
SELECT cluster_id, left_child_id, right_child_id
FROM DM$VDEM_SH_CLUS_SAMPLE
ORDER BY cluster_id;
-- CENTROIDS FOR LEAF CLUSTERS
-- For cluster_id 17, this output lists all the attributes that
-- constitute the centroid, with the mean (for numericals) or
-- mode (for categoricals), along with the variance from mean
--
column attribute_name format a20
column attribute_subname format a20
column mean format 9999999.999
column variance format 9999999.999
column lower_bin_boundary format 9999999.999
column upper_bin_boundary format 9999999.999
column attribute_value format a20
column mode_value format a20
SELECT cluster_id, attribute_name, attribute_subname, mean, variance,
mode_value
FROM DM$VAEM_SH_CLUS_SAMPLE
WHERE cluster_id = 17
ORDER BY attribute_name, attribute_subname;
-- HISTOGRAM FOR ATTRIBUTE OF A LEAF CLUSTER
-- For cluster 17, provide the histogram for the AGE attribute.
--
SELECT cluster_id, attribute_name, attribute_subname,
bin_id, lower_bin_boundary, upper_bin_boundary, attribute_value, count
FROM DM$VHEM_SH_CLUS_SAMPLE
WHERE cluster_id = 17 AND attribute_name = 'AGE'
ORDER BY bin_id;
-- RULES FOR LEAF CLUSTERS
-- A rule_id corresponds to the associated cluster_id. The support
-- indicates the number of records (say M) that satisfies this rule.
-- This is an upper bound on the number of records that fall within
-- the bounding box defined by the rule. Each predicate in the rule
-- antecedent defines a range for an attribute, and it can be
-- interpreted as the side of a bounding box which envelops most of
-- the data in the cluster.
-- Confidence = M/N, where N is the number of records in the cluster
-- and M is the rule support defined as above.
--
column numeric_value format 999999.999
column confidence format 999999.999
column rule_confidence format 999999.999
column support format 9999
column rule_support format 9999
column operator format a2
SELECT distinct cluster_id, rule_support, rule_confidence
FROM DM$VREM_SH_CLUS_SAMPLE ORDER BY cluster_id;
-- RULE DETAILS FOR LEAF CLUSTERS
-- Attribute level details of each rule/cluster id.
-- For an attribute, support (say M) indicates the number of records that
-- fall in the attribute range specified in the rule antecedent where the
-- given attribute is not null. Confidence is a number between 0 and 1
-- that indicates how relevant this attribute is in distinguishing the
-- the records in the cluster from all the records in the whole data. The
-- larger the number, more relevant the attribute.
--
-- The query shown below reverse-transforms the data to its original
-- values, since build data was normalized.
--
SELECT cluster_id, attribute_name, attribute_subname, operator,
numeric_value, attribute_value, support, confidence
FROM DM$VREM_SH_CLUS_SAMPLE
WHERE cluster_id < 3
ORDER BY cluster_id, attribute_name, attribute_subname, operator,
numeric_value, attribute_value;
-- Global EM model statistics
-- This view shows high-level model statistics, including
-- number of components, number of clusters, and log likelihood value
column numeric_value format 9999999.999
column string_value format a20
select name, numeric_value, string_value from DM$VGEM_SH_CLUS_SAMPLE
ORDER BY name;
-- EM component details
-- Component priors and mapping to leaf clusters view
col prior_probability format 9.999
select component_id, cluster_id, prior_probability
from DM$VOEM_SH_CLUS_SAMPLE
ORDER BY component_id;
-- Means and variances for attributes modeled with Gaussian distributions
column attribute_name format a25
select component_id, attribute_name, mean, variance
from DM$VMEM_SH_CLUS_sample
WHERE component_id = 11
ORDER BY attribute_name;
-- Frequences for attributes modeled with multivalued Bernoulli
-- distributions
column attribute_value format a15
column frequency format 9999999.999
select component_id, attribute_name, attribute_value, frequency
from DM$VFEM_SH_CLUS_SAMPLE
WHERE component_id=11
ORDER BY attribute_name, attribute_value;
-----------------------------------------------------------------------
-- TEST THE MODEL
-----------------------------------------------------------------------
-- There is no specific set of testing parameters for Clustering.
-- Examination and analysis of clusters is the main method to prove
-- the efficacy of a clustering model.
--
-----------------------------------------------------------------------
-- APPLY THE MODEL
-----------------------------------------------------------------------
-- For a descriptive mining function like Clustering, "Scoring" involves
-- providing the probability values for each cluster.
-------------------------------------------------
-- SCORE NEW DATA USING SQL DATA MINING FUNCTIONS
--
------------------
-- BUSINESS CASE 1
-- List the clusters into which the customers in this
-- given dataset have been grouped.
--
SELECT CLUSTER_ID(em_sh_clus_sample USING *) AS clus, COUNT(*) AS cnt
FROM mining_data_apply_parallel_v
GROUP BY CLUSTER_ID(em_sh_clus_sample USING *)
ORDER BY cnt DESC;
------------------
-- BUSINESS CASE 2
-- List ten most representative (based on likelihood) customers of cluster 7
--
SELECT cust_id
FROM (SELECT cust_id, rank() over (order by prob desc, cust_id) rnk_clus2
FROM (SELECT cust_id,
round(CLUSTER_PROBABILITY(em_sh_clus_sample, 7 USING *),3) prob
FROM mining_data_apply_parallel_v))
WHERE rnk_clus2 <= 10
order by rnk_clus2;
------------------
-- BUSINESS CASE 3
-- List the five most relevant attributes for likely cluster assignments
-- for customer id 100955 (> 20% likelihood of assignment).
--
column prob format 9.9999
set long 10000
SELECT S.cluster_id, probability prob,
CLUSTER_DETAILS(em_sh_clus_sample, S.cluster_id, 5 using T.*) det
FROM
(SELECT v.*, CLUSTER_SET(em_sh_clus_sample, NULL, 0.2 USING *) pset
FROM mining_data_apply_parallel_v v
WHERE cust_id = 100955) T,
TABLE(T.pset) S
order by 2 desc; | the_stack |
-----
-- 21.08.2015 10:42
-- URL zum Konzept
UPDATE AD_Process SET Value='C_Order_OrderCheckup_Summary',Updated=TO_TIMESTAMP('2015-08-21 10:42:50','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_ID=540457
;
-- 21.08.2015 10:43
-- URL zum Konzept
UPDATE AD_Process SET Value='C_BPartner_OrderCheckup_Summary',Updated=TO_TIMESTAMP('2015-08-21 10:43:14','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_ID=540532
;
-- 21.08.2015 10:43
-- URL zum Konzept
UPDATE AD_Process SET Value='C_BPartner_OrderCheckup_Summary_Jasper',Updated=TO_TIMESTAMP('2015-08-21 10:43:21','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_ID=540532
;
-- 21.08.2015 10:43
-- URL zum Konzept
UPDATE AD_Process SET Value='C_Order_OrderCheckup_Summary_Jasper',Updated=TO_TIMESTAMP('2015-08-21 10:43:37','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_ID=540457
;
-- 21.08.2015 10:47
-- URL zum Konzept
UPDATE AD_Process SET Value='C_Order_OrderCheckup_Warehouse_Jasper',Updated=TO_TIMESTAMP('2015-08-21 10:47:29','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_ID=540601
;
----
--
-- creating a legacy/fallback report to preserve the old behavior
--
-- 24.08.2015 09:26
-- URL zum Konzept
INSERT INTO AD_Process (AccessLevel,AD_Client_ID,AD_Org_ID,AD_Process_ID,Classname,CopyFromProcess,Created,CreatedBy,Description,EntityType,IsActive,IsBetaFunctionality,IsDirectPrint,IsOneInstanceOnly,IsReport,IsServerProcess,JasperReport,LockWaitTimeout,Name,RefreshAllAfterExecution,ShowHelp,Statistic_Count,Statistic_Seconds,Type,Updated,UpdatedBy,Value) VALUES ('3',0,0,540602,'org.compiere.report.ReportStarter','N',TO_TIMESTAMP('2015-08-24 09:26:50','YYYY-MM-DD HH24:MI:SS'),100,'Druckt den Zusatz zur Auftragsbestätigung, ohne das betreffende Druckstück einer bestimmten Person zuzuordnen. Dadurch wird das Druckstück letztlich der Person zugeordnet, die diesen Prozess ausführt.','de.metas.fresh','Y','N','N','N','Y','N','@PREFIX@de/metas/docs/sales/ordercheckup/report.jasper',0,'Bestellkontrolle Drucken','N','Y',0,0,'Java',TO_TIMESTAMP('2015-08-24 09:26:50','YYYY-MM-DD HH24:MI:SS'),100,'C_Order_OrderCheckup_Jasper_NoRouting')
;
-- 24.08.2015 09:26
-- URL zum Konzept
INSERT INTO AD_Process_Trl (AD_Language,AD_Process_ID, Description,Help,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Process_ID, t.Description,t.Help,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Process t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Process_ID=540602 AND NOT EXISTS (SELECT * FROM AD_Process_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Process_ID=t.AD_Process_ID)
;
--------
-- 24.08.2015 10:00
-- URL zum Konzept
INSERT INTO AD_SysConfig (AD_Client_ID,AD_Org_ID,AD_SysConfig_ID,ConfigurationLevel,Created,CreatedBy,Description,EntityType,IsActive,Name,Updated,UpdatedBy,Value) VALUES (0,0,540871,'S',TO_TIMESTAMP('2015-08-24 10:00:23','YYYY-MM-DD HH24:MI:SS'),100,'If set to Y then for a completed sales order there will be a process available to create order checkup reports for the persons that are in charge of producing the products from the order lines (task 09028).','de.metas.fresh','Y','de.metas.fresh.ordercheckup.CreateAndRouteJasperReports.EnableProcessGear',TO_TIMESTAMP('2015-08-24 10:00:23','YYYY-MM-DD HH24:MI:SS'),100,'N')
;
-- 24.08.2015 10:01
-- URL zum Konzept
INSERT INTO AD_SysConfig (AD_Client_ID,AD_Org_ID,AD_SysConfig_ID,ConfigurationLevel,Created,CreatedBy,Description,EntityType,IsActive,Name,Updated,UpdatedBy,Value) VALUES (0,0,540872,'S',TO_TIMESTAMP('2015-08-24 10:01:03','YYYY-MM-DD HH24:MI:SS'),100,'If set to Y and a sales order is completed, then the system will create order checkup reports for the persons that are in charge of producing the products from the order lines (task 09028).','de.metas.fresh','Y','de.metas.fresh.ordercheckup.CreateAndRouteJasperReports.OnSalesOrderComplete',TO_TIMESTAMP('2015-08-24 10:01:03','YYYY-MM-DD HH24:MI:SS'),100,'N')
;
-- 24.08.2015 10:12
-- URL zum Konzept
INSERT INTO AD_Process (AccessLevel,AD_Client_ID,AD_Org_ID,AD_Process_ID,Classname,CopyFromProcess,Created,CreatedBy,EntityType,IsActive,IsBetaFunctionality,IsDirectPrint,IsOneInstanceOnly,IsReport,IsServerProcess,LockWaitTimeout,Name,RefreshAllAfterExecution,ShowHelp,Statistic_Count,Statistic_Seconds,Type,Updated,UpdatedBy,Value) VALUES ('3',0,0,540603,'de.metas.fresh.ordercheckup.process.C_Order_OrderCheckup_CreateJasperReports','N',TO_TIMESTAMP('2015-08-24 10:12:55','YYYY-MM-DD HH24:MI:SS'),100,'de.metas.fresh','Y','N','N','N','N','N',0,'Bestellkontrollen für Produktionsverantworktliche erstellen','N','Y',0,0,'Java',TO_TIMESTAMP('2015-08-24 10:12:55','YYYY-MM-DD HH24:MI:SS'),100,'C_Order_OrderCheckup_CreateJasperReports')
;
-- 24.08.2015 10:12
-- URL zum Konzept
INSERT INTO AD_Process_Trl (AD_Language,AD_Process_ID, Description,Help,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Process_ID, t.Description,t.Help,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Process t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Process_ID=540603 AND NOT EXISTS (SELECT * FROM AD_Process_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Process_ID=t.AD_Process_ID)
;
-- 24.08.2015 10:13
-- URL zum Konzept
INSERT INTO AD_Table_Process (AD_Client_ID,AD_Org_ID,AD_Process_ID,AD_Table_ID,Created,CreatedBy,EntityType,IsActive,Updated,UpdatedBy) VALUES (0,0,540603,259,TO_TIMESTAMP('2015-08-24 10:13:06','YYYY-MM-DD HH24:MI:SS'),100,'de.metas.fresh','Y',TO_TIMESTAMP('2015-08-24 10:13:06','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 24.08.2015 10:13
-- URL zum Konzept
UPDATE AD_Process SET Name='Bestellkontrolle für Kunde Drucken',Updated=TO_TIMESTAMP('2015-08-24 10:13:47','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_ID=540532
;
-- 24.08.2015 10:13
-- URL zum Konzept
UPDATE AD_Process_Trl SET IsTranslated='N' WHERE AD_Process_ID=540532
;
-- 24.08.2015 10:13
-- URL zum Konzept
UPDATE AD_Menu SET Description='Druckt den Zusatz zur Auftragsbestätigung', IsActive='Y', Name='Bestellkontrolle für Kunde Drucken',Updated=TO_TIMESTAMP('2015-08-24 10:13:47','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Menu_ID=540583
;
-- 24.08.2015 10:13
-- URL zum Konzept
UPDATE AD_Menu_Trl SET IsTranslated='N' WHERE AD_Menu_ID=540583
;
-- 24.08.2015 10:13
-- URL zum Konzept
UPDATE AD_Process SET Name='Bestellkontrolle zum Kunden Drucken',Updated=TO_TIMESTAMP('2015-08-24 10:13:56','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_ID=540532
;
-- 24.08.2015 10:13
-- URL zum Konzept
UPDATE AD_Process_Trl SET IsTranslated='N' WHERE AD_Process_ID=540532
;
-- 24.08.2015 10:13
-- URL zum Konzept
UPDATE AD_Menu SET Description='Druckt den Zusatz zur Auftragsbestätigung', IsActive='Y', Name='Bestellkontrolle zum Kunden Drucken',Updated=TO_TIMESTAMP('2015-08-24 10:13:56','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Menu_ID=540583
;
-- 24.08.2015 10:13
-- URL zum Konzept
UPDATE AD_Menu_Trl SET IsTranslated='N' WHERE AD_Menu_ID=540583
;
-- 24.08.2015 10:14
-- URL zum Konzept
UPDATE AD_Process SET Name='Bestellkontrolle zum Auftrag Drucken',Updated=TO_TIMESTAMP('2015-08-24 10:14:08','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_ID=540457
;
-- 24.08.2015 10:14
-- URL zum Konzept
UPDATE AD_Process_Trl SET IsTranslated='N' WHERE AD_Process_ID=540457
;
-- 24.08.2015 10:14
-- URL zum Konzept
UPDATE AD_Process SET Name='Bestellkontrolle zu Auftrag und Lager Drucken',Updated=TO_TIMESTAMP('2015-08-24 10:14:21','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_ID=540601
;
-- 24.08.2015 10:14
-- URL zum Konzept
UPDATE AD_Process_Trl SET IsTranslated='N' WHERE AD_Process_ID=540601
;
-- 24.08.2015 10:14
-- URL zum Konzept
UPDATE AD_Menu SET Description=NULL, IsActive='Y', Name='Bestellkontrolle zu Auftrag und Lager Drucken',Updated=TO_TIMESTAMP('2015-08-24 10:14:21','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Menu_ID=540643
;
-- 24.08.2015 10:14
-- URL zum Konzept
UPDATE AD_Menu_Trl SET IsTranslated='N' WHERE AD_Menu_ID=540643
;
-- 24.08.2015 10:14
-- URL zum Konzept
UPDATE AD_Process SET Name='Bestellkontrolle zum Drucken',Updated=TO_TIMESTAMP('2015-08-24 10:14:50','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_ID=540602
;
-- 24.08.2015 10:14
-- URL zum Konzept
UPDATE AD_Process_Trl SET IsTranslated='N' WHERE AD_Process_ID=540602
;
-- 24.08.2015 10:15
-- URL zum Konzept
UPDATE AD_Process SET Name='Bestellkontrolle zum Auftrag eigener Ausdruck',Updated=TO_TIMESTAMP('2015-08-24 10:15:22','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_ID=540602
;
-- 24.08.2015 10:15
-- URL zum Konzept
UPDATE AD_Process_Trl SET IsTranslated='N' WHERE AD_Process_ID=540602
;
-- 24.08.2015 10:16
-- URL zum Konzept
UPDATE AD_Process SET Name='Bestellkontrolle zum Auftrag für Produktionsverantwortliche',Updated=TO_TIMESTAMP('2015-08-24 10:16:05','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_ID=540603
;
-- 24.08.2015 10:16
-- URL zum Konzept
UPDATE AD_Process_Trl SET IsTranslated='N' WHERE AD_Process_ID=540603
;
-- 24.08.2015 10:17
-- URL zum Konzept
UPDATE AD_Process SET Help='This jasper process is not directly accessible, but invoked by C_Order_OrderCheckup_CreateJasperReports (task 09028)',Updated=TO_TIMESTAMP('2015-08-24 10:17:29','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_ID=540457
;
-- 24.08.2015 10:17
-- URL zum Konzept
UPDATE AD_Process_Trl SET IsTranslated='N' WHERE AD_Process_ID=540457
;
-- 24.08.2015 10:17
-- URL zum Konzept
UPDATE AD_Process SET Help='This jasper process is not directly accessible, but invoked by C_Order_OrderCheckup_CreateJasperReports (task 09028)',Updated=TO_TIMESTAMP('2015-08-24 10:17:48','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_ID=540601
;
-- 24.08.2015 10:17
-- URL zum Konzept
UPDATE AD_Process_Trl SET IsTranslated='N' WHERE AD_Process_ID=540601
;
-- 24.08.2015 10:17
-- URL zum Konzept
DELETE FROM AD_Table_Process WHERE AD_Process_ID=540457 AND AD_Table_ID=259
;
-- 24.08.2015 10:18
-- URL zum Konzept
INSERT INTO AD_Table_Process (AD_Client_ID,AD_Org_ID,AD_Process_ID,AD_Table_ID,Created,CreatedBy,EntityType,IsActive,Updated,UpdatedBy) VALUES (0,0,540602,259,TO_TIMESTAMP('2015-08-24 10:18:15','YYYY-MM-DD HH24:MI:SS'),100,'de.metas.fresh','Y',TO_TIMESTAMP('2015-08-24 10:18:15','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 24.08.2015 10:20
-- URL zum Konzept
UPDATE AD_Process SET Description='Erstellt zu den Auftragspositionen Bestellkontroll-Berichte für die jeweiligen Produktionsverantwortlichen', Help='Die Produktionsverantwortlichen werden über Produkt-Plandaten und deren Lager ermittelt.',Updated=TO_TIMESTAMP('2015-08-24 10:20:29','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_ID=540603
;
-- 24.08.2015 10:20
-- URL zum Konzept
UPDATE AD_Process_Trl SET IsTranslated='N' WHERE AD_Process_ID=540603
;
-- 24.08.2015 10:20
-- URL zum Konzept
UPDATE AD_Process SET Description=NULL,Updated=TO_TIMESTAMP('2015-08-24 10:20:53','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_ID=540532
;
-- 24.08.2015 10:20
-- URL zum Konzept
UPDATE AD_Process_Trl SET IsTranslated='N' WHERE AD_Process_ID=540532
;
-- 24.08.2015 10:20
-- URL zum Konzept
UPDATE AD_Menu SET Description=NULL, IsActive='Y', Name='Bestellkontrolle zum Kunden Drucken',Updated=TO_TIMESTAMP('2015-08-24 10:20:53','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Menu_ID=540583
;
-- 24.08.2015 10:20
-- URL zum Konzept
UPDATE AD_Menu_Trl SET IsTranslated='N' WHERE AD_Menu_ID=540583
;
-- 24.08.2015 10:22
-- URL zum Konzept
UPDATE AD_Process SET Help='Die Produktionsverantwortlichen werden über Produkt-Plandaten und deren Lager ermittelt.<p>
Hinweis: Über System-Konfigurator "de.metas.fresh.ordercheckup.CreateAndRouteJasperReports.OnSalesOrderComplete" kann festgelegt werden, dass diese Bestellkontrolle automatisch beim fertigstellen eines Auftrags erstellt werden.',Updated=TO_TIMESTAMP('2015-08-24 10:22:55','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_ID=540603
;
-- 24.08.2015 10:22
-- URL zum Konzept
UPDATE AD_Process_Trl SET IsTranslated='N' WHERE AD_Process_ID=540603
;
-- 24.08.2015 10:23
-- URL zum Konzept
UPDATE AD_SysConfig SET Value='Y',Updated=TO_TIMESTAMP('2015-08-24 10:23:50','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_SysConfig_ID=540872
;
-- 24.08.2015 10:23
-- URL zum Konzept
UPDATE AD_SysConfig SET Value='Y',Updated=TO_TIMESTAMP('2015-08-24 10:23:55','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_SysConfig_ID=540871
; | the_stack |
SET FOREIGN_KEY_CHECKS=0;
-- ----------------------------
-- Table structure for t_action_monitor
-- ----------------------------
DROP TABLE IF EXISTS `t_action_monitor`;
CREATE TABLE `t_action_monitor` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`create_date` datetime DEFAULT NULL,
`modify_date` datetime DEFAULT NULL,
`hazard_level` int(4) DEFAULT NULL,
`ip_address` varchar(50) DEFAULT NULL,
`mac_address` varchar(50) DEFAULT NULL,
`specific_action` varchar(100) DEFAULT NULL,
`target` varchar(100) DEFAULT NULL,
`user_id` bigint(20) DEFAULT NULL,
`effect` varchar(255) DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `FK778cx0a2e229a29anx9i682ar` (`user_id`),
CONSTRAINT `FK778cx0a2e229a29anx9i682ar` FOREIGN KEY (`user_id`) REFERENCES `t_user` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- ----------------------------
-- Records of t_action_monitor
-- ----------------------------
-- ----------------------------
-- Table structure for t_code_record
-- ----------------------------
DROP TABLE IF EXISTS `t_code_record`;
CREATE TABLE `t_code_record` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`user_id` bigint(20) DEFAULT NULL,
`code` varchar(20) DEFAULT NULL,
`type` int(11) DEFAULT NULL,
`create_date` datetime DEFAULT NULL,
`modify_date` datetime DEFAULT NULL,
`expired_date` datetime DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- ----------------------------
-- Records of t_code_record
-- ----------------------------
-- ----------------------------
-- Table structure for t_department
-- ----------------------------
DROP TABLE IF EXISTS `t_department`;
CREATE TABLE `t_department` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`create_date` datetime DEFAULT NULL,
`modify_date` datetime DEFAULT NULL,
`available` bit(1) DEFAULT NULL,
`code` varchar(255) COLLATE utf8_bin DEFAULT NULL,
`descirption` varchar(255) COLLATE utf8_bin DEFAULT NULL,
`name` varchar(255) COLLATE utf8_bin DEFAULT NULL,
`sort` int(11) DEFAULT NULL,
`parent_id` bigint(20) DEFAULT NULL,
`organization_id` bigint(20) DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `FKjoxpd0y26uhuy0j085jvqmlo8` (`parent_id`),
KEY `FK8g0fldrdyf38vx2qsv1vb8o4f` (`organization_id`),
CONSTRAINT `FK8g0fldrdyf38vx2qsv1vb8o4f` FOREIGN KEY (`organization_id`) REFERENCES `t_organization` (`id`),
CONSTRAINT `FKjoxpd0y26uhuy0j085jvqmlo8` FOREIGN KEY (`parent_id`) REFERENCES `t_department` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
-- ----------------------------
-- Records of t_department
-- ----------------------------
INSERT INTO `t_department` VALUES ('1', '2017-05-22 08:12:58', '2017-05-22 08:12:58', '', 'DEPT001', '部门001描述', '部门001', '1', null, '1');
INSERT INTO `t_department` VALUES ('2', '2017-05-22 08:18:26', '2017-05-22 08:18:26', '\0', 'DEPT002', '部门002描述', '部门002', '2', '1', null);
INSERT INTO `t_department` VALUES ('3', '2017-05-23 09:40:08', '2017-05-23 09:40:08', '', 'DEPT003', '部门003描述', '部门003', '3', '1', null);
INSERT INTO `t_department` VALUES ('4', '2017-05-23 09:40:08', '2017-05-23 09:40:08', '\0', 'DEPT004', '部门004描述', '部门004', '4', '3', null);
INSERT INTO `t_department` VALUES ('5', '2017-05-24 13:30:09', '2017-05-24 13:30:09', '', 'DEPT005', '部门005描述', '部门005', '5', null, null);
INSERT INTO `t_department` VALUES ('6', '2017-05-24 16:25:54', '2017-05-24 16:25:54', '', 'DEPT006', '部门006描述', '部门006', '6', null, null);
-- ----------------------------
-- Table structure for t_detail_control
-- ----------------------------
DROP TABLE IF EXISTS `t_detail_control`;
CREATE TABLE `t_detail_control` (
`id` bigint(20) NOT NULL,
`role_id` bigint(20) DEFAULT NULL,
`entity_class` varchar(50) COLLATE utf8_bin DEFAULT NULL,
`unavailable_columns` varchar(200) COLLATE utf8_bin DEFAULT NULL,
`filter_rules` varchar(250) COLLATE utf8_bin DEFAULT NULL,
`priority` smallint(6) DEFAULT NULL,
`enabled` tinyint(4) DEFAULT NULL,
`modify_date` datetime DEFAULT NULL,
`create_date` datetime DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
-- ----------------------------
-- Records of t_detail_control
-- ----------------------------
INSERT INTO `t_detail_control` VALUES ('1', '1', 'com.beamofsoul.springboot.entity.User', 'password,sex,status', null, '1', '1', '2016-12-08 14:47:57', '2016-12-08 14:47:57');
-- ----------------------------
-- Table structure for t_organization
-- ----------------------------
DROP TABLE IF EXISTS `t_organization`;
CREATE TABLE `t_organization` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`create_date` datetime DEFAULT NULL,
`modify_date` datetime DEFAULT NULL,
`available` bit(1) DEFAULT NULL,
`descirption` varchar(255) COLLATE utf8_bin DEFAULT NULL,
`name` varchar(255) COLLATE utf8_bin DEFAULT NULL,
`sort` int(11) DEFAULT NULL,
`parent_id` bigint(20) DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `FKek1x02uw2s7yti5b17khbr418` (`parent_id`),
CONSTRAINT `FKek1x02uw2s7yti5b17khbr418` FOREIGN KEY (`parent_id`) REFERENCES `t_organization` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
-- ----------------------------
-- Records of t_organization
-- ----------------------------
INSERT INTO `t_organization` VALUES ('1', '2017-05-22 15:02:06', '2017-05-22 15:55:23', '', '组织001描述', '组织001', '1', null);
INSERT INTO `t_organization` VALUES ('2', '2017-05-24 08:18:17', '2017-05-24 08:18:17', '', '组织002描述', '组织002', '1', '1');
INSERT INTO `t_organization` VALUES ('3', '2017-05-24 08:18:32', '2017-05-24 08:18:32', '', '组织003描述', '组织003', '1', '2');
INSERT INTO `t_organization` VALUES ('5', '2017-05-25 08:35:15', '2017-05-25 08:35:15', '', '组织004描述', '组织004', '4', '2');
-- ----------------------------
-- Table structure for t_permission
-- ----------------------------
DROP TABLE IF EXISTS `t_permission`;
CREATE TABLE `t_permission` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`name` varchar(255) COLLATE utf8_bin DEFAULT NULL,
`url` varchar(255) COLLATE utf8_bin DEFAULT NULL,
`action` varchar(255) COLLATE utf8_bin DEFAULT NULL,
`group` varchar(50) COLLATE utf8_bin DEFAULT NULL,
`parent_id` bigint(20) DEFAULT NULL,
`resource_type` enum('menu','button') COLLATE utf8_bin DEFAULT NULL,
`sort` bigint(20) DEFAULT NULL,
`available` bit(1) DEFAULT NULL,
`create_date` datetime DEFAULT NULL,
`modify_date` datetime DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=29 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
-- ----------------------------
-- Records of t_permission
-- ----------------------------
INSERT INTO `t_permission` VALUES ('1', '系统列表', 'sys/list', 'sys:list', '系统管理', null, 'menu', '0', '', '2016-12-08 14:47:57', '2017-05-17 13:45:37');
INSERT INTO `t_permission` VALUES ('2', '系统添加', 'sys/add', 'sys:add', '系统管理', '1', 'button', '0', '', '2016-12-08 14:47:57', '2017-02-17 14:41:22');
INSERT INTO `t_permission` VALUES ('3', '系统删除', 'sys/delete', 'sys:delete', '系统管理', '1', 'button', '0', '', '2017-02-07 14:02:15', '2017-02-17 14:41:27');
INSERT INTO `t_permission` VALUES ('4', '系统修改', 'sys/update', 'sys:update', '系统管理', '1', 'button', '0', '', '2017-02-07 14:02:43', '2017-02-17 14:41:31');
INSERT INTO `t_permission` VALUES ('5', '用户列表', 'user/list', 'user:list', '用户管理', '1', 'menu', '1', '', '2016-12-08 14:47:57', '2016-12-08 14:47:57');
INSERT INTO `t_permission` VALUES ('6', '用户添加', 'user/add', 'user:add', '用户管理', '5', 'button', '1', '', '2016-12-08 14:47:57', '2017-02-17 14:41:52');
INSERT INTO `t_permission` VALUES ('7', '用户删除', 'user/delete', 'user:delete', '用户管理', '5', 'button', '1', '', '2016-12-08 14:47:57', '2017-02-17 14:41:56');
INSERT INTO `t_permission` VALUES ('8', '用户修改', 'user/update', 'user:update', '用户管理', '5', 'button', '1', '', '2016-12-08 14:47:57', '2017-02-17 14:41:59');
INSERT INTO `t_permission` VALUES ('9', '角色列表', 'role/list', 'role:list', '角色管理', '1', 'menu', '2', '', '2017-02-07 14:03:42', '2017-02-17 14:42:07');
INSERT INTO `t_permission` VALUES ('10', '角色添加', 'role/add', 'role:add', '角色管理', '9', 'button', '2', '', '2017-02-07 14:04:26', '2017-02-17 15:37:44');
INSERT INTO `t_permission` VALUES ('11', '角色删除', 'role/delete', 'role:delete', '角色管理', '9', 'button', '2', '', '2017-02-07 14:05:18', '2017-02-07 14:05:21');
INSERT INTO `t_permission` VALUES ('12', '角色修改', 'role/update', 'role:update', '角色管理', '9', 'button', '2', '', '2017-02-07 14:05:49', '2017-02-07 14:05:51');
INSERT INTO `t_permission` VALUES ('13', '角色分配', 'role/allot', 'role:allot', '角色管理', '9', 'button', '2', '', '2017-02-24 09:02:26', '2017-03-23 10:44:01');
INSERT INTO `t_permission` VALUES ('14', '角色用户列表', 'role/roleuser', 'role:roleuser', '角色管理', '9', 'menu', '2', '', '2017-02-24 09:05:10', '2017-02-24 09:05:10');
INSERT INTO `t_permission` VALUES ('15', '权限列表', 'permission/list', 'permission:list', '权限管理', '1', 'menu', '3', '', '2017-02-17 14:27:55', '2017-02-17 14:27:55');
INSERT INTO `t_permission` VALUES ('16', '权限增加', 'permission/add', 'permission:add', '权限管理', '15', 'button', '3', '', '2017-02-17 14:42:48', '2017-02-17 14:42:48');
INSERT INTO `t_permission` VALUES ('17', '权限修改', 'permission/update', 'permission:update', '权限管理', '15', 'button', '3', '', '2017-02-17 14:43:33', '2017-02-17 14:43:33');
INSERT INTO `t_permission` VALUES ('18', '权限删除', 'permission/delete', 'permission:delete', '权限管理', '15', 'button', '3', '', '2017-02-17 14:43:59', '2017-02-17 14:43:59');
INSERT INTO `t_permission` VALUES ('19', '角色权限分配', 'role/rolepermission', 'role:rolepermission', '角色管理', '9', 'button', '2', '', '2017-02-24 09:44:38', '2017-02-24 09:44:38');
INSERT INTO `t_permission` VALUES ('25', '系统复制', 'sys/copy', 'sys:copy', '系统管理', '1', 'button', '0', '', '2017-02-27 10:32:42', '2017-02-27 10:32:42');
INSERT INTO `t_permission` VALUES ('26', '用户复制', 'user/copy', 'user:copy', '用户管理', '5', 'button', '1', '', '2017-02-27 10:33:07', '2017-02-27 10:33:07');
INSERT INTO `t_permission` VALUES ('27', '角色复制', 'role/copy', 'role:copy', '角色管理', '9', 'button', '2', '', '2017-02-27 10:33:32', '2017-02-27 10:33:32');
INSERT INTO `t_permission` VALUES ('28', '权限复制', 'permission/copy', 'permission:copy', '权限管理', '15', 'button', '3', '', '2017-02-27 10:33:59', '2017-02-27 10:33:59');
-- ----------------------------
-- Table structure for t_role
-- ----------------------------
DROP TABLE IF EXISTS `t_role`;
CREATE TABLE `t_role` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`name` varchar(255) COLLATE utf8_bin DEFAULT NULL,
`priority` int(11) DEFAULT NULL,
`create_date` datetime DEFAULT NULL,
`modify_date` datetime DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
-- ----------------------------
-- Records of t_role
-- ----------------------------
INSERT INTO `t_role` VALUES ('1', 'admin', '0', '2016-12-08 14:47:57', '2016-12-08 14:47:57');
INSERT INTO `t_role` VALUES ('2', 'manager', '1', '2016-12-08 14:47:57', '2016-12-08 14:47:57');
INSERT INTO `t_role` VALUES ('3', 'normal', '98', '2016-12-08 14:47:57', '2017-03-14 15:31:37');
-- ----------------------------
-- Table structure for t_role_permission
-- ----------------------------
DROP TABLE IF EXISTS `t_role_permission`;
CREATE TABLE `t_role_permission` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`permission_id` bigint(20) DEFAULT NULL,
`role_id` bigint(20) DEFAULT NULL,
`create_date` datetime DEFAULT NULL,
`modify_date` datetime DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `FKjobmrl6dorhlfite4u34hciik` (`permission_id`),
KEY `FK90j038mnbnthgkc17mqnoilu9` (`role_id`),
CONSTRAINT `FK90j038mnbnthgkc17mqnoilu9` FOREIGN KEY (`role_id`) REFERENCES `t_role` (`id`),
CONSTRAINT `FKjobmrl6dorhlfite4u34hciik` FOREIGN KEY (`permission_id`) REFERENCES `t_permission` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=389 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
-- ----------------------------
-- Records of t_role_permission
-- ----------------------------
INSERT INTO `t_role_permission` VALUES ('1', '1', '1', '2017-02-07 14:33:56', '2017-02-07 14:33:56');
INSERT INTO `t_role_permission` VALUES ('2', '2', '1', '2017-02-07 14:33:56', '2017-02-07 14:33:56');
INSERT INTO `t_role_permission` VALUES ('3', '3', '1', '2017-02-07 14:33:56', '2017-02-07 14:33:56');
INSERT INTO `t_role_permission` VALUES ('27', '5', '2', '2017-02-23 10:53:39', '2017-02-23 10:53:39');
INSERT INTO `t_role_permission` VALUES ('31', '9', '2', '2017-02-23 10:53:39', '2017-02-23 10:53:39');
INSERT INTO `t_role_permission` VALUES ('35', '19', '1', '2017-02-27 09:10:59', '2017-02-27 09:11:01');
INSERT INTO `t_role_permission` VALUES ('356', '13', '1', '2017-02-27 09:15:33', '2017-02-27 09:15:33');
INSERT INTO `t_role_permission` VALUES ('357', '14', '1', '2017-02-27 09:15:33', '2017-02-27 09:15:33');
INSERT INTO `t_role_permission` VALUES ('361', '19', '2', '2017-02-27 09:18:05', '2017-02-27 09:18:05');
INSERT INTO `t_role_permission` VALUES ('363', '14', '2', '2017-02-27 09:18:05', '2017-02-27 09:18:05');
INSERT INTO `t_role_permission` VALUES ('364', '15', '2', '2017-02-27 09:18:05', '2017-02-27 09:18:05');
INSERT INTO `t_role_permission` VALUES ('365', '25', '1', '2017-02-27 10:34:41', '2017-02-27 10:34:41');
INSERT INTO `t_role_permission` VALUES ('388', '4', '1', '2017-03-23 15:15:36', '2017-03-23 15:15:36');
-- ----------------------------
-- Table structure for t_user
-- ----------------------------
DROP TABLE IF EXISTS `t_user`;
CREATE TABLE `t_user` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`username` varchar(20) COLLATE utf8_bin DEFAULT NULL,
`password` varchar(20) COLLATE utf8_bin DEFAULT NULL,
`nickname` varchar(20) COLLATE utf8_bin DEFAULT NULL,
`email` varchar(50) COLLATE utf8_bin DEFAULT NULL,
`phone` varchar(20) COLLATE utf8_bin DEFAULT NULL,
`photo` varchar(255) COLLATE utf8_bin DEFAULT NULL,
`status` tinyint(4) DEFAULT NULL,
`create_date` datetime DEFAULT NULL,
`modify_date` datetime DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `UK_pu2s3uanurepbp3159l1ft4xo` (`nickname`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
-- ----------------------------
-- Records of t_user
-- ----------------------------
INSERT INTO `t_user` VALUES ('1', 'tom', '123456', 'Tom', 'tom@sina.com', '', 'tom.jpeg', '1', '2016-12-08 14:47:57', '2017-05-03 08:33:56');
INSERT INTO `t_user` VALUES ('2', 'jack', '123456', 'Jack', 'jack@163.com', '', '', '1', '2016-12-08 14:47:57', '2017-05-03 09:24:36');
INSERT INTO `t_user` VALUES ('3', 'rose', '1234561', 'Rose', 'rose@gmail.com', '', '', '1', '2016-12-08 14:47:57', '2017-05-03 09:24:54');
-- ----------------------------
-- Table structure for t_user_role
-- ----------------------------
DROP TABLE IF EXISTS `t_user_role`;
CREATE TABLE `t_user_role` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`role_id` bigint(20) DEFAULT NULL,
`user_id` bigint(20) DEFAULT NULL,
`create_date` datetime DEFAULT NULL,
`modify_date` datetime DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `FKa9c8iiy6ut0gnx491fqx4pxam` (`role_id`),
KEY `FKq5un6x7ecoef5w1n39cop66kl` (`user_id`),
CONSTRAINT `FKa9c8iiy6ut0gnx491fqx4pxam` FOREIGN KEY (`role_id`) REFERENCES `t_role` (`id`),
CONSTRAINT `FKq5un6x7ecoef5w1n39cop66kl` FOREIGN KEY (`user_id`) REFERENCES `t_user` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
-- ----------------------------
-- Records of t_user_role
-- ----------------------------
INSERT INTO `t_user_role` VALUES ('1', '1', '1', '2016-12-08 14:47:57', '2016-12-08 14:47:57');
INSERT INTO `t_user_role` VALUES ('2', '3', '2', '2017-01-17 10:19:41', '2017-01-17 10:19:44');
INSERT INTO `t_user_role` VALUES ('3', '2', '3', '2016-12-08 14:47:57', '2016-12-08 14:47:57');
-- ----------------------------
-- View structure for v_user_role_combine_role
-- ----------------------------
DROP VIEW IF EXISTS `v_user_role_combine_role`;
CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v_user_role_combine_role` AS select ifnull(group_concat(`tur`.`id` order by `tur`.`id` ASC separator ','),rand()) AS `id`,`tu`.`id` AS `user_id`,`tu`.`username` AS `username`,`tu`.`nickname` AS `nickname`,ifnull(group_concat(`tur`.`role_id` order by `tur`.`role_id` ASC separator ','),0) AS `role_id`,ifnull(group_concat(`tr`.`name` order by `tr`.`name` ASC separator ','),'') AS `role_name` from ((`t_user` `tu` left join `t_user_role` `tur` on((`tur`.`user_id` = `tu`.`id`))) left join `t_role` `tr` on((`tr`.`id` = `tur`.`role_id`))) group by `tu`.`id` ;
-- ----------------------------
-- Procedure structure for proc_getChildren
-- ----------------------------
DROP PROCEDURE IF EXISTS `proc_getChildren`;
DELIMITER ;;
CREATE DEFINER=`root`@`%` PROCEDURE `proc_getChildren`(IN parentId BIGINT,
OUT children VARCHAR(1000))
BEGIN
DECLARE temp VARCHAR(1000);
SET children = '$';
SET temp = cast(parentId as CHAR);
WHILE temp is not null DO
SET children = concat(children, ',', temp);
SELECT group_concat(tc.id) INTO temp FROM t_column AS tc where FIND_IN_SET(tc.parent_id, temp) > 0;
END WHILE;
SET children = SUBSTRING(children FROM 3 FOR LENGTH(children));
END
;;
DELIMITER ;
-- ----------------------------
-- Function structure for getChildren
-- ----------------------------
DROP FUNCTION IF EXISTS `getChildren`;
DELIMITER ;;
CREATE DEFINER=`root`@`%` FUNCTION `getChildren`(`parentId` bigint) RETURNS varchar(1000) CHARSET utf8
READS SQL DATA
BEGIN
DECLARE sTemp VARCHAR(1000);
DECLARE sTempChd VARCHAR(1000);
SET sTemp = '$';
SET sTempChd =cast(parentId as CHAR);
WHILE sTempChd is not null DO
SET sTemp = concat(sTemp,',',sTempChd);
SELECT group_concat(tc.id) INTO sTempChd FROM t_column AS tc where FIND_IN_SET(tc.parent_id, sTempChd) > 0;
END WHILE;
SET sTemp = SUBSTRING(sTemp FROM 3 FOR LENGTH(sTemp));
RETURN sTemp;
END
;;
DELIMITER ; | the_stack |
-- ===================================================================
-- create FDW objects
-- ===================================================================
--Testcase 483:
CREATE EXTENSION duckdb_fdw;
DO $d$
BEGIN
EXECUTE $$CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER duckdb_fdw
OPTIONS (database '/tmp/sqlitefdw_test_post.db')$$;
EXECUTE $$CREATE SERVER sqlite_svr2 FOREIGN DATA WRAPPER duckdb_fdw
OPTIONS (database '/tmp/sqlitefdw_test_post.db')$$;
END;
$d$;
--Testcase 484:
CREATE USER MAPPING FOR CURRENT_USER SERVER sqlite_svr;
--Testcase 485:
CREATE USER MAPPING FOR CURRENT_USER SERVER sqlite_svr2;
-- ===================================================================
-- create objects used through FDW sqlite server
-- ===================================================================
--Testcase 486:
CREATE SCHEMA "S 1";
IMPORT FOREIGN SCHEMA public FROM SERVER sqlite_svr INTO "S 1";
--Testcase 1:
INSERT INTO "S 1"."T 1"
SELECT id,
id % 10,
to_char(id, 'FM00000'),
'1970-01-01'::timestamptz + ((id % 100) || ' days')::interval,
'1970-01-01'::timestamp + ((id % 100) || ' days')::interval,
id % 10,
id % 10,
'foo'
FROM generate_series(1, 1000) id;
--Testcase 2:
INSERT INTO "S 1"."T 2"
SELECT id,
'AAA' || to_char(id, 'FM000')
FROM generate_series(1, 100) id;
--Testcase 3:
INSERT INTO "S 1"."T 3"
SELECT id,
id + 1,
'AAA' || to_char(id, 'FM000')
FROM generate_series(1, 100) id;
--Testcase 487:
DELETE FROM "S 1"."T 3" WHERE c1 % 2 != 0; -- delete for outer join tests
--Testcase 4:
INSERT INTO "S 1"."T 4"
SELECT id,
id + 1,
'AAA' || to_char(id, 'FM000')
FROM generate_series(1, 100) id;
--Testcase 488:
DELETE FROM "S 1"."T 4" WHERE c1 % 3 != 0; -- delete for outer join tests
/*ANALYZE "S 1"."T 1";
ANALYZE "S 1"."T 2";
ANALYZE "S 1"."T 3";
ANALYZE "S 1"."T 4";*/
-- ===================================================================
-- create foreign tables
-- ===================================================================
--Testcase 489:
CREATE FOREIGN TABLE ft1 (
c0 int,
c1 int OPTIONS (key 'true'),
c2 int NOT NULL,
c3 text,
c4 timestamptz,
c5 timestamp,
c6 varchar(10),
c7 char(10) default 'ft1',
c8 text
) SERVER sqlite_svr;
ALTER FOREIGN TABLE ft1 DROP COLUMN c0;
--Testcase 490:
CREATE FOREIGN TABLE ft2 (
c1 int OPTIONS (key 'true'),
c2 int NOT NULL,
cx int,
c3 text,
c4 timestamptz,
c5 timestamp,
c6 varchar(10),
c7 char(10) default 'ft2',
c8 text
) SERVER sqlite_svr;
ALTER FOREIGN TABLE ft2 DROP COLUMN cx;
--Testcase 491:
CREATE FOREIGN TABLE ft4 (
c1 int NOT NULL,
c2 int NOT NULL,
c3 text
) SERVER sqlite_svr OPTIONS (table 'T 3');
--Testcase 492:
CREATE FOREIGN TABLE ft5 (
c1 int OPTIONS (key 'true'),
c2 int NOT NULL,
c3 text
) SERVER sqlite_svr OPTIONS (table 'T 4');
--Testcase 493:
CREATE FOREIGN TABLE ft6 (
c1 int NOT NULL,
c2 int NOT NULL,
c3 text
) SERVER sqlite_svr2 OPTIONS (table 'T 4');
ALTER FOREIGN TABLE ft1 OPTIONS (table 'T 1');
ALTER FOREIGN TABLE ft2 OPTIONS (table 'T 1');
ALTER FOREIGN TABLE ft1 ALTER COLUMN c1 OPTIONS (column_name 'C 1');
ALTER FOREIGN TABLE ft2 ALTER COLUMN c1 OPTIONS (column_name 'C 1');
--Testcase 5:
\det+
-- Test that alteration of server options causes reconnection
-- Remote's errors might be non-English, so hide them to ensure stable results
\set VERBOSITY terse
--Testcase 6:
SELECT c3, c4 FROM ft1 ORDER BY c3, c1 LIMIT 1; -- should work
ALTER SERVER sqlite_svr OPTIONS (SET database 'no such database');
--Testcase 7:
SELECT c3, c4 FROM ft1 ORDER BY c3, c1 LIMIT 1; -- should fail
DO $d$
BEGIN
EXECUTE $$ALTER SERVER sqlite_svr
OPTIONS (SET database '/tmp/sqlitefdw_test_post.db')$$;
END;
$d$;
--Testcase 8:
SELECT c3, c4 FROM ft1 ORDER BY c3, c1 LIMIT 1; -- should work again
\set VERBOSITY default
-- Now we should be able to run ANALYZE.
-- To exercise multiple code paths, we use local stats on ft1
-- and remote-estimate mode on ft2.
--ANALYZE ft1;
--ALTER FOREIGN TABLE ft2 OPTIONS (use_remote_estimate 'true');
-- ===================================================================
-- simple queries
-- ===================================================================
-- single table without alias
--Testcase 9:
EXPLAIN (COSTS OFF) SELECT * FROM ft1 ORDER BY c3, c1 OFFSET 100 LIMIT 10;
--Testcase 10:
SELECT * FROM ft1 ORDER BY c3, c1 OFFSET 100 LIMIT 10;
-- single table with alias - also test that tableoid sort is not pushed to remote side
--Testcase 11:
EXPLAIN (VERBOSE, COSTS OFF) SELECT * FROM ft1 t1 ORDER BY t1.c3, t1.c1, t1.tableoid OFFSET 100 LIMIT 10;
--Testcase 12:
SELECT * FROM ft1 t1 ORDER BY t1.c3, t1.c1, t1.tableoid OFFSET 100 LIMIT 10;
-- whole-row reference
--Testcase 13:
EXPLAIN (VERBOSE, COSTS OFF) SELECT t1 FROM ft1 t1 ORDER BY t1.c3, t1.c1 OFFSET 100 LIMIT 10;
--Testcase 14:
SELECT t1 FROM ft1 t1 ORDER BY t1.c3, t1.c1 OFFSET 100 LIMIT 10;
-- empty result
--Testcase 15:
SELECT * FROM ft1 WHERE false;
-- with WHERE clause
--Testcase 16:
EXPLAIN (VERBOSE, COSTS OFF) SELECT * FROM ft1 t1 WHERE t1.c1 = 101 AND t1.c6 = '1' AND t1.c7 >= '1';
--Testcase 17:
SELECT * FROM ft1 t1 WHERE t1.c1 = 101 AND t1.c6 = '1' AND t1.c7 >= '1';
-- with FOR UPDATE/SHARE
--Testcase 18:
EXPLAIN (VERBOSE, COSTS OFF) SELECT * FROM ft1 t1 WHERE c1 = 101 FOR UPDATE;
--Testcase 19:
SELECT * FROM ft1 t1 WHERE c1 = 101 FOR UPDATE;
--Testcase 20:
EXPLAIN (VERBOSE, COSTS OFF) SELECT * FROM ft1 t1 WHERE c1 = 102 FOR SHARE;
--Testcase 21:
SELECT * FROM ft1 t1 WHERE c1 = 102 FOR SHARE;
-- aggregate
--Testcase 22:
SELECT COUNT(*) FROM ft1 t1;
-- subquery
--Testcase 23:
SELECT * FROM ft1 t1 WHERE t1.c3 IN (SELECT c3 FROM ft2 t2 WHERE c1 <= 10) ORDER BY c1;
-- subquery+MAX
--Testcase 24:
SELECT * FROM ft1 t1 WHERE t1.c3 = (SELECT MAX(c3) FROM ft2 t2) ORDER BY c1;
-- used in CTE
--Testcase 25:
WITH t1 AS (SELECT * FROM ft1 WHERE c1 <= 10) SELECT t2.c1, t2.c2, t2.c3, t2.c4 FROM t1, ft2 t2 WHERE t1.c1 = t2.c1 ORDER BY t1.c1;
-- fixed values
--Testcase 26:
SELECT 'fixed', NULL FROM ft1 t1 WHERE c1 = 1;
-- Test forcing the remote server to produce sorted data for a merge join.
SET enable_hashjoin TO false;
SET enable_nestloop TO false;
-- inner join; expressions in the clauses appear in the equivalence class list
--Testcase 27:
EXPLAIN (VERBOSE, COSTS OFF)
SELECT t1.c1, t2."C 1" FROM ft2 t1 JOIN "S 1"."T 1" t2 ON (t1.c1 = t2."C 1") OFFSET 100 LIMIT 10;
--Testcase 28:
SELECT t1.c1, t2."C 1" FROM ft2 t1 JOIN "S 1"."T 1" t2 ON (t1.c1 = t2."C 1") OFFSET 100 LIMIT 10;
-- outer join; expressions in the clauses do not appear in equivalence class
-- list but no output change as compared to the previous query
--Testcase 29:
EXPLAIN (VERBOSE, COSTS OFF)
SELECT t1.c1, t2."C 1" FROM ft2 t1 LEFT JOIN "S 1"."T 1" t2 ON (t1.c1 = t2."C 1") OFFSET 100 LIMIT 10;
--Testcase 30:
SELECT t1.c1, t2."C 1" FROM ft2 t1 LEFT JOIN "S 1"."T 1" t2 ON (t1.c1 = t2."C 1") OFFSET 100 LIMIT 10;
-- A join between local table and foreign join. ORDER BY clause is added to the
-- foreign join so that the local table can be joined using merge join strategy.
--Testcase 31:
EXPLAIN (VERBOSE, COSTS OFF)
SELECT t1."C 1" FROM "S 1"."T 1" t1 left join ft1 t2 join ft2 t3 on (t2.c1 = t3.c1) on (t3.c1 = t1."C 1") OFFSET 100 LIMIT 10;
--Testcase 32:
SELECT t1."C 1" FROM "S 1"."T 1" t1 left join ft1 t2 join ft2 t3 on (t2.c1 = t3.c1) on (t3.c1 = t1."C 1") OFFSET 100 LIMIT 10;
-- Test similar to above, except that the full join prevents any equivalence
-- classes from being merged. This produces single relation equivalence classes
-- included in join restrictions.
--Testcase 33:
EXPLAIN (VERBOSE, COSTS OFF)
SELECT t1."C 1", t2.c1, t3.c1 FROM "S 1"."T 1" t1 left join ft1 t2 full join ft2 t3 on (t2.c1 = t3.c1) on (t3.c1 = t1."C 1") OFFSET 100 LIMIT 10;
--Testcase 34:
SELECT t1."C 1", t2.c1, t3.c1 FROM "S 1"."T 1" t1 left join ft1 t2 full join ft2 t3 on (t2.c1 = t3.c1) on (t3.c1 = t1."C 1") OFFSET 100 LIMIT 10;
-- Test similar to above with all full outer joins
--Testcase 35:
EXPLAIN (VERBOSE, COSTS OFF)
SELECT t1."C 1", t2.c1, t3.c1 FROM "S 1"."T 1" t1 full join ft1 t2 full join ft2 t3 on (t2.c1 = t3.c1) on (t3.c1 = t1."C 1") OFFSET 100 LIMIT 10;
--Testcase 36:
SELECT t1."C 1", t2.c1, t3.c1 FROM "S 1"."T 1" t1 full join ft1 t2 full join ft2 t3 on (t2.c1 = t3.c1) on (t3.c1 = t1."C 1") OFFSET 100 LIMIT 10;
RESET enable_hashjoin;
RESET enable_nestloop;
-- ===================================================================
-- WHERE with remotely-executable conditions
-- ===================================================================
--Testcase 37:
EXPLAIN (VERBOSE, COSTS OFF) SELECT * FROM ft1 t1 WHERE t1.c1 = 1; -- Var, OpExpr(b), Const
--Testcase 38:
EXPLAIN (VERBOSE, COSTS OFF) SELECT * FROM ft1 t1 WHERE t1.c1 = 100 AND t1.c2 = 0; -- BoolExpr
--Testcase 39:
EXPLAIN (VERBOSE, COSTS OFF) SELECT * FROM ft1 t1 WHERE c1 IS NULL; -- NullTest
--Testcase 40:
EXPLAIN (VERBOSE, COSTS OFF) SELECT * FROM ft1 t1 WHERE c1 IS NOT NULL; -- NullTest
--Testcase 41:
EXPLAIN (VERBOSE, COSTS OFF) SELECT * FROM ft1 t1 WHERE round(abs(c1), 0) = 1; -- FuncExpr
--Testcase 42:
EXPLAIN (VERBOSE, COSTS OFF) SELECT * FROM ft1 t1 WHERE c1 = -c1; -- OpExpr(l)
--Testcase 43:
EXPLAIN (VERBOSE, COSTS OFF) SELECT * FROM ft1 t1 WHERE 1 = c1!; -- OpExpr(r)
--Testcase 44:
EXPLAIN (VERBOSE, COSTS OFF) SELECT * FROM ft1 t1 WHERE (c1 IS NOT NULL) IS DISTINCT FROM (c1 IS NOT NULL); -- DistinctExpr
--Testcase 45:
EXPLAIN (VERBOSE, COSTS OFF) SELECT * FROM ft1 t1 WHERE c1 = ANY(ARRAY[c2, 1, c1 + 0]); -- ScalarArrayOpExpr
--Testcase 46:
EXPLAIN (VERBOSE, COSTS OFF) SELECT * FROM ft1 t1 WHERE c1 = (ARRAY[c1,c2,3])[1]; -- SubscriptingRef
--Testcase 47:
EXPLAIN (VERBOSE, COSTS OFF) SELECT * FROM ft1 t1 WHERE c6 = E'foo''s\\bar'; -- check special chars
--Testcase 48:
EXPLAIN (VERBOSE, COSTS OFF) SELECT * FROM ft1 t1 WHERE c8 = 'foo'; -- can't be sent to remote
-- parameterized remote path for foreign table
--Testcase 49:
EXPLAIN (VERBOSE, COSTS OFF)
SELECT * FROM "S 1"."T 1" a, ft2 b WHERE a."C 1" = 47 AND b.c1 = a.c2;
--Testcase 50:
SELECT * FROM ft2 a, ft2 b WHERE a.c1 = 47 AND b.c1 = a.c2;
-- check both safe and unsafe join conditions
--Testcase 51:
EXPLAIN (VERBOSE, COSTS OFF)
SELECT * FROM ft2 a, ft2 b
WHERE a.c2 = 6 AND b.c1 = a.c1 AND a.c8 = 'foo' AND b.c7 = upper(a.c7);
--Testcase 52:
SELECT * FROM ft2 a, ft2 b
WHERE a.c2 = 6 AND b.c1 = a.c1 AND a.c8 = 'foo' AND b.c7 = upper(a.c7);
-- bug before 9.3.5 due to sloppy handling of remote-estimate parameters
--Testcase 53:
SELECT * FROM ft1 WHERE c1 = ANY (ARRAY(SELECT c1 FROM ft2 WHERE c1 < 5));
--Testcase 54:
SELECT * FROM ft2 WHERE c1 = ANY (ARRAY(SELECT c1 FROM ft1 WHERE c1 < 5));
-- we should not push order by clause with volatile expressions or unsafe
-- collations
--Testcase 55:
EXPLAIN (VERBOSE, COSTS OFF)
SELECT * FROM ft2 ORDER BY ft2.c1, random();
--Testcase 56:
EXPLAIN (VERBOSE, COSTS OFF)
SELECT * FROM ft2 ORDER BY ft2.c1, ft2.c3 collate "C";
-- user-defined operator/function
--Testcase 494:
CREATE FUNCTION duckdb_fdw_abs(int) RETURNS int AS $$
BEGIN
RETURN abs($1);
END
$$ LANGUAGE plpgsql IMMUTABLE;
--Testcase 495:
CREATE OPERATOR === (
LEFTARG = int,
RIGHTARG = int,
PROCEDURE = int4eq,
COMMUTATOR = ===
);
-- built-in operators and functions can be shipped for remote execution
--Testcase 57:
EXPLAIN (VERBOSE, COSTS OFF)
SELECT count(c3) FROM ft1 t1 WHERE t1.c1 = abs(t1.c2);
--Testcase 58:
SELECT count(c3) FROM ft1 t1 WHERE t1.c1 = abs(t1.c2);
--Testcase 59:
EXPLAIN (VERBOSE, COSTS OFF)
SELECT count(c3) FROM ft1 t1 WHERE t1.c1 = t1.c2;
--Testcase 60:
SELECT count(c3) FROM ft1 t1 WHERE t1.c1 = t1.c2;
-- by default, user-defined ones cannot
--Testcase 61:
EXPLAIN (VERBOSE, COSTS OFF)
SELECT count(c3) FROM ft1 t1 WHERE t1.c1 = duckdb_fdw_abs(t1.c2);
--Testcase 62:
SELECT count(c3) FROM ft1 t1 WHERE t1.c1 = duckdb_fdw_abs(t1.c2);
--Testcase 63:
EXPLAIN (VERBOSE, COSTS OFF)
SELECT count(c3) FROM ft1 t1 WHERE t1.c1 === t1.c2;
--Testcase 64:
SELECT count(c3) FROM ft1 t1 WHERE t1.c1 === t1.c2;
-- ORDER BY can be shipped, though
--Testcase 496:
EXPLAIN (VERBOSE, COSTS OFF)
SELECT * FROM ft1 t1 WHERE t1.c1 === t1.c2 order by t1.c2 limit 1;
--Testcase 497:
SELECT * FROM ft1 t1 WHERE t1.c1 === t1.c2 order by t1.c2 limit 1;
-- but let's put them in an extension ...
ALTER EXTENSION duckdb_fdw ADD FUNCTION duckdb_fdw_abs(int);
ALTER EXTENSION duckdb_fdw ADD OPERATOR === (int, int);
--ALTER SERVER sqlite_svr2 OPTIONS (ADD extensions 'duckdb_fdw');
-- ... now they can be shipped
--Testcase 498:
EXPLAIN (VERBOSE, COSTS OFF)
SELECT count(c3) FROM ft1 t1 WHERE t1.c1 = duckdb_fdw_abs(t1.c2);
--Testcase 499:
SELECT count(c3) FROM ft1 t1 WHERE t1.c1 = duckdb_fdw_abs(t1.c2);
--Testcase 500:
EXPLAIN (VERBOSE, COSTS OFF)
SELECT count(c3) FROM ft1 t1 WHERE t1.c1 === t1.c2;
--Testcase 501:
SELECT count(c3) FROM ft1 t1 WHERE t1.c1 === t1.c2;
-- and both ORDER BY and LIMIT can be shipped
--Testcase 502:
EXPLAIN (VERBOSE, COSTS OFF)
SELECT * FROM ft1 t1 WHERE t1.c1 === t1.c2 order by t1.c2 limit 1;
--Testcase 503:
SELECT * FROM ft1 t1 WHERE t1.c1 === t1.c2 order by t1.c2 limit 1;
-- ===================================================================
-- JOIN queries
-- ===================================================================
-- Analyze ft4 and ft5 so that we have better statistics. These tables do not
-- have use_remote_estimate set.
--ANALYZE ft4;
--ANALYZE ft5;
-- join two tables
--Testcase 65:
EXPLAIN (VERBOSE, COSTS OFF)
SELECT t1.c1, t2.c1 FROM ft1 t1 JOIN ft2 t2 ON (t1.c1 = t2.c1) ORDER BY t1.c3, t1.c1 OFFSET 100 LIMIT 10;
--Testcase 66:
SELECT t1.c1, t2.c1 FROM ft1 t1 JOIN ft2 t2 ON (t1.c1 = t2.c1) ORDER BY t1.c3, t1.c1 OFFSET 100 LIMIT 10;
-- join three tables
--Testcase 67:
EXPLAIN (VERBOSE, COSTS OFF)
SELECT t1.c1, t2.c2, t3.c3 FROM ft1 t1 JOIN ft2 t2 ON (t1.c1 = t2.c1) JOIN ft4 t3 ON (t3.c1 = t1.c1) ORDER BY t1.c3, t1.c1 OFFSET 10 LIMIT 10;
--Testcase 68:
SELECT t1.c1, t2.c2, t3.c3 FROM ft1 t1 JOIN ft2 t2 ON (t1.c1 = t2.c1) JOIN ft4 t3 ON (t3.c1 = t1.c1) ORDER BY t1.c3, t1.c1 OFFSET 10 LIMIT 10;
-- left outer join
--Testcase 69:
EXPLAIN (VERBOSE, COSTS OFF)
SELECT t1.c1, t2.c1 FROM ft4 t1 LEFT JOIN ft5 t2 ON (t1.c1 = t2.c1) ORDER BY t1.c1, t2.c1 OFFSET 10 LIMIT 10;
--Testcase 70:
SELECT t1.c1, t2.c1 FROM ft4 t1 LEFT JOIN ft5 t2 ON (t1.c1 = t2.c1) ORDER BY t1.c1, t2.c1 OFFSET 10 LIMIT 10;
-- left outer join three tables
--Testcase 71:
EXPLAIN (VERBOSE, COSTS OFF)
SELECT t1.c1, t2.c2, t3.c3 FROM ft2 t1 LEFT JOIN ft2 t2 ON (t1.c1 = t2.c1) LEFT JOIN ft4 t3 ON (t2.c1 = t3.c1) OFFSET 10 LIMIT 10;
--Testcase 72:
SELECT t1.c1, t2.c2, t3.c3 FROM ft2 t1 LEFT JOIN ft2 t2 ON (t1.c1 = t2.c1) LEFT JOIN ft4 t3 ON (t2.c1 = t3.c1) OFFSET 10 LIMIT 10;
-- left outer join + placement of clauses.
-- clauses within the nullable side are not pulled up, but top level clause on
-- non-nullable side is pushed into non-nullable side
--Testcase 73:
EXPLAIN (VERBOSE, COSTS OFF)
SELECT t1.c1, t1.c2, t2.c1, t2.c2 FROM ft4 t1 LEFT JOIN (SELECT * FROM ft5 WHERE c1 < 10) t2 ON (t1.c1 = t2.c1) WHERE t1.c1 < 10;
--Testcase 74:
SELECT t1.c1, t1.c2, t2.c1, t2.c2 FROM ft4 t1 LEFT JOIN (SELECT * FROM ft5 WHERE c1 < 10) t2 ON (t1.c1 = t2.c1) WHERE t1.c1 < 10;
-- clauses within the nullable side are not pulled up, but the top level clause
-- on nullable side is not pushed down into nullable side
--Testcase 75:
EXPLAIN (VERBOSE, COSTS OFF)
SELECT t1.c1, t1.c2, t2.c1, t2.c2 FROM ft4 t1 LEFT JOIN (SELECT * FROM ft5 WHERE c1 < 10) t2 ON (t1.c1 = t2.c1)
WHERE (t2.c1 < 10 OR t2.c1 IS NULL) AND t1.c1 < 10;
--Testcase 76:
SELECT t1.c1, t1.c2, t2.c1, t2.c2 FROM ft4 t1 LEFT JOIN (SELECT * FROM ft5 WHERE c1 < 10) t2 ON (t1.c1 = t2.c1)
WHERE (t2.c1 < 10 OR t2.c1 IS NULL) AND t1.c1 < 10;
-- right outer join
--Testcase 77:
EXPLAIN (VERBOSE, COSTS OFF)
SELECT t1.c1, t2.c1 FROM ft5 t1 RIGHT JOIN ft4 t2 ON (t1.c1 = t2.c1) ORDER BY t2.c1, t1.c1 OFFSET 10 LIMIT 10;
--Testcase 78:
SELECT t1.c1, t2.c1 FROM ft5 t1 RIGHT JOIN ft4 t2 ON (t1.c1 = t2.c1) ORDER BY t2.c1, t1.c1 OFFSET 10 LIMIT 10;
-- right outer join three tables
--Testcase 79:
EXPLAIN (VERBOSE, COSTS OFF)
SELECT t1.c1, t2.c2, t3.c3 FROM ft2 t1 RIGHT JOIN ft2 t2 ON (t1.c1 = t2.c1) RIGHT JOIN ft4 t3 ON (t2.c1 = t3.c1) OFFSET 10 LIMIT 10;
--Testcase 80:
SELECT t1.c1, t2.c2, t3.c3 FROM ft2 t1 RIGHT JOIN ft2 t2 ON (t1.c1 = t2.c1) RIGHT JOIN ft4 t3 ON (t2.c1 = t3.c1) OFFSET 10 LIMIT 10;
-- full outer join
--Testcase 81:
EXPLAIN (VERBOSE, COSTS OFF)
SELECT t1.c1, t2.c1 FROM ft4 t1 FULL JOIN ft5 t2 ON (t1.c1 = t2.c1) ORDER BY t1.c1, t2.c1 OFFSET 45 LIMIT 10;
--Testcase 82:
SELECT t1.c1, t2.c1 FROM ft4 t1 FULL JOIN ft5 t2 ON (t1.c1 = t2.c1) ORDER BY t1.c1, t2.c1 OFFSET 45 LIMIT 10;
-- full outer join with restrictions on the joining relations
-- a. the joining relations are both base relations
--Testcase 83:
EXPLAIN (VERBOSE, COSTS OFF)
SELECT t1.c1, t2.c1 FROM (SELECT c1 FROM ft4 WHERE c1 between 50 and 60) t1 FULL JOIN (SELECT c1 FROM ft5 WHERE c1 between 50 and 60) t2 ON (t1.c1 = t2.c1) ORDER BY t1.c1, t2.c1;
--Testcase 84:
SELECT t1.c1, t2.c1 FROM (SELECT c1 FROM ft4 WHERE c1 between 50 and 60) t1 FULL JOIN (SELECT c1 FROM ft5 WHERE c1 between 50 and 60) t2 ON (t1.c1 = t2.c1) ORDER BY t1.c1, t2.c1;
--Testcase 85:
EXPLAIN (VERBOSE, COSTS OFF)
SELECT 1 FROM (SELECT c1 FROM ft4 WHERE c1 between 50 and 60) t1 FULL JOIN (SELECT c1 FROM ft5 WHERE c1 between 50 and 60) t2 ON (TRUE) OFFSET 10 LIMIT 10;
--Testcase 86:
SELECT 1 FROM (SELECT c1 FROM ft4 WHERE c1 between 50 and 60) t1 FULL JOIN (SELECT c1 FROM ft5 WHERE c1 between 50 and 60) t2 ON (TRUE) OFFSET 10 LIMIT 10;
-- b. one of the joining relations is a base relation and the other is a join
-- relation
--Testcase 87:
EXPLAIN (VERBOSE, COSTS OFF)
SELECT t1.c1, ss.a, ss.b FROM (SELECT c1 FROM ft4 WHERE c1 between 50 and 60) t1 FULL JOIN (SELECT t2.c1, t3.c1 FROM ft4 t2 LEFT JOIN ft5 t3 ON (t2.c1 = t3.c1) WHERE (t2.c1 between 50 and 60)) ss(a, b) ON (t1.c1 = ss.a) ORDER BY t1.c1, ss.a, ss.b;
--Testcase 88:
SELECT t1.c1, ss.a, ss.b FROM (SELECT c1 FROM ft4 WHERE c1 between 50 and 60) t1 FULL JOIN (SELECT t2.c1, t3.c1 FROM ft4 t2 LEFT JOIN ft5 t3 ON (t2.c1 = t3.c1) WHERE (t2.c1 between 50 and 60)) ss(a, b) ON (t1.c1 = ss.a) ORDER BY t1.c1, ss.a, ss.b;
-- c. test deparsing the remote query as nested subqueries
--Testcase 89:
EXPLAIN (VERBOSE, COSTS OFF)
SELECT t1.c1, ss.a, ss.b FROM (SELECT c1 FROM ft4 WHERE c1 between 50 and 60) t1 FULL JOIN (SELECT t2.c1, t3.c1 FROM (SELECT c1 FROM ft4 WHERE c1 between 50 and 60) t2 FULL JOIN (SELECT c1 FROM ft5 WHERE c1 between 50 and 60) t3 ON (t2.c1 = t3.c1) WHERE t2.c1 IS NULL OR t2.c1 IS NOT NULL) ss(a, b) ON (t1.c1 = ss.a) ORDER BY t1.c1, ss.a, ss.b;
--Testcase 90:
SELECT t1.c1, ss.a, ss.b FROM (SELECT c1 FROM ft4 WHERE c1 between 50 and 60) t1 FULL JOIN (SELECT t2.c1, t3.c1 FROM (SELECT c1 FROM ft4 WHERE c1 between 50 and 60) t2 FULL JOIN (SELECT c1 FROM ft5 WHERE c1 between 50 and 60) t3 ON (t2.c1 = t3.c1) WHERE t2.c1 IS NULL OR t2.c1 IS NOT NULL) ss(a, b) ON (t1.c1 = ss.a) ORDER BY t1.c1, ss.a, ss.b;
-- d. test deparsing rowmarked relations as subqueries
--Testcase 91:
EXPLAIN (VERBOSE, COSTS OFF)
SELECT t1.c1, ss.a, ss.b FROM (SELECT c1 FROM "S 1"."T 3" WHERE c1 = 50) t1 INNER JOIN (SELECT t2.c1, t3.c1 FROM (SELECT c1 FROM ft4 WHERE c1 between 50 and 60) t2 FULL JOIN (SELECT c1 FROM ft5 WHERE c1 between 50 and 60) t3 ON (t2.c1 = t3.c1) WHERE t2.c1 IS NULL OR t2.c1 IS NOT NULL) ss(a, b) ON (TRUE) ORDER BY t1.c1, ss.a, ss.b FOR UPDATE OF t1;
--Testcase 92:
SELECT t1.c1, ss.a, ss.b FROM (SELECT c1 FROM "S 1"."T 3" WHERE c1 = 50) t1 INNER JOIN (SELECT t2.c1, t3.c1 FROM (SELECT c1 FROM ft4 WHERE c1 between 50 and 60) t2 FULL JOIN (SELECT c1 FROM ft5 WHERE c1 between 50 and 60) t3 ON (t2.c1 = t3.c1) WHERE t2.c1 IS NULL OR t2.c1 IS NOT NULL) ss(a, b) ON (TRUE) ORDER BY t1.c1, ss.a, ss.b FOR UPDATE OF t1;
-- full outer join + inner join
--Testcase 93:
EXPLAIN (VERBOSE, COSTS OFF)
SELECT t1.c1, t2.c1, t3.c1 FROM ft4 t1 INNER JOIN ft5 t2 ON (t1.c1 = t2.c1 + 1 and t1.c1 between 50 and 60) FULL JOIN ft4 t3 ON (t2.c1 = t3.c1) ORDER BY t1.c1, t2.c1, t3.c1 LIMIT 10;
--Testcase 94:
SELECT t1.c1, t2.c1, t3.c1 FROM ft4 t1 INNER JOIN ft5 t2 ON (t1.c1 = t2.c1 + 1 and t1.c1 between 50 and 60) FULL JOIN ft4 t3 ON (t2.c1 = t3.c1) ORDER BY t1.c1, t2.c1, t3.c1 LIMIT 10;
-- full outer join three tables
--Testcase 95:
EXPLAIN (VERBOSE, COSTS OFF)
SELECT t1.c1, t2.c2, t3.c3 FROM ft2 t1 FULL JOIN ft2 t2 ON (t1.c1 = t2.c1) FULL JOIN ft4 t3 ON (t2.c1 = t3.c1) OFFSET 10 LIMIT 10;
--Testcase 96:
SELECT t1.c1, t2.c2, t3.c3 FROM ft2 t1 FULL JOIN ft2 t2 ON (t1.c1 = t2.c1) FULL JOIN ft4 t3 ON (t2.c1 = t3.c1) ORDER BY t1.c1 OFFSET 10 LIMIT 10;
-- full outer join + right outer join
--Testcase 97:
EXPLAIN (VERBOSE, COSTS OFF)
SELECT t1.c1, t2.c2, t3.c3 FROM ft2 t1 FULL JOIN ft2 t2 ON (t1.c1 = t2.c1) RIGHT JOIN ft4 t3 ON (t2.c1 = t3.c1) OFFSET 10 LIMIT 10;
--Testcase 98:
SELECT t1.c1, t2.c2, t3.c3 FROM ft2 t1 FULL JOIN ft2 t2 ON (t1.c1 = t2.c1) RIGHT JOIN ft4 t3 ON (t2.c1 = t3.c1) OFFSET 10 LIMIT 10;
-- right outer join + full outer join
--Testcase 99:
EXPLAIN (VERBOSE, COSTS OFF)
SELECT t1.c1, t2.c2, t3.c3 FROM ft2 t1 RIGHT JOIN ft2 t2 ON (t1.c1 = t2.c1) FULL JOIN ft4 t3 ON (t2.c1 = t3.c1) OFFSET 10 LIMIT 10;
--Testcase 100:
SELECT t1.c1, t2.c2, t3.c3 FROM ft2 t1 RIGHT JOIN ft2 t2 ON (t1.c1 = t2.c1) FULL JOIN ft4 t3 ON (t2.c1 = t3.c1) ORDER BY t1.c1 OFFSET 10 LIMIT 10;
-- full outer join + left outer join
--Testcase 101:
EXPLAIN (VERBOSE, COSTS OFF)
SELECT t1.c1, t2.c2, t3.c3 FROM ft2 t1 FULL JOIN ft2 t2 ON (t1.c1 = t2.c1) LEFT JOIN ft4 t3 ON (t2.c1 = t3.c1) OFFSET 10 LIMIT 10;
--Testcase 102:
SELECT t1.c1, t2.c2, t3.c3 FROM ft2 t1 FULL JOIN ft2 t2 ON (t1.c1 = t2.c1) LEFT JOIN ft4 t3 ON (t2.c1 = t3.c1) ORDER BY t1.c1 OFFSET 10 LIMIT 10;
-- left outer join + full outer join
--Testcase 103:
EXPLAIN (VERBOSE, COSTS OFF)
SELECT t1.c1, t2.c2, t3.c3 FROM ft2 t1 LEFT JOIN ft2 t2 ON (t1.c1 = t2.c1) FULL JOIN ft4 t3 ON (t2.c1 = t3.c1) OFFSET 10 LIMIT 10;
--Testcase 104:
SELECT t1.c1, t2.c2, t3.c3 FROM ft2 t1 LEFT JOIN ft2 t2 ON (t1.c1 = t2.c1) FULL JOIN ft4 t3 ON (t2.c1 = t3.c1) ORDER BY t1.c1 OFFSET 10 LIMIT 10;
-- right outer join + left outer join
--Testcase 105:
EXPLAIN (VERBOSE, COSTS OFF)
SELECT t1.c1, t2.c2, t3.c3 FROM ft2 t1 RIGHT JOIN ft2 t2 ON (t1.c1 = t2.c1) LEFT JOIN ft4 t3 ON (t2.c1 = t3.c1) OFFSET 10 LIMIT 10;
--Testcase 106:
SELECT t1.c1, t2.c2, t3.c3 FROM ft2 t1 RIGHT JOIN ft2 t2 ON (t1.c1 = t2.c1) LEFT JOIN ft4 t3 ON (t2.c1 = t3.c1) OFFSET 10 LIMIT 10;
-- left outer join + right outer join
--Testcase 107:
EXPLAIN (VERBOSE, COSTS OFF)
SELECT t1.c1, t2.c2, t3.c3 FROM ft2 t1 LEFT JOIN ft2 t2 ON (t1.c1 = t2.c1) RIGHT JOIN ft4 t3 ON (t2.c1 = t3.c1) OFFSET 10 LIMIT 10;
--Testcase 108:
SELECT t1.c1, t2.c2, t3.c3 FROM ft2 t1 LEFT JOIN ft2 t2 ON (t1.c1 = t2.c1) RIGHT JOIN ft4 t3 ON (t2.c1 = t3.c1) ORDER BY t1.c1 OFFSET 10 LIMIT 10;
-- full outer join + WHERE clause, only matched rows
--Testcase 109:
EXPLAIN (VERBOSE, COSTS OFF)
SELECT t1.c1, t2.c1 FROM ft4 t1 FULL JOIN ft5 t2 ON (t1.c1 = t2.c1) WHERE (t1.c1 = t2.c1 OR t1.c1 IS NULL) ORDER BY t1.c1, t2.c1 OFFSET 10 LIMIT 10;
--Testcase 110:
SELECT t1.c1, t2.c1 FROM ft4 t1 FULL JOIN ft5 t2 ON (t1.c1 = t2.c1) WHERE (t1.c1 = t2.c1 OR t1.c1 IS NULL) ORDER BY t1.c1, t2.c1 OFFSET 10 LIMIT 10;
-- full outer join + WHERE clause with shippable extensions set
--Testcase 504:
EXPLAIN (VERBOSE, COSTS OFF)
SELECT t1.c1, t2.c2, t1.c3 FROM ft1 t1 FULL JOIN ft2 t2 ON (t1.c1 = t2.c1) WHERE duckdb_fdw_abs(t1.c1) > 0 OFFSET 10 LIMIT 10;
--ALTER SERVER sqlite_svr2 OPTIONS (DROP extensions);
-- full outer join + WHERE clause with shippable extensions not set
--Testcase 505:
EXPLAIN (VERBOSE, COSTS OFF)
SELECT t1.c1, t2.c2, t1.c3 FROM ft1 t1 FULL JOIN ft2 t2 ON (t1.c1 = t2.c1) WHERE duckdb_fdw_abs(t1.c1) > 0 OFFSET 10 LIMIT 10;
ALTER SERVER loopback OPTIONS (ADD extensions 'postgres_fdw');
-- join two tables with FOR UPDATE clause
-- tests whole-row reference for row marks
--Testcase 111:
EXPLAIN (VERBOSE, COSTS OFF)
SELECT t1.c1, t2.c1 FROM ft1 t1 JOIN ft2 t2 ON (t1.c1 = t2.c1) ORDER BY t1.c3, t1.c1 OFFSET 100 LIMIT 10 FOR UPDATE OF t1;
--Testcase 112:
SELECT t1.c1, t2.c1 FROM ft1 t1 JOIN ft2 t2 ON (t1.c1 = t2.c1) ORDER BY t1.c3, t1.c1 OFFSET 100 LIMIT 10 FOR UPDATE OF t1;
--Testcase 113:
EXPLAIN (VERBOSE, COSTS OFF)
SELECT t1.c1, t2.c1 FROM ft1 t1 JOIN ft2 t2 ON (t1.c1 = t2.c1) ORDER BY t1.c3, t1.c1 OFFSET 100 LIMIT 10 FOR UPDATE;
--Testcase 114:
SELECT t1.c1, t2.c1 FROM ft1 t1 JOIN ft2 t2 ON (t1.c1 = t2.c1) ORDER BY t1.c3, t1.c1 OFFSET 100 LIMIT 10 FOR UPDATE;
-- join two tables with FOR SHARE clause
--Testcase 115:
EXPLAIN (VERBOSE, COSTS OFF)
SELECT t1.c1, t2.c1 FROM ft1 t1 JOIN ft2 t2 ON (t1.c1 = t2.c1) ORDER BY t1.c3, t1.c1 OFFSET 100 LIMIT 10 FOR SHARE OF t1;
--Testcase 116:
SELECT t1.c1, t2.c1 FROM ft1 t1 JOIN ft2 t2 ON (t1.c1 = t2.c1) ORDER BY t1.c3, t1.c1 OFFSET 100 LIMIT 10 FOR SHARE OF t1;
--Testcase 117:
EXPLAIN (VERBOSE, COSTS OFF)
SELECT t1.c1, t2.c1 FROM ft1 t1 JOIN ft2 t2 ON (t1.c1 = t2.c1) ORDER BY t1.c3, t1.c1 OFFSET 100 LIMIT 10 FOR SHARE;
--Testcase 118:
SELECT t1.c1, t2.c1 FROM ft1 t1 JOIN ft2 t2 ON (t1.c1 = t2.c1) ORDER BY t1.c3, t1.c1 OFFSET 100 LIMIT 10 FOR SHARE;
-- join in CTE
--Testcase 119:
EXPLAIN (VERBOSE, COSTS OFF)
WITH t (c1_1, c1_3, c2_1) AS MATERIALIZED (SELECT t1.c1, t1.c3, t2.c1 FROM ft1 t1 JOIN ft2 t2 ON (t1.c1 = t2.c1)) SELECT c1_1, c2_1 FROM t ORDER BY c1_3, c1_1 OFFSET 100 LIMIT 10;
--Testcase 120:
WITH t (c1_1, c1_3, c2_1) AS MATERIALIZED (SELECT t1.c1, t1.c3, t2.c1 FROM ft1 t1 JOIN ft2 t2 ON (t1.c1 = t2.c1)) SELECT c1_1, c2_1 FROM t ORDER BY c1_3, c1_1 OFFSET 100 LIMIT 10;
-- ctid with whole-row reference
--Testcase 121:
EXPLAIN (VERBOSE, COSTS OFF)
SELECT t1.ctid, t1, t2, t1.c1 FROM ft1 t1 JOIN ft2 t2 ON (t1.c1 = t2.c1) ORDER BY t1.c3, t1.c1 OFFSET 100 LIMIT 10;
-- SEMI JOIN, not pushed down
--Testcase 122:
EXPLAIN (VERBOSE, COSTS OFF)
SELECT t1.c1 FROM ft1 t1 WHERE EXISTS (SELECT 1 FROM ft2 t2 WHERE t1.c1 = t2.c1) ORDER BY t1.c1 OFFSET 100 LIMIT 10;
--Testcase 123:
SELECT t1.c1 FROM ft1 t1 WHERE EXISTS (SELECT 1 FROM ft2 t2 WHERE t1.c1 = t2.c1) ORDER BY t1.c1 OFFSET 100 LIMIT 10;
-- ANTI JOIN, not pushed down
--Testcase 124:
EXPLAIN (VERBOSE, COSTS OFF)
SELECT t1.c1 FROM ft1 t1 WHERE NOT EXISTS (SELECT 1 FROM ft2 t2 WHERE t1.c1 = t2.c2) ORDER BY t1.c1 OFFSET 100 LIMIT 10;
--Testcase 125:
SELECT t1.c1 FROM ft1 t1 WHERE NOT EXISTS (SELECT 1 FROM ft2 t2 WHERE t1.c1 = t2.c2) ORDER BY t1.c1 OFFSET 100 LIMIT 10;
-- CROSS JOIN can be pushed down
--Testcase 126:
EXPLAIN (VERBOSE, COSTS OFF)
SELECT t1.c1, t2.c1 FROM ft1 t1 CROSS JOIN ft2 t2 ORDER BY t1.c1, t2.c1 OFFSET 100 LIMIT 10;
--Testcase 127:
SELECT t1.c1, t2.c1 FROM ft1 t1 CROSS JOIN ft2 t2 ORDER BY t1.c1, t2.c1 OFFSET 100 LIMIT 10;
-- different server, not pushed down. No result expected.
--Testcase 128:
EXPLAIN (VERBOSE, COSTS OFF)
SELECT t1.c1, t2.c1 FROM ft5 t1 JOIN ft6 t2 ON (t1.c1 = t2.c1) ORDER BY t1.c1, t2.c1 OFFSET 100 LIMIT 10;
--Testcase 129:
SELECT t1.c1, t2.c1 FROM ft5 t1 JOIN ft6 t2 ON (t1.c1 = t2.c1) ORDER BY t1.c1, t2.c1 OFFSET 100 LIMIT 10;
-- unsafe join conditions (c8 has a UDT), not pushed down. Practically a CROSS
-- JOIN since c8 in both tables has same value.
--Testcase 130:
EXPLAIN (VERBOSE, COSTS OFF)
SELECT t1.c1, t2.c1 FROM ft1 t1 LEFT JOIN ft2 t2 ON (t1.c8 = t2.c8) ORDER BY t1.c1, t2.c1 OFFSET 100 LIMIT 10;
--Testcase 131:
SELECT t1.c1, t2.c1 FROM ft1 t1 LEFT JOIN ft2 t2 ON (t1.c8 = t2.c8) ORDER BY t1.c1, t2.c1 OFFSET 100 LIMIT 10;
-- unsafe conditions on one side (c8 has a UDT), not pushed down.
--Testcase 132:
EXPLAIN (VERBOSE, COSTS OFF)
SELECT t1.c1, t2.c1 FROM ft1 t1 LEFT JOIN ft2 t2 ON (t1.c1 = t2.c1) WHERE t1.c8 = 'foo' ORDER BY t1.c3, t1.c1 OFFSET 100 LIMIT 10;
--Testcase 133:
SELECT t1.c1, t2.c1 FROM ft1 t1 LEFT JOIN ft2 t2 ON (t1.c1 = t2.c1) WHERE t1.c8 = 'foo' ORDER BY t1.c3, t1.c1 OFFSET 100 LIMIT 10;
-- join where unsafe to pushdown condition in WHERE clause has a column not
-- in the SELECT clause. In this test unsafe clause needs to have column
-- references from both joining sides so that the clause is not pushed down
-- into one of the joining sides.
--Testcase 134:
EXPLAIN (VERBOSE, COSTS OFF)
SELECT t1.c1, t2.c1 FROM ft1 t1 JOIN ft2 t2 ON (t1.c1 = t2.c1) WHERE t1.c8 = t2.c8 ORDER BY t1.c3, t1.c1 OFFSET 100 LIMIT 10;
--Testcase 135:
SELECT t1.c1, t2.c1 FROM ft1 t1 JOIN ft2 t2 ON (t1.c1 = t2.c1) WHERE t1.c8 = t2.c8 ORDER BY t1.c3, t1.c1 OFFSET 100 LIMIT 10;
-- Aggregate after UNION, for testing setrefs
--Testcase 136:
EXPLAIN (VERBOSE, COSTS OFF)
SELECT t1c1, avg(t1c1 + t2c1) FROM (SELECT t1.c1, t2.c1 FROM ft1 t1 JOIN ft2 t2 ON (t1.c1 = t2.c1) UNION SELECT t1.c1, t2.c1 FROM ft1 t1 JOIN ft2 t2 ON (t1.c1 = t2.c1)) AS t (t1c1, t2c1) GROUP BY t1c1 ORDER BY t1c1 OFFSET 100 LIMIT 10;
--Testcase 137:
SELECT t1c1, avg(t1c1 + t2c1) FROM (SELECT t1.c1, t2.c1 FROM ft1 t1 JOIN ft2 t2 ON (t1.c1 = t2.c1) UNION SELECT t1.c1, t2.c1 FROM ft1 t1 JOIN ft2 t2 ON (t1.c1 = t2.c1)) AS t (t1c1, t2c1) GROUP BY t1c1 ORDER BY t1c1 OFFSET 100 LIMIT 10;
-- join with lateral reference
--Testcase 138:
EXPLAIN (VERBOSE, COSTS OFF)
SELECT t1."C 1" FROM "S 1"."T 1" t1, LATERAL (SELECT DISTINCT t2.c1, t3.c1 FROM ft1 t2, ft2 t3 WHERE t2.c1 = t3.c1 AND t2.c2 = t1.c2) q ORDER BY t1."C 1" OFFSET 10 LIMIT 10;
--Testcase 139:
SELECT t1."C 1" FROM "S 1"."T 1" t1, LATERAL (SELECT DISTINCT t2.c1, t3.c1 FROM ft1 t2, ft2 t3 WHERE t2.c1 = t3.c1 AND t2.c2 = t1.c2) q ORDER BY t1."C 1" OFFSET 10 LIMIT 10;
-- non-Var items in targetlist of the nullable rel of a join preventing
-- push-down in some cases
-- unable to push {ft1, ft2}
--Testcase 140:
EXPLAIN (VERBOSE, COSTS OFF)
SELECT q.a, ft2.c1 FROM (SELECT 13 FROM ft1 WHERE c1 = 13) q(a) RIGHT JOIN ft2 ON (q.a = ft2.c1) WHERE ft2.c1 BETWEEN 10 AND 15;
--Testcase 141:
SELECT q.a, ft2.c1 FROM (SELECT 13 FROM ft1 WHERE c1 = 13) q(a) RIGHT JOIN ft2 ON (q.a = ft2.c1) WHERE ft2.c1 BETWEEN 10 AND 15;
-- ok to push {ft1, ft2} but not {ft1, ft2, ft4}
--Testcase 142:
EXPLAIN (VERBOSE, COSTS OFF)
SELECT ft4.c1, q.* FROM ft4 LEFT JOIN (SELECT 13, ft1.c1, ft2.c1 FROM ft1 RIGHT JOIN ft2 ON (ft1.c1 = ft2.c1) WHERE ft1.c1 = 12) q(a, b, c) ON (ft4.c1 = q.b) WHERE ft4.c1 BETWEEN 10 AND 15;
--Testcase 143:
SELECT ft4.c1, q.* FROM ft4 LEFT JOIN (SELECT 13, ft1.c1, ft2.c1 FROM ft1 RIGHT JOIN ft2 ON (ft1.c1 = ft2.c1) WHERE ft1.c1 = 12) q(a, b, c) ON (ft4.c1 = q.b) WHERE ft4.c1 BETWEEN 10 AND 15;
-- join with nullable side with some columns with null values
--Testcase 144:
UPDATE ft5 SET c3 = null where c1 % 9 = 0;
--Testcase 145:
EXPLAIN (VERBOSE, COSTS OFF)
SELECT ft5, ft5.c1, ft5.c2, ft5.c3, ft4.c1, ft4.c2 FROM ft5 left join ft4 on ft5.c1 = ft4.c1 WHERE ft4.c1 BETWEEN 10 and 30 ORDER BY ft5.c1, ft4.c1;
--Testcase 146:
SELECT ft5, ft5.c1, ft5.c2, ft5.c3, ft4.c1, ft4.c2 FROM ft5 left join ft4 on ft5.c1 = ft4.c1 WHERE ft4.c1 BETWEEN 10 and 30 ORDER BY ft5.c1, ft4.c1;
-- multi-way join involving multiple merge joins
-- (this case used to have EPQ-related planning problems)
--Testcase 506:
CREATE TABLE local_tbl (c1 int NOT NULL, c2 int NOT NULL, c3 text, CONSTRAINT local_tbl_pkey PRIMARY KEY (c1));
--Testcase 507:
INSERT INTO local_tbl SELECT id, id % 10, to_char(id, 'FM0000') FROM generate_series(1, 1000) id;
ANALYZE local_tbl;
SET enable_nestloop TO false;
SET enable_hashjoin TO false;
--Testcase 147:
EXPLAIN (VERBOSE, COSTS OFF)
SELECT * FROM ft1, ft2, ft4, ft5, local_tbl WHERE ft1.c1 = ft2.c1 AND ft1.c2 = ft4.c1
AND ft1.c2 = ft5.c1 AND ft1.c2 = local_tbl.c1 AND ft1.c1 < 100 AND ft2.c1 < 100 FOR UPDATE;
--Testcase 148:
SELECT * FROM ft1, ft2, ft4, ft5, local_tbl WHERE ft1.c1 = ft2.c1 AND ft1.c2 = ft4.c1
AND ft1.c2 = ft5.c1 AND ft1.c2 = local_tbl.c1 AND ft1.c1 < 100 AND ft2.c1 < 100 ORDER BY ft1.c1 FOR UPDATE;
RESET enable_nestloop;
RESET enable_hashjoin;
--DROP TABLE local_tbl;
-- check join pushdown in situations where multiple userids are involved
--Testcase 508:
CREATE ROLE regress_view_owner SUPERUSER;
--Testcase 509:
CREATE USER MAPPING FOR regress_view_owner SERVER sqlite_svr;
GRANT SELECT ON ft4 TO regress_view_owner;
GRANT SELECT ON ft5 TO regress_view_owner;
--Testcase 510:
CREATE VIEW v4 AS SELECT * FROM ft4;
--Testcase 511:
CREATE VIEW v5 AS SELECT * FROM ft5;
ALTER VIEW v5 OWNER TO regress_view_owner;
--Testcase 149:
EXPLAIN (VERBOSE, COSTS OFF)
SELECT t1.c1, t2.c2 FROM v4 t1 LEFT JOIN v5 t2 ON (t1.c1 = t2.c1) ORDER BY t1.c1, t2.c1 OFFSET 10 LIMIT 10; -- can't be pushed down, different view owners
--Testcase 150:
SELECT t1.c1, t2.c2 FROM v4 t1 LEFT JOIN v5 t2 ON (t1.c1 = t2.c1) ORDER BY t1.c1, t2.c1 OFFSET 10 LIMIT 10;
ALTER VIEW v4 OWNER TO regress_view_owner;
--Testcase 151:
EXPLAIN (VERBOSE, COSTS OFF)
SELECT t1.c1, t2.c2 FROM v4 t1 LEFT JOIN v5 t2 ON (t1.c1 = t2.c1) ORDER BY t1.c1, t2.c1 OFFSET 10 LIMIT 10; -- can be pushed down
--Testcase 152:
SELECT t1.c1, t2.c2 FROM v4 t1 LEFT JOIN v5 t2 ON (t1.c1 = t2.c1) ORDER BY t1.c1, t2.c1 OFFSET 10 LIMIT 10;
--Testcase 153:
EXPLAIN (VERBOSE, COSTS OFF)
SELECT t1.c1, t2.c2 FROM v4 t1 LEFT JOIN ft5 t2 ON (t1.c1 = t2.c1) ORDER BY t1.c1, t2.c1 OFFSET 10 LIMIT 10; -- can't be pushed down, view owner not current user
--Testcase 154:
SELECT t1.c1, t2.c2 FROM v4 t1 LEFT JOIN ft5 t2 ON (t1.c1 = t2.c1) ORDER BY t1.c1, t2.c1 OFFSET 10 LIMIT 10;
ALTER VIEW v4 OWNER TO CURRENT_USER;
--Testcase 155:
EXPLAIN (VERBOSE, COSTS OFF)
SELECT t1.c1, t2.c2 FROM v4 t1 LEFT JOIN ft5 t2 ON (t1.c1 = t2.c1) ORDER BY t1.c1, t2.c1 OFFSET 10 LIMIT 10; -- can be pushed down
--Testcase 156:
SELECT t1.c1, t2.c2 FROM v4 t1 LEFT JOIN ft5 t2 ON (t1.c1 = t2.c1) ORDER BY t1.c1, t2.c1 OFFSET 10 LIMIT 10;
ALTER VIEW v4 OWNER TO regress_view_owner;
-- cleanup
--Testcase 512:
DROP OWNED BY regress_view_owner;
--Testcase 513:
DROP ROLE regress_view_owner;
-- ===================================================================
-- Aggregate and grouping queries
-- ===================================================================
-- Simple aggregates
--Testcase 157:
explain (verbose, costs off)
select count(c6), sum(c1), avg(c1), min(c2), max(c1), stddev(c2), sum(c1) * (random() <= 1)::int as sum2 from ft1 where c2 < 5 group by c2 order by 1, 2;
--Testcase 158:
select count(c6), sum(c1), avg(c1), min(c2), max(c1), stddev(c2), sum(c1) * (random() <= 1)::int as sum2 from ft1 where c2 < 5 group by c2 order by 1, 2;
--Testcase 514:
explain (verbose, costs off)
select count(c6), sum(c1), avg(c1), min(c2), max(c1), stddev(c2), sum(c1) * (random() <= 1)::int as sum2 from ft1 where c2 < 5 group by c2 order by 1, 2 limit 1;
--Testcase 515:
select count(c6), sum(c1), avg(c1), min(c2), max(c1), stddev(c2), sum(c1) * (random() <= 1)::int as sum2 from ft1 where c2 < 5 group by c2 order by 1, 2 limit 1;
-- Aggregate is not pushed down as aggregation contains random()
--Testcase 159:
explain (verbose, costs off)
select sum(c1 * (random() <= 1)::int) as sum, avg(c1) from ft1;
-- Aggregate over join query
--Testcase 160:
explain (verbose, costs off)
select count(*), sum(t1.c1), avg(t2.c1) from ft1 t1 inner join ft1 t2 on (t1.c2 = t2.c2) where t1.c2 = 6;
--Testcase 161:
select count(*), sum(t1.c1), avg(t2.c1) from ft1 t1 inner join ft1 t2 on (t1.c2 = t2.c2) where t1.c2 = 6;
-- Not pushed down due to local conditions present in underneath input rel
--Testcase 162:
explain (verbose, costs off)
select sum(t1.c1), count(t2.c1) from ft1 t1 inner join ft2 t2 on (t1.c1 = t2.c1) where ((t1.c1 * t2.c1)/(t1.c1 * t2.c1)) * random() <= 1;
-- GROUP BY clause having expressions
--Testcase 163:
explain (verbose, costs off)
select c2/2, sum(c2) * (c2/2) from ft1 group by c2/2 order by c2/2;
--Testcase 164:
select c2/2, sum(c2) * (c2/2) from ft1 group by c2/2 order by c2/2;
-- Aggregates in subquery are pushed down.
--Testcase 165:
explain (verbose, costs off)
select count(x.a), sum(x.a) from (select c2 a, sum(c1) b from ft1 group by c2, sqrt(c1) order by 1, 2) x;
--Testcase 166:
select count(x.a), sum(x.a) from (select c2 a, sum(c1) b from ft1 group by c2, sqrt(c1) order by 1, 2) x;
-- Aggregate is still pushed down by taking unshippable expression out
--Testcase 167:
explain (verbose, costs off)
select c2 * (random() <= 1)::int as sum1, sum(c1) * c2 as sum2 from ft1 group by c2 order by 1, 2;
--Testcase 168:
select c2 * (random() <= 1)::int as sum1, sum(c1) * c2 as sum2 from ft1 group by c2 order by 1, 2;
-- Aggregate with unshippable GROUP BY clause are not pushed
--Testcase 169:
explain (verbose, costs off)
select c2 * (random() <= 1)::int as c2 from ft2 group by c2 * (random() <= 1)::int order by 1;
-- GROUP BY clause in various forms, cardinal, alias and constant expression
--Testcase 516:
explain (verbose, costs off)
select count(c2) w, c2 x, 5 y, 7.0 z from ft1 group by 2, y, 9.0::int order by 2;
--Testcase 517:
select count(c2) w, c2 x, 5 y, 7.0 z from ft1 group by 2, y, 9.0::int order by 2;
-- GROUP BY clause referring to same column multiple times
-- Also, ORDER BY contains an aggregate function
--Testcase 170:
explain (verbose, costs off)
select c2, c2 from ft1 where c2 > 6 group by 1, 2 order by sum(c1);
--Testcase 171:
select c2, c2 from ft1 where c2 > 6 group by 1, 2 order by sum(c1);
-- Testing HAVING clause shippability
--Testcase 172:
explain (verbose, costs off)
select c2, sum(c1) from ft2 group by c2 having avg(c1) < 500 and sum(c1) < 49800 order by c2;
--Testcase 173:
select c2, sum(c1) from ft2 group by c2 having avg(c1) < 500 and sum(c1) < 49800 order by c2;
-- Unshippable HAVING clause will be evaluated locally, and other qual in HAVING clause is pushed down
--Testcase 174:
explain (verbose, costs off)
select count(*) from (select c5, count(c1) from ft1 group by c5, sqrt(c2) having (avg(c1) / avg(c1)) * random() <= 1 and avg(c1) < 500) x;
--Testcase 175:
select count(*) from (select c5, count(c1) from ft1 group by c5, sqrt(c2) having (avg(c1) / avg(c1)) * random() <= 1 and avg(c1) < 500) x;
-- Aggregate in HAVING clause is not pushable, and thus aggregation is not pushed down
--Testcase 176:
explain (verbose, costs off)
select sum(c1) from ft1 group by c2 having avg(c1 * (random() <= 1)::int) > 100 order by 1;
-- Remote aggregate in combination with a local Param (for the output
-- of an initplan) can be trouble, per bug #15781
--Testcase 518:
explain (verbose, costs off)
select exists(select 1 from pg_enum), sum(c1) from ft1;
--Testcase 519:
select exists(select 1 from pg_enum), sum(c1) from ft1;
--Testcase 520:
explain (verbose, costs off)
select exists(select 1 from pg_enum), sum(c1) from ft1 group by 1;
--Testcase 521:
select exists(select 1 from pg_enum), sum(c1) from ft1 group by 1;
-- Testing ORDER BY, DISTINCT, FILTER, Ordered-sets and VARIADIC within aggregates
-- ORDER BY within aggregate, same column used to order
--Testcase 177:
explain (verbose, costs off)
select array_agg(c1 order by c1) from ft1 where c1 < 100 group by c2 order by 1;
--Testcase 178:
select array_agg(c1 order by c1) from ft1 where c1 < 100 group by c2 order by 1;
-- ORDER BY within aggregate, different column used to order also using DESC
--Testcase 179:
explain (verbose, costs off)
select array_agg(c5 order by c1 desc) from ft2 where c2 = 6 and c1 < 50;
--Testcase 180:
select array_agg(c5 order by c1 desc) from ft2 where c2 = 6 and c1 < 50;
-- DISTINCT within aggregate
--Testcase 181:
explain (verbose, costs off)
select array_agg(distinct (t1.c1)%5) from ft4 t1 full join ft5 t2 on (t1.c1 = t2.c1) where t1.c1 < 20 or (t1.c1 is null and t2.c1 < 5) group by (t2.c1)%3 order by 1;
--Testcase 182:
select array_agg(distinct (t1.c1)%5) from ft4 t1 full join ft5 t2 on (t1.c1 = t2.c1) where t1.c1 < 20 or (t1.c1 is null and t2.c1 < 5) group by (t2.c1)%3 order by 1;
-- DISTINCT combined with ORDER BY within aggregate
--Testcase 183:
explain (verbose, costs off)
select array_agg(distinct (t1.c1)%5 order by (t1.c1)%5) from ft4 t1 full join ft5 t2 on (t1.c1 = t2.c1) where t1.c1 < 20 or (t1.c1 is null and t2.c1 < 5) group by (t2.c1)%3 order by 1;
--Testcase 184:
select array_agg(distinct (t1.c1)%5 order by (t1.c1)%5) from ft4 t1 full join ft5 t2 on (t1.c1 = t2.c1) where t1.c1 < 20 or (t1.c1 is null and t2.c1 < 5) group by (t2.c1)%3 order by 1;
--Testcase 185:
explain (verbose, costs off)
select array_agg(distinct (t1.c1)%5 order by (t1.c1)%5 desc nulls last) from ft4 t1 full join ft5 t2 on (t1.c1 = t2.c1) where t1.c1 < 20 or (t1.c1 is null and t2.c1 < 5) group by (t2.c1)%3 order by 1;
--Testcase 186:
select array_agg(distinct (t1.c1)%5 order by (t1.c1)%5 desc nulls last) from ft4 t1 full join ft5 t2 on (t1.c1 = t2.c1) where t1.c1 < 20 or (t1.c1 is null and t2.c1 < 5) group by (t2.c1)%3 order by 1;
-- FILTER within aggregate
--Testcase 187:
explain (verbose, costs off)
select sum(c1) filter (where c1 < 100 and c2 > 5) from ft1 group by c2 order by 1 nulls last;
--Testcase 188:
select sum(c1) filter (where c1 < 100 and c2 > 5) from ft1 group by c2 order by 1 nulls last;
-- DISTINCT, ORDER BY and FILTER within aggregate
--Testcase 189:
explain (verbose, costs off)
select sum(c1%3), sum(distinct c1%3 order by c1%3) filter (where c1%3 < 2), c2 from ft1 where c2 = 6 group by c2;
--Testcase 190:
select sum(c1%3), sum(distinct c1%3 order by c1%3) filter (where c1%3 < 2), c2 from ft1 where c2 = 6 group by c2;
-- Outer query is aggregation query
--Testcase 191:
explain (verbose, costs off)
select distinct (select count(*) filter (where t2.c2 = 6 and t2.c1 < 10) from ft1 t1 where t1.c1 = 6) from ft2 t2 where t2.c2 % 6 = 0 order by 1;
--Testcase 192:
select distinct (select count(*) filter (where t2.c2 = 6 and t2.c1 < 10) from ft1 t1 where t1.c1 = 6) from ft2 t2 where t2.c2 % 6 = 0 order by 1;
-- Inner query is aggregation query
--Testcase 193:
explain (verbose, costs off)
select distinct (select count(t1.c1) filter (where t2.c2 = 6 and t2.c1 < 10) from ft1 t1 where t1.c1 = 6) from ft2 t2 where t2.c2 % 6 = 0 order by 1;
--Testcase 194:
select distinct (select count(t1.c1) filter (where t2.c2 = 6 and t2.c1 < 10) from ft1 t1 where t1.c1 = 6) from ft2 t2 where t2.c2 % 6 = 0 order by 1;
-- Aggregate not pushed down as FILTER condition is not pushable
--Testcase 195:
explain (verbose, costs off)
select sum(c1) filter (where (c1 / c1) * random() <= 1) from ft1 group by c2 order by 1;
--Testcase 196:
explain (verbose, costs off)
select sum(c2) filter (where c2 in (select c2 from ft1 where c2 < 5)) from ft1;
-- Ordered-sets within aggregate
--Testcase 197:
explain (verbose, costs off)
select c2, rank('10'::varchar) within group (order by c6), percentile_cont(c2/10::numeric) within group (order by c1) from ft1 where c2 < 10 group by c2 having percentile_cont(c2/10::numeric) within group (order by c1) < 500 order by c2;
--Testcase 198:
select c2, rank('10'::varchar) within group (order by c6), percentile_cont(c2/10::numeric) within group (order by c1) from ft1 where c2 < 10 group by c2 having percentile_cont(c2/10::numeric) within group (order by c1) < 500 order by c2;
-- Using multiple arguments within aggregates
--Testcase 199:
explain (verbose, costs off)
select c1, rank(c1, c2) within group (order by c1, c2) from ft1 group by c1, c2 having c1 = 6 order by 1;
--Testcase 200:
select c1, rank(c1, c2) within group (order by c1, c2) from ft1 group by c1, c2 having c1 = 6 order by 1;
-- User defined function for user defined aggregate, VARIADIC
--Testcase 522:
create function least_accum(anyelement, variadic anyarray)
returns anyelement language sql as
'select least($1, min($2[i])) from generate_subscripts($2,1) g(i)';
--Testcase 523:
create aggregate least_agg(variadic items anyarray) (
stype = anyelement, sfunc = least_accum
);
-- Disable hash aggregation for plan stability.
set enable_hashagg to false;
-- Not pushed down due to user defined aggregate
--Testcase 524:
explain (verbose, costs off)
select c2, least_agg(c1) from ft1 group by c2 order by c2;
-- Add function and aggregate into extension
--alter extension postgres_fdw add function least_accum(anyelement, variadic anyarray);
--alter extension postgres_fdw add aggregate least_agg(variadic items anyarray);
--alter server loopback options (set extensions 'postgres_fdw');
-- Now aggregate will be pushed. Aggregate will display VARIADIC argument.
--Testcase 525:
explain (verbose, costs off)
select c2, least_agg(c1) from ft1 where c2 < 100 group by c2 order by c2;
--Testcase 526:
select c2, least_agg(c1) from ft1 where c2 < 100 group by c2 order by c2;
-- Remove function and aggregate from extension
--alter extension postgres_fdw drop function least_accum(anyelement, variadic anyarray);
--alter extension postgres_fdw drop aggregate least_agg(variadic items anyarray);
--alter server loopback options (set extensions 'postgres_fdw');
-- Not pushed down as we have dropped objects from extension.
--Testcase 527:
explain (verbose, costs off)
select c2, least_agg(c1) from ft1 group by c2 order by c2;
-- Cleanup
reset enable_hashagg;
--Testcase 528:
drop aggregate least_agg(variadic items anyarray);
--Testcase 529:
drop function least_accum(anyelement, variadic anyarray);
-- Testing USING OPERATOR() in ORDER BY within aggregate.
-- For this, we need user defined operators along with operator family and
-- operator class. Create those and then add them in extension. Note that
-- user defined objects are considered unshippable unless they are part of
-- the extension.
--Testcase 530:
create operator public.<^ (
leftarg = int4,
rightarg = int4,
procedure = int4eq
);
--Testcase 531:
create operator public.=^ (
leftarg = int4,
rightarg = int4,
procedure = int4lt
);
--Testcase 532:
create operator public.>^ (
leftarg = int4,
rightarg = int4,
procedure = int4gt
);
--Testcase 533:
create operator family my_op_family using btree;
--Testcase 534:
create function my_op_cmp(a int, b int) returns int as
$$begin return btint4cmp(a, b); end $$ language plpgsql;
--Testcase 535:
create operator class my_op_class for type int using btree family my_op_family as
operator 1 public.<^,
operator 3 public.=^,
operator 5 public.>^,
function 1 my_op_cmp(int, int);
-- This will not be pushed as user defined sort operator is not part of the
-- extension yet.
--Testcase 536:
explain (verbose, costs off)
select array_agg(c1 order by c1 using operator(public.<^)) from ft2 where c2 = 6 and c1 < 100 group by c2;
-- Update local stats on ft2
--ANALYZE ft2;
-- Add into extension
alter extension duckdb_fdw add operator class my_op_class using btree;
alter extension duckdb_fdw add function my_op_cmp(a int, b int);
alter extension duckdb_fdw add operator family my_op_family using btree;
alter extension duckdb_fdw add operator public.<^(int, int);
alter extension duckdb_fdw add operator public.=^(int, int);
alter extension duckdb_fdw add operator public.>^(int, int);
--alter server loopback options (set extensions 'postgres_fdw');
-- Now this will be pushed as sort operator is part of the extension.
--Testcase 537:
explain (verbose, costs off)
select array_agg(c1 order by c1 using operator(public.<^)) from ft2 where c2 = 6 and c1 < 100 group by c2;
--Testcase 538:
select array_agg(c1 order by c1 using operator(public.<^)) from ft2 where c2 = 6 and c1 < 100 group by c2;
-- Remove from extension
alter extension duckdb_fdw drop operator class my_op_class using btree;
alter extension duckdb_fdw drop function my_op_cmp(a int, b int);
alter extension duckdb_fdw drop operator family my_op_family using btree;
alter extension duckdb_fdw drop operator public.<^(int, int);
alter extension duckdb_fdw drop operator public.=^(int, int);
alter extension duckdb_fdw drop operator public.>^(int, int);
--alter server loopback options (set extensions 'postgres_fdw');
-- This will not be pushed as sort operator is now removed from the extension.
--Testcase 539:
explain (verbose, costs off)
select array_agg(c1 order by c1 using operator(public.<^)) from ft2 where c2 = 6 and c1 < 100 group by c2;
-- Cleanup
--Testcase 540:
drop operator class my_op_class using btree;
--Testcase 541:
drop function my_op_cmp(a int, b int);
--Testcase 542:
drop operator family my_op_family using btree;
--Testcase 543:
drop operator public.>^(int, int);
--Testcase 544:
drop operator public.=^(int, int);
--Testcase 545:
drop operator public.<^(int, int);
-- Input relation to aggregate push down hook is not safe to pushdown and thus
-- the aggregate cannot be pushed down to foreign server.
--Testcase 201:
explain (verbose, costs off)
select count(t1.c3) from ft2 t1 left join ft2 t2 on (t1.c1 = random() * t2.c2);
-- Subquery in FROM clause having aggregate
--Testcase 202:
explain (verbose, costs off)
select count(*), x.b from ft1, (select c2 a, sum(c1) b from ft1 group by c2) x where ft1.c2 = x.a group by x.b order by 1, 2;
--Testcase 203:
select count(*), x.b from ft1, (select c2 a, sum(c1) b from ft1 group by c2) x where ft1.c2 = x.a group by x.b order by 1, 2;
-- FULL join with IS NULL check in HAVING
--Testcase 204:
explain (verbose, costs off)
select avg(t1.c1), sum(t2.c1) from ft4 t1 full join ft5 t2 on (t1.c1 = t2.c1) group by t2.c1 having (avg(t1.c1) is null and sum(t2.c1) < 10) or sum(t2.c1) is null order by 1 nulls last, 2;
--Testcase 205:
select avg(t1.c1), sum(t2.c1) from ft4 t1 full join ft5 t2 on (t1.c1 = t2.c1) group by t2.c1 having (avg(t1.c1) is null and sum(t2.c1) < 10) or sum(t2.c1) is null order by 1 nulls last, 2;
-- Aggregate over FULL join needing to deparse the joining relations as
-- subqueries.
--Testcase 206:
explain (verbose, costs off)
select count(*), sum(t1.c1), avg(t2.c1) from (select c1 from ft4 where c1 between 50 and 60) t1 full join (select c1 from ft5 where c1 between 50 and 60) t2 on (t1.c1 = t2.c1);
--Testcase 207:
select count(*), sum(t1.c1), avg(t2.c1) from (select c1 from ft4 where c1 between 50 and 60) t1 full join (select c1 from ft5 where c1 between 50 and 60) t2 on (t1.c1 = t2.c1);
-- ORDER BY expression is part of the target list but not pushed down to
-- foreign server.
--Testcase 208:
explain (verbose, costs off)
select sum(c2) * (random() <= 1)::int as sum from ft1 order by 1;
--Testcase 209:
select sum(c2) * (random() <= 1)::int as sum from ft1 order by 1;
-- LATERAL join, with parameterization
set enable_hashagg to false;
--Testcase 210:
explain (verbose, costs off)
select c2, sum from "S 1"."T 1" t1, lateral (select sum(t2.c1 + t1."C 1") sum from ft2 t2 group by t2.c1) qry where t1.c2 * 2 = qry.sum and t1.c2 < 3 and t1."C 1" < 100 order by 1;
--Testcase 211:
select c2, sum from "S 1"."T 1" t1, lateral (select sum(t2.c1 + t1."C 1") sum from ft2 t2 group by t2.c1) qry where t1.c2 * 2 = qry.sum and t1.c2 < 3 and t1."C 1" < 100 order by 1;
reset enable_hashagg;
-- bug #15613: bad plan for foreign table scan with lateral reference
--Testcase 546:
EXPLAIN (VERBOSE, COSTS OFF)
SELECT ref_0.c2, subq_1.*
FROM
"S 1"."T 1" AS ref_0,
LATERAL (
SELECT ref_0."C 1" c1, subq_0.*
FROM (SELECT ref_0.c2, ref_1.c3
FROM ft1 AS ref_1) AS subq_0
RIGHT JOIN ft2 AS ref_3 ON (subq_0.c3 = ref_3.c3)
) AS subq_1
WHERE ref_0."C 1" < 10 AND subq_1.c3 = '00001'
ORDER BY ref_0."C 1";
--Testcase 547:
SELECT ref_0.c2, subq_1.*
FROM
"S 1"."T 1" AS ref_0,
LATERAL (
SELECT ref_0."C 1" c1, subq_0.*
FROM (SELECT ref_0.c2, ref_1.c3
FROM ft1 AS ref_1) AS subq_0
RIGHT JOIN ft2 AS ref_3 ON (subq_0.c3 = ref_3.c3)
) AS subq_1
WHERE ref_0."C 1" < 10 AND subq_1.c3 = '00001'
ORDER BY ref_0."C 1";
-- Check with placeHolderVars
--Testcase 212:
explain (verbose, costs off)
select sum(q.a), count(q.b) from ft4 left join (select 13, avg(ft1.c1), sum(ft2.c1) from ft1 right join ft2 on (ft1.c1 = ft2.c1)) q(a, b, c) on (ft4.c1 <= q.b);
--Testcase 213:
select sum(q.a), count(q.b) from ft4 left join (select 13, avg(ft1.c1), sum(ft2.c1) from ft1 right join ft2 on (ft1.c1 = ft2.c1)) q(a, b, c) on (ft4.c1 <= q.b);
-- Not supported cases
-- Grouping sets
--Testcase 214:
explain (verbose, costs off)
select c2, sum(c1) from ft1 where c2 < 3 group by rollup(c2) order by 1 nulls last;
--Testcase 215:
select c2, sum(c1) from ft1 where c2 < 3 group by rollup(c2) order by 1 nulls last;
--Testcase 216:
explain (verbose, costs off)
select c2, sum(c1) from ft1 where c2 < 3 group by cube(c2) order by 1 nulls last;
--Testcase 217:
select c2, sum(c1) from ft1 where c2 < 3 group by cube(c2) order by 1 nulls last;
--Testcase 218:
explain (verbose, costs off)
select c2, c6, sum(c1) from ft1 where c2 < 3 group by grouping sets(c2, c6) order by 1 nulls last, 2 nulls last;
--Testcase 219:
select c2, c6, sum(c1) from ft1 where c2 < 3 group by grouping sets(c2, c6) order by 1 nulls last, 2 nulls last;
--Testcase 220:
explain (verbose, costs off)
select c2, sum(c1), grouping(c2) from ft1 where c2 < 3 group by c2 order by 1 nulls last;
--Testcase 221:
select c2, sum(c1), grouping(c2) from ft1 where c2 < 3 group by c2 order by 1 nulls last;
-- DISTINCT itself is not pushed down, whereas underneath aggregate is pushed
--Testcase 222:
explain (verbose, costs off)
select distinct sum(c1)/1000 s from ft2 where c2 < 6 group by c2 order by 1;
--Testcase 223:
select distinct sum(c1)/1000 s from ft2 where c2 < 6 group by c2 order by 1;
-- WindowAgg
--Testcase 224:
explain (verbose, costs off)
select c2, sum(c2), count(c2) over (partition by c2%2) from ft2 where c2 < 10 group by c2 order by 1;
--Testcase 225:
select c2, sum(c2), count(c2) over (partition by c2%2) from ft2 where c2 < 10 group by c2 order by 1;
--Testcase 226:
explain (verbose, costs off)
select c2, array_agg(c2) over (partition by c2%2 order by c2 desc) from ft1 where c2 < 10 group by c2 order by 1;
--Testcase 227:
select c2, array_agg(c2) over (partition by c2%2 order by c2 desc) from ft1 where c2 < 10 group by c2 order by 1;
--Testcase 228:
explain (verbose, costs off)
select c2, array_agg(c2) over (partition by c2%2 order by c2 range between current row and unbounded following) from ft1 where c2 < 10 group by c2 order by 1;
--Testcase 229:
select c2, array_agg(c2) over (partition by c2%2 order by c2 range between current row and unbounded following) from ft1 where c2 < 10 group by c2 order by 1;
-- ===================================================================
-- parameterized queries
-- ===================================================================
-- simple join
--Testcase 230:
PREPARE st1(int, int) AS SELECT t1.c3, t2.c3 FROM ft1 t1, ft2 t2 WHERE t1.c1 = $1 AND t2.c1 = $2;
--Testcase 231:
EXPLAIN (VERBOSE, COSTS OFF) EXECUTE st1(1, 2);
--Testcase 232:
EXECUTE st1(1, 1);
--Testcase 233:
EXECUTE st1(101, 101);
-- subquery using stable function (can't be sent to remote)
--Testcase 234:
PREPARE st2(int) AS SELECT * FROM ft1 t1 WHERE t1.c1 < $2 AND t1.c3 IN (SELECT c3 FROM ft2 t2 WHERE c1 > $1 AND date(c4) = '1970-01-17'::date) ORDER BY c1;
--Testcase 235:
EXPLAIN (VERBOSE, COSTS OFF) EXECUTE st2(10, 20);
--Testcase 236:
EXECUTE st2(10, 20);
--Testcase 237:
EXECUTE st2(101, 121);
-- subquery using immutable function (can be sent to remote)
--Testcase 238:
PREPARE st3(int) AS SELECT * FROM ft1 t1 WHERE t1.c1 < $2 AND t1.c3 IN (SELECT c3 FROM ft2 t2 WHERE c1 > $1 AND date(c5) = '1970-01-17'::date) ORDER BY c1;
--Testcase 239:
EXPLAIN (VERBOSE, COSTS OFF) EXECUTE st3(10, 20);
--Testcase 240:
EXECUTE st3(10, 20);
--Testcase 241:
EXECUTE st3(20, 30);
-- custom plan should be chosen initially
--Testcase 242:
PREPARE st4(int) AS SELECT * FROM ft1 t1 WHERE t1.c1 = $1;
--Testcase 243:
EXPLAIN (VERBOSE, COSTS OFF) EXECUTE st4(1);
--Testcase 244:
EXPLAIN (VERBOSE, COSTS OFF) EXECUTE st4(1);
--Testcase 245:
EXPLAIN (VERBOSE, COSTS OFF) EXECUTE st4(1);
--Testcase 246:
EXPLAIN (VERBOSE, COSTS OFF) EXECUTE st4(1);
--Testcase 247:
EXPLAIN (VERBOSE, COSTS OFF) EXECUTE st4(1);
-- once we try it enough times, should switch to generic plan
--Testcase 248:
EXPLAIN (VERBOSE, COSTS OFF) EXECUTE st4(1);
-- value of $1 should not be sent to remote
--Testcase 249:
PREPARE st5(text,int) AS SELECT * FROM ft1 t1 WHERE c8 = $1 and c1 = $2;
--Testcase 250:
EXPLAIN (VERBOSE, COSTS OFF) EXECUTE st5('foo', 1);
--Testcase 251:
EXPLAIN (VERBOSE, COSTS OFF) EXECUTE st5('foo', 1);
--Testcase 252:
EXPLAIN (VERBOSE, COSTS OFF) EXECUTE st5('foo', 1);
--Testcase 253:
EXPLAIN (VERBOSE, COSTS OFF) EXECUTE st5('foo', 1);
--Testcase 254:
EXPLAIN (VERBOSE, COSTS OFF) EXECUTE st5('foo', 1);
--Testcase 255:
EXPLAIN (VERBOSE, COSTS OFF) EXECUTE st5('foo', 1);
--Testcase 256:
EXECUTE st5('foo', 1);
-- altering FDW options requires replanning
--Testcase 257:
PREPARE st6 AS SELECT * FROM ft1 t1 WHERE t1.c1 = t1.c2;
--Testcase 258:
EXPLAIN (VERBOSE, COSTS OFF) EXECUTE st6;
--Testcase 259:
PREPARE st7 AS INSERT INTO ft1 (c1,c2,c3) VALUES (1001,101,'foo');
--Testcase 260:
EXPLAIN (VERBOSE, COSTS OFF) EXECUTE st7;
--Testcase 548:
INSERT INTO "S 1"."T 0" SELECT * FROM "S 1"."T 1";
ALTER FOREIGN TABLE ft1 OPTIONS (SET table 'T 0');
--Testcase 261:
EXPLAIN (VERBOSE, COSTS OFF) EXECUTE st6;
--Testcase 262:
EXECUTE st6;
--Testcase 263:
EXPLAIN (VERBOSE, COSTS OFF) EXECUTE st7;
ALTER FOREIGN TABLE ft1 OPTIONS (SET table 'T 1');
--Testcase 549:
PREPARE st8 AS SELECT count(c3) FROM ft1 t1 WHERE t1.c1 === t1.c2;
--Testcase 550:
EXPLAIN (VERBOSE, COSTS OFF) EXECUTE st8;
--ALTER SERVER loopback OPTIONS (DROP extensions);
--Testcase 551:
EXPLAIN (VERBOSE, COSTS OFF) EXECUTE st8;
--Testcase 552:
EXECUTE st8;
--ALTER SERVER loopback OPTIONS (ADD extensions 'postgres_fdw');
-- cleanup
DEALLOCATE st1;
DEALLOCATE st2;
DEALLOCATE st3;
DEALLOCATE st4;
DEALLOCATE st5;
DEALLOCATE st6;
DEALLOCATE st7;
DEALLOCATE st8;
-- System columns, except ctid and oid, should not be sent to remote
--Testcase 264:
EXPLAIN (VERBOSE, COSTS OFF)
SELECT * FROM ft1 t1 WHERE t1.tableoid = 'pg_class'::regclass LIMIT 1;
--Testcase 265:
SELECT * FROM ft1 t1 WHERE t1.tableoid = 'ft1'::regclass LIMIT 1;
--Testcase 266:
EXPLAIN (VERBOSE, COSTS OFF)
SELECT tableoid::regclass, * FROM ft1 t1 LIMIT 1;
--Testcase 267:
SELECT tableoid::regclass, * FROM ft1 t1 LIMIT 1;
--Testcase 268:
EXPLAIN (VERBOSE, COSTS OFF)
SELECT * FROM ft1 t1 WHERE t1.ctid = '(0,2)';
--Testcase 553:
SELECT * FROM ft1 t1 WHERE t1.ctid = '(0,2)';
--Testcase 554:
EXPLAIN (VERBOSE, COSTS OFF)
SELECT ctid, * FROM ft1 t1 LIMIT 1;
--Testcase 271:
SELECT ctid, * FROM ft1 t1 LIMIT 1;
-- ===================================================================
-- used in PL/pgSQL function
-- ===================================================================
--Testcase 555:
CREATE OR REPLACE FUNCTION f_test(p_c1 int) RETURNS int AS $$
DECLARE
v_c1 int;
BEGIN
--Testcase 556:
SELECT c1 INTO v_c1 FROM ft1 WHERE c1 = p_c1 LIMIT 1;
PERFORM c1 FROM ft1 WHERE c1 = p_c1 AND p_c1 = v_c1 LIMIT 1;
RETURN v_c1;
END;
$$ LANGUAGE plpgsql;
--Testcase 272:
SELECT f_test(100);
--Testcase 557:
DROP FUNCTION f_test(int);
-- ===================================================================
-- conversion error
-- ===================================================================
ALTER FOREIGN TABLE ft1 ALTER COLUMN c8 TYPE int;
--Testcase 273:
SELECT * FROM ft1 WHERE c1 = 1;
--Testcase 274:
SELECT ft1.c1, ft2.c2, ft1.c8 FROM ft1, ft2 WHERE ft1.c1 = ft2.c1 AND ft1.c1 = 1;
--Testcase 275:
SELECT ft1.c1, ft2.c2, ft1 FROM ft1, ft2 WHERE ft1.c1 = ft2.c1 AND ft1.c1 = 1;
--Testcase 276:
SELECT sum(c2), array_agg(c8) FROM ft1 GROUP BY c8;
ALTER FOREIGN TABLE ft1 ALTER COLUMN c8 TYPE text;
-- ===================================================================
-- subtransaction
-- + local/remote error doesn't break cursor
-- ===================================================================
BEGIN;
DECLARE c CURSOR FOR SELECT * FROM ft1 ORDER BY c1;
--Testcase 277:
FETCH c;
SAVEPOINT s;
ERROR OUT; -- ERROR
ROLLBACK TO s;
--Testcase 278:
FETCH c;
SAVEPOINT s;
--Testcase 279:
SELECT * FROM ft1 WHERE 1 / (c1 - 1) > 0; -- ERROR
ROLLBACK TO s;
--Testcase 280:
FETCH c;
--Testcase 281:
SELECT * FROM ft1 ORDER BY c1 LIMIT 1;
COMMIT;
-- ===================================================================
-- test handling of collations
-- ===================================================================
--Testcase 558:
create foreign table ft3 (f1 text collate "C", f2 text, f3 varchar(10)) server sqlite_svr;
-- can be sent to remote
--Testcase 559:
explain (verbose, costs off) select * from ft3 where f1 = 'foo';
--Testcase 560:
explain (verbose, costs off) select * from ft3 where f1 COLLATE "C" = 'foo';
--Testcase 561:
explain (verbose, costs off) select * from ft3 where f2 = 'foo';
--Testcase 562:
explain (verbose, costs off) select * from ft3 where f3 = 'foo';
--Testcase 563:
explain (verbose, costs off) select * from ft3 f, loct3 l
where f.f3 = l.f3 and l.f1 = 'foo';
-- can't be sent to remote
--Testcase 564:
explain (verbose, costs off) select * from ft3 where f1 COLLATE "POSIX" = 'foo';
--Testcase 565:
explain (verbose, costs off) select * from ft3 where f1 = 'foo' COLLATE "C";
--Testcase 566:
explain (verbose, costs off) select * from ft3 where f2 COLLATE "C" = 'foo';
--Testcase 567:
explain (verbose, costs off) select * from ft3 where f2 = 'foo' COLLATE "C";
--Testcase 568:
explain (verbose, costs off) select * from ft3 f, loct3 l
where f.f3 = l.f3 COLLATE "POSIX" and l.f1 = 'foo';
-- ===================================================================
-- test writable foreign table stuff
-- ===================================================================
--Testcase 282:
EXPLAIN (verbose, costs off)
INSERT INTO ft2 (c1,c2,c3) SELECT c1+1000,c2+100, c3 || c3 FROM ft2 LIMIT 20;
--Testcase 283:
INSERT INTO ft2 (c1,c2,c3) SELECT c1+1000,c2+100, c3 || c3 FROM ft2 LIMIT 20;
--Testcase 284:
INSERT INTO ft2 (c1,c2,c3) VALUES (1101,201,'aaa'), (1102,202,'bbb'), (1103,203,'ccc');
--Testcase 285:
SELECT * FROM ft2 WHERE c1 >= 1101;
--Testcase 286:
INSERT INTO ft2 (c1,c2,c3) VALUES (1104,204,'ddd'), (1105,205,'eee');
--Testcase 287:
EXPLAIN (verbose, costs off)
UPDATE ft2 SET c2 = c2 + 300, c3 = c3 || '_update3' WHERE c1 % 10 = 3; -- can be pushed down
--Testcase 288:
UPDATE ft2 SET c2 = c2 + 300, c3 = c3 || '_update3' WHERE c1 % 10 = 3;
--Testcase 289:
EXPLAIN (verbose, costs off)
UPDATE ft2 SET c2 = c2 + 400, c3 = c3 || '_update7' WHERE c1 % 10 = 7; -- can be pushed down
--Testcase 290:
UPDATE ft2 SET c2 = c2 + 400, c3 = c3 || '_update7' WHERE c1 % 10 = 7;
--Testcase 291:
SELECT * FROM ft2 WHERE c1 % 10 = 7;
--Testcase 292:
EXPLAIN (verbose, costs off)
UPDATE ft2 SET c2 = ft2.c2 + 500, c3 = ft2.c3 || '_update9', c7 = DEFAULT
FROM ft1 WHERE ft1.c1 = ft2.c2 AND ft1.c1 % 10 = 9; -- can be pushed down
--Testcase 293:
UPDATE ft2 SET c2 = ft2.c2 + 500, c3 = ft2.c3 || '_update9', c7 = DEFAULT
FROM ft1 WHERE ft1.c1 = ft2.c2 AND ft1.c1 % 10 = 9;
--Testcase 294:
EXPLAIN (verbose, costs off)
DELETE FROM ft2 WHERE c1 % 10 = 5; -- can be pushed down
--Testcase 295:
SELECT c1, c4 FROM ft2 WHERE c1 % 10 = 5;
--Testcase 569:
DELETE FROM ft2 WHERE c1 % 10 = 5;
--Testcase 297:
EXPLAIN (verbose, costs off)
DELETE FROM ft2 USING ft1 WHERE ft1.c1 = ft2.c2 AND ft1.c1 % 10 = 2; -- can be pushed down
--Testcase 298:
DELETE FROM ft2 USING ft1 WHERE ft1.c1 = ft2.c2 AND ft1.c1 % 10 = 2;
--Testcase 299:
SELECT c1,c2,c3,c4 FROM ft2 ORDER BY c1;
--Testcase 300:
EXPLAIN (verbose, costs off)
INSERT INTO ft2 (c1,c2,c3) VALUES (1200,999,'foo');
--Testcase 301:
INSERT INTO ft2 (c1,c2,c3) VALUES (1200,999,'foo');
--Testcase 302:
EXPLAIN (verbose, costs off)
UPDATE ft2 SET c3 = 'bar' WHERE c1 = 1200; -- can be pushed down
--Testcase 303:
UPDATE ft2 SET c3 = 'bar' WHERE c1 = 1200;
--Testcase 304:
EXPLAIN (verbose, costs off)
DELETE FROM ft2 WHERE c1 = 1200; -- can be pushed down
--Testcase 305:
DELETE FROM ft2 WHERE c1 = 1200;
-- Test UPDATE/DELETE on a three-table join
--Testcase 306:
INSERT INTO ft2 (c1,c2,c3)
SELECT id, id - 1200, to_char(id, 'FM00000') FROM generate_series(1201, 1300) id;
--Testcase 307:
EXPLAIN (verbose, costs off)
UPDATE ft2 SET c3 = 'foo'
FROM ft4 INNER JOIN ft5 ON (ft4.c1 = ft5.c1)
WHERE ft2.c1 > 1200 AND ft2.c2 = ft4.c1; -- can be pushed down
--Testcase 308:
UPDATE ft2 SET c3 = 'foo'
FROM ft4 INNER JOIN ft5 ON (ft4.c1 = ft5.c1)
WHERE ft2.c1 > 1200 AND ft2.c2 = ft4.c1;
--Testcase 309:
SELECT ft2, ft2.*, ft4, ft4.*
FROM ft2 INNER JOIN ft4 ON (ft2.c1 > 1200 AND ft2.c2 = ft4.c1)
INNER JOIN ft5 ON (ft4.c1 = ft5.c1);
--Testcase 310:
EXPLAIN (verbose, costs off)
DELETE FROM ft2
USING ft4 LEFT JOIN ft5 ON (ft4.c1 = ft5.c1)
WHERE ft2.c1 > 1200 AND ft2.c1 % 10 = 0 AND ft2.c2 = ft4.c1; -- can be pushed down
--Testcase 311:
SELECT 100 FROM ft2, ft4 LEFT JOIN ft5 ON (ft4.c1 = ft5.c1)
WHERE ft2.c1 > 1200 AND ft2.c1 % 10 = 0 AND ft2.c2 = ft4.c1;
--Testcase 570:
DELETE FROM ft2
USING ft4 LEFT JOIN ft5 ON (ft4.c1 = ft5.c1)
WHERE ft2.c1 > 1200 AND ft2.c1 % 10 = 0 AND ft2.c2 = ft4.c1;
--Testcase 312:
DELETE FROM ft2 WHERE ft2.c1 > 1200;
-- Test UPDATE with a MULTIEXPR sub-select
-- (maybe someday this'll be remotely executable, but not today)
--Testcase 571:
EXPLAIN (verbose, costs off)
UPDATE ft2 AS target SET (c2, c7) = (
SELECT c2 * 10, c7
FROM ft2 AS src
WHERE target.c1 = src.c1
) WHERE c1 > 1100;
--Testcase 572:
UPDATE ft2 AS target SET (c2, c7) = (
SELECT c2 * 10, c7
FROM ft2 AS src
WHERE target.c1 = src.c1
) WHERE c1 > 1100;
--Testcase 573:
UPDATE ft2 AS target SET (c2) = (
SELECT c2 / 10
FROM ft2 AS src
WHERE target.c1 = src.c1
) WHERE c1 > 1100;
-- Test UPDATE/DELETE with WHERE or JOIN/ON conditions containing
-- user-defined operators/functions
--ALTER SERVER loopback OPTIONS (DROP extensions);
--Testcase 574:
INSERT INTO ft2 (c1,c2,c3)
SELECT id, id % 10, to_char(id, 'FM00000') FROM generate_series(2001, 2010) id;
--Testcase 575:
EXPLAIN (verbose, costs off)
UPDATE ft2 SET c3 = 'bar' WHERE duckdb_fdw_abs(c1) > 2000; -- can't be pushed down
--Testcase 576:
UPDATE ft2 SET c3 = 'bar' WHERE duckdb_fdw_abs(c1) > 2000;
--Testcase 577:
SELECT * FROM ft2 WHERE duckdb_fdw_abs(c1) > 2000;
--Testcase 578:
EXPLAIN (verbose, costs off)
UPDATE ft2 SET c3 = 'baz'
FROM ft4 INNER JOIN ft5 ON (ft4.c1 = ft5.c1)
WHERE ft2.c1 > 2000 AND ft2.c2 === ft4.c1; -- can't be pushed down
--Testcase 579:
UPDATE ft2 SET c3 = 'baz'
FROM ft4 INNER JOIN ft5 ON (ft4.c1 = ft5.c1)
WHERE ft2.c1 > 2000 AND ft2.c2 === ft4.c1;
--Testcase 580:
SELECT ft2.*, ft4.*, ft5.*
FROM ft2, ft4 INNER JOIN ft5 ON (ft4.c1 = ft5.c1)
WHERE ft2.c1 > 2000 AND ft2.c2 === ft4.c1;
--Testcase 581:
EXPLAIN (verbose, costs off)
DELETE FROM ft2
USING ft4 INNER JOIN ft5 ON (ft4.c1 === ft5.c1)
WHERE ft2.c1 > 2000 AND ft2.c2 = ft4.c1; -- can't be pushed down
--Testcase 582:
SELECT ft2.c1, ft2.c2, ft2.c3 FROM ft2, ft4 INNER JOIN ft5 ON (ft4.c1 === ft5.c1)
WHERE ft2.c1 > 2000 AND ft2.c2 = ft4.c1; -- can't be pushed down
--Testcase 583:
DELETE FROM ft2
USING ft4 INNER JOIN ft5 ON (ft4.c1 === ft5.c1)
WHERE ft2.c1 > 2000 AND ft2.c2 = ft4.c1;
--Testcase 584:
DELETE FROM ft2 WHERE ft2.c1 > 2000;
--ALTER SERVER loopback OPTIONS (ADD extensions 'postgres_fdw');
-- Test that trigger on remote table works as expected
--Testcase 585:
CREATE OR REPLACE FUNCTION "S 1".F_BRTRIG() RETURNS trigger AS $$
BEGIN
NEW.c3 = NEW.c3 || '_trig_update';
RETURN NEW;
END;
$$ LANGUAGE plpgsql;
--Testcase 586:
CREATE TRIGGER t1_br_insert BEFORE INSERT OR UPDATE
ON ft2 FOR EACH ROW EXECUTE PROCEDURE "S 1".F_BRTRIG();
--Testcase 313:
INSERT INTO ft2 (c1,c2,c3) VALUES (1208, 818, 'fff');
--Testcase 314:
SELECT * FROM ft2 WHERE c1 = 1208;
--Testcase 315:
INSERT INTO ft2 (c1,c2,c3,c6) VALUES (1218, 818, 'ggg', '(--;');
--Testcase 316:
SELECT * FROM ft2 WHERE c1 = 1218;
--Testcase 317:
UPDATE ft2 SET c2 = c2 + 600, c3 = c3 WHERE c1 % 10 = 8 AND c1 < 1200;
--Testcase 318:
SELECT * FROM ft2 WHERE c1 % 10 = 8 AND c1 < 1200;
-- Test errors thrown on remote side during update
ALTER TABLE "S 1"."T 1" ADD CONSTRAINT c2positive CHECK (c2 >= 0);
--Testcase 319:
INSERT INTO ft1(c1, c2) VALUES(11, 12); -- duplicate key
--Testcase 320:
INSERT INTO ft1(c1, c2) VALUES(11, 12) ON CONFLICT (c1, c2) DO NOTHING; -- unsupported
--Testcase 321:
INSERT INTO ft1(c1, c2) VALUES(11, 12) ON CONFLICT (c1, c2) DO UPDATE SET c3 = 'ffg'; -- unsupported
-- skip these tests, sqlite fdw does not support CHECK constraint
--INSERT INTO ft1(c1, c2) VALUES(1111, -2); -- c2positive
--UPDATE ft1 SET c2 = -c2 WHERE c1 = 1; -- c2positive
-- Test savepoint/rollback behavior
--Testcase 322:
select c2, count(*) from ft2 where c2 < 500 group by 1 order by 1;
--Testcase 323:
select c2, count(*) from "S 1"."T 1" where c2 < 500 group by 1 order by 1;
begin;
--Testcase 324:
update ft2 set c2 = 42 where c2 = 0;
--Testcase 325:
select c2, count(*) from ft2 where c2 < 500 group by 1 order by 1;
savepoint s1;
--Testcase 326:
update ft2 set c2 = 44 where c2 = 4;
--Testcase 327:
select c2, count(*) from ft2 where c2 < 500 group by 1 order by 1;
release savepoint s1;
--Testcase 328:
select c2, count(*) from ft2 where c2 < 500 group by 1 order by 1;
savepoint s2;
--Testcase 329:
update ft2 set c2 = 46 where c2 = 6;
--Testcase 330:
select c2, count(*) from ft2 where c2 < 500 group by 1 order by 1;
rollback to savepoint s2;
--Testcase 331:
select c2, count(*) from ft2 where c2 < 500 group by 1 order by 1;
release savepoint s2;
--Testcase 332:
select c2, count(*) from ft2 where c2 < 500 group by 1 order by 1;
savepoint s3;
--Testcase 333:
--skip, does not support CHECK
--update ft2 set c2 = -2 where c2 = 42 and c1 = 10; -- fail on remote side
rollback to savepoint s3;
--Testcase 334:
select c2, count(*) from ft2 where c2 < 500 group by 1 order by 1;
release savepoint s3;
--Testcase 335:
select c2, count(*) from ft2 where c2 < 500 group by 1 order by 1;
-- none of the above is committed yet remotely
--Testcase 336:
select c2, count(*) from "S 1"."T 1" where c2 < 500 group by 1 order by 1;
commit;
--Testcase 337:
select c2, count(*) from ft2 where c2 < 500 group by 1 order by 1;
--Testcase 338:
select c2, count(*) from "S 1"."T 1" where c2 < 500 group by 1 order by 1;
--VACUUM ANALYZE "S 1"."T 1";
-- Above DMLs add data with c6 as NULL in ft1, so test ORDER BY NULLS LAST and NULLs
-- FIRST behavior here.
-- ORDER BY DESC NULLS LAST options
--Testcase 339:
EXPLAIN (VERBOSE, COSTS OFF) SELECT * FROM ft1 ORDER BY c6 DESC NULLS LAST, c1 OFFSET 795 LIMIT 10;
--Testcase 340:
SELECT * FROM ft1 ORDER BY c6 DESC NULLS LAST, c1 OFFSET 795 LIMIT 10;
-- ORDER BY DESC NULLS FIRST options
--Testcase 341:
EXPLAIN (VERBOSE, COSTS OFF) SELECT * FROM ft1 ORDER BY c6 DESC NULLS FIRST, c1 OFFSET 15 LIMIT 10;
--Testcase 342:
SELECT * FROM ft1 ORDER BY c6 DESC NULLS FIRST, c1 OFFSET 15 LIMIT 10;
-- ORDER BY ASC NULLS FIRST options
--Testcase 343:
EXPLAIN (VERBOSE, COSTS OFF) SELECT * FROM ft1 ORDER BY c6 ASC NULLS FIRST, c1 OFFSET 15 LIMIT 10;
--Testcase 344:
SELECT * FROM ft1 ORDER BY c6 ASC NULLS FIRST, c1 OFFSET 15 LIMIT 10;
-- ===================================================================
-- test check constraints
-- ===================================================================
-- Consistent check constraints provide consistent results
ALTER FOREIGN TABLE ft1 ADD CONSTRAINT ft1_c2positive CHECK (c2 >= 0);
--Testcase 587:
EXPLAIN (VERBOSE, COSTS OFF) SELECT count(*) FROM ft1 WHERE c2 < 0;
--Testcase 588:
SELECT count(*) FROM ft1 WHERE c2 < 0;
SET constraint_exclusion = 'on';
--Testcase 589:
EXPLAIN (VERBOSE, COSTS OFF) SELECT count(*) FROM ft1 WHERE c2 < 0;
--Testcase 590:
SELECT count(*) FROM ft1 WHERE c2 < 0;
RESET constraint_exclusion;
-- skip this test, does not support CHECK CONSTRAINT
-- check constraint is enforced on the remote side, not locally
--INSERT INTO ft1(c1, c2) VALUES(1111, -2); -- c2positive
--UPDATE ft1 SET c2 = -c2 WHERE c1 = 1; -- c2positive
ALTER FOREIGN TABLE ft1 DROP CONSTRAINT ft1_c2positive;
-- But inconsistent check constraints provide inconsistent results
ALTER FOREIGN TABLE ft1 ADD CONSTRAINT ft1_c2negative CHECK (c2 < 0);
--Testcase 591:
EXPLAIN (VERBOSE, COSTS OFF) SELECT count(*) FROM ft1 WHERE c2 >= 0;
--Testcase 592:
SELECT count(*) FROM ft1 WHERE c2 >= 0;
SET constraint_exclusion = 'on';
--Testcase 593:
EXPLAIN (VERBOSE, COSTS OFF) SELECT count(*) FROM ft1 WHERE c2 >= 0;
--Testcase 594:
SELECT count(*) FROM ft1 WHERE c2 >= 0;
RESET constraint_exclusion;
-- local check constraint is not actually enforced
--Testcase 595:
INSERT INTO ft1(c1, c2) VALUES(1111, 2);
--Testcase 596:
UPDATE ft1 SET c2 = c2 + 1 WHERE c1 = 1;
ALTER FOREIGN TABLE ft1 DROP CONSTRAINT ft1_c2negative;
-- ===================================================================
-- test WITH CHECK OPTION constraints
-- ===================================================================
--Testcase 597:
CREATE FUNCTION row_before_insupd_trigfunc() RETURNS trigger AS $$BEGIN NEW.a := NEW.a + 10; RETURN NEW; END$$ LANGUAGE plpgsql;
--Testcase 598:
CREATE FOREIGN TABLE foreign_tbl (a int OPTIONS (key 'true'), b int)
SERVER sqlite_svr;
--Testcase 599:
CREATE TRIGGER row_before_insupd_trigger BEFORE INSERT OR UPDATE ON foreign_tbl FOR EACH ROW EXECUTE PROCEDURE row_before_insupd_trigfunc();
--Testcase 600:
CREATE VIEW rw_view AS SELECT * FROM foreign_tbl
WHERE a < b WITH CHECK OPTION;
--Testcase 601:
\d+ rw_view
--Testcase 345:
EXPLAIN (VERBOSE, COSTS OFF)
INSERT INTO rw_view VALUES (0, 5);
--Testcase 602:
INSERT INTO rw_view VALUES (0, 5); -- should fail
--Testcase 603:
EXPLAIN (VERBOSE, COSTS OFF)
INSERT INTO rw_view VALUES (0, 15);
--Testcase 604:
INSERT INTO rw_view VALUES (0, 15); -- error
--Testcase 605:
SELECT * FROM foreign_tbl;
--Testcase 606:
EXPLAIN (VERBOSE, COSTS OFF)
UPDATE rw_view SET b = b + 5;
--Testcase 607:
UPDATE rw_view SET b = b + 5; -- should fail
--Testcase 608:
EXPLAIN (VERBOSE, COSTS OFF)
UPDATE rw_view SET b = b + 15;
--Testcase 609:
UPDATE rw_view SET b = b + 15; -- ok
--Testcase 610:
SELECT * FROM foreign_tbl;
--Testcase 611:
DROP FOREIGN TABLE foreign_tbl CASCADE;
--Testcase 612:
DROP TRIGGER row_before_insupd_trigger ON foreign_tbl;
-- test WCO for partitions
--Testcase 613:
CREATE FOREIGN TABLE foreign_tbl (a int OPTIONS (key 'true'), b int)
SERVER sqlite_svr;
--Testcase 614:
CREATE TRIGGER row_before_insupd_trigger BEFORE INSERT OR UPDATE ON foreign_tbl FOR EACH ROW EXECUTE PROCEDURE row_before_insupd_trigfunc();
--Testcase 615:
CREATE TABLE parent_tbl (a int, b int) PARTITION BY RANGE(a);
ALTER TABLE parent_tbl ATTACH PARTITION foreign_tbl FOR VALUES FROM (0) TO (100);
--Testcase 616:
CREATE VIEW rw_view AS SELECT * FROM parent_tbl
WHERE a < b WITH CHECK OPTION;
--Testcase 617:
\d+ rw_view
--Testcase 618:
EXPLAIN (VERBOSE, COSTS OFF)
INSERT INTO rw_view VALUES (0, 5);
--Testcase 619:
INSERT INTO rw_view VALUES (0, 5); -- should fail
--Testcase 620:
EXPLAIN (VERBOSE, COSTS OFF)
INSERT INTO rw_view VALUES (0, 15);
--Testcase 621:
INSERT INTO rw_view VALUES (0, 15); -- ok
--Testcase 622:
SELECT * FROM foreign_tbl;
--Testcase 623:
EXPLAIN (VERBOSE, COSTS OFF)
UPDATE rw_view SET b = b + 5;
--Testcase 624:
UPDATE rw_view SET b = b + 5; -- should fail
--Testcase 625:
EXPLAIN (VERBOSE, COSTS OFF)
UPDATE rw_view SET b = b + 15;
--Testcase 626:
UPDATE rw_view SET b = b + 15; -- ok
--Testcase 627:
SELECT * FROM foreign_tbl;
--Testcase 628:
DROP TRIGGER row_before_insupd_trigger ON foreign_tbl;
--Testcase 629:
DROP FOREIGN TABLE foreign_tbl CASCADE;
--Testcase 630:
DROP TABLE parent_tbl CASCADE;
--Testcase 631:
DROP FUNCTION row_before_insupd_trigfunc;
-- ===================================================================
-- test serial columns (ie, sequence-based defaults)
-- ===================================================================
--Testcase 632:
create foreign table loc1 (f1 serial, f2 text, id integer options (key 'true'))
server sqlite_svr;
--Testcase 633:
create foreign table rem1 (f1 serial, f2 text, id integer options (key 'true'))
server sqlite_svr options(table 'loc1');
--Testcase 352:
select pg_catalog.setval('rem1_f1_seq', 10, false);
--Testcase 353:
insert into loc1(f2) values('hi');
--Testcase 634:
insert into rem1(f2) values('hi remote');
--Testcase 354:
insert into loc1(f2) values('bye');
--Testcase 635:
insert into rem1(f2) values('bye remote');
--Testcase 355:
select f1, f2 from loc1;
--Testcase 636:
select f1, f2 from rem1;
-- ===================================================================
-- test generated columns
-- ===================================================================
--Testcase 637:
create foreign table grem1 (
a int options (key 'true'),
b int generated always as (a * 2) stored)
server sqlite_svr;
--Testcase 638:
insert into grem1 (a) values (1), (2);
--Testcase 639:
update grem1 set a = 22 where a = 2;
--Testcase 640:
select * from grem1;
-- ===================================================================
-- test local triggers
-- ===================================================================
-- Trigger functions "borrowed" from triggers regress test.
--Testcase 641:
CREATE FUNCTION trigger_func() RETURNS trigger LANGUAGE plpgsql AS $$
BEGIN
RAISE NOTICE 'trigger_func(%) called: action = %, when = %, level = %',
TG_ARGV[0], TG_OP, TG_WHEN, TG_LEVEL;
RETURN NULL;
END;$$;
--Testcase 642:
CREATE TRIGGER trig_stmt_before BEFORE DELETE OR INSERT OR UPDATE ON rem1
FOR EACH STATEMENT EXECUTE PROCEDURE trigger_func();
--Testcase 643:
CREATE TRIGGER trig_stmt_after AFTER DELETE OR INSERT OR UPDATE ON rem1
FOR EACH STATEMENT EXECUTE PROCEDURE trigger_func();
--Testcase 644:
CREATE OR REPLACE FUNCTION trigger_data() RETURNS trigger
LANGUAGE plpgsql AS $$
declare
oldnew text[];
relid text;
argstr text;
begin
relid := TG_relid::regclass;
argstr := '';
for i in 0 .. TG_nargs - 1 loop
if i > 0 then
argstr := argstr || ', ';
end if;
argstr := argstr || TG_argv[i];
end loop;
RAISE NOTICE '%(%) % % % ON %',
tg_name, argstr, TG_when, TG_level, TG_OP, relid;
oldnew := '{}'::text[];
if TG_OP != 'INSERT' then
oldnew := array_append(oldnew, format('OLD: %s', OLD));
end if;
if TG_OP != 'DELETE' then
oldnew := array_append(oldnew, format('NEW: %s', NEW));
end if;
RAISE NOTICE '%', array_to_string(oldnew, ',');
if TG_OP = 'DELETE' then
return OLD;
else
return NEW;
end if;
end;
$$;
-- Test basic functionality
--Testcase 645:
CREATE TRIGGER trig_row_before
BEFORE INSERT OR UPDATE OR DELETE ON rem1
FOR EACH ROW EXECUTE PROCEDURE trigger_data(23,'skidoo');
--Testcase 646:
CREATE TRIGGER trig_row_after
AFTER INSERT OR UPDATE OR DELETE ON rem1
FOR EACH ROW EXECUTE PROCEDURE trigger_data(23,'skidoo');
--Testcase 356:
delete from rem1;
--Testcase 357:
insert into rem1 values(1,'insert');
--Testcase 358:
update rem1 set f2 = 'update' where f1 = 1;
--Testcase 359:
update rem1 set f2 = f2 || f2;
-- cleanup
--Testcase 647:
DROP TRIGGER trig_row_before ON rem1;
--Testcase 648:
DROP TRIGGER trig_row_after ON rem1;
--Testcase 649:
DROP TRIGGER trig_stmt_before ON rem1;
--Testcase 650:
DROP TRIGGER trig_stmt_after ON rem1;
--Testcase 360:
DELETE from rem1;
-- Test multiple AFTER ROW triggers on a foreign table
--Testcase 651:
CREATE TRIGGER trig_row_after1
AFTER INSERT OR UPDATE OR DELETE ON rem1
FOR EACH ROW EXECUTE PROCEDURE trigger_data(23,'skidoo');
--Testcase 652:
CREATE TRIGGER trig_row_after2
AFTER INSERT OR UPDATE OR DELETE ON rem1
FOR EACH ROW EXECUTE PROCEDURE trigger_data(23,'skidoo');
--Testcase 653:
insert into rem1 values(1,'insert');
--Testcase 654:
update rem1 set f2 = 'update' where f1 = 1;
--Testcase 655:
update rem1 set f2 = f2 || f2;
--Testcase 656:
delete from rem1;
-- cleanup
--Testcase 657:
DROP TRIGGER trig_row_after1 ON rem1;
--Testcase 658:
DROP TRIGGER trig_row_after2 ON rem1;
-- Test WHEN conditions
--Testcase 659:
CREATE TRIGGER trig_row_before_insupd
BEFORE INSERT OR UPDATE ON rem1
FOR EACH ROW
WHEN (NEW.f2 like '%update%')
EXECUTE PROCEDURE trigger_data(23,'skidoo');
--Testcase 660:
CREATE TRIGGER trig_row_after_insupd
AFTER INSERT OR UPDATE ON rem1
FOR EACH ROW
WHEN (NEW.f2 like '%update%')
EXECUTE PROCEDURE trigger_data(23,'skidoo');
-- Insert or update not matching: nothing happens
--Testcase 363:
INSERT INTO rem1 values(1, 'insert');
--Testcase 364:
UPDATE rem1 set f2 = 'test';
-- Insert or update matching: triggers are fired
--Testcase 365:
INSERT INTO rem1 values(2, 'update');
--Testcase 366:
UPDATE rem1 set f2 = 'update update' where f1 = '2';
--Testcase 661:
CREATE TRIGGER trig_row_before_delete
BEFORE DELETE ON rem1
FOR EACH ROW
WHEN (OLD.f2 like '%update%')
EXECUTE PROCEDURE trigger_data(23,'skidoo');
--Testcase 662:
CREATE TRIGGER trig_row_after_delete
AFTER DELETE ON rem1
FOR EACH ROW
WHEN (OLD.f2 like '%update%')
EXECUTE PROCEDURE trigger_data(23,'skidoo');
-- Trigger is fired for f1=2, not for f1=1
--Testcase 369:
DELETE FROM rem1;
-- cleanup
--Testcase 663:
DROP TRIGGER trig_row_before_insupd ON rem1;
--Testcase 664:
DROP TRIGGER trig_row_after_insupd ON rem1;
--Testcase 665:
DROP TRIGGER trig_row_before_delete ON rem1;
--Testcase 666:
DROP TRIGGER trig_row_after_delete ON rem1;
-- Test various RETURN statements in BEFORE triggers.
--Testcase 667:
CREATE FUNCTION trig_row_before_insupdate() RETURNS TRIGGER AS $$
BEGIN
NEW.f2 := NEW.f2 || ' triggered !';
RETURN NEW;
END
$$ language plpgsql;
--Testcase 668:
CREATE TRIGGER trig_row_before_insupd
BEFORE INSERT OR UPDATE ON rem1
FOR EACH ROW EXECUTE PROCEDURE trig_row_before_insupdate();
-- The new values should have 'triggered' appended
--Testcase 370:
INSERT INTO rem1 values(1, 'insert');
--Testcase 371:
SELECT f1, f2 from rem1;
--Testcase 372:
INSERT INTO rem1 values(2, 'insert');
--Testcase 373:
SELECT f1, f2 from rem1;
--Testcase 374:
UPDATE rem1 set f2 = '';
--Testcase 375:
SELECT f1, f2 from rem1;
--Testcase 376:
UPDATE rem1 set f2 = 'skidoo';
--Testcase 377:
SELECT f1, f2 from rem1;
--Testcase 669:
EXPLAIN (verbose, costs off)
UPDATE rem1 set f1 = 10; -- all columns should be transmitted
--Testcase 670:
UPDATE rem1 set f1 = 10;
--Testcase 671:
SELECT f1, f2 from rem1;
--Testcase 378:
DELETE FROM rem1;
-- Add a second trigger, to check that the changes are propagated correctly
-- from trigger to trigger
--Testcase 672:
CREATE TRIGGER trig_row_before_insupd2
BEFORE INSERT OR UPDATE ON rem1
FOR EACH ROW EXECUTE PROCEDURE trig_row_before_insupdate();
--Testcase 379:
INSERT INTO rem1 values(1, 'insert');
--Testcase 380:
SELECT f1, f2 from rem1;
--Testcase 381:
INSERT INTO rem1 values(2, 'insert');
--Testcase 382:
SELECT f1, f2 from rem1;
--Testcase 383:
UPDATE rem1 set f2 = '';
--Testcase 384:
SELECT f1, f2 from rem1;
--Testcase 385:
UPDATE rem1 set f2 = 'skidoo';
--Testcase 386:
SELECT f1, f2 from rem1;
--Testcase 673:
DROP TRIGGER trig_row_before_insupd ON rem1;
--Testcase 674:
DROP TRIGGER trig_row_before_insupd2 ON rem1;
--Testcase 387:
DELETE from rem1;
--Testcase 388:
INSERT INTO rem1 VALUES (1, 'test');
-- Test with a trigger returning NULL
--Testcase 675:
CREATE FUNCTION trig_null() RETURNS TRIGGER AS $$
BEGIN
RETURN NULL;
END
$$ language plpgsql;
--Testcase 676:
CREATE TRIGGER trig_null
BEFORE INSERT OR UPDATE OR DELETE ON rem1
FOR EACH ROW EXECUTE PROCEDURE trig_null();
-- Nothing should have changed.
--Testcase 389:
INSERT INTO rem1 VALUES (2, 'test2');
--Testcase 390:
SELECT f1, f2 from rem1;
--Testcase 391:
UPDATE rem1 SET f2 = 'test2';
--Testcase 392:
SELECT f1, f2 from rem1;
--Testcase 393:
DELETE from rem1;
--Testcase 394:
SELECT f1, f2 from rem1;
--Testcase 677:
DROP TRIGGER trig_null ON rem1;
--Testcase 395:
DELETE from rem1;
-- Test a combination of local and remote triggers
--Testcase 678:
CREATE TRIGGER trig_row_before
BEFORE INSERT OR UPDATE OR DELETE ON rem1
FOR EACH ROW EXECUTE PROCEDURE trigger_data(23,'skidoo');
--Testcase 679:
CREATE TRIGGER trig_row_after
AFTER INSERT OR UPDATE OR DELETE ON rem1
FOR EACH ROW EXECUTE PROCEDURE trigger_data(23,'skidoo');
--Testcase 680:
CREATE TRIGGER trig_local_before BEFORE INSERT OR UPDATE ON rem1
FOR EACH ROW EXECUTE PROCEDURE trig_row_before_insupdate();
--Testcase 681:
INSERT INTO rem1(f2) VALUES ('test');
--Testcase 682:
UPDATE rem1 SET f2 = 'testo';
-- Test returning a system attribute
--Testcase 683:
INSERT INTO rem1(f2) VALUES ('test');
-- cleanup
--Testcase 684:
DROP TRIGGER trig_row_before ON rem1;
--Testcase 685:
DROP TRIGGER trig_row_after ON rem1;
--Testcase 686:
DROP TRIGGER trig_local_before ON rem1;
-- Test direct foreign table modification functionality
-- Test with statement-level triggers
--Testcase 687:
CREATE TRIGGER trig_stmt_before
BEFORE DELETE OR INSERT OR UPDATE ON rem1
FOR EACH STATEMENT EXECUTE PROCEDURE trigger_func();
--Testcase 396:
EXPLAIN (verbose, costs off)
UPDATE rem1 set f2 = ''; -- can be pushed down
--Testcase 397:
EXPLAIN (verbose, costs off)
DELETE FROM rem1; -- can be pushed down
--Testcase 688:
DROP TRIGGER trig_stmt_before ON rem1;
--Testcase 689:
CREATE TRIGGER trig_stmt_after
AFTER DELETE OR INSERT OR UPDATE ON rem1
FOR EACH STATEMENT EXECUTE PROCEDURE trigger_func();
--Testcase 398:
EXPLAIN (verbose, costs off)
UPDATE rem1 set f2 = ''; -- can be pushed down
--Testcase 399:
EXPLAIN (verbose, costs off)
DELETE FROM rem1; -- can be pushed down
--Testcase 690:
DROP TRIGGER trig_stmt_after ON rem1;
-- Test with row-level ON INSERT triggers
--Testcase 691:
CREATE TRIGGER trig_row_before_insert
BEFORE INSERT ON rem1
FOR EACH ROW EXECUTE PROCEDURE trigger_data(23,'skidoo');
--Testcase 400:
EXPLAIN (verbose, costs off)
UPDATE rem1 set f2 = ''; -- can be pushed down
--Testcase 401:
EXPLAIN (verbose, costs off)
DELETE FROM rem1; -- can be pushed down
--Testcase 692:
DROP TRIGGER trig_row_before_insert ON rem1;
--Testcase 693:
CREATE TRIGGER trig_row_after_insert
AFTER INSERT ON rem1
FOR EACH ROW EXECUTE PROCEDURE trigger_data(23,'skidoo');
--Testcase 402:
EXPLAIN (verbose, costs off)
UPDATE rem1 set f2 = ''; -- can be pushed down
--Testcase 403:
EXPLAIN (verbose, costs off)
DELETE FROM rem1; -- can be pushed down
--Testcase 694:
DROP TRIGGER trig_row_after_insert ON rem1;
-- Test with row-level ON UPDATE triggers
--Testcase 695:
CREATE TRIGGER trig_row_before_update
BEFORE UPDATE ON rem1
FOR EACH ROW EXECUTE PROCEDURE trigger_data(23,'skidoo');
--Testcase 404:
EXPLAIN (verbose, costs off)
UPDATE rem1 set f2 = ''; -- can't be pushed down
--Testcase 405:
EXPLAIN (verbose, costs off)
DELETE FROM rem1; -- can be pushed down
--Testcase 696:
DROP TRIGGER trig_row_before_update ON rem1;
--Testcase 697:
CREATE TRIGGER trig_row_after_update
AFTER UPDATE ON rem1
FOR EACH ROW EXECUTE PROCEDURE trigger_data(23,'skidoo');
--Testcase 406:
EXPLAIN (verbose, costs off)
UPDATE rem1 set f2 = ''; -- can't be pushed down
--Testcase 407:
EXPLAIN (verbose, costs off)
DELETE FROM rem1; -- can be pushed down
--Testcase 698:
DROP TRIGGER trig_row_after_update ON rem1;
-- Test with row-level ON DELETE triggers
--Testcase 699:
CREATE TRIGGER trig_row_before_delete
BEFORE DELETE ON rem1
FOR EACH ROW EXECUTE PROCEDURE trigger_data(23,'skidoo');
--Testcase 408:
EXPLAIN (verbose, costs off)
UPDATE rem1 set f2 = ''; -- can be pushed down
--Testcase 409:
EXPLAIN (verbose, costs off)
DELETE FROM rem1; -- can't be pushed down
--Testcase 700:
DROP TRIGGER trig_row_before_delete ON rem1;
--Testcase 701:
CREATE TRIGGER trig_row_after_delete
AFTER DELETE ON rem1
FOR EACH ROW EXECUTE PROCEDURE trigger_data(23,'skidoo');
--Testcase 410:
EXPLAIN (verbose, costs off)
UPDATE rem1 set f2 = ''; -- can be pushed down
--Testcase 411:
EXPLAIN (verbose, costs off)
DELETE FROM rem1; -- can't be pushed down
--Testcase 702:
DROP TRIGGER trig_row_after_delete ON rem1;
-- ===================================================================
-- test inheritance features
-- ===================================================================
--Testcase 703:
CREATE TABLE a (aa TEXT);
ALTER TABLE a SET (autovacuum_enabled = 'false');
--Testcase 704:
CREATE FOREIGN TABLE b (aa TEXT OPTIONS (key 'true'), bb TEXT) INHERITS (a)
SERVER sqlite_svr OPTIONS (table 'loct');
--Testcase 412:
INSERT INTO a(aa) VALUES('aaa');
--Testcase 413:
INSERT INTO a(aa) VALUES('aaaa');
--Testcase 414:
INSERT INTO a(aa) VALUES('aaaaa');
--Testcase 415:
INSERT INTO b(aa) VALUES('bbb');
--Testcase 416:
INSERT INTO b(aa) VALUES('bbbb');
--Testcase 417:
INSERT INTO b(aa) VALUES('bbbbb');
--Testcase 418:
SELECT tableoid::regclass, * FROM a;
--Testcase 419:
SELECT tableoid::regclass, * FROM b;
--Testcase 420:
SELECT tableoid::regclass, * FROM ONLY a;
--Testcase 421:
UPDATE a SET aa = 'zzzzzz' WHERE aa LIKE 'aaaa%';
--Testcase 422:
SELECT tableoid::regclass, * FROM a;
--Testcase 423:
SELECT tableoid::regclass, * FROM b;
--Testcase 424:
SELECT tableoid::regclass, * FROM ONLY a;
--Testcase 425:
UPDATE b SET aa = 'new';
--Testcase 426:
SELECT tableoid::regclass, * FROM a;
--Testcase 427:
SELECT tableoid::regclass, * FROM b;
--Testcase 428:
SELECT tableoid::regclass, * FROM ONLY a;
--Testcase 429:
UPDATE a SET aa = 'newtoo';
--Testcase 430:
SELECT tableoid::regclass, * FROM a;
--Testcase 431:
SELECT tableoid::regclass, * FROM b;
--Testcase 432:
SELECT tableoid::regclass, * FROM ONLY a;
--Testcase 433:
DELETE FROM a;
--Testcase 434:
SELECT tableoid::regclass, * FROM a;
--Testcase 435:
SELECT tableoid::regclass, * FROM b;
--Testcase 436:
SELECT tableoid::regclass, * FROM ONLY a;
--Testcase 705:
DROP TABLE a CASCADE;
-- Check SELECT FOR UPDATE/SHARE with an inherited source table
--Testcase 706:
create table foo (f1 int, f2 int);
--Testcase 707:
create foreign table foo2 (f3 int OPTIONS (key 'true')) inherits (foo)
server sqlite_svr options (table 'loct1');
--Testcase 708:
create table bar (f1 int, f2 int);
--Testcase 709:
create foreign table bar2 (f3 int OPTIONS (key 'true')) inherits (bar)
server sqlite_svr options (table 'loct2');
alter table foo set (autovacuum_enabled = 'false');
alter table bar set (autovacuum_enabled = 'false');
--Testcase 437:
insert into foo values(1,1);
--Testcase 438:
insert into foo values(3,3);
--Testcase 439:
insert into foo2 values(2,2,2);
--Testcase 440:
insert into foo2 values(4,4,4);
--Testcase 441:
insert into bar values(1,11);
--Testcase 442:
insert into bar values(2,22);
--Testcase 443:
insert into bar values(6,66);
--Testcase 444:
insert into bar2 values(3,33,33);
--Testcase 445:
insert into bar2 values(4,44,44);
--Testcase 446:
insert into bar2 values(7,77,77);
--Testcase 447:
explain (verbose, costs off)
select * from bar where f1 in (select f1 from foo) for update;
--Testcase 448:
select * from bar where f1 in (select f1 from foo) for update;
--Testcase 449:
explain (verbose, costs off)
select * from bar where f1 in (select f1 from foo) for share;
--Testcase 450:
select * from bar where f1 in (select f1 from foo) for share;
-- Check UPDATE with inherited target and an inherited source table
--Testcase 451:
explain (verbose, costs off)
update bar set f2 = f2 + 100 where f1 in (select f1 from foo);
--Testcase 452:
update bar set f2 = f2 + 100 where f1 in (select f1 from foo);
--Testcase 453:
select tableoid::regclass, * from bar order by 1,2;
-- Check UPDATE with inherited target and an appendrel subquery
--Testcase 454:
explain (verbose, costs off)
update bar set f2 = f2 + 100
from
( select f1 from foo union all select f1+3 from foo ) ss
where bar.f1 = ss.f1;
--Testcase 455:
update bar set f2 = f2 + 100
from
( select f1 from foo union all select f1+3 from foo ) ss
where bar.f1 = ss.f1;
--Testcase 456:
select tableoid::regclass, * from bar order by 1,2;
-- Test forcing the remote server to produce sorted data for a merge join,
-- but the foreign table is an inheritance child.
--truncate table loct1;
--Testcase 710:
delete from foo2;
truncate table only foo;
\set num_rows_foo 2000
--Testcase 711:
insert into foo2 select generate_series(0, :num_rows_foo, 2), generate_series(0, :num_rows_foo, 2), generate_series(0, :num_rows_foo, 2);
--Testcase 712:
insert into foo select generate_series(1, :num_rows_foo, 2), generate_series(1, :num_rows_foo, 2);
SET enable_hashjoin to false;
SET enable_nestloop to false;
--alter foreign table foo2 options (use_remote_estimate 'true');
--create index i_loct1_f1 on loct1(f1);
--Testcase 713:
create index i_foo_f1 on foo(f1);
analyze foo;
--analyze loct1;
-- inner join; expressions in the clauses appear in the equivalence class list
--Testcase 714:
explain (verbose, costs off)
select foo.f1, foo2.f1 from foo join foo2 on (foo.f1 = foo2.f1) order by foo.f2 offset 10 limit 10;
--Testcase 715:
select foo.f1, foo2.f1 from foo join foo2 on (foo.f1 = foo2.f1) order by foo.f2 offset 10 limit 10;
-- outer join; expressions in the clauses do not appear in equivalence class
-- list but no output change as compared to the previous query
--Testcase 716:
explain (verbose, costs off)
select foo.f1, foo2.f1 from foo left join foo2 on (foo.f1 = foo2.f1) order by foo.f2 offset 10 limit 10;
--Testcase 717:
select foo.f1, foo2.f1 from foo left join foo2 on (foo.f1 = foo2.f1) order by foo.f2 offset 10 limit 10;
RESET enable_hashjoin;
RESET enable_nestloop;
-- Test that WHERE CURRENT OF is not supported
begin;
declare c cursor for select * from bar where f1 = 7;
--Testcase 457:
fetch from c;
--Testcase 458:
update bar set f2 = null where current of c;
rollback;
--Testcase 459:
explain (verbose, costs off)
delete from foo where f1 < 5;
--Testcase 460:
delete from foo where f1 < 5;
--Testcase 461:
explain (verbose, costs off)
update bar set f2 = f2 + 100;
--Testcase 462:
update bar set f2 = f2 + 100;
--Testcase 463:
select * from bar;
-- Test that UPDATE/DELETE with inherited target works with row-level triggers
--Testcase 718:
CREATE TRIGGER trig_row_before
BEFORE UPDATE OR DELETE ON bar2
FOR EACH ROW EXECUTE PROCEDURE trigger_data(23,'skidoo');
--Testcase 719:
CREATE TRIGGER trig_row_after
AFTER UPDATE OR DELETE ON bar2
FOR EACH ROW EXECUTE PROCEDURE trigger_data(23,'skidoo');
--Testcase 464:
explain (verbose, costs off)
update bar set f2 = f2 + 100;
--Testcase 465:
update bar set f2 = f2 + 100;
--Testcase 466:
explain (verbose, costs off)
delete from bar where f2 < 400;
--Testcase 467:
delete from bar where f2 < 400;
-- cleanup
--Testcase 720:
drop table foo cascade;
--Testcase 721:
drop table bar cascade;
-- Test pushing down UPDATE/DELETE joins to the remote server
--Testcase 722:
create table parent (a int, b text);
--Testcase 723:
create foreign table remt1 (a int OPTIONS (key 'true'), b text)
server sqlite_svr options (table 'loct3');
--Testcase 724:
create foreign table remt2 (a int OPTIONS (key 'true'), b text)
server sqlite_svr options (table 'loct4');
alter foreign table remt1 inherit parent;
--Testcase 468:
insert into remt1 values (1, 'foo');
--Testcase 469:
insert into remt1 values (2, 'bar');
--Testcase 470:
insert into remt2 values (1, 'foo');
--Testcase 471:
insert into remt2 values (2, 'bar');
--Testcase 472:
explain (verbose, costs off)
update parent set b = parent.b || remt2.b from remt2 where parent.a = remt2.a;
--Testcase 473:
update parent set b = parent.b || remt2.b from remt2 where parent.a = remt2.a;
--Testcase 474:
select * from parent inner join remt2 on (parent.a = remt2.a);
--Testcase 475:
explain (verbose, costs off)
delete from parent using remt2 where parent.a = remt2.a;
--Testcase 476:
delete from parent using remt2 where parent.a = remt2.a;
-- cleanup
--Testcase 725:
drop foreign table remt1;
--Testcase 726:
drop foreign table remt2;
--Testcase 727:
drop table parent;
/*
-- Skip these tests, sqlite fdw does not support partition table, check constraint, copy from
-- ===================================================================
-- test tuple routing for foreign-table partitions
-- ===================================================================
-- Test insert tuple routing
create table itrtest (a int, b text) partition by list (a);
create table loct1 (a int check (a in (1)), b text);
create foreign table remp1 (a int check (a in (1)), b text) server loopback options (table_name 'loct1');
create table loct2 (a int check (a in (2)), b text);
create foreign table remp2 (b text, a int check (a in (2))) server loopback options (table_name 'loct2');
alter table itrtest attach partition remp1 for values in (1);
alter table itrtest attach partition remp2 for values in (2);
insert into itrtest values (1, 'foo');
insert into itrtest values (1, 'bar') returning *;
insert into itrtest values (2, 'baz');
insert into itrtest values (2, 'qux') returning *;
insert into itrtest values (1, 'test1'), (2, 'test2') returning *;
select tableoid::regclass, * FROM itrtest;
select tableoid::regclass, * FROM remp1;
select tableoid::regclass, * FROM remp2;
delete from itrtest;
create unique index loct1_idx on loct1 (a);
-- DO NOTHING without an inference specification is supported
insert into itrtest values (1, 'foo') on conflict do nothing returning *;
insert into itrtest values (1, 'foo') on conflict do nothing returning *;
-- But other cases are not supported
insert into itrtest values (1, 'bar') on conflict (a) do nothing;
insert into itrtest values (1, 'bar') on conflict (a) do update set b = excluded.b;
select tableoid::regclass, * FROM itrtest;
delete from itrtest;
drop index loct1_idx;
-- Test that remote triggers work with insert tuple routing
create function br_insert_trigfunc() returns trigger as $$
begin
new.b := new.b || ' triggered !';
return new;
end
$$ language plpgsql;
create trigger loct1_br_insert_trigger before insert on loct1
for each row execute procedure br_insert_trigfunc();
create trigger loct2_br_insert_trigger before insert on loct2
for each row execute procedure br_insert_trigfunc();
-- The new values are concatenated with ' triggered !'
insert into itrtest values (1, 'foo') returning *;
insert into itrtest values (2, 'qux') returning *;
insert into itrtest values (1, 'test1'), (2, 'test2') returning *;
with result as (insert into itrtest values (1, 'test1'), (2, 'test2') returning *) select * from result;
drop trigger loct1_br_insert_trigger on loct1;
drop trigger loct2_br_insert_trigger on loct2;
drop table itrtest;
drop table loct1;
drop table loct2;
-- Test update tuple routing
create table utrtest (a int, b text) partition by list (a);
create table loct (a int check (a in (1)), b text);
create foreign table remp (a int check (a in (1)), b text) server loopback options (table_name 'loct');
create table locp (a int check (a in (2)), b text);
alter table utrtest attach partition remp for values in (1);
alter table utrtest attach partition locp for values in (2);
insert into utrtest values (1, 'foo');
insert into utrtest values (2, 'qux');
select tableoid::regclass, * FROM utrtest;
select tableoid::regclass, * FROM remp;
select tableoid::regclass, * FROM locp;
-- It's not allowed to move a row from a partition that is foreign to another
update utrtest set a = 2 where b = 'foo' returning *;
-- But the reverse is allowed
update utrtest set a = 1 where b = 'qux' returning *;
select tableoid::regclass, * FROM utrtest;
select tableoid::regclass, * FROM remp;
select tableoid::regclass, * FROM locp;
-- The executor should not let unexercised FDWs shut down
update utrtest set a = 1 where b = 'foo';
-- Test that remote triggers work with update tuple routing
create trigger loct_br_insert_trigger before insert on loct
for each row execute procedure br_insert_trigfunc();
delete from utrtest;
insert into utrtest values (2, 'qux');
-- Check case where the foreign partition is a subplan target rel
explain (verbose, costs off)
update utrtest set a = 1 where a = 1 or a = 2 returning *;
-- The new values are concatenated with ' triggered !'
update utrtest set a = 1 where a = 1 or a = 2 returning *;
delete from utrtest;
insert into utrtest values (2, 'qux');
-- Check case where the foreign partition isn't a subplan target rel
explain (verbose, costs off)
update utrtest set a = 1 where a = 2 returning *;
-- The new values are concatenated with ' triggered !'
update utrtest set a = 1 where a = 2 returning *;
drop trigger loct_br_insert_trigger on loct;
-- We can move rows to a foreign partition that has been updated already,
-- but can't move rows to a foreign partition that hasn't been updated yet
delete from utrtest;
insert into utrtest values (1, 'foo');
insert into utrtest values (2, 'qux');
-- Test the former case:
-- with a direct modification plan
explain (verbose, costs off)
update utrtest set a = 1 returning *;
update utrtest set a = 1 returning *;
delete from utrtest;
insert into utrtest values (1, 'foo');
insert into utrtest values (2, 'qux');
-- with a non-direct modification plan
explain (verbose, costs off)
update utrtest set a = 1 from (values (1), (2)) s(x) where a = s.x returning *;
update utrtest set a = 1 from (values (1), (2)) s(x) where a = s.x returning *;
-- Change the definition of utrtest so that the foreign partition get updated
-- after the local partition
delete from utrtest;
alter table utrtest detach partition remp;
drop foreign table remp;
alter table loct drop constraint loct_a_check;
alter table loct add check (a in (3));
create foreign table remp (a int check (a in (3)), b text) server loopback options (table_name 'loct');
alter table utrtest attach partition remp for values in (3);
insert into utrtest values (2, 'qux');
insert into utrtest values (3, 'xyzzy');
-- Test the latter case:
-- with a direct modification plan
explain (verbose, costs off)
update utrtest set a = 3 returning *;
update utrtest set a = 3 returning *; -- ERROR
-- with a non-direct modification plan
explain (verbose, costs off)
update utrtest set a = 3 from (values (2), (3)) s(x) where a = s.x returning *;
update utrtest set a = 3 from (values (2), (3)) s(x) where a = s.x returning *; -- ERROR
drop table utrtest;
drop table loct;
-- Test copy tuple routing
create table ctrtest (a int, b text) partition by list (a);
create table loct1 (a int check (a in (1)), b text);
create foreign table remp1 (a int check (a in (1)), b text) server loopback options (table_name 'loct1');
create table loct2 (a int check (a in (2)), b text);
create foreign table remp2 (b text, a int check (a in (2))) server loopback options (table_name 'loct2');
alter table ctrtest attach partition remp1 for values in (1);
alter table ctrtest attach partition remp2 for values in (2);
copy ctrtest from stdin;
1 foo
2 qux
\.
select tableoid::regclass, * FROM ctrtest;
select tableoid::regclass, * FROM remp1;
select tableoid::regclass, * FROM remp2;
-- Copying into foreign partitions directly should work as well
copy remp1 from stdin;
1 bar
\.
select tableoid::regclass, * FROM remp1;
drop table ctrtest;
drop table loct1;
drop table loct2;
-- ===================================================================
-- test COPY FROM
-- ===================================================================
create table loc2 (f1 int, f2 text);
alter table loc2 set (autovacuum_enabled = 'false');
create foreign table rem2 (f1 int, f2 text) server loopback options(table_name 'loc2');
-- Test basic functionality
copy rem2 from stdin;
1 foo
2 bar
\.
select * from rem2;
delete from rem2;
-- Test check constraints
alter table loc2 add constraint loc2_f1positive check (f1 >= 0);
alter foreign table rem2 add constraint rem2_f1positive check (f1 >= 0);
-- check constraint is enforced on the remote side, not locally
copy rem2 from stdin;
1 foo
2 bar
\.
copy rem2 from stdin; -- ERROR
-1 xyzzy
\.
select * from rem2;
alter foreign table rem2 drop constraint rem2_f1positive;
alter table loc2 drop constraint loc2_f1positive;
delete from rem2;
-- Test local triggers
create trigger trig_stmt_before before insert on rem2
for each statement execute procedure trigger_func();
create trigger trig_stmt_after after insert on rem2
for each statement execute procedure trigger_func();
create trigger trig_row_before before insert on rem2
for each row execute procedure trigger_data(23,'skidoo');
create trigger trig_row_after after insert on rem2
for each row execute procedure trigger_data(23,'skidoo');
copy rem2 from stdin;
1 foo
2 bar
\.
select * from rem2;
drop trigger trig_row_before on rem2;
drop trigger trig_row_after on rem2;
drop trigger trig_stmt_before on rem2;
drop trigger trig_stmt_after on rem2;
delete from rem2;
create trigger trig_row_before_insert before insert on rem2
for each row execute procedure trig_row_before_insupdate();
-- The new values are concatenated with ' triggered !'
copy rem2 from stdin;
1 foo
2 bar
\.
select * from rem2;
drop trigger trig_row_before_insert on rem2;
delete from rem2;
create trigger trig_null before insert on rem2
for each row execute procedure trig_null();
-- Nothing happens
copy rem2 from stdin;
1 foo
2 bar
\.
select * from rem2;
drop trigger trig_null on rem2;
delete from rem2;
-- Test remote triggers
create trigger trig_row_before_insert before insert on loc2
for each row execute procedure trig_row_before_insupdate();
-- The new values are concatenated with ' triggered !'
copy rem2 from stdin;
1 foo
2 bar
\.
select * from rem2;
drop trigger trig_row_before_insert on loc2;
delete from rem2;
create trigger trig_null before insert on loc2
for each row execute procedure trig_null();
-- Nothing happens
copy rem2 from stdin;
1 foo
2 bar
\.
select * from rem2;
drop trigger trig_null on loc2;
delete from rem2;
-- Test a combination of local and remote triggers
create trigger rem2_trig_row_before before insert on rem2
for each row execute procedure trigger_data(23,'skidoo');
create trigger rem2_trig_row_after after insert on rem2
for each row execute procedure trigger_data(23,'skidoo');
create trigger loc2_trig_row_before_insert before insert on loc2
for each row execute procedure trig_row_before_insupdate();
copy rem2 from stdin;
1 foo
2 bar
\.
select * from rem2;
drop trigger rem2_trig_row_before on rem2;
drop trigger rem2_trig_row_after on rem2;
drop trigger loc2_trig_row_before_insert on loc2;
delete from rem2;
-- test COPY FROM with foreign table created in the same transaction
create table loc3 (f1 int, f2 text);
begin;
create foreign table rem3 (f1 int, f2 text)
server loopback options(table_name 'loc3');
copy rem3 from stdin;
1 foo
2 bar
\.
commit;
select * from rem3;
drop foreign table rem3;
drop table loc3;
*/
-- ===================================================================
-- test IMPORT FOREIGN SCHEMA
-- ===================================================================
--Testcase 728:
CREATE SCHEMA import_dest1;
IMPORT FOREIGN SCHEMA public FROM SERVER sqlite_svr INTO import_dest1;
--Testcase 477:
\det+ import_dest1.*
--Testcase 478:
\d import_dest1.*
-- Options
--Testcase 729:
CREATE SCHEMA import_dest2;
IMPORT FOREIGN SCHEMA public FROM SERVER sqlite_svr INTO import_dest2
OPTIONS (import_default 'true');
--Testcase 479:
\det+ import_dest2.*
--Testcase 480:
\d import_dest2.*
-- Check LIMIT TO and EXCEPT
--Testcase 730:
CREATE SCHEMA import_dest3;
IMPORT FOREIGN SCHEMA public LIMIT TO ("T 1", loct6, nonesuch)
FROM SERVER sqlite_svr INTO import_dest3;
--Testcase 481:
\det+ import_dest3.*
IMPORT FOREIGN SCHEMA public EXCEPT ("T 1", loct6, nonesuch)
FROM SERVER sqlite_svr INTO import_dest3;
--Testcase 482:
\det+ import_dest3.*
-- Assorted error cases
IMPORT FOREIGN SCHEMA public FROM SERVER sqlite_svr INTO import_dest3;
IMPORT FOREIGN SCHEMA public FROM SERVER sqlite_svr INTO notthere;
IMPORT FOREIGN SCHEMA public FROM SERVER nowhere INTO notthere;
/*
-- Skip these test, sqlite fdw does not support fetch_size option, partition table
-- Check case of a type present only on the remote server.
-- We can fake this by dropping the type locally in our transaction.
CREATE TYPE "Colors" AS ENUM ('red', 'green', 'blue');
CREATE TABLE import_source.t5 (c1 int, c2 text collate "C", "Col" "Colors");
CREATE SCHEMA import_dest5;
BEGIN;
DROP TYPE "Colors" CASCADE;
IMPORT FOREIGN SCHEMA import_source LIMIT TO (t5)
FROM SERVER loopback INTO import_dest5; -- ERROR
ROLLBACK;
BEGIN;
CREATE SERVER fetch101 FOREIGN DATA WRAPPER postgres_fdw OPTIONS( fetch_size '101' );
SELECT count(*)
FROM pg_foreign_server
WHERE srvname = 'fetch101'
AND srvoptions @> array['fetch_size=101'];
ALTER SERVER fetch101 OPTIONS( SET fetch_size '202' );
SELECT count(*)
FROM pg_foreign_server
WHERE srvname = 'fetch101'
AND srvoptions @> array['fetch_size=101'];
SELECT count(*)
FROM pg_foreign_server
WHERE srvname = 'fetch101'
AND srvoptions @> array['fetch_size=202'];
CREATE FOREIGN TABLE table30000 ( x int ) SERVER fetch101 OPTIONS ( fetch_size '30000' );
SELECT COUNT(*)
FROM pg_foreign_table
WHERE ftrelid = 'table30000'::regclass
AND ftoptions @> array['fetch_size=30000'];
ALTER FOREIGN TABLE table30000 OPTIONS ( SET fetch_size '60000');
SELECT COUNT(*)
FROM pg_foreign_table
WHERE ftrelid = 'table30000'::regclass
AND ftoptions @> array['fetch_size=30000'];
SELECT COUNT(*)
FROM pg_foreign_table
WHERE ftrelid = 'table30000'::regclass
AND ftoptions @> array['fetch_size=60000'];
ROLLBACK;
-- ===================================================================
-- test partitionwise joins
-- ===================================================================
SET enable_partitionwise_join=on;
CREATE TABLE fprt1 (a int, b int, c varchar) PARTITION BY RANGE(a);
CREATE TABLE fprt1_p1 (LIKE fprt1);
CREATE TABLE fprt1_p2 (LIKE fprt1);
ALTER TABLE fprt1_p1 SET (autovacuum_enabled = 'false');
ALTER TABLE fprt1_p2 SET (autovacuum_enabled = 'false');
INSERT INTO fprt1_p1 SELECT i, i, to_char(i/50, 'FM0000') FROM generate_series(0, 249, 2) i;
INSERT INTO fprt1_p2 SELECT i, i, to_char(i/50, 'FM0000') FROM generate_series(250, 499, 2) i;
CREATE FOREIGN TABLE ftprt1_p1 PARTITION OF fprt1 FOR VALUES FROM (0) TO (250)
SERVER loopback OPTIONS (table_name 'fprt1_p1', use_remote_estimate 'true');
CREATE FOREIGN TABLE ftprt1_p2 PARTITION OF fprt1 FOR VALUES FROM (250) TO (500)
SERVER loopback OPTIONS (TABLE_NAME 'fprt1_p2');
ANALYZE fprt1;
ANALYZE fprt1_p1;
ANALYZE fprt1_p2;
CREATE TABLE fprt2 (a int, b int, c varchar) PARTITION BY RANGE(b);
CREATE TABLE fprt2_p1 (LIKE fprt2);
CREATE TABLE fprt2_p2 (LIKE fprt2);
ALTER TABLE fprt2_p1 SET (autovacuum_enabled = 'false');
ALTER TABLE fprt2_p2 SET (autovacuum_enabled = 'false');
INSERT INTO fprt2_p1 SELECT i, i, to_char(i/50, 'FM0000') FROM generate_series(0, 249, 3) i;
INSERT INTO fprt2_p2 SELECT i, i, to_char(i/50, 'FM0000') FROM generate_series(250, 499, 3) i;
CREATE FOREIGN TABLE ftprt2_p1 (b int, c varchar, a int)
SERVER loopback OPTIONS (table_name 'fprt2_p1', use_remote_estimate 'true');
ALTER TABLE fprt2 ATTACH PARTITION ftprt2_p1 FOR VALUES FROM (0) TO (250);
CREATE FOREIGN TABLE ftprt2_p2 PARTITION OF fprt2 FOR VALUES FROM (250) TO (500)
SERVER loopback OPTIONS (table_name 'fprt2_p2', use_remote_estimate 'true');
ANALYZE fprt2;
ANALYZE fprt2_p1;
ANALYZE fprt2_p2;
-- inner join three tables
EXPLAIN (COSTS OFF)
SELECT t1.a,t2.b,t3.c FROM fprt1 t1 INNER JOIN fprt2 t2 ON (t1.a = t2.b) INNER JOIN fprt1 t3 ON (t2.b = t3.a) WHERE t1.a % 25 =0 ORDER BY 1,2,3;
SELECT t1.a,t2.b,t3.c FROM fprt1 t1 INNER JOIN fprt2 t2 ON (t1.a = t2.b) INNER JOIN fprt1 t3 ON (t2.b = t3.a) WHERE t1.a % 25 =0 ORDER BY 1,2,3;
-- left outer join + nullable clause
EXPLAIN (VERBOSE, COSTS OFF)
SELECT t1.a,t2.b,t2.c FROM fprt1 t1 LEFT JOIN (SELECT * FROM fprt2 WHERE a < 10) t2 ON (t1.a = t2.b and t1.b = t2.a) WHERE t1.a < 10 ORDER BY 1,2,3;
SELECT t1.a,t2.b,t2.c FROM fprt1 t1 LEFT JOIN (SELECT * FROM fprt2 WHERE a < 10) t2 ON (t1.a = t2.b and t1.b = t2.a) WHERE t1.a < 10 ORDER BY 1,2,3;
-- with whole-row reference; partitionwise join does not apply
EXPLAIN (COSTS OFF)
SELECT t1.wr, t2.wr FROM (SELECT t1 wr, a FROM fprt1 t1 WHERE t1.a % 25 = 0) t1 FULL JOIN (SELECT t2 wr, b FROM fprt2 t2 WHERE t2.b % 25 = 0) t2 ON (t1.a = t2.b) ORDER BY 1,2;
SELECT t1.wr, t2.wr FROM (SELECT t1 wr, a FROM fprt1 t1 WHERE t1.a % 25 = 0) t1 FULL JOIN (SELECT t2 wr, b FROM fprt2 t2 WHERE t2.b % 25 = 0) t2 ON (t1.a = t2.b) ORDER BY 1,2;
-- join with lateral reference
EXPLAIN (COSTS OFF)
SELECT t1.a,t1.b FROM fprt1 t1, LATERAL (SELECT t2.a, t2.b FROM fprt2 t2 WHERE t1.a = t2.b AND t1.b = t2.a) q WHERE t1.a%25 = 0 ORDER BY 1,2;
SELECT t1.a,t1.b FROM fprt1 t1, LATERAL (SELECT t2.a, t2.b FROM fprt2 t2 WHERE t1.a = t2.b AND t1.b = t2.a) q WHERE t1.a%25 = 0 ORDER BY 1,2;
-- with PHVs, partitionwise join selected but no join pushdown
EXPLAIN (COSTS OFF)
SELECT t1.a, t1.phv, t2.b, t2.phv FROM (SELECT 't1_phv' phv, * FROM fprt1 WHERE a % 25 = 0) t1 FULL JOIN (SELECT 't2_phv' phv, * FROM fprt2 WHERE b % 25 = 0) t2 ON (t1.a = t2.b) ORDER BY t1.a, t2.b;
SELECT t1.a, t1.phv, t2.b, t2.phv FROM (SELECT 't1_phv' phv, * FROM fprt1 WHERE a % 25 = 0) t1 FULL JOIN (SELECT 't2_phv' phv, * FROM fprt2 WHERE b % 25 = 0) t2 ON (t1.a = t2.b) ORDER BY t1.a, t2.b;
-- test FOR UPDATE; partitionwise join does not apply
EXPLAIN (COSTS OFF)
SELECT t1.a, t2.b FROM fprt1 t1 INNER JOIN fprt2 t2 ON (t1.a = t2.b) WHERE t1.a % 25 = 0 ORDER BY 1,2 FOR UPDATE OF t1;
SELECT t1.a, t2.b FROM fprt1 t1 INNER JOIN fprt2 t2 ON (t1.a = t2.b) WHERE t1.a % 25 = 0 ORDER BY 1,2 FOR UPDATE OF t1;
RESET enable_partitionwise_join;
-- ===================================================================
-- test partitionwise aggregates
-- ===================================================================
CREATE TABLE pagg_tab (a int, b int, c text) PARTITION BY RANGE(a);
CREATE TABLE pagg_tab_p1 (LIKE pagg_tab);
CREATE TABLE pagg_tab_p2 (LIKE pagg_tab);
CREATE TABLE pagg_tab_p3 (LIKE pagg_tab);
INSERT INTO pagg_tab_p1 SELECT i % 30, i % 50, to_char(i/30, 'FM0000') FROM generate_series(1, 3000) i WHERE (i % 30) < 10;
INSERT INTO pagg_tab_p2 SELECT i % 30, i % 50, to_char(i/30, 'FM0000') FROM generate_series(1, 3000) i WHERE (i % 30) < 20 and (i % 30) >= 10;
INSERT INTO pagg_tab_p3 SELECT i % 30, i % 50, to_char(i/30, 'FM0000') FROM generate_series(1, 3000) i WHERE (i % 30) < 30 and (i % 30) >= 20;
-- Create foreign partitions
CREATE FOREIGN TABLE fpagg_tab_p1 PARTITION OF pagg_tab FOR VALUES FROM (0) TO (10) SERVER loopback OPTIONS (table_name 'pagg_tab_p1');
CREATE FOREIGN TABLE fpagg_tab_p2 PARTITION OF pagg_tab FOR VALUES FROM (10) TO (20) SERVER loopback OPTIONS (table_name 'pagg_tab_p2');;
CREATE FOREIGN TABLE fpagg_tab_p3 PARTITION OF pagg_tab FOR VALUES FROM (20) TO (30) SERVER loopback OPTIONS (table_name 'pagg_tab_p3');;
ANALYZE pagg_tab;
ANALYZE fpagg_tab_p1;
ANALYZE fpagg_tab_p2;
ANALYZE fpagg_tab_p3;
-- When GROUP BY clause matches with PARTITION KEY.
-- Plan with partitionwise aggregates is disabled
SET enable_partitionwise_aggregate TO false;
EXPLAIN (COSTS OFF)
SELECT a, sum(b), min(b), count(*) FROM pagg_tab GROUP BY a HAVING avg(b) < 22 ORDER BY 1;
-- Plan with partitionwise aggregates is enabled
SET enable_partitionwise_aggregate TO true;
EXPLAIN (COSTS OFF)
SELECT a, sum(b), min(b), count(*) FROM pagg_tab GROUP BY a HAVING avg(b) < 22 ORDER BY 1;
SELECT a, sum(b), min(b), count(*) FROM pagg_tab GROUP BY a HAVING avg(b) < 22 ORDER BY 1;
-- Check with whole-row reference
-- Should have all the columns in the target list for the given relation
EXPLAIN (VERBOSE, COSTS OFF)
SELECT a, count(t1) FROM pagg_tab t1 GROUP BY a HAVING avg(b) < 22 ORDER BY 1;
SELECT a, count(t1) FROM pagg_tab t1 GROUP BY a HAVING avg(b) < 22 ORDER BY 1;
-- When GROUP BY clause does not match with PARTITION KEY.
EXPLAIN (COSTS OFF)
SELECT b, avg(a), max(a), count(*) FROM pagg_tab GROUP BY b HAVING sum(a) < 700 ORDER BY 1;
*/
/*
-- Skip these tests, sqlite fdw does not support nosuper user.
-- ===================================================================
-- access rights and superuser
-- ===================================================================
-- Non-superuser cannot create a FDW without a password in the connstr
CREATE ROLE regress_nosuper NOSUPERUSER;
GRANT USAGE ON FOREIGN DATA WRAPPER duckdb_fdw TO regress_nosuper;
SET ROLE regress_nosuper;
SHOW is_superuser;
-- This will be OK, we can create the FDW
DO $d$
BEGIN
EXECUTE $$CREATE SERVER sqlite_nopw FOREIGN DATA WRAPPER duckdb_fdw
OPTIONS (database '/tmp/sqlitefdw_test_post.db')$$;
END;
$d$;
-- But creation of user mappings for non-superusers should fail
CREATE USER MAPPING FOR public SERVER sqlite_nopw;
CREATE USER MAPPING FOR CURRENT_USER SERVER sqlite_nopw;
CREATE FOREIGN TABLE ft1_nopw (
c1 int OPTIONS (key 'true'),
c2 int NOT NULL,
c3 text,
c4 timestamptz,
c5 timestamp,
c6 varchar(10),
c7 char(10) default 'ft1',
c8 text
) SERVER sqlite_nopw;
ALTER FOREIGN TABLE ft1_nopw OPTIONS (table 'T 1');
ALTER FOREIGN TABLE ft1_nopw ALTER COLUMN c1 OPTIONS (column_name 'C 1');
SELECT * FROM ft1_nopw LIMIT 1;
-- If we add a password to the connstr it'll fail, because we don't allow passwords
-- in connstrs only in user mappings.
DO $d$
BEGIN
EXECUTE $$ALTER SERVER sqlite_nopw OPTIONS (ADD password 'dummypw')$$;
END;
$d$;
-- If we add a password for our user mapping instead, we should get a different
-- error because the password wasn't actually *used* when we run with trust auth.
--
-- This won't work with installcheck, but neither will most of the FDW checks.
ALTER USER MAPPING FOR CURRENT_USER SERVER sqlite_nopw OPTIONS (ADD password 'dummypw');
SELECT * FROM ft1_nopw LIMIT 1;
-- Unpriv user cannot make the mapping passwordless
ALTER USER MAPPING FOR CURRENT_USER SERVER sqlite_nopw OPTIONS (ADD password_required 'false');
SELECT * FROM ft1_nopw LIMIT 1;
RESET ROLE;
-- But the superuser can
ALTER USER MAPPING FOR regress_nosuper SERVER sqlite_nopw OPTIONS (ADD password_required 'false');
SET ROLE regress_nosuper;
-- Should finally work now
SELECT * FROM ft1_nopw LIMIT 1;
-- unpriv user also cannot set sslcert / sslkey on the user mapping
-- first set password_required so we see the right error messages
ALTER USER MAPPING FOR CURRENT_USER SERVER sqlite_nopw OPTIONS (SET password_required 'true');
ALTER USER MAPPING FOR CURRENT_USER SERVER sqlite_nopw OPTIONS (ADD sslcert 'foo.crt');
ALTER USER MAPPING FOR CURRENT_USER SERVER sqlite_nopw OPTIONS (ADD sslkey 'foo.key');
-- We're done with the role named after a specific user and need to check the
-- changes to the public mapping.
DROP USER MAPPING FOR CURRENT_USER SERVER sqlite_nopw;
-- This will fail again as it'll resolve the user mapping for public, which
-- lacks password_required=false
SELECT * FROM ft1_nopw LIMIT 1;
RESET ROLE;
-- The user mapping for public is passwordless and lacks the password_required=false
-- mapping option, but will work because the current user is a superuser.
SELECT * FROM ft1_nopw LIMIT 1;
-- cleanup
DROP USER MAPPING FOR public SERVER sqlite_nopw;
DROP OWNED BY regress_nosuper;
DROP ROLE regress_nosuper;
-- Clean-up
RESET enable_partitionwise_aggregate;
*/
-- Two-phase transactions are not supported.
BEGIN;
--Testcase 731:
SELECT count(*) FROM ft1;
-- error here
--Testcase 732:
PREPARE TRANSACTION 'fdw_tpc';
ROLLBACK;
-- Clean-up
--Testcase 733:
DROP USER MAPPING FOR CURRENT_USER SERVER sqlite_svr;
--Testcase 734:
DROP USER MAPPING FOR CURRENT_USER SERVER sqlite_svr2;
--Testcase 735:
DROP SERVER sqlite_svr CASCADE;
--Testcase 736:
DROP SERVER sqlite_svr2 CASCADE;
--Testcase 737:
DROP EXTENSION duckdb_fdw CASCADE; | the_stack |
-- MySQL dump 10.13 Distrib 5.7.24, for Win64 (x86_64)
--
-- Host: localhost Database: feather
-- ------------------------------------------------------
-- Server version 5.7.24-log
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
--
-- Table structure for table `article`
--
DROP TABLE IF EXISTS `article`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `article` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`title` text COLLATE utf8mb4_unicode_ci,
`introduce` text COLLATE utf8mb4_unicode_ci,
`user_id` int(11) DEFAULT NULL,
`visible` int(11) DEFAULT NULL,
`create_time` text COLLATE utf8mb4_unicode_ci,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `article`
--
LOCK TABLES `article` WRITE;
/*!40000 ALTER TABLE `article` DISABLE KEYS */;
/*!40000 ALTER TABLE `article` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `article_detail`
--
DROP TABLE IF EXISTS `article_detail`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `article_detail` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`parant_id` int(11) DEFAULT NULL,
`title` text COLLATE utf8mb4_unicode_ci,
`content` text COLLATE utf8mb4_unicode_ci,
`update_time` text COLLATE utf8mb4_unicode_ci,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `article_detail`
--
LOCK TABLES `article_detail` WRITE;
/*!40000 ALTER TABLE `article_detail` DISABLE KEYS */;
/*!40000 ALTER TABLE `article_detail` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `cncppcon2018_user`
--
DROP TABLE IF EXISTS `cncppcon2018_user`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `cncppcon2018_user` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`user_name` text,
`phone` bigint(20) DEFAULT NULL,
`email` text,
`user_group` text,
`join_time` text,
PRIMARY KEY (`id`),
UNIQUE KEY `phone` (`phone`)
) ENGINE=InnoDB AUTO_INCREMENT=341 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `cncppcon2018_user`
--
LOCK TABLES `cncppcon2018_user` WRITE;
/*!40000 ALTER TABLE `cncppcon2018_user` DISABLE KEYS */;
/*!40000 ALTER TABLE `cncppcon2018_user` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `pp_comment`
--
DROP TABLE IF EXISTS `pp_comment`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `pp_comment` (
`ID` bigint(20) NOT NULL AUTO_INCREMENT,
`user_id` bigint(20) NOT NULL,
`post_id` bigint(20) NOT NULL,
`comment_parant` bigint(20) NOT NULL,
`comment_content` text NOT NULL,
`comment_date` varchar(255) NOT NULL,
`comment_status` varchar(45) DEFAULT NULL,
PRIMARY KEY (`ID`)
) ENGINE=MyISAM AUTO_INCREMENT=704 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `pp_comment`
--
LOCK TABLES `pp_comment` WRITE;
/*!40000 ALTER TABLE `pp_comment` DISABLE KEYS */;
/*!40000 ALTER TABLE `pp_comment` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `pp_post_views`
--
DROP TABLE IF EXISTS `pp_post_views`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `pp_post_views` (
`ID` bigint(20) NOT NULL AUTO_INCREMENT,
`type` tinyint(4) NOT NULL,
`count` int(11) NOT NULL,
`period` varchar(255) NOT NULL,
PRIMARY KEY (`type`,`period`,`ID`)
) ENGINE=MyISAM AUTO_INCREMENT=13284 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `pp_post_views`
--
LOCK TABLES `pp_post_views` WRITE;
/*!40000 ALTER TABLE `pp_post_views` DISABLE KEYS */;
/*!40000 ALTER TABLE `pp_post_views` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `pp_posts`
--
DROP TABLE IF EXISTS `pp_posts`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `pp_posts` (
`ID` bigint(20) NOT NULL AUTO_INCREMENT,
`post_author` bigint(20) NOT NULL,
`post_date` varchar(255) NOT NULL,
`post_title` text NOT NULL,
`post_content` text NOT NULL,
`post_status` varchar(255) NOT NULL,
`post_modified` varchar(255) NOT NULL,
`content_abstract` text NOT NULL,
`url` varchar(255) NOT NULL,
`comment_count` bigint(20) NOT NULL,
`category` varchar(255) NOT NULL,
`raw_content` text NOT NULL,
PRIMARY KEY (`ID`)
) ENGINE=MyISAM AUTO_INCREMENT=2059 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `pp_posts`
--
LOCK TABLES `pp_posts` WRITE;
/*!40000 ALTER TABLE `pp_posts` DISABLE KEYS */;
INSERT INTO `pp_posts` VALUES (2058,2535,'2018-12-12 10:16:44','1','# 初始数据放这里','publish','2018-12-12 10:16:44','# 初始数据放这里...','',0,'3','');
/*!40000 ALTER TABLE `pp_posts` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `pp_sign_out_answer`
--
DROP TABLE IF EXISTS `pp_sign_out_answer`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `pp_sign_out_answer` (
`ID` int(11) NOT NULL AUTO_INCREMENT,
`question` varchar(255) NOT NULL,
`answer` text NOT NULL,
PRIMARY KEY (`ID`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `pp_sign_out_answer`
--
LOCK TABLES `pp_sign_out_answer` WRITE;
/*!40000 ALTER TABLE `pp_sign_out_answer` DISABLE KEYS */;
INSERT INTO `pp_sign_out_answer` VALUES (1,'args + ...是C++17什么特性?','fold expression,right fold,折叠表达式'),(2,'[](){}是C++11的什么特性?','lambda,Lambda,lambda表达式,Lambda表达式');
/*!40000 ALTER TABLE `pp_sign_out_answer` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `pp_terms`
--
DROP TABLE IF EXISTS `pp_terms`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `pp_terms` (
`term_id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(200) NOT NULL DEFAULT '',
`slug` varchar(200) NOT NULL DEFAULT '',
`term_group` bigint(10) NOT NULL DEFAULT '0',
PRIMARY KEY (`term_id`),
KEY `slug` (`slug`) USING BTREE,
KEY `name` (`name`) USING BTREE
) ENGINE=MyISAM AUTO_INCREMENT=61 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `pp_terms`
--
LOCK TABLES `pp_terms` WRITE;
/*!40000 ALTER TABLE `pp_terms` DISABLE KEYS */;
/*!40000 ALTER TABLE `pp_terms` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `pp_user`
--
DROP TABLE IF EXISTS `pp_user`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `pp_user` (
`ID` bigint(20) NOT NULL AUTO_INCREMENT,
`user_login` varchar(255) NOT NULL,
`user_nickname` varchar(255) NOT NULL,
`user_email` varchar(255) NOT NULL,
`user_registered` varchar(255) DEFAULT NULL,
`user_icon` varchar(255) DEFAULT NULL,
`user_pass` varchar(255) NOT NULL,
`user_role` tinyint(4) NOT NULL,
PRIMARY KEY (`ID`)
) ENGINE=MyISAM AUTO_INCREMENT=2536 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `pp_user`
--
LOCK TABLES `pp_user` WRITE;
/*!40000 ALTER TABLE `pp_user` DISABLE KEYS */;
INSERT INTO `pp_user` VALUES (2535,'tc','tc','tc163mail@163.com','','','e10adc3949ba59abbe56e057f20f883e',0);
/*!40000 ALTER TABLE `pp_user` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `user`
--
DROP TABLE IF EXISTS `user`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `user` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`user_name` text COLLATE utf8mb4_unicode_ci,
`nick_name` text COLLATE utf8mb4_unicode_ci,
`token` text COLLATE utf8mb4_unicode_ci,
`gender` int(11) DEFAULT NULL,
`role` int(11) DEFAULT NULL,
`avatar` text COLLATE utf8mb4_unicode_ci,
`phone` bigint(20) DEFAULT NULL,
`email` text COLLATE utf8mb4_unicode_ci,
`qq` text COLLATE utf8mb4_unicode_ci,
`location` text COLLATE utf8mb4_unicode_ci,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `user`
--
LOCK TABLES `user` WRITE;
/*!40000 ALTER TABLE `user` DISABLE KEYS */;
/*!40000 ALTER TABLE `user` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `visit_counter`
--
DROP TABLE IF EXISTS `visit_counter`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `visit_counter` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`save_hour` text,
`counter` int(11) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=114 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `visit_counter`
--
LOCK TABLES `visit_counter` WRITE;
/*!40000 ALTER TABLE `visit_counter` DISABLE KEYS */;
/*!40000 ALTER TABLE `visit_counter` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `wp_term_relationships`
--
DROP TABLE IF EXISTS `wp_term_relationships`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `wp_term_relationships` (
`object_id` bigint(20) unsigned NOT NULL DEFAULT '0',
`term_taxonomy_id` bigint(20) unsigned NOT NULL DEFAULT '0',
`term_order` int(11) NOT NULL DEFAULT '0',
PRIMARY KEY (`object_id`,`term_taxonomy_id`),
KEY `term_taxonomy_id` (`term_taxonomy_id`) USING BTREE
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `wp_term_relationships`
--
LOCK TABLES `wp_term_relationships` WRITE;
/*!40000 ALTER TABLE `wp_term_relationships` DISABLE KEYS */;
/*!40000 ALTER TABLE `wp_term_relationships` ENABLE KEYS */;
UNLOCK TABLES;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
-- Dump completed on 2018-12-12 10:20:13 | the_stack |
--
-- INT8
-- Test int8 64-bit integers.
--
--Testcase 140:
CREATE EXTENSION duckdb_fdw;
--Testcase 141:
CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER duckdb_fdw
OPTIONS (database '/tmp/sqlitefdw_test_core.db');
--Testcase 142:
CREATE FOREIGN TABLE INT8_TBL(
q1 int8 OPTIONS (key 'true'),
q2 int8 OPTIONS (key 'true')
) SERVER sqlite_svr;
--Testcase 143:
CREATE FOREIGN TABLE INT8_TMP(
q1 int8,
q2 int8,
q3 int4,
q4 int2,
q5 text,
id int options (key 'true')
) SERVER sqlite_svr;
--Testcase 1:
INSERT INTO INT8_TBL VALUES(' 123 ',' 456');
--Testcase 2:
INSERT INTO INT8_TBL VALUES('123 ','4567890123456789');
--Testcase 3:
INSERT INTO INT8_TBL VALUES('4567890123456789','123');
--Testcase 4:
INSERT INTO INT8_TBL VALUES(+4567890123456789,'4567890123456789');
--Testcase 5:
INSERT INTO INT8_TBL VALUES('+4567890123456789','-4567890123456789');
-- bad inputs
--Testcase 6:
INSERT INTO INT8_TBL(q1) VALUES (' ');
--Testcase 7:
INSERT INTO INT8_TBL(q1) VALUES ('xxx');
--Testcase 8:
INSERT INTO INT8_TBL(q1) VALUES ('3908203590239580293850293850329485');
--Testcase 9:
INSERT INTO INT8_TBL(q1) VALUES ('-1204982019841029840928340329840934');
--Testcase 10:
INSERT INTO INT8_TBL(q1) VALUES ('- 123');
--Testcase 11:
INSERT INTO INT8_TBL(q1) VALUES (' 345 5');
--Testcase 12:
INSERT INTO INT8_TBL(q1) VALUES ('');
--Testcase 13:
SELECT * FROM INT8_TBL;
-- int8/int8 cmp
--Testcase 14:
SELECT * FROM INT8_TBL WHERE q2 = 4567890123456789;
--Testcase 15:
SELECT * FROM INT8_TBL WHERE q2 <> 4567890123456789;
--Testcase 16:
SELECT * FROM INT8_TBL WHERE q2 < 4567890123456789;
--Testcase 17:
SELECT * FROM INT8_TBL WHERE q2 > 4567890123456789;
--Testcase 18:
SELECT * FROM INT8_TBL WHERE q2 <= 4567890123456789;
--Testcase 19:
SELECT * FROM INT8_TBL WHERE q2 >= 4567890123456789;
-- int8/int4 cmp
--Testcase 20:
SELECT * FROM INT8_TBL WHERE q2 = 456;
--Testcase 21:
SELECT * FROM INT8_TBL WHERE q2 <> 456;
--Testcase 22:
SELECT * FROM INT8_TBL WHERE q2 < 456;
--Testcase 23:
SELECT * FROM INT8_TBL WHERE q2 > 456;
--Testcase 24:
SELECT * FROM INT8_TBL WHERE q2 <= 456;
--Testcase 25:
SELECT * FROM INT8_TBL WHERE q2 >= 456;
-- int4/int8 cmp
--Testcase 26:
SELECT * FROM INT8_TBL WHERE 123 = q1;
--Testcase 27:
SELECT * FROM INT8_TBL WHERE 123 <> q1;
--Testcase 28:
SELECT * FROM INT8_TBL WHERE 123 < q1;
--Testcase 29:
SELECT * FROM INT8_TBL WHERE 123 > q1;
--Testcase 30:
SELECT * FROM INT8_TBL WHERE 123 <= q1;
--Testcase 31:
SELECT * FROM INT8_TBL WHERE 123 >= q1;
-- int8/int2 cmp
--Testcase 32:
SELECT * FROM INT8_TBL WHERE q2 = '456'::int2;
--Testcase 33:
SELECT * FROM INT8_TBL WHERE q2 <> '456'::int2;
--Testcase 34:
SELECT * FROM INT8_TBL WHERE q2 < '456'::int2;
--Testcase 35:
SELECT * FROM INT8_TBL WHERE q2 > '456'::int2;
--Testcase 36:
SELECT * FROM INT8_TBL WHERE q2 <= '456'::int2;
--Testcase 37:
SELECT * FROM INT8_TBL WHERE q2 >= '456'::int2;
-- int2/int8 cmp
--Testcase 38:
SELECT * FROM INT8_TBL WHERE '123'::int2 = q1;
--Testcase 39:
SELECT * FROM INT8_TBL WHERE '123'::int2 <> q1;
--Testcase 40:
SELECT * FROM INT8_TBL WHERE '123'::int2 < q1;
--Testcase 41:
SELECT * FROM INT8_TBL WHERE '123'::int2 > q1;
--Testcase 42:
SELECT * FROM INT8_TBL WHERE '123'::int2 <= q1;
--Testcase 43:
SELECT * FROM INT8_TBL WHERE '123'::int2 >= q1;
--Testcase 44:
SELECT '' AS five, q1 AS plus, -q1 AS minus FROM INT8_TBL;
--Testcase 45:
SELECT '' AS five, q1, q2, q1 + q2 AS plus FROM INT8_TBL;
--Testcase 46:
SELECT '' AS five, q1, q2, q1 - q2 AS minus FROM INT8_TBL;
--Testcase 47:
SELECT '' AS three, q1, q2, q1 * q2 AS multiply FROM INT8_TBL;
--Testcase 48:
SELECT '' AS three, q1, q2, q1 * q2 AS multiply FROM INT8_TBL
WHERE q1 < 1000 or (q2 > 0 and q2 < 1000);
--Testcase 49:
SELECT '' AS five, q1, q2, q1 / q2 AS divide, q1 % q2 AS mod FROM INT8_TBL;
--Testcase 50:
SELECT '' AS five, q1, float8(q1) FROM INT8_TBL;
--Testcase 51:
SELECT '' AS five, q2, float8(q2) FROM INT8_TBL;
--Testcase 52:
SELECT 37 + q1 AS plus4 FROM INT8_TBL;
--Testcase 53:
SELECT 37 - q1 AS minus4 FROM INT8_TBL;
--Testcase 54:
SELECT '' AS five, 2 * q1 AS "twice int4" FROM INT8_TBL;
--Testcase 55:
SELECT '' AS five, q1 * 2 AS "twice int4" FROM INT8_TBL;
-- int8 op int4
--Testcase 56:
SELECT q1 + 42::int4 AS "8plus4", q1 - 42::int4 AS "8minus4", q1 * 42::int4 AS "8mul4", q1 / 42::int4 AS "8div4" FROM INT8_TBL;
-- int4 op int8
--Testcase 57:
SELECT 246::int4 + q1 AS "4plus8", 246::int4 - q1 AS "4minus8", 246::int4 * q1 AS "4mul8", 246::int4 / q1 AS "4div8" FROM INT8_TBL;
-- int8 op int2
--Testcase 58:
SELECT q1 + 42::int2 AS "8plus2", q1 - 42::int2 AS "8minus2", q1 * 42::int2 AS "8mul2", q1 / 42::int2 AS "8div2" FROM INT8_TBL;
-- int2 op int8
--Testcase 59:
SELECT 246::int2 + q1 AS "2plus8", 246::int2 - q1 AS "2minus8", 246::int2 * q1 AS "2mul8", 246::int2 / q1 AS "2div8" FROM INT8_TBL;
--Testcase 60:
SELECT q2, abs(q2) FROM INT8_TBL;
--Testcase 61:
SELECT min(q1), min(q2) FROM INT8_TBL;
--Testcase 62:
SELECT max(q1), max(q2) FROM INT8_TBL;
-- TO_CHAR()
--
--Testcase 63:
SELECT '' AS to_char_1, to_char(q1, '9G999G999G999G999G999'), to_char(q2, '9,999,999,999,999,999')
FROM INT8_TBL;
--Testcase 64:
SELECT '' AS to_char_2, to_char(q1, '9G999G999G999G999G999D999G999'), to_char(q2, '9,999,999,999,999,999.999,999')
FROM INT8_TBL;
--Testcase 65:
SELECT '' AS to_char_3, to_char( (q1 * -1), '9999999999999999PR'), to_char( (q2 * -1), '9999999999999999.999PR')
FROM INT8_TBL;
--Testcase 66:
SELECT '' AS to_char_4, to_char( (q1 * -1), '9999999999999999S'), to_char( (q2 * -1), 'S9999999999999999')
FROM INT8_TBL;
--Testcase 67:
SELECT '' AS to_char_5, to_char(q2, 'MI9999999999999999') FROM INT8_TBL;
--Testcase 68:
SELECT '' AS to_char_6, to_char(q2, 'FMS9999999999999999') FROM INT8_TBL;
--Testcase 69:
SELECT '' AS to_char_7, to_char(q2, 'FM9999999999999999THPR') FROM INT8_TBL;
--Testcase 70:
SELECT '' AS to_char_8, to_char(q2, 'SG9999999999999999th') FROM INT8_TBL;
--Testcase 71:
SELECT '' AS to_char_9, to_char(q2, '0999999999999999') FROM INT8_TBL;
--Testcase 72:
SELECT '' AS to_char_10, to_char(q2, 'S0999999999999999') FROM INT8_TBL;
--Testcase 73:
SELECT '' AS to_char_11, to_char(q2, 'FM0999999999999999') FROM INT8_TBL;
--Testcase 74:
SELECT '' AS to_char_12, to_char(q2, 'FM9999999999999999.000') FROM INT8_TBL;
--Testcase 75:
SELECT '' AS to_char_13, to_char(q2, 'L9999999999999999.000') FROM INT8_TBL;
--Testcase 76:
SELECT '' AS to_char_14, to_char(q2, 'FM9999999999999999.999') FROM INT8_TBL;
--Testcase 77:
SELECT '' AS to_char_15, to_char(q2, 'S 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 . 9 9 9') FROM INT8_TBL;
--Testcase 78:
SELECT '' AS to_char_16, to_char(q2, E'99999 "text" 9999 "9999" 999 "\\"text between quote marks\\"" 9999') FROM INT8_TBL;
--Testcase 79:
SELECT '' AS to_char_17, to_char(q2, '999999SG9999999999') FROM INT8_TBL;
-- check min/max values and overflow behavior
--Testcase 80:
DELETE FROM INT8_TMP;
--Testcase 144:
INSERT INTO INT8_TMP VALUES ('-9223372036854775808'::int8);
--Testcase 145:
SELECT q1 FROM INT8_TMP;
--Testcase 81:
DELETE FROM INT8_TMP;
--Testcase 146:
INSERT INTO INT8_TMP VALUES ('-9223372036854775809'::int8);
--Testcase 147:
SELECT q1 FROM INT8_TMP;
--Testcase 82:
DELETE FROM INT8_TMP;
--Testcase 148:
INSERT INTO INT8_TMP VALUES ('9223372036854775807'::int8);
--Testcase 149:
SELECT q1 FROM INT8_TMP;
--Testcase 83:
DELETE FROM INT8_TMP;
--Testcase 150:
INSERT INTO INT8_TMP VALUES ('9223372036854775808'::int8);
--Testcase 151:
SELECT q1 FROM INT8_TMP;
--Testcase 84:
DELETE FROM INT8_TMP;
--Testcase 152:
INSERT INTO INT8_TMP VALUES (-('-9223372036854775807'::int8));
--Testcase 153:
SELECT q1 FROM INT8_TMP;
--Testcase 86:
DELETE FROM INT8_TMP;
--Testcase 154:
INSERT INTO INT8_TMP VALUES (-('-9223372036854775808'::int8));
--Testcase 155:
SELECT q1 FROM INT8_TMP;
--Testcase 87:
DELETE FROM INT8_TMP;
--Testcase 156:
INSERT INTO INT8_TMP VALUES ('9223372036854775800'::int8 , '9223372036854775800'::int8);
--Testcase 157:
SELECT q1 + q2 FROM INT8_TMP;
--Testcase 88:
DELETE FROM INT8_TMP;
--Testcase 158:
INSERT INTO INT8_TMP VALUES ('-9223372036854775800'::int8 , '-9223372036854775800'::int8);
--Testcase 159:
SELECT q1 + q2 FROM INT8_TMP;
--Testcase 89:
DELETE FROM INT8_TMP;
--Testcase 160:
INSERT INTO INT8_TMP VALUES ('9223372036854775800'::int8 , '-9223372036854775800'::int8);
--Testcase 161:
SELECT q1-q2 FROM INT8_TMP;
--Testcase 90:
DELETE FROM INT8_TMP;
--Testcase 162:
INSERT INTO INT8_TMP VALUES ('-9223372036854775800'::int8 , '9223372036854775800'::int8);
--Testcase 163:
SELECT q1 - q2 FROM INT8_TMP;
--Testcase 91:
DELETE FROM INT8_TMP;
--Testcase 164:
INSERT INTO INT8_TMP VALUES ('9223372036854775800'::int8 , '9223372036854775800'::int8);
--Testcase 165:
SELECT q1 * q2 FROM INT8_TMP;
--Testcase 92:
DELETE FROM INT8_TMP;
--Testcase 166:
INSERT INTO INT8_TMP VALUES ('9223372036854775800'::int8 , '0'::int8);
--Testcase 167:
SELECT q1 / q2 FROM INT8_TMP;
--Testcase 93:
DELETE FROM INT8_TMP;
--Testcase 168:
INSERT INTO INT8_TMP VALUES ('9223372036854775800'::int8 , '0'::int8);
--Testcase 169:
SELECT q1 % q2 FROM INT8_TMP;
--Testcase 94:
DELETE FROM INT8_TMP;
--Testcase 170:
INSERT INTO INT8_TMP VALUES ('-9223372036854775808'::int8);
--Testcase 171:
SELECT abs(q1) FROM INT8_TMP;
--Testcase 95:
DELETE FROM INT8_TMP;
--Testcase 172:
INSERT INTO INT8_TMP(q1, q3) VALUES ('9223372036854775800'::int8 , '100'::int4);
--Testcase 173:
SELECT q1 + q3 FROM INT8_TMP;
--Testcase 96:
DELETE FROM INT8_TMP;
--Testcase 174:
INSERT INTO INT8_TMP(q1, q3) VALUES ('-9223372036854775800'::int8 , '100'::int4);
--Testcase 175:
SELECT q1 - q3 FROM INT8_TMP;
--Testcase 97:
DELETE FROM INT8_TMP;
--Testcase 176:
INSERT INTO INT8_TMP(q1, q3) VALUES ('9223372036854775800'::int8 , '100'::int4);
--Testcase 177:
SELECT q1 * q3 FROM INT8_TMP;
--Testcase 98:
DELETE FROM INT8_TMP;
--Testcase 178:
INSERT INTO INT8_TMP(q3, q1) VALUES ('100'::int4 , '9223372036854775800'::int8);
--Testcase 179:
SELECT q3 + q1 FROM INT8_TMP;
--Testcase 99:
DELETE FROM INT8_TMP;
--Testcase 180:
INSERT INTO INT8_TMP(q3, q1) VALUES ('-100'::int4 , '9223372036854775800'::int8);
--Testcase 181:
SELECT q3 - q1 FROM INT8_TMP;
--Testcase 100:
DELETE FROM INT8_TMP;
--Testcase 182:
INSERT INTO INT8_TMP(q3, q1) VALUES ('100'::int4 , '9223372036854775800'::int8);
--Testcase 183:
SELECT q3 * q1 FROM INT8_TMP;
--Testcase 101:
DELETE FROM INT8_TMP;
--Testcase 184:
INSERT INTO INT8_TMP(q1, q4) VALUES ('9223372036854775800'::int8 , '100'::int2);
--Testcase 185:
SELECT q1 + q4 FROM INT8_TMP;
--Testcase 102:
DELETE FROM INT8_TMP;
--Testcase 186:
INSERT INTO INT8_TMP(q1, q4) VALUES ('-9223372036854775800'::int8 , '100'::int2);
--Testcase 187:
SELECT q1 - q4 FROM INT8_TMP;
--Testcase 103:
DELETE FROM INT8_TMP;
--Testcase 188:
INSERT INTO INT8_TMP VALUES ('9223372036854775800'::int8 , '100'::int2);
--Testcase 189:
SELECT q1 * q4 FROM INT8_TMP;
--Testcase 104:
DELETE FROM INT8_TMP;
--Testcase 190:
INSERT INTO INT8_TMP(q1, q4) VALUES ('-9223372036854775808'::int8 , '0'::int2);
--Testcase 191:
SELECT q1 / q4 FROM INT8_TMP;
--Testcase 105:
DELETE FROM INT8_TMP;
--Testcase 192:
INSERT INTO INT8_TMP(q4, q1) VALUES ('100'::int2 , '9223372036854775800'::int8);
--Testcase 193:
SELECT q4 + q1 FROM INT8_TMP;
--Testcase 106:
DELETE FROM INT8_TMP;
--Testcase 194:
INSERT INTO INT8_TMP(q4, q1) VALUES ('-100'::int2 , '9223372036854775800'::int8);
--Testcase 195:
SELECT q4 - q1 FROM INT8_TMP;
--Testcase 107:
DELETE FROM INT8_TMP;
--Testcase 196:
INSERT INTO INT8_TMP(q4, q1) VALUES ('100'::int2 , '9223372036854775800'::int8);
--Testcase 197:
SELECT q4 * q1 FROM INT8_TMP;
--Testcase 108:
DELETE FROM INT8_TMP;
--Testcase 198:
INSERT INTO INT8_TMP(q4, q1) VALUES ('100'::int2 , '0'::int8);
--Testcase 199:
SELECT q4 / q1 FROM INT8_TMP;
--Testcase 110:
SELECT CAST(q1 AS int4) FROM int8_tbl WHERE q2 = 456;
--Testcase 111:
SELECT CAST(q1 AS int4) FROM int8_tbl WHERE q2 <> 456;
--Testcase 112:
SELECT CAST(q1 AS int2) FROM int8_tbl WHERE q2 = 456;
--Testcase 113:
SELECT CAST(q1 AS int2) FROM int8_tbl WHERE q2 <> 456;
--Testcase 200:
DELETE FROM INT8_TMP;
--Testcase 201:
INSERT INTO INT8_TMP(q5) VALUES ('42'), ('-37');
--Testcase 202:
SELECT CAST(q5::int2 as int8) FROM INT8_TMP;
--Testcase 114:
SELECT CAST(q1 AS float4), CAST(q2 AS float8) FROM INT8_TBL;
--Testcase 203:
DELETE FROM INT8_TMP;
--Testcase 204:
INSERT INTO INT8_TMP(q5) VALUES ('36854775807.0');
--Testcase 205:
SELECT CAST(q5::float4 AS int8) FROM INT8_TMP;
--Testcase 206:
DELETE FROM INT8_TMP;
--Testcase 207:
INSERT INTO INT8_TMP(q5) VALUES ('922337203685477580700.0');
--Testcase 208:
SELECT CAST(q5::float8 AS int8) FROM INT8_TMP;
--Testcase 115:
SELECT CAST(q1 AS oid) FROM INT8_TBL;
--Testcase 209:
SELECT oid::int8 FROM pg_class WHERE relname = 'pg_class';
-- bit operations
--Testcase 116:
SELECT q1, q2, q1 & q2 AS "and", q1 | q2 AS "or", q1 # q2 AS "xor", ~q1 AS "not" FROM INT8_TBL;
--Testcase 117:
SELECT q1, q1 << 2 AS "shl", q1 >> 3 AS "shr" FROM INT8_TBL;
-- generate_series
--Testcase 118:
DELETE FROM INT8_TMP;
--Testcase 210:
INSERT INTO INT8_TMP SELECT q1 FROM generate_series('+4567890123456789'::int8, '+4567890123456799'::int8) q1;
--Testcase 211:
SELECT q1 FROM INT8_TMP;
--Testcase 120:
DELETE FROM INT8_TMP;
--Testcase 212:
INSERT INTO INT8_TMP SELECT q1 FROM generate_series('+4567890123456789'::int8, '+4567890123456799'::int8, 0) q1; -- should error
--Testcase 213:
SELECT q1 FROM INT8_TMP;
--Testcase 122:
DELETE FROM INT8_TMP;
--Testcase 214:
INSERT INTO INT8_TMP SELECT q1 FROM generate_series('+4567890123456789'::int8, '+4567890123456799'::int8, 2) q1;
--Testcase 215:
SELECT q1 FROM INT8_TMP;
-- corner case
--Testcase 216:
DELETE FROM INT8_TMP;
--Testcase 217:
INSERT INTO INT8_TMP VALUES (-1::int8<<63);
--Testcase 218:
SELECT q1::text FROM INT8_TMP;
--Testcase 219:
DELETE FROM INT8_TMP;
--Testcase 220:
INSERT INTO INT8_TMP VALUES ((-1::int8<<63)+1);
--Testcase 221:
SELECT q1::text FROM INT8_TMP;
-- check sane handling of INT64_MIN overflow cases
--Testcase 125:
DELETE FROM INT8_TMP;
--Testcase 222:
INSERT INTO INT8_TMP VALUES ((-9223372036854775808)::int8 * (-1)::int8, 888);
--Testcase 126:
INSERT INTO INT8_TMP VALUES ((-9223372036854775808)::int8 / (-1)::int8, 888);
--Testcase 127:
INSERT INTO INT8_TMP VALUES ((-9223372036854775808)::int8 % (-1)::int8, 888);
--Testcase 128:
SELECT q1 FROM INT8_TMP WHERE q2 = 888;
--Testcase 129:
DELETE FROM INT8_TMP WHERE q2 = 888;
--Testcase 130:
INSERT INTO INT8_TMP VALUES ((-9223372036854775808)::int8 * (-1)::int4, 888);
--Testcase 131:
INSERT INTO INT8_TMP VALUES ((-9223372036854775808)::int8 / (-1)::int4, 888);
--Testcase 132:
INSERT INTO INT8_TMP VALUES ((-9223372036854775808)::int8 % (-1)::int4, 888);
--Testcase 133:
SELECT q1 FROM INT8_TMP WHERE q2 = 888;
--Testcase 134:
DELETE FROM INT8_TMP WHERE q2 = 888;
--Testcase 135:
INSERT INTO INT8_TMP VALUES ((-9223372036854775808)::int8 * (-1)::int2, 888);
--Testcase 136:
INSERT INTO INT8_TMP VALUES ((-9223372036854775808)::int8 / (-1)::int2, 888);
--Testcase 137:
INSERT INTO INT8_TMP VALUES ((-9223372036854775808)::int8 % (-1)::int2, 888);
--Testcase 138:
SELECT q1 FROM INT8_TMP WHERE q2 = 888;
--Testcase 139:
DELETE FROM INT8_TMP WHERE q2 = 888;
-- check rounding when casting from float
--Testcase 223:
CREATE FOREIGN TABLE FLOAT8_TMP(f1 float8, id int OPTIONS (key 'true')) SERVER sqlite_svr;
--Testcase 224:
DELETE FROM FLOAT8_TMP;
--Testcase 225:
INSERT INTO FLOAT8_TMP VALUES
(-2.5::float8),
(-1.5::float8),
(-0.5::float8),
(0.0::float8),
(0.5::float8),
(1.5::float8),
(2.5::float8);
--Testcase 226:
SELECT f1 as x, f1::int8 as int8_value FROM FLOAT8_TMP;
-- check rounding when casting from numeric
--Testcase 227:
CREATE FOREIGN TABLE NUMERIC_TMP(f1 numeric, id int OPTIONS (key 'true')) SERVER sqlite_svr;
--Testcase 228:
DELETE FROM NUMERIC_TMP;
--Testcase 229:
INSERT INTO NUMERIC_TMP VALUES
(-2.5::numeric),
(-1.5::numeric),
(-0.5::numeric),
(0.0::numeric),
(0.5::numeric),
(1.5::numeric),
(2.5::numeric);
--Testcase 230:
SELECT f1 as x, f1::int8 as int8_value FROM NUMERIC_TMP;
-- test gcd()
--Testcase 231:
DELETE FROM INT8_TMP;
--Testcase 232:
INSERT INTO INT8_TMP VALUES
(0::int8, 0::int8),
(0::int8, 29893644334::int8),
(288484263558::int8, 29893644334::int8),
(-288484263558::int8, 29893644334::int8),
((-9223372036854775808)::int8, 1::int8),
((-9223372036854775808)::int8, 9223372036854775807::int8),
((-9223372036854775808)::int8, 4611686018427387904::int8);
--Testcase 233:
SELECT q1, q2, gcd(q1, q2), gcd(q1, -q2), gcd(q2, q1), gcd(-q2, q1) FROM INT8_TMP;
--Testcase 234:
DELETE FROM INT8_TMP;
--Testcase 235:
INSERT INTO INT8_TMP VALUES ((-9223372036854775808)::int8, 0::int8);
--Testcase 236:
SELECT gcd(q1, q2) FROM INT8_TMP; -- overflow
--Testcase 237:
DELETE FROM INT8_TMP;
--Testcase 238:
INSERT INTO INT8_TMP VALUES ((-9223372036854775808)::int8, (-9223372036854775808)::int8);
--Testcase 239:
SELECT gcd(q1, q2) FROM INT8_TMP; -- overflow
-- test lcm()
--Testcase 240:
DELETE FROM INT8_TMP;
--Testcase 241:
INSERT INTO INT8_TMP VALUES
(0::int8, 0::int8),
(0::int8, 29893644334::int8),
(29893644334::int8, 29893644334::int8),
(288484263558::int8, 29893644334::int8),
(-288484263558::int8, 29893644334::int8),
((-9223372036854775808)::int8, 0::int8);
--Testcase 242:
SELECT q1, q2, lcm(q1, q2), lcm(q1, -q2), lcm(q2, q1), lcm(-q2, q1) FROM INT8_TMP;
--Testcase 243:
DELETE FROM INT8_TMP;
--Testcase 244:
INSERT INTO INT8_TMP VALUES ((-9223372036854775808)::int8, 1::int8);
--Testcase 245:
SELECT lcm(q1, q2) FROM INT8_TMP; -- overflow
--Testcase 246:
DELETE FROM INT8_TMP;
--Testcase 247:
INSERT INTO INT8_TMP VALUES ((9223372036854775807)::int8, (9223372036854775806)::int8);
--Testcase 248:
SELECT lcm(q1, q2) FROM INT8_TMP; -- overflow
-- Clean up
DO $d$
declare
l_rec record;
begin
for l_rec in (select foreign_table_schema, foreign_table_name
from information_schema.foreign_tables) loop
execute format('drop foreign table %I.%I cascade;', l_rec.foreign_table_schema, l_rec.foreign_table_name);
end loop;
end;
$d$;
--Testcase 249:
DROP SERVER sqlite_svr;
--Testcase 250:
DROP EXTENSION duckdb_fdw CASCADE; | the_stack |
--
-- DDL for PP_Order_BOMLine_Trl
--
-- 16.12.2016 15:08
-- URL zum Konzept
ALTER TABLE PP_Order_BOMLine_Trl ADD COLUMN PP_Order_BOMLine_Trl_ID numeric(10,0) NOT NULL DEFAULT nextval('pp_order_bomline_trl_seq')
;
-- 16.12.2016 15:08
-- URL zum Konzept
ALTER TABLE PP_Order_BOMLine_Trl DROP CONSTRAINT IF EXISTS pp_order_bomline_trl_pkey
;
-- 16.12.2016 15:08
-- URL zum Konzept
ALTER TABLE PP_Order_BOMLine_Trl DROP CONSTRAINT IF EXISTS pp_order_bomline_trl_key
;
-- 16.12.2016 15:08
-- URL zum Konzept
ALTER TABLE PP_Order_BOMLine_Trl ADD CONSTRAINT pp_order_bomline_trl_pkey PRIMARY KEY (PP_Order_BOMLine_Trl_ID)
;
--
-- DDL for PP_Order_BOM_Trl
--
-- 16.12.2016 15:09
-- URL zum Konzept
ALTER TABLE PP_Order_BOM_Trl ADD COLUMN PP_Order_BOM_Trl_ID numeric(10,0) NOT NULL DEFAULT nextval('pp_order_bom_trl_seq')
;
-- 16.12.2016 15:09
-- URL zum Konzept
ALTER TABLE PP_Order_BOM_Trl DROP CONSTRAINT IF EXISTS pp_order_bom_trl_pkey
;
-- 16.12.2016 15:09
-- URL zum Konzept
ALTER TABLE PP_Order_BOM_Trl DROP CONSTRAINT IF EXISTS pp_order_bom_trl_key
;
-- 16.12.2016 15:09
-- URL zum Konzept
ALTER TABLE PP_Order_BOM_Trl ADD CONSTRAINT pp_order_bom_trl_pkey PRIMARY KEY (PP_Order_BOM_Trl_ID)
;
--
-- DDL for PP_Product_BOMLine_Trl
--
-- 16.12.2016 15:09
-- URL zum Konzept
ALTER TABLE PP_Product_BOMLine_Trl ADD COLUMN PP_Product_BOMLine_Trl_ID numeric(10,0) NOT NULL DEFAULT nextval('pp_product_bomline_trl_seq')
;
-- 16.12.2016 15:09
-- URL zum Konzept
ALTER TABLE PP_Product_BOMLine_Trl DROP CONSTRAINT IF EXISTS pp_product_bomline_trl_pkey
;
-- 16.12.2016 15:09
-- URL zum Konzept
ALTER TABLE PP_Product_BOMLine_Trl DROP CONSTRAINT IF EXISTS pp_product_bomline_trl_key
;
-- 16.12.2016 15:09
-- URL zum Konzept
ALTER TABLE PP_Product_BOMLine_Trl ADD CONSTRAINT pp_product_bomline_trl_pkey PRIMARY KEY (PP_Product_BOMLine_Trl_ID)
;
-- 16.12.2016 16:12
-- URL zum Konzept
ALTER TABLE PP_Order_Node_Trl ADD COLUMN PP_Order_Node_Trl_ID numeric(10,0) NOT NULL DEFAULT nextval('pp_order_node_trl_seq')
;
-- 16.12.2016 16:12
-- URL zum Konzept
ALTER TABLE PP_Order_Node_Trl DROP CONSTRAINT IF EXISTS pp_order_node_trl_pkey
;
-- 16.12.2016 16:12
-- URL zum Konzept
ALTER TABLE PP_Order_Node_Trl DROP CONSTRAINT IF EXISTS pp_order_node_trl_key
;
-- 16.12.2016 16:12
-- URL zum Konzept
ALTER TABLE PP_Order_Node_Trl ADD CONSTRAINT pp_order_node_trl_pkey PRIMARY KEY (PP_Order_Node_Trl_ID)
;
-- 16.12.2016 16:12
-- URL zum Konzept
ALTER TABLE PP_Order_Workflow_Trl ADD COLUMN PP_Order_Workflow_Trl_ID numeric(10,0) NOT NULL DEFAULT nextval('pp_order_workflow_trl_seq')
;
-- 16.12.2016 16:12
-- URL zum Konzept
ALTER TABLE PP_Order_Workflow_Trl DROP CONSTRAINT IF EXISTS pp_order_workflow_trl_pkey
;
-- 16.12.2016 16:12
-- URL zum Konzept
ALTER TABLE PP_Order_Workflow_Trl DROP CONSTRAINT IF EXISTS pp_order_workflow_trl_key
;
-- 16.12.2016 16:12
-- URL zum Konzept
ALTER TABLE PP_Order_Workflow_Trl ADD CONSTRAINT pp_order_workflow_trl_pkey PRIMARY KEY (PP_Order_Workflow_Trl_ID)
;
-- 16.12.2016 16:13
-- URL zum Konzept
ALTER TABLE PP_Product_BOM_Trl ADD COLUMN PP_Product_BOM_Trl_ID numeric(10,0) NOT NULL DEFAULT nextval('pp_product_bom_trl_seq')
;
-- 16.12.2016 16:13
-- URL zum Konzept
ALTER TABLE PP_Product_BOM_Trl DROP CONSTRAINT IF EXISTS pp_product_bom_trl_pkey
;
-- 16.12.2016 16:13
-- URL zum Konzept
ALTER TABLE PP_Product_BOM_Trl DROP CONSTRAINT IF EXISTS pp_product_bom_trl_key
;
-- 16.12.2016 16:13
-- URL zum Konzept
ALTER TABLE PP_Product_BOM_Trl ADD CONSTRAINT pp_product_bom_trl_pkey PRIMARY KEY (PP_Product_BOM_Trl_ID)
;
SELECT dba_seq_check_native();
COMMIT;
--
-- DML for PP_Order_BOMLine_Trl
--
-- 16.12.2016 15:08
-- URL zum Konzept
INSERT INTO AD_Element (AD_Client_ID,AD_Element_ID,AD_Org_ID,ColumnName,Created,CreatedBy,EntityType,IsActive,Name,PrintName,Updated,UpdatedBy) VALUES (0,543259,0,'PP_Order_BOMLine_Trl_ID',TO_TIMESTAMP('2016-12-16 15:08:10','YYYY-MM-DD HH24:MI:SS'),100,'EE01','Y','Manufacturing Order BOM Line **','Manufacturing Order BOM Line **',TO_TIMESTAMP('2016-12-16 15:08:10','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 16.12.2016 15:08
-- URL zum Konzept
INSERT INTO AD_Element_Trl (AD_Language,AD_Element_ID, Description,Help,Name,PO_Description,PO_Help,PO_Name,PO_PrintName,PrintName, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Element_ID, t.Description,t.Help,t.Name,t.PO_Description,t.PO_Help,t.PO_Name,t.PO_PrintName,t.PrintName, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Element t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Element_ID=543259 AND NOT EXISTS (SELECT * FROM AD_Element_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Element_ID=t.AD_Element_ID)
;
-- 16.12.2016 15:08
-- URL zum Konzept
INSERT INTO AD_Column (AD_Client_ID,AD_Column_ID,AD_Element_ID,AD_Org_ID,AD_Reference_ID,AD_Table_ID,AllowZoomTo,ColumnName,Created,CreatedBy,EntityType,FieldLength,IsActive,IsAllowLogging,IsAlwaysUpdateable,IsEncrypted,IsIdentifier,IsKey,IsMandatory,IsParent,IsSelectionColumn,IsTranslated,IsUpdateable,Name,Updated,UpdatedBy,Version) VALUES (0,555709,543259,0,13,53195,'N','PP_Order_BOMLine_Trl_ID',TO_TIMESTAMP('2016-12-16 15:08:10','YYYY-MM-DD HH24:MI:SS'),100,'EE01',10,'Y','Y','N','N','N','Y','Y','N','N','N','N','Manufacturing Order BOM Line **',TO_TIMESTAMP('2016-12-16 15:08:10','YYYY-MM-DD HH24:MI:SS'),100,1)
;
-- 16.12.2016 15:08
-- URL zum Konzept
INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=555709 AND NOT EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Column_ID=t.AD_Column_ID)
;
-- 16.12.2016 15:08
-- URL zum Konzept
INSERT INTO AD_Field (AD_Client_ID,AD_Column_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,Created,CreatedBy,DisplayLength,EntityType,IsActive,IsCentrallyMaintained,IsDisplayed,IsDisplayedGrid,IsEncrypted,IsFieldOnly,IsHeading,IsReadOnly,IsSameLine,Name,Updated,UpdatedBy) VALUES (0,555709,557476,0,53218,TO_TIMESTAMP('2016-12-16 15:08:11','YYYY-MM-DD HH24:MI:SS'),100,10,'EE01','Y','Y','N','N','N','N','N','N','N','Manufacturing Order BOM Line **',TO_TIMESTAMP('2016-12-16 15:08:11','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 16.12.2016 15:08
-- URL zum Konzept
INSERT INTO AD_Field_Trl (AD_Language,AD_Field_ID, Description,Help,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Field_ID, t.Description,t.Help,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Field t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Field_ID=557476 AND NOT EXISTS (SELECT * FROM AD_Field_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Field_ID=t.AD_Field_ID)
;
--
-- DML for PP_Order_BOM_Trl
--
-- 16.12.2016 15:09
-- URL zum Konzept
INSERT INTO AD_Element (AD_Client_ID,AD_Element_ID,AD_Org_ID,ColumnName,Created,CreatedBy,EntityType,IsActive,Name,PrintName,Updated,UpdatedBy) VALUES (0,543260,0,'PP_Order_BOM_Trl_ID',TO_TIMESTAMP('2016-12-16 15:09:00','YYYY-MM-DD HH24:MI:SS'),100,'EE01','Y','Manufacturing Order BOM **','Manufacturing Order BOM **',TO_TIMESTAMP('2016-12-16 15:09:00','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 16.12.2016 15:09
-- URL zum Konzept
INSERT INTO AD_Element_Trl (AD_Language,AD_Element_ID, Description,Help,Name,PO_Description,PO_Help,PO_Name,PO_PrintName,PrintName, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Element_ID, t.Description,t.Help,t.Name,t.PO_Description,t.PO_Help,t.PO_Name,t.PO_PrintName,t.PrintName, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Element t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Element_ID=543260 AND NOT EXISTS (SELECT * FROM AD_Element_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Element_ID=t.AD_Element_ID)
;
-- 16.12.2016 15:09
-- URL zum Konzept
INSERT INTO AD_Column (AD_Client_ID,AD_Column_ID,AD_Element_ID,AD_Org_ID,AD_Reference_ID,AD_Table_ID,AllowZoomTo,ColumnName,Created,CreatedBy,EntityType,FieldLength,IsActive,IsAllowLogging,IsAlwaysUpdateable,IsEncrypted,IsIdentifier,IsKey,IsMandatory,IsParent,IsSelectionColumn,IsTranslated,IsUpdateable,Name,Updated,UpdatedBy,Version) VALUES (0,555712,543260,0,13,53194,'N','PP_Order_BOM_Trl_ID',TO_TIMESTAMP('2016-12-16 15:09:00','YYYY-MM-DD HH24:MI:SS'),100,'EE01',10,'Y','Y','N','N','N','Y','Y','N','N','N','N','Manufacturing Order BOM **',TO_TIMESTAMP('2016-12-16 15:09:00','YYYY-MM-DD HH24:MI:SS'),100,1)
;
-- 16.12.2016 15:09
-- URL zum Konzept
INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=555712 AND NOT EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Column_ID=t.AD_Column_ID)
;
-- 16.12.2016 15:09
-- URL zum Konzept
INSERT INTO AD_Field (AD_Client_ID,AD_Column_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,Created,CreatedBy,DisplayLength,EntityType,IsActive,IsCentrallyMaintained,IsDisplayed,IsDisplayedGrid,IsEncrypted,IsFieldOnly,IsHeading,IsReadOnly,IsSameLine,Name,Updated,UpdatedBy) VALUES (0,555712,557477,0,53217,TO_TIMESTAMP('2016-12-16 15:09:01','YYYY-MM-DD HH24:MI:SS'),100,10,'EE01','Y','Y','N','N','N','N','N','N','N','Manufacturing Order BOM **',TO_TIMESTAMP('2016-12-16 15:09:01','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 16.12.2016 15:09
-- URL zum Konzept
INSERT INTO AD_Field_Trl (AD_Language,AD_Field_ID, Description,Help,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Field_ID, t.Description,t.Help,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Field t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Field_ID=557477 AND NOT EXISTS (SELECT * FROM AD_Field_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Field_ID=t.AD_Field_ID)
;
--
-- DML for PP_Product_BOMLine_Trl
--
-- 16.12.2016 15:09
-- URL zum Konzept
INSERT INTO AD_Element (AD_Client_ID,AD_Element_ID,AD_Org_ID,ColumnName,Created,CreatedBy,EntityType,IsActive,Name,PrintName,Updated,UpdatedBy) VALUES (0,543261,0,'PP_Product_BOMLine_Trl_ID',TO_TIMESTAMP('2016-12-16 15:09:17','YYYY-MM-DD HH24:MI:SS'),100,'EE01','Y','BOM Line **','BOM Line **',TO_TIMESTAMP('2016-12-16 15:09:17','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 16.12.2016 15:09
-- URL zum Konzept
INSERT INTO AD_Element_Trl (AD_Language,AD_Element_ID, Description,Help,Name,PO_Description,PO_Help,PO_Name,PO_PrintName,PrintName, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Element_ID, t.Description,t.Help,t.Name,t.PO_Description,t.PO_Help,t.PO_Name,t.PO_PrintName,t.PrintName, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Element t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Element_ID=543261 AND NOT EXISTS (SELECT * FROM AD_Element_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Element_ID=t.AD_Element_ID)
;
-- 16.12.2016 15:09
-- URL zum Konzept
INSERT INTO AD_Column (AD_Client_ID,AD_Column_ID,AD_Element_ID,AD_Org_ID,AD_Reference_ID,AD_Table_ID,AllowZoomTo,ColumnName,Created,CreatedBy,EntityType,FieldLength,IsActive,IsAllowLogging,IsAlwaysUpdateable,IsEncrypted,IsIdentifier,IsKey,IsMandatory,IsParent,IsSelectionColumn,IsTranslated,IsUpdateable,Name,Updated,UpdatedBy,Version) VALUES (0,555715,543261,0,13,53193,'N','PP_Product_BOMLine_Trl_ID',TO_TIMESTAMP('2016-12-16 15:09:17','YYYY-MM-DD HH24:MI:SS'),100,'EE01',10,'Y','Y','N','N','N','Y','Y','N','N','N','N','BOM Line **',TO_TIMESTAMP('2016-12-16 15:09:17','YYYY-MM-DD HH24:MI:SS'),100,1)
;
-- 16.12.2016 15:09
-- URL zum Konzept
INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=555715 AND NOT EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Column_ID=t.AD_Column_ID)
;
-- 16.12.2016 15:09
-- URL zum Konzept
INSERT INTO AD_Field (AD_Client_ID,AD_Column_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,Created,CreatedBy,DisplayLength,EntityType,IsActive,IsCentrallyMaintained,IsDisplayed,IsDisplayedGrid,IsEncrypted,IsFieldOnly,IsHeading,IsReadOnly,IsSameLine,Name,Updated,UpdatedBy) VALUES (0,555715,557478,0,53216,TO_TIMESTAMP('2016-12-16 15:09:17','YYYY-MM-DD HH24:MI:SS'),100,10,'EE01','Y','Y','N','N','N','N','N','N','N','BOM Line **',TO_TIMESTAMP('2016-12-16 15:09:17','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 16.12.2016 15:09
-- URL zum Konzept
INSERT INTO AD_Field_Trl (AD_Language,AD_Field_ID, Description,Help,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Field_ID, t.Description,t.Help,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Field t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Field_ID=557478 AND NOT EXISTS (SELECT * FROM AD_Field_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Field_ID=t.AD_Field_ID)
;
-- 16.12.2016 16:12
-- URL zum Konzept
INSERT INTO AD_Element (AD_Client_ID,AD_Element_ID,AD_Org_ID,ColumnName,Created,CreatedBy,EntityType,IsActive,Name,PrintName,Updated,UpdatedBy) VALUES (0,543262,0,'PP_Order_Node_Trl_ID',TO_TIMESTAMP('2016-12-16 16:12:45','YYYY-MM-DD HH24:MI:SS'),100,'EE01','Y','Manufacturing Order Activity **','Manufacturing Order Activity **',TO_TIMESTAMP('2016-12-16 16:12:45','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 16.12.2016 16:12
-- URL zum Konzept
INSERT INTO AD_Element_Trl (AD_Language,AD_Element_ID, Description,Help,Name,PO_Description,PO_Help,PO_Name,PO_PrintName,PrintName, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Element_ID, t.Description,t.Help,t.Name,t.PO_Description,t.PO_Help,t.PO_Name,t.PO_PrintName,t.PrintName, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Element t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Element_ID=543262 AND NOT EXISTS (SELECT * FROM AD_Element_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Element_ID=t.AD_Element_ID)
;
-- 16.12.2016 16:12
-- URL zum Konzept
INSERT INTO AD_Column (AD_Client_ID,AD_Column_ID,AD_Element_ID,AD_Org_ID,AD_Reference_ID,AD_Table_ID,AllowZoomTo,ColumnName,Created,CreatedBy,EntityType,FieldLength,IsActive,IsAllowLogging,IsAlwaysUpdateable,IsEncrypted,IsIdentifier,IsKey,IsMandatory,IsParent,IsSelectionColumn,IsTranslated,IsUpdateable,Name,Updated,UpdatedBy,Version) VALUES (0,555722,543262,0,13,53190,'N','PP_Order_Node_Trl_ID',TO_TIMESTAMP('2016-12-16 16:12:45','YYYY-MM-DD HH24:MI:SS'),100,'EE01',10,'Y','Y','N','N','N','Y','Y','N','N','N','N','Manufacturing Order Activity **',TO_TIMESTAMP('2016-12-16 16:12:45','YYYY-MM-DD HH24:MI:SS'),100,1)
;
-- 16.12.2016 16:12
-- URL zum Konzept
INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=555722 AND NOT EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Column_ID=t.AD_Column_ID)
;
-- 16.12.2016 16:12
-- URL zum Konzept
INSERT INTO AD_Field (AD_Client_ID,AD_Column_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,Created,CreatedBy,DisplayLength,EntityType,IsActive,IsCentrallyMaintained,IsDisplayed,IsDisplayedGrid,IsEncrypted,IsFieldOnly,IsHeading,IsReadOnly,IsSameLine,Name,Updated,UpdatedBy) VALUES (0,555722,557479,0,53214,TO_TIMESTAMP('2016-12-16 16:12:46','YYYY-MM-DD HH24:MI:SS'),100,10,'EE01','Y','Y','N','N','N','N','N','N','N','Manufacturing Order Activity **',TO_TIMESTAMP('2016-12-16 16:12:46','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 16.12.2016 16:12
-- URL zum Konzept
INSERT INTO AD_Field_Trl (AD_Language,AD_Field_ID, Description,Help,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Field_ID, t.Description,t.Help,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Field t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Field_ID=557479 AND NOT EXISTS (SELECT * FROM AD_Field_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Field_ID=t.AD_Field_ID)
;
--------------------
-- 16.12.2016 16:12
-- URL zum Konzept
INSERT INTO AD_Element (AD_Client_ID,AD_Element_ID,AD_Org_ID,ColumnName,Created,CreatedBy,EntityType,IsActive,Name,PrintName,Updated,UpdatedBy) VALUES (0,543263,0,'PP_Order_Workflow_Trl_ID',TO_TIMESTAMP('2016-12-16 16:12:54','YYYY-MM-DD HH24:MI:SS'),100,'EE01','Y','Manufacturing Order Workflow **','Manufacturing Order Workflow **',TO_TIMESTAMP('2016-12-16 16:12:54','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 16.12.2016 16:12
-- URL zum Konzept
INSERT INTO AD_Element_Trl (AD_Language,AD_Element_ID, Description,Help,Name,PO_Description,PO_Help,PO_Name,PO_PrintName,PrintName, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Element_ID, t.Description,t.Help,t.Name,t.PO_Description,t.PO_Help,t.PO_Name,t.PO_PrintName,t.PrintName, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Element t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Element_ID=543263 AND NOT EXISTS (SELECT * FROM AD_Element_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Element_ID=t.AD_Element_ID)
;
-- 16.12.2016 16:12
-- URL zum Konzept
INSERT INTO AD_Column (AD_Client_ID,AD_Column_ID,AD_Element_ID,AD_Org_ID,AD_Reference_ID,AD_Table_ID,AllowZoomTo,ColumnName,Created,CreatedBy,EntityType,FieldLength,IsActive,IsAllowLogging,IsAlwaysUpdateable,IsEncrypted,IsIdentifier,IsKey,IsMandatory,IsParent,IsSelectionColumn,IsTranslated,IsUpdateable,Name,Updated,UpdatedBy,Version) VALUES (0,555723,543263,0,13,53189,'N','PP_Order_Workflow_Trl_ID',TO_TIMESTAMP('2016-12-16 16:12:54','YYYY-MM-DD HH24:MI:SS'),100,'EE01',10,'Y','Y','N','N','N','Y','Y','N','N','N','N','Manufacturing Order Workflow **',TO_TIMESTAMP('2016-12-16 16:12:54','YYYY-MM-DD HH24:MI:SS'),100,1)
;
-- 16.12.2016 16:12
-- URL zum Konzept
INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=555723 AND NOT EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Column_ID=t.AD_Column_ID)
;
-- 16.12.2016 16:12
-- URL zum Konzept
INSERT INTO AD_Field (AD_Client_ID,AD_Column_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,Created,CreatedBy,DisplayLength,EntityType,IsActive,IsCentrallyMaintained,IsDisplayed,IsDisplayedGrid,IsEncrypted,IsFieldOnly,IsHeading,IsReadOnly,IsSameLine,Name,Updated,UpdatedBy) VALUES (0,555723,557480,0,53213,TO_TIMESTAMP('2016-12-16 16:12:54','YYYY-MM-DD HH24:MI:SS'),100,10,'EE01','Y','Y','N','N','N','N','N','N','N','Manufacturing Order Workflow **',TO_TIMESTAMP('2016-12-16 16:12:54','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 16.12.2016 16:12
-- URL zum Konzept
INSERT INTO AD_Field_Trl (AD_Language,AD_Field_ID, Description,Help,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Field_ID, t.Description,t.Help,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Field t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Field_ID=557480 AND NOT EXISTS (SELECT * FROM AD_Field_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Field_ID=t.AD_Field_ID)
;
--------------
-- 16.12.2016 16:13
-- URL zum Konzept
INSERT INTO AD_Element (AD_Client_ID,AD_Element_ID,AD_Org_ID,ColumnName,Created,CreatedBy,EntityType,IsActive,Name,PrintName,Updated,UpdatedBy) VALUES (0,543264,0,'PP_Product_BOM_Trl_ID',TO_TIMESTAMP('2016-12-16 16:13:04','YYYY-MM-DD HH24:MI:SS'),100,'EE01','Y','BOM & Formula **','BOM & Formula **',TO_TIMESTAMP('2016-12-16 16:13:04','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 16.12.2016 16:13
-- URL zum Konzept
INSERT INTO AD_Element_Trl (AD_Language,AD_Element_ID, Description,Help,Name,PO_Description,PO_Help,PO_Name,PO_PrintName,PrintName, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Element_ID, t.Description,t.Help,t.Name,t.PO_Description,t.PO_Help,t.PO_Name,t.PO_PrintName,t.PrintName, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Element t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Element_ID=543264 AND NOT EXISTS (SELECT * FROM AD_Element_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Element_ID=t.AD_Element_ID)
;
-- 16.12.2016 16:13
-- URL zum Konzept
INSERT INTO AD_Column (AD_Client_ID,AD_Column_ID,AD_Element_ID,AD_Org_ID,AD_Reference_ID,AD_Table_ID,AllowZoomTo,ColumnName,Created,CreatedBy,EntityType,FieldLength,IsActive,IsAllowLogging,IsAlwaysUpdateable,IsEncrypted,IsIdentifier,IsKey,IsMandatory,IsParent,IsSelectionColumn,IsTranslated,IsUpdateable,Name,Updated,UpdatedBy,Version) VALUES (0,555724,543264,0,13,53191,'N','PP_Product_BOM_Trl_ID',TO_TIMESTAMP('2016-12-16 16:13:04','YYYY-MM-DD HH24:MI:SS'),100,'EE01',10,'Y','Y','N','N','N','Y','Y','N','N','N','N','BOM & Formula **',TO_TIMESTAMP('2016-12-16 16:13:04','YYYY-MM-DD HH24:MI:SS'),100,1)
;
-- 16.12.2016 16:13
-- URL zum Konzept
INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=555724 AND NOT EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Column_ID=t.AD_Column_ID)
;
-- 16.12.2016 16:13
-- URL zum Konzept
INSERT INTO AD_Field (AD_Client_ID,AD_Column_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,Created,CreatedBy,DisplayLength,EntityType,IsActive,IsCentrallyMaintained,IsDisplayed,IsDisplayedGrid,IsEncrypted,IsFieldOnly,IsHeading,IsReadOnly,IsSameLine,Name,Updated,UpdatedBy) VALUES (0,555724,557481,0,53215,TO_TIMESTAMP('2016-12-16 16:13:04','YYYY-MM-DD HH24:MI:SS'),100,10,'EE01','Y','Y','N','N','N','N','N','N','N','BOM & Formula **',TO_TIMESTAMP('2016-12-16 16:13:04','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 16.12.2016 16:13
-- URL zum Konzept
INSERT INTO AD_Field_Trl (AD_Language,AD_Field_ID, Description,Help,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Field_ID, t.Description,t.Help,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Field t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Field_ID=557481 AND NOT EXISTS (SELECT * FROM AD_Field_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Field_ID=t.AD_Field_ID)
; | the_stack |
DROP VIEW v_logged_actions;
DROP MATERIALIZED VIEW home_projects;
ALTER TABLE api_keys
ALTER COLUMN created_at TYPE TIMESTAMPTZ USING created_at AT TIME ZONE 'UTC',
DROP CONSTRAINT api_keys_owner_id_fkey,
ADD CONSTRAINT api_keys_owner_id_fkey FOREIGN KEY (owner_id) REFERENCES users ON DELETE CASCADE;
ALTER TABLE api_sessions
ALTER COLUMN created_at TYPE TIMESTAMPTZ USING created_at AT TIME ZONE 'UTC',
ALTER COLUMN expires TYPE TIMESTAMPTZ USING expires AT TIME ZONE 'UTC',
DROP CONSTRAINT api_sessions_user_id_fkey,
ADD CONSTRAINT api_sessions_user_id_fkey FOREIGN KEY (user_id) REFERENCES users ON DELETE CASCADE;
--We alter logged_actions here just to get correct timestamp when we partition it later
ALTER TABLE logged_actions
ALTER COLUMN created_at TYPE TIMESTAMPTZ USING created_at AT TIME ZONE 'UTC';
ALTER TABLE notifications
ALTER COLUMN created_at TYPE TIMESTAMPTZ USING created_at AT TIME ZONE 'UTC',
DROP CONSTRAINT notifications_origin_id_fkey,
ADD CONSTRAINT notifications_origin_id_fkey FOREIGN KEY (origin_id) REFERENCES users ON DELETE SET NULL;
ALTER TABLE organizations
RENAME COLUMN user_id TO owner_id;
ALTER TABLE organizations
ADD COLUMN user_id BIGINT REFERENCES users ON DELETE CASCADE;
UPDATE organizations o
SET user_id = u.id
FROM users u
WHERE o.name = u.name;
ALTER TABLE organizations
ADD CONSTRAINT organizations_name_fkey FOREIGN KEY (name) REFERENCES users (name) ON UPDATE CASCADE,
ALTER COLUMN created_at TYPE TIMESTAMPTZ USING created_at AT TIME ZONE 'UTC';
ALTER TABLE organizations
RENAME CONSTRAINT organizations_username_key TO organizations_name_key;
ALTER TABLE project_api_keys
ALTER COLUMN created_at TYPE TIMESTAMPTZ USING created_at AT TIME ZONE 'UTC';
ALTER TABLE project_channels
ALTER COLUMN created_at TYPE TIMESTAMPTZ USING created_at AT TIME ZONE 'UTC';
ALTER TABLE project_flags
ALTER COLUMN comment TYPE TEXT,
ADD CONSTRAINT project_flags_resolved_by_fkey FOREIGN KEY (resolved_by) REFERENCES users ON DELETE SET NULL,
ALTER COLUMN created_at TYPE TIMESTAMPTZ USING created_at AT TIME ZONE 'UTC',
ALTER COLUMN resolved_at TYPE TIMESTAMPTZ USING resolved_at AT TIME ZONE 'UTC';
UPDATE project_pages p
SET parent_id = NULL
WHERE p.parent_id IS NOT NULL
AND NOT EXISTS(SELECT * FROM project_pages pp WHERE pp.id = p.parent_id);
ALTER TABLE project_pages
ADD CONSTRAINT project_pages_parent_id_fkey FOREIGN KEY (parent_id) REFERENCES project_pages ON DELETE SET NULL,
ALTER COLUMN created_at TYPE TIMESTAMPTZ USING created_at AT TIME ZONE 'UTC';
DELETE
FROM project_version_download_warnings pvdw
WHERE pvdw.download_id IS NOT NULL
AND NOT EXISTS(SELECT * FROM project_version_downloads pvd WHERE pvd.id = pvdw.download_id);
ALTER TABLE project_version_download_warnings
ADD CONSTRAINT project_version_download_warnings_download_id_fkey FOREIGN KEY (download_id) REFERENCES project_version_downloads ON DELETE CASCADE,
ALTER COLUMN created_at TYPE TIMESTAMPTZ USING created_at AT TIME ZONE 'UTC',
ALTER COLUMN expiration TYPE TIMESTAMPTZ USING expiration AT TIME ZONE 'UTC';
DELETE
FROM project_version_downloads pvd
WHERE NOT EXISTS(SELECT * FROM project_versions pv WHERE pv.id = pvd.version_id);
ALTER TABLE project_version_downloads
ALTER COLUMN created_at TYPE TIMESTAMPTZ USING created_at AT TIME ZONE 'UTC',
ADD CONSTRAINT project_version_downloads_version_id_fkey FOREIGN KEY (version_id) REFERENCES project_versions ON DELETE CASCADE,
ADD CONSTRAINT project_version_downloads_user_id_fkey FOREIGN KEY (user_id) REFERENCES users ON DELETE CASCADE;
ALTER TABLE project_version_reviews
ALTER COLUMN created_at TYPE TIMESTAMPTZ USING created_at AT TIME ZONE 'UTC',
ALTER COLUMN ended_at TYPE TIMESTAMPTZ USING ended_at AT TIME ZONE 'UTC';
UPDATE project_version_unsafe_downloads
SET user_id = NULL
WHERE user_id = -1;
ALTER TABLE project_version_unsafe_downloads
ADD CONSTRAINT project_version_unsafe_downloads_fkey FOREIGN KEY (user_id) REFERENCES users ON DELETE CASCADE,
ALTER COLUMN created_at TYPE TIMESTAMPTZ USING created_at AT TIME ZONE 'UTC',
ALTER COLUMN user_id DROP DEFAULT;
ALTER TABLE project_version_visibility_changes
ALTER COLUMN created_at TYPE TIMESTAMPTZ USING created_at AT TIME ZONE 'UTC',
ALTER COLUMN resolved_at TYPE TIMESTAMPTZ USING resolved_at AT TIME ZONE 'UTC',
DROP CONSTRAINT project_version_visibility_changes_created_by_fkey,
ADD CONSTRAINT project_version_visibility_changes_created_by_fkey FOREIGN KEY (created_by) REFERENCES users ON DELETE CASCADE,
DROP CONSTRAINT project_version_visibility_changes_version_id_fkey,
ADD CONSTRAINT project_version_visibility_changes_version_id_fkey FOREIGN KEY (version_id) REFERENCES project_versions ON DELETE CASCADE,
DROP CONSTRAINT project_version_visibility_changes_resolved_by_fkey,
ADD CONSTRAINT project_version_visibility_changes_resolved_by_fkey FOREIGN KEY (resolved_by) REFERENCES users ON DELETE CASCADE;
ALTER TABLE project_versions
ALTER COLUMN author_id DROP NOT NULL,
DROP CONSTRAINT versions_project_id_fkey,
ADD CONSTRAINT versions_project_id_fkey FOREIGN KEY (project_id) REFERENCES projects ON DELETE CASCADE;
UPDATE project_versions pv
SET author_id = NULL
WHERE pv.author_id = -1;
ALTER TABLE project_versions
ADD CONSTRAINT project_versions_reviewer_id_fkey FOREIGN KEY (reviewer_id) REFERENCES users ON DELETE SET NULL,
ADD CONSTRAINT project_versions_author_id_fkey FOREIGN KEY (author_id) REFERENCES users ON DELETE SET NULL,
ALTER COLUMN created_at TYPE TIMESTAMPTZ USING created_at AT TIME ZONE 'UTC',
ALTER COLUMN approved_at TYPE TIMESTAMPTZ USING approved_at AT TIME ZONE 'UTC';
ALTER TABLE project_views
ALTER COLUMN created_at TYPE TIMESTAMPTZ USING created_at AT TIME ZONE 'UTC',
ADD CONSTRAINT project_views_user_id_fkey FOREIGN KEY (user_id) REFERENCES users ON DELETE SET NULL;
ALTER TABLE project_visibility_changes
ALTER COLUMN created_at TYPE TIMESTAMPTZ USING created_at AT TIME ZONE 'UTC',
ALTER COLUMN resolved_at TYPE TIMESTAMPTZ USING resolved_at AT TIME ZONE 'UTC',
DROP CONSTRAINT project_visibility_changes_created_by_fkey,
ADD CONSTRAINT project_visibility_changes_created_by_fkey FOREIGN KEY (created_by) REFERENCES users ON DELETE CASCADE,
DROP CONSTRAINT project_visibility_changes_resolved_by_fkey,
ADD CONSTRAINT project_visibility_changes_resolved_by_fkey FOREIGN KEY (resolved_by) REFERENCES users ON DELETE CASCADE;
DELETE
FROM project_watchers pw
WHERE NOT EXISTS(SELECT * FROM projects p WHERE p.id = pw.project_id);
ALTER TABLE project_watchers
ADD CONSTRAINT project_watchers_pkey PRIMARY KEY (project_id, user_id),
ADD CONSTRAINT project_watchers_project_id_fkey FOREIGN KEY (project_id) REFERENCES projects ON DELETE CASCADE,
ADD CONSTRAINT project_watchers_user_id_fkey FOREIGN KEY (user_id) REFERENCES users ON DELETE CASCADE;
ALTER TABLE user_organization_roles
ALTER COLUMN created_at TYPE TIMESTAMPTZ USING created_at AT TIME ZONE 'UTC';
ALTER TABLE user_project_roles
ALTER COLUMN created_at TYPE TIMESTAMPTZ USING created_at AT TIME ZONE 'UTC';
ALTER TABLE user_sessions
ADD COLUMN user_id BIGINT REFERENCES users ON DELETE CASCADE;
UPDATE user_sessions us
SET user_id = u.id
FROM users u
WHERE us.username = u.name;
ALTER TABLE user_sessions
ALTER COLUMN user_id SET NOT NULL,
DROP COLUMN username,
ALTER COLUMN created_at TYPE TIMESTAMPTZ USING created_at AT TIME ZONE 'UTC',
ALTER COLUMN expiration TYPE TIMESTAMPTZ USING expiration AT TIME ZONE 'UTC';
ALTER TABLE user_sign_ons
ALTER COLUMN created_at TYPE TIMESTAMPTZ USING created_at AT TIME ZONE 'UTC';
ALTER TABLE users
ALTER COLUMN created_at TYPE TIMESTAMPTZ USING created_at AT TIME ZONE 'UTC',
ALTER COLUMN join_date TYPE TIMESTAMPTZ USING join_date AT TIME ZONE 'UTC';
UPDATE projects
SET recommended_version_id = NULL
WHERE recommended_version_id = -1;
ALTER TABLE projects
DROP COLUMN stars,
DROP COLUMN last_updated,
ALTER COLUMN created_at TYPE TIMESTAMPTZ USING created_at AT TIME ZONE 'UTC',
ADD COLUMN homepage VARCHAR(255),
ADD COLUMN issues VARCHAR(255),
ADD COLUMN source VARCHAR(255),
ADD COLUMN support VARCHAR(255),
ADD COLUMN license_name VARCHAR(255),
ADD COLUMN license_url VARCHAR(255),
ADD COLUMN forum_sync BOOLEAN DEFAULT TRUE NOT NULL,
DROP CONSTRAINT projects_owner_id_fkey,
ADD CONSTRAINT projects_owner_id_fkey FOREIGN KEY (owner_id) REFERENCES users ON DELETE CASCADE,
ALTER COLUMN recommended_version_id DROP DEFAULT,
ADD CONSTRAINT projects_recommended_version_id_fkey FOREIGN KEY (recommended_version_id) REFERENCES project_versions ON DELETE SET NULL;
CREATE FUNCTION update_project_name_trigger() RETURNS TRIGGER
LANGUAGE plpgsql AS
$$
BEGIN
UPDATE projects p SET name = u.name FROM users u WHERE p.id = new.id AND u.id = new.owner_id;;
END;;
$$;
CREATE TRIGGER project_owner_name_updater
AFTER UPDATE OF owner_id
ON projects
FOR EACH ROW
WHEN (old.owner_id != new.owner_id)
EXECUTE FUNCTION update_project_name_trigger();
UPDATE projects p
SET homepage = ps.homepage,
issues = ps.issues,
source = ps.source,
support = ps.support,
license_name = ps.license_name,
license_url = ps.license_url,
forum_sync = ps.forum_sync
FROM project_settings ps
WHERE ps.project_id = p.id;
DROP TABLE project_settings;
CREATE TYPE LOGGED_ACTION_TYPE AS ENUM (
'project_visibility_change',
'project_renamed',
'project_flagged',
'project_settings_changed',
'project_member_removed',
'project_icon_changed',
'project_page_edited',
'project_flag_resolved',
'version_deleted',
'version_uploaded', --No recommended version changed as we're phasing them out
'version_description_changed',
'version_review_state_changed',
'user_tagline_changed'
);
CREATE FUNCTION logged_action_type_from_int(id int) RETURNS LOGGED_ACTION_TYPE
IMMUTABLE
RETURNS NULL ON NULL INPUT
LANGUAGE plpgsql AS
$$
BEGIN
CASE id
WHEN 0 THEN RETURN 'project_visibility_change';;
WHEN 2 THEN RETURN 'project_renamed';;
WHEN 3 THEN RETURN 'project_flagged';;
WHEN 4 THEN RETURN 'project_settings_changed';;
WHEN 5 THEN RETURN 'project_member_removed';;
WHEN 6 THEN RETURN 'project_icon_changed';;
WHEN 7 THEN RETURN 'project_page_edited';;
WHEN 13 THEN RETURN 'project_flag_resolved';;
WHEN 8 THEN RETURN 'version_deleted';;
WHEN 9 THEN RETURN 'version_uploaded';;
WHEN 12 THEN RETURN 'version_description_changed';;
WHEN 17 THEN RETURN 'version_review_state_changed';;
WHEN 14 THEN RETURN 'user_tagline_changed';;
ELSE
END CASE;;
RETURN NULL;;
END;;
$$;
DELETE
FROM logged_actions
WHERE logged_action_type_from_int(action) IS NULL;
CREATE TABLE logged_actions_project
(
id BIGSERIAL PRIMARY KEY,
created_at TIMESTAMPTZ NOT NULL,
user_id BIGINT REFERENCES users ON DELETE SET NULL,
address INET NOT NULL,
action LOGGED_ACTION_TYPE NOT NULL,
project_id BIGINT REFERENCES projects ON DELETE SET NULL,
new_state TEXT NOT NULL,
old_state TEXT NOT NULL
);
DELETE
FROM logged_actions a
WHERE action_context = 0
AND NOT EXISTS(SELECT * FROM projects p WHERE p.id = a.action_context_id);
INSERT INTO logged_actions_project (created_at, user_id, address, action, project_id, new_state, old_state)
SELECT a.created_at,
a.user_id,
a.address,
logged_action_type_from_int(a.action),
a.action_context_id,
a.new_state,
a.old_state
FROM logged_actions a
WHERE a.action_context = 0;
CREATE TABLE logged_actions_version
(
id BIGSERIAL PRIMARY KEY,
created_at TIMESTAMPTZ NOT NULL,
user_id BIGINT REFERENCES users ON DELETE SET NULL,
address INET NOT NULL,
action LOGGED_ACTION_TYPE NOT NULL,
project_id BIGINT REFERENCES projects ON DELETE SET NULL,
version_id BIGINT REFERENCES project_versions ON DELETE SET NULL,
new_state TEXT NOT NULL,
old_state TEXT NOT NULL
);
INSERT INTO logged_actions_version (created_at, user_id, address, action, project_id, version_id, new_state, old_state)
SELECT a.created_at,
a.user_id,
a.address,
logged_action_type_from_int(a.action),
pv.project_id,
a.action_context_id,
a.new_state,
a.old_state
FROM logged_actions a
JOIN project_versions pv ON a.action_context_id = pv.id
WHERE a.action_context = 1
AND a.action != 11; --We don't care about recommended version changes
CREATE TABLE logged_actions_page
(
id BIGSERIAL PRIMARY KEY,
created_at TIMESTAMPTZ NOT NULL,
user_id BIGINT REFERENCES users ON DELETE SET NULL,
address INET NOT NULL,
action LOGGED_ACTION_TYPE NOT NULL,
project_id BIGINT REFERENCES projects ON DELETE SET NULL,
page_id BIGINT REFERENCES project_pages ON DELETE SET NULL,
new_state TEXT NOT NULL,
old_state TEXT NOT NULL
);
INSERT INTO logged_actions_page (created_at, user_id, address, action, project_id, page_id, new_state, old_state)
SELECT a.created_at,
a.user_id,
a.address,
logged_action_type_from_int(a.action),
pp.project_id,
a.action_context_id,
a.new_state,
a.old_state
FROM logged_actions a
JOIN project_pages pp ON a.action_context_id = pp.id
WHERE a.action_context = 2;
CREATE TABLE logged_actions_user
(
id BIGSERIAL PRIMARY KEY,
created_at TIMESTAMPTZ NOT NULL,
user_id BIGINT REFERENCES users ON DELETE SET NULL,
address INET NOT NULL,
action LOGGED_ACTION_TYPE NOT NULL,
subject_id BIGINT REFERENCES users ON DELETE SET NULL,
new_state TEXT NOT NULL,
old_state TEXT NOT NULL
);
INSERT INTO logged_actions_user (created_at, user_id, address, action, subject_id, new_state, old_state)
SELECT a.created_at,
a.user_id,
a.address,
logged_action_type_from_int(a.action),
a.action_context_id,
a.new_state,
a.old_state
FROM logged_actions a
WHERE a.action_context = 3;
CREATE TABLE logged_actions_organization
(
id BIGSERIAL PRIMARY KEY,
created_at TIMESTAMPTZ NOT NULL,
user_id BIGINT REFERENCES users ON DELETE SET NULL,
address INET NOT NULL,
action LOGGED_ACTION_TYPE NOT NULL,
organization_id BIGINT REFERENCES organizations ON DELETE SET NULL,
new_state TEXT NOT NULL,
old_state TEXT NOT NULL
);
INSERT INTO logged_actions_organization (created_at, user_id, address, action, organization_id, new_state, old_state)
SELECT a.created_at,
a.user_id,
a.address,
logged_action_type_from_int(a.action),
a.action_context_id,
a.new_state,
a.old_state
FROM logged_actions a
WHERE a.action_context = 4;
DROP TABLE logged_actions;
CREATE VIEW v_logged_actions AS
SELECT a.id,
a.created_at,
a.user_id,
u.name as user_name,
a.address,
a.action,
0 AS context_type,
a.new_state,
a.old_state,
p.id AS p_id,
p.plugin_id AS p_plugin_id,
p.slug AS p_slug,
ou.name AS p_owner_name,
NULL::BIGINT AS pv_id,
NULL::VARCHAR(255) AS pv_version_string,
NULL::BIGINT AS pp_id,
NULL::VARCHAR(255) AS pp_name,
NULL::VARCHAR(255) AS pp_slug,
NULL::BIGINT AS s_id,
NULL::VARCHAR(255) AS s_name
FROM logged_actions_project a
LEFT JOIN users u ON a.user_id = u.id
LEFT JOIN projects p ON a.project_id = p.id
LEFT JOIN users ou ON p.owner_id = ou.id
UNION ALL
SELECT a.id,
a.created_at,
a.user_id,
u.name,
a.address,
a.action,
1,
a.new_state,
a.old_state,
p.id,
p.plugin_id,
p.slug,
ou.name AS p_owner_name,
pv.id,
pv.version_string,
NULL,
NULL,
NULL,
NULL,
NULL
FROM logged_actions_version a
LEFT JOIN users u ON a.user_id = u.id
LEFT JOIN project_versions pv ON a.version_id = pv.id
LEFT JOIN projects p ON a.project_id = p.id
LEFT JOIN users ou ON p.owner_id = ou.id
UNION ALL
SELECT a.id,
a.created_at,
a.user_id,
u.name,
a.address,
a.action,
2,
a.new_state,
a.old_state,
p.id,
p.plugin_id,
p.slug,
ou.name AS p_owner_name,
NULL,
NULL,
pp.id,
pp.name,
pp.slug,
NULL,
NULL
FROM logged_actions_page a
LEFT JOIN users u ON a.user_id = u.id
LEFT JOIN project_pages pp ON a.page_id = pp.id
LEFT JOIN projects p ON a.project_id = p.id
LEFT JOIN users ou ON p.owner_id = ou.id
UNION ALL
SELECT a.id,
a.created_at,
a.user_id,
u.name,
a.address,
a.action,
3,
a.new_state,
a.old_state,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
s.id,
s.name
FROM logged_actions_user a
LEFT JOIN users u ON a.user_id = u.id
LEFT JOIN users s ON a.subject_id = s.id
UNION ALL
SELECT a.id,
a.created_at,
a.user_id,
u.name,
a.address,
a.action,
4,
a.new_state,
a.old_state,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
s.id,
s.name
FROM logged_actions_organization a
LEFT JOIN organizations o ON a.organization_id = o.id
LEFT JOIN users u ON a.user_id = u.id
LEFT JOIN users s ON o.user_id = s.id;
CREATE MATERIALIZED VIEW home_projects AS
WITH tags AS (
SELECT sq.project_id, sq.version_string, sq.tag_name, sq.tag_version, sq.tag_color
FROM (SELECT pv.project_id,
pv.version_string,
pvt.name AS tag_name,
pvt.data AS tag_version,
pvt.platform_version,
pvt.color AS tag_color,
row_number()
OVER (PARTITION BY pv.project_id, pvt.platform_version ORDER BY pv.created_at DESC) AS row_num
FROM project_versions pv
JOIN (
SELECT pvti.version_id,
pvti.name,
pvti.data,
--TODO, use a STORED column in Postgres 12
CASE
WHEN pvti.name = 'Sponge'
THEN substring(pvti.data FROM
'^\[?(\d+)\.\d+(?:\.\d+)?(?:-SNAPSHOT)?(?:-[a-z0-9]{7,9})?(?:,(?:\d+\.\d+(?:\.\d+)?)?\))?$')
WHEN pvti.name = 'SpongeForge'
THEN substring(pvti.data FROM
'^\d+\.\d+\.\d+-\d+-(\d+)\.\d+\.\d+(?:(?:-BETA-\d+)|(?:-RC\d+))?$')
WHEN pvti.name = 'SpongeVanilla'
THEN substring(pvti.data FROM
'^\d+\.\d+\.\d+-(\d+)\.\d+\.\d+(?:(?:-BETA-\d+)|(?:-RC\d+))?$')
WHEN pvti.name = 'Forge'
THEN substring(pvti.data FROM '^\d+\.(\d+)\.\d+(?:\.\d+)?$')
WHEN pvti.name = 'Lantern'
THEN NULL --TODO Change this once Lantern changes to SpongeVanilla's format
ELSE NULL
END AS platform_version,
pvti.color
FROM project_version_tags pvti
WHERE pvti.name IN ('Sponge', 'SpongeForge', 'SpongeVanilla', 'Forge', 'Lantern')
AND pvti.data IS NOT NULL
) pvt ON pv.id = pvt.version_id
WHERE pv.visibility = 1
AND pvt.name IN
('Sponge', 'SpongeForge', 'SpongeVanilla', 'Forge', 'Lantern')
AND pvt.platform_version IS NOT NULL) sq
WHERE sq.row_num = 1
ORDER BY sq.platform_version DESC)
SELECT p.id,
p.owner_name AS owner_name,
array_agg(DISTINCT pm.user_id) AS project_members,
p.slug,
p.visibility,
p.views,
p.downloads,
coalesce(ps.stars, 0) AS stars,
coalesce(pw.watchers, 0) AS watchers,
p.category,
p.description,
p.name,
p.plugin_id,
p.created_at,
max(lv.created_at) AS last_updated,
to_jsonb(
ARRAY(SELECT jsonb_build_object('version_string', tags.version_string, 'tag_name',
tags.tag_name,
'tag_version', tags.tag_version, 'tag_color',
tags.tag_color)
FROM tags
WHERE tags.project_id = p.id
LIMIT 5)) AS promoted_versions,
setweight(to_tsvector('english', p.name) ||
to_tsvector('english', regexp_replace(p.name, '([a-z])([A-Z]+)', '\1_\2', 'g')) ||
to_tsvector('english', p.plugin_id), 'A') ||
setweight(to_tsvector('english', p.description), 'B') ||
setweight(to_tsvector('english', array_to_string(p.keywords, ' ')), 'C') ||
setweight(to_tsvector('english', p.owner_name) ||
to_tsvector('english', regexp_replace(p.owner_name, '([a-z])([A-Z]+)', '\1_\2', 'g')),
'D') AS search_words
FROM projects p
LEFT JOIN project_versions lv ON p.id = lv.project_id
JOIN project_members_all pm ON p.id = pm.id
LEFT JOIN (SELECT p.id, COUNT(*) AS stars
FROM projects p
LEFT JOIN project_stars ps ON p.id = ps.project_id
GROUP BY p.id) ps ON p.id = ps.id
LEFT JOIN (SELECT p.id, COUNT(*) AS watchers
FROM projects p
LEFT JOIN project_watchers pw ON p.id = pw.project_id
GROUP BY p.id) pw ON p.id = pw.id
GROUP BY p.id, ps.stars, pw.watchers;
CREATE INDEX home_projects_downloads_idx ON home_projects (downloads);
CREATE INDEX home_projects_stars_idx ON home_projects (stars);
CREATE INDEX home_projects_views_idx ON home_projects (views);
CREATE INDEX home_projects_created_at_idx ON home_projects (created_at);
CREATE INDEX home_projects_last_updated_idx ON home_projects (last_updated);
CREATE INDEX home_projects_search_words_idx ON home_projects USING gin (search_words);
# --- !Downs
DROP VIEW v_logged_actions;
DROP MATERIALIZED VIEW home_projects;
ALTER TABLE api_keys
ALTER COLUMN created_at TYPE TIMESTAMP,
DROP CONSTRAINT api_keys_owner_id_fkey,
ADD CONSTRAINT api_keys_owner_id_fkey FOREIGN KEY (owner_id) REFERENCES users;
ALTER TABLE api_sessions
ALTER COLUMN created_at TYPE TIMESTAMP,
ALTER COLUMN expires TYPE TIMESTAMP,
DROP CONSTRAINT api_sessions_user_id_fkey,
ADD CONSTRAINT api_sessions_user_id_fkey FOREIGN KEY (user_id) REFERENCES users;
ALTER TABLE notifications
ALTER COLUMN created_at TYPE TIMESTAMP,
DROP CONSTRAINT notifications_origin_id_fkey,
ADD CONSTRAINT notifications_origin_id_fkey FOREIGN KEY (origin_id) REFERENCES users ON DELETE CASCADE;
ALTER TABLE organizations
RENAME CONSTRAINT organizations_name_key TO organizations_username_key;
ALTER TABLE organizations
ALTER COLUMN created_at TYPE TIMESTAMP,
DROP COLUMN user_id,
DROP CONSTRAINT organizations_name_fkey;
ALTER TABLE organizations
RENAME COLUMN owner_id TO user_id;
ALTER TABLE project_api_keys
ALTER COLUMN created_at TYPE TIMESTAMP;
ALTER TABLE project_channels
ALTER COLUMN created_at TYPE TIMESTAMP;
ALTER TABLE project_flags
ALTER COLUMN comment TYPE VARCHAR(255),
DROP CONSTRAINT project_flags_resolved_by_fkey,
ALTER COLUMN created_at TYPE TIMESTAMP,
ALTER COLUMN resolved_at TYPE TIMESTAMP;
ALTER TABLE project_pages
DROP CONSTRAINT project_pages_parent_id_fkey,
ALTER COLUMN created_at TYPE TIMESTAMP;
ALTER TABLE project_version_download_warnings
DROP CONSTRAINT project_version_download_warnings_download_id_fkey,
ALTER COLUMN created_at TYPE TIMESTAMP,
ALTER COLUMN expiration TYPE TIMESTAMP;
ALTER TABLE project_version_downloads
ALTER COLUMN created_at TYPE TIMESTAMP,
DROP CONSTRAINT project_version_downloads_version_id_fkey,
DROP CONSTRAINT project_version_downloads_user_id_fkey;
ALTER TABLE project_version_reviews
ALTER COLUMN created_at TYPE TIMESTAMP,
ALTER COLUMN ended_at TYPE TIMESTAMP;
ALTER TABLE project_version_unsafe_downloads
DROP CONSTRAINT project_version_unsafe_downloads_fkey,
ALTER COLUMN created_at TYPE TIMESTAMP,
ALTER COLUMN user_id SET DEFAULT -1::INTEGER;
ALTER TABLE project_version_visibility_changes
ALTER COLUMN created_at TYPE TIMESTAMP,
ALTER COLUMN resolved_at TYPE TIMESTAMP,
DROP CONSTRAINT project_version_visibility_changes_created_by_fkey,
ADD CONSTRAINT project_version_visibility_changes_created_by_fkey FOREIGN KEY (created_by) REFERENCES users,
DROP CONSTRAINT project_version_visibility_changes_version_id_fkey,
ADD CONSTRAINT project_version_visibility_changes_version_id_fkey FOREIGN KEY (version_id) REFERENCES project_versions,
DROP CONSTRAINT project_version_visibility_changes_resolved_by_fkey,
ADD CONSTRAINT project_version_visibility_changes_resolved_by_fkey FOREIGN KEY (resolved_by) REFERENCES users;
UPDATE project_version_unsafe_downloads
SET user_id = -1
WHERE user_id IS NULL;
ALTER TABLE project_versions
DROP CONSTRAINT project_versions_reviewer_id_fkey,
DROP CONSTRAINT project_versions_author_id_fkey,
ALTER COLUMN created_at TYPE TIMESTAMP,
ALTER COLUMN approved_at TYPE TIMESTAMP;
UPDATE project_versions pv
SET author_id = -1
WHERE pv.author_id IS NULL;
ALTER TABLE project_versions
ALTER COLUMN author_id SET NOT NULL,
DROP CONSTRAINT versions_project_id_fkey,
ADD CONSTRAINT versions_project_id_fkey FOREIGN KEY (project_id) REFERENCES projects;
ALTER TABLE project_views
ALTER COLUMN created_at TYPE TIMESTAMP,
DROP CONSTRAINT project_views_user_id_fkey;
ALTER TABLE project_visibility_changes
ALTER COLUMN created_at TYPE TIMESTAMP,
ALTER COLUMN resolved_at TYPE TIMESTAMP,
DROP CONSTRAINT project_visibility_changes_created_by_fkey,
ADD CONSTRAINT project_visibility_changes_created_by_fkey FOREIGN KEY (created_by) REFERENCES users,
DROP CONSTRAINT project_visibility_changes_resolved_by_fkey,
ADD CONSTRAINT project_visibility_changes_resolved_by_fkey FOREIGN KEY (resolved_by) REFERENCES users;
ALTER TABLE project_watchers
DROP CONSTRAINT project_watchers_pkey,
DROP CONSTRAINT project_watchers_project_id_fkey,
DROP CONSTRAINT project_watchers_user_id_fkey;
ALTER TABLE user_organization_roles
ALTER COLUMN created_at TYPE TIMESTAMP;
ALTER TABLE user_project_roles
ALTER COLUMN created_at TYPE TIMESTAMP;
ALTER TABLE user_sessions
ADD COLUMN username VARCHAR(255) REFERENCES users (name) ON UPDATE CASCADE ON DELETE CASCADE;
UPDATE user_sessions us
SET username = u.name
FROM users u
WHERE us.user_id = u.id;
ALTER TABLE user_sessions
ALTER COLUMN username SET NOT NULL,
DROP COLUMN user_id,
ALTER COLUMN created_at TYPE TIMESTAMP,
ALTER COLUMN expiration TYPE TIMESTAMP;
ALTER TABLE user_sign_ons
ALTER COLUMN created_at TYPE TIMESTAMP;
ALTER TABLE users
ALTER COLUMN created_at TYPE TIMESTAMP,
ALTER COLUMN join_date TYPE TIMESTAMP;
CREATE TABLE project_settings
(
id BIGSERIAL PRIMARY KEY,
created_at TIMESTAMP NOT NULL,
project_id BIGINT NOT NULL UNIQUE
REFERENCES projects
ON DELETE CASCADE,
homepage VARCHAR(255),
issues VARCHAR(255),
source VARCHAR(255),
license_name VARCHAR(255),
license_url VARCHAR(255),
forum_sync BOOLEAN DEFAULT TRUE NOT NULL,
support VARCHAR(255)
);
INSERT INTO project_settings (created_at, project_id, homepage, issues, source, license_name, license_url, forum_sync,
support)
SELECT p.created_at,
p.id,
p.homepage,
p.issues,
p.source,
p.license_name,
p.license_url,
p.forum_sync,
p.support
FROM projects p;
ALTER TABLE projects
ADD COLUMN stars BIGINT,
ADD COLUMN last_updated TIMESTAMP NOT NULL DEFAULT now(),
ALTER COLUMN created_at TYPE TIMESTAMP,
DROP COLUMN homepage,
DROP COLUMN issues,
DROP COLUMN source,
DROP COLUMN support,
DROP COLUMN license_name,
DROP COLUMN license_url,
DROP COLUMN forum_sync,
DROP CONSTRAINT projects_owner_id_fkey,
ADD CONSTRAINT projects_owner_id_fkey FOREIGN KEY (owner_id) REFERENCES users,
ALTER COLUMN recommended_version_id SET DEFAULT -1,
DROP CONSTRAINT projects_recommended_version_id_fkey;
UPDATE projects p
SET stars = coalesce(ps.stars, 0),
owner_name = u.name
FROM users u,
(SELECT pp.id, COUNT(*) AS stars
FROM projects pp
LEFT JOIN project_stars ps ON pp.id = ps.project_id
GROUP BY pp.id) ps
WHERE p.owner_id = u.id
AND p.id = ps.id;
ALTER TABLE projects
ALTER COLUMN owner_name SET NOT NULL,
ALTER COLUMN stars SET NOT NULL;
DROP TRIGGER project_owner_name_updater ON projects;
DROP FUNCTION update_project_name_trigger;
DROP FUNCTION logged_action_type_from_int;
CREATE FUNCTION logged_action_type_to_int(id LOGGED_ACTION_TYPE) RETURNS INT
IMMUTABLE
RETURNS NULL ON NULL INPUT
LANGUAGE plpgsql AS
$$
BEGIN
CASE id
WHEN 'project_visibility_change' THEN RETURN 0;;
WHEN 'project_renamed' THEN RETURN 2;;
WHEN 'project_flagged' THEN RETURN 3;;
WHEN 'project_settings_changed' THEN RETURN 4;;
WHEN 'project_member_removed' THEN RETURN 5;;
WHEN 'project_icon_changed' THEN RETURN 6;;
WHEN 'project_page_edited' THEN RETURN 7;;
WHEN 'project_flag_resolved' THEN RETURN 13;;
WHEN 'version_deleted' THEN RETURN 8;;
WHEN 'version_uploaded' THEN RETURN 9;;
WHEN 'version_description_changed' THEN RETURN 12;;
WHEN 'version_review_state_changed' THEN RETURN 17;;
WHEN 'user_tagline_changed' THEN RETURN 14;;
ELSE
END CASE;;
RETURN NULL;;
END;;
$$;
CREATE TABLE logged_actions
(
id BIGSERIAL PRIMARY KEY,
created_at TIMESTAMP DEFAULT now() NOT NULL,
user_id BIGINT NOT NULL REFERENCES users,
address INET NOT NULL,
action INTEGER NOT NULL,
action_context INTEGER NOT NULL,
action_context_id BIGINT NOT NULL,
new_state TEXT NOT NULL,
old_state TEXT NOT NULL
);
CREATE INDEX i_logged_actions
ON logged_actions (action_context, action_context_id);
INSERT INTO logged_actions (created_at, user_id, address, action, action_context, action_context_id, new_state,
old_state)
SELECT a.created_at,
a.user_id,
a.address,
logged_action_type_to_int(a.action),
0,
a.project_id,
a.new_state,
a.old_state
FROM logged_actions_project a WHERE a.project_id IS NOT NULL;
DROP TABLE logged_actions_project;
INSERT INTO logged_actions (created_at, user_id, address, action, action_context, action_context_id, new_state,
old_state)
SELECT a.created_at,
a.user_id,
a.address,
logged_action_type_to_int(a.action),
1,
a.version_id,
a.new_state,
a.old_state
FROM logged_actions_version a WHERE a.version_id IS NOT NULL;
DROP TABLE logged_actions_version;
INSERT INTO logged_actions (created_at, user_id, address, action, action_context, action_context_id, new_state,
old_state)
SELECT a.created_at,
a.user_id,
a.address,
logged_action_type_to_int(a.action),
2,
a.page_id,
a.new_state,
a.old_state
FROM logged_actions_page a WHERE a.page_id IS NOT NULL;
DROP TABLE logged_actions_page;
INSERT INTO logged_actions (created_at, user_id, address, action, action_context, action_context_id, new_state,
old_state)
SELECT a.created_at,
a.user_id,
a.address,
logged_action_type_to_int(a.action),
3,
a.subject_id,
a.new_state,
a.old_state
FROM logged_actions_user a WHERE a.subject_id IS NOT NULL;
DROP TABLE logged_actions_user;
INSERT INTO logged_actions (created_at, user_id, address, action, action_context, action_context_id, new_state,
old_state)
SELECT a.created_at,
a.user_id,
a.address,
logged_action_type_to_int(a.action),
4,
a.organization_id,
a.new_state,
a.old_state
FROM logged_actions_organization a WHERE a.organization_id IS NOT NULL;
DROP TABLE logged_actions_organization;
DROP FUNCTION logged_action_type_to_int;
DROP TYPE LOGGED_ACTION_TYPE;
CREATE VIEW v_logged_actions
AS
SELECT a.id,
a.created_at,
a.user_id,
a.address,
a.action,
a.action_context,
a.action_context_id,
a.new_state,
a.old_state,
u.id AS u_id,
u.name AS u_name,
p.id AS p_id,
p.plugin_id AS p_plugin_id,
p.slug AS p_slug,
p.owner_name AS p_owner_name,
pv.id AS pv_id,
pv.version_string AS pv_version_string,
pp.id AS pp_id,
pp.name AS pp_name,
pp.slug AS pp_slug,
s.id AS s_id,
s.name AS s_name,
CASE
WHEN (a.action_context = 0) THEN a.action_context_id -- Project
WHEN (a.action_context = 1) THEN COALESCE(pv.project_id, -1) -- Version
WHEN (a.action_context = 2) THEN COALESCE(pp.project_id, -1) -- ProjectPage
ELSE -1 -- Return -1 to allow filtering
END AS filter_project,
CASE
WHEN (a.action_context = 1) THEN COALESCE(pv.id, a.action_context_id) -- Version (possible deleted)
ELSE -1 -- Return -1 to allow filtering correctly
END AS filter_version,
CASE
WHEN (a.action_context = 2) THEN COALESCE(pp.id, -1)
ELSE -1
END AS filter_page,
CASE
WHEN (a.action_context = 3) THEN a.action_context_id -- User
WHEN (a.action_context = 4) THEN a.action_context_id -- Organization
ELSE -1
END AS filter_subject,
a.action AS filter_action
FROM logged_actions a
LEFT OUTER JOIN users u ON a.user_id = u.id
LEFT OUTER JOIN projects p ON
CASE
WHEN a.action_context = 0 AND a.action_context_id = p.id THEN 1 -- Join on action
WHEN a.action_context = 1 AND
(SELECT project_id FROM project_versions pvin WHERE pvin.id = a.action_context_id) = p.id
THEN 1 -- Query for projectId from Version
WHEN a.action_context = 2 AND
(SELECT project_id FROM project_pages ppin WHERE ppin.id = a.action_context_id) = p.id
THEN 1 -- Query for projectId from Page
ELSE 0
END = 1
LEFT OUTER JOIN project_versions pv ON (a.action_context = 1 AND a.action_context_id = pv.id)
LEFT OUTER JOIN project_pages pp ON (a.action_context = 2 AND a.action_context_id = pp.id)
LEFT OUTER JOIN users s ON
CASE
WHEN a.action_context = 3 AND a.action_context_id = s.id THEN 1
WHEN a.action_context = 4 AND a.action_context_id = s.id THEN 1
ELSE 0
END = 1;
CREATE MATERIALIZED VIEW home_projects AS
WITH tags AS (
SELECT sq.project_id, sq.version_string, sq.tag_name, sq.tag_version, sq.tag_color
FROM (SELECT pv.project_id,
pv.version_string,
pvt.name AS tag_name,
pvt.data AS tag_version,
pvt.platform_version,
pvt.color AS tag_color,
row_number()
OVER (PARTITION BY pv.project_id, pvt.platform_version ORDER BY pv.created_at DESC) AS row_num
FROM project_versions pv
JOIN (
SELECT pvti.version_id,
pvti.name,
pvti.data,
--TODO, use a STORED column in Postgres 12
CASE
WHEN pvti.name = 'Sponge'
THEN substring(pvti.data FROM
'^\[?(\d+)\.\d+(?:\.\d+)?(?:-SNAPSHOT)?(?:-[a-z0-9]{7,9})?(?:,(?:\d+\.\d+(?:\.\d+)?)?\))?$')
WHEN pvti.name = 'SpongeForge'
THEN substring(pvti.data FROM
'^\d+\.\d+\.\d+-\d+-(\d+)\.\d+\.\d+(?:(?:-BETA-\d+)|(?:-RC\d+))?$')
WHEN pvti.name = 'SpongeVanilla'
THEN substring(pvti.data FROM
'^\d+\.\d+\.\d+-(\d+)\.\d+\.\d+(?:(?:-BETA-\d+)|(?:-RC\d+))?$')
WHEN pvti.name = 'Forge'
THEN substring(pvti.data FROM '^\d+\.(\d+)\.\d+(?:\.\d+)?$')
WHEN pvti.name = 'Lantern'
THEN NULL --TODO Change this once Lantern changes to SpongeVanilla's format
ELSE NULL
END AS platform_version,
pvti.color
FROM project_version_tags pvti
WHERE pvti.name IN ('Sponge', 'SpongeForge', 'SpongeVanilla', 'Forge', 'Lantern')
AND pvti.data IS NOT NULL
) pvt ON pv.id = pvt.version_id
WHERE pv.visibility = 1
AND pvt.name IN
('Sponge', 'SpongeForge', 'SpongeVanilla', 'Forge', 'Lantern')
AND pvt.platform_version IS NOT NULL) sq
WHERE sq.row_num = 1
ORDER BY sq.platform_version DESC)
SELECT p.id,
p.owner_name,
array_agg(DISTINCT pm.user_id) AS project_members,
p.slug,
p.visibility,
p.views,
p.downloads,
p.stars,
p.category,
p.description,
p.name,
p.plugin_id,
p.created_at,
max(lv.created_at) AS last_updated,
to_jsonb(
ARRAY(SELECT jsonb_build_object('version_string', tags.version_string, 'tag_name',
tags.tag_name,
'tag_version', tags.tag_version, 'tag_color',
tags.tag_color)
FROM tags
WHERE tags.project_id = p.id
LIMIT 5)) AS promoted_versions,
setweight(to_tsvector('english', p.name) ||
to_tsvector('english', regexp_replace(p.name, '([a-z])([A-Z]+)', '\1_\2', 'g')) ||
to_tsvector('english', p.plugin_id), 'A') ||
setweight(to_tsvector('english', p.description), 'B') ||
setweight(to_tsvector('english', array_to_string(p.keywords, ' ')), 'C') ||
setweight(to_tsvector('english', p.owner_name) ||
to_tsvector('english', regexp_replace(p.owner_name, '([a-z])([A-Z]+)', '\1_\2', 'g')),
'D') AS search_words
FROM projects p
LEFT JOIN project_versions lv ON p.id = lv.project_id
JOIN project_members_all pm ON p.id = pm.id
GROUP BY p.id;
CREATE INDEX home_projects_downloads_idx ON home_projects (downloads);
CREATE INDEX home_projects_stars_idx ON home_projects (stars);
CREATE INDEX home_projects_views_idx ON home_projects (views);
CREATE INDEX home_projects_created_at_idx ON home_projects (extract(EPOCH FROM created_at));
CREATE INDEX home_projects_last_updated_idx ON home_projects (extract(EPOCH FROM last_updated));
CREATE INDEX home_projects_search_words_idx ON home_projects USING gin (search_words); | the_stack |
SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;
-- ----------------------------
-- Table structure for QRTZ_BLOB_TRIGGERS
-- ----------------------------
DROP TABLE IF EXISTS `QRTZ_BLOB_TRIGGERS`;
CREATE TABLE `QRTZ_BLOB_TRIGGERS` (
`SCHED_NAME` varchar(120) NOT NULL,
`TRIGGER_NAME` varchar(200) NOT NULL,
`TRIGGER_GROUP` varchar(200) NOT NULL,
`BLOB_DATA` blob,
PRIMARY KEY (`SCHED_NAME`,`TRIGGER_NAME`,`TRIGGER_GROUP`),
KEY `SCHED_NAME` (`SCHED_NAME`,`TRIGGER_NAME`,`TRIGGER_GROUP`),
CONSTRAINT `qrtz_blob_triggers_ibfk_1` FOREIGN KEY (`SCHED_NAME`, `TRIGGER_NAME`, `TRIGGER_GROUP`) REFERENCES `QRTZ_TRIGGERS` (`SCHED_NAME`, `TRIGGER_NAME`, `TRIGGER_GROUP`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- ----------------------------
-- Table structure for QRTZ_CALENDARS
-- ----------------------------
DROP TABLE IF EXISTS `QRTZ_CALENDARS`;
CREATE TABLE `QRTZ_CALENDARS` (
`SCHED_NAME` varchar(120) NOT NULL,
`CALENDAR_NAME` varchar(200) NOT NULL,
`CALENDAR` blob NOT NULL,
PRIMARY KEY (`SCHED_NAME`,`CALENDAR_NAME`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- ----------------------------
-- Table structure for QRTZ_CRON_TRIGGERS
-- ----------------------------
DROP TABLE IF EXISTS `QRTZ_CRON_TRIGGERS`;
CREATE TABLE `QRTZ_CRON_TRIGGERS` (
`SCHED_NAME` varchar(120) NOT NULL,
`TRIGGER_NAME` varchar(200) NOT NULL,
`TRIGGER_GROUP` varchar(200) NOT NULL,
`CRON_EXPRESSION` varchar(120) NOT NULL,
`TIME_ZONE_ID` varchar(80) DEFAULT NULL,
PRIMARY KEY (`SCHED_NAME`,`TRIGGER_NAME`,`TRIGGER_GROUP`),
CONSTRAINT `qrtz_cron_triggers_ibfk_1` FOREIGN KEY (`SCHED_NAME`, `TRIGGER_NAME`, `TRIGGER_GROUP`) REFERENCES `QRTZ_TRIGGERS` (`SCHED_NAME`, `TRIGGER_NAME`, `TRIGGER_GROUP`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- ----------------------------
-- Table structure for QRTZ_FIRED_TRIGGERS
-- ----------------------------
DROP TABLE IF EXISTS `QRTZ_FIRED_TRIGGERS`;
CREATE TABLE `QRTZ_FIRED_TRIGGERS` (
`SCHED_NAME` varchar(120) NOT NULL,
`ENTRY_ID` varchar(95) NOT NULL,
`TRIGGER_NAME` varchar(200) NOT NULL,
`TRIGGER_GROUP` varchar(200) NOT NULL,
`INSTANCE_NAME` varchar(200) NOT NULL,
`FIRED_TIME` bigint(13) NOT NULL,
`SCHED_TIME` bigint(13) NOT NULL,
`PRIORITY` int(11) NOT NULL,
`STATE` varchar(16) NOT NULL,
`JOB_NAME` varchar(200) DEFAULT NULL,
`JOB_GROUP` varchar(200) DEFAULT NULL,
`IS_NONCONCURRENT` varchar(1) DEFAULT NULL,
`REQUESTS_RECOVERY` varchar(1) DEFAULT NULL,
PRIMARY KEY (`SCHED_NAME`,`ENTRY_ID`),
KEY `IDX_QRTZ_FT_TRIG_INST_NAME` (`SCHED_NAME`,`INSTANCE_NAME`),
KEY `IDX_QRTZ_FT_INST_JOB_REQ_RCVRY` (`SCHED_NAME`,`INSTANCE_NAME`,`REQUESTS_RECOVERY`),
KEY `IDX_QRTZ_FT_J_G` (`SCHED_NAME`,`JOB_NAME`,`JOB_GROUP`),
KEY `IDX_QRTZ_FT_JG` (`SCHED_NAME`,`JOB_GROUP`),
KEY `IDX_QRTZ_FT_T_G` (`SCHED_NAME`,`TRIGGER_NAME`,`TRIGGER_GROUP`),
KEY `IDX_QRTZ_FT_TG` (`SCHED_NAME`,`TRIGGER_GROUP`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- ----------------------------
-- Table structure for QRTZ_JOB_DETAILS
-- ----------------------------
DROP TABLE IF EXISTS `QRTZ_JOB_DETAILS`;
CREATE TABLE `QRTZ_JOB_DETAILS` (
`SCHED_NAME` varchar(120) NOT NULL,
`JOB_NAME` varchar(200) NOT NULL,
`JOB_GROUP` varchar(200) NOT NULL,
`DESCRIPTION` varchar(250) DEFAULT NULL,
`JOB_CLASS_NAME` varchar(250) NOT NULL,
`IS_DURABLE` varchar(1) NOT NULL,
`IS_NONCONCURRENT` varchar(1) NOT NULL,
`IS_UPDATE_DATA` varchar(1) NOT NULL,
`REQUESTS_RECOVERY` varchar(1) NOT NULL,
`JOB_DATA` blob,
PRIMARY KEY (`SCHED_NAME`,`JOB_NAME`,`JOB_GROUP`),
KEY `IDX_QRTZ_J_REQ_RECOVERY` (`SCHED_NAME`,`REQUESTS_RECOVERY`),
KEY `IDX_QRTZ_J_GRP` (`SCHED_NAME`,`JOB_GROUP`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- ----------------------------
-- Table structure for QRTZ_LOCKS
-- ----------------------------
DROP TABLE IF EXISTS `QRTZ_LOCKS`;
CREATE TABLE `QRTZ_LOCKS` (
`SCHED_NAME` varchar(120) NOT NULL,
`LOCK_NAME` varchar(40) NOT NULL,
PRIMARY KEY (`SCHED_NAME`,`LOCK_NAME`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- ----------------------------
-- Table structure for QRTZ_PAUSED_TRIGGER_GRPS
-- ----------------------------
DROP TABLE IF EXISTS `QRTZ_PAUSED_TRIGGER_GRPS`;
CREATE TABLE `QRTZ_PAUSED_TRIGGER_GRPS` (
`SCHED_NAME` varchar(120) NOT NULL,
`TRIGGER_GROUP` varchar(200) NOT NULL,
PRIMARY KEY (`SCHED_NAME`,`TRIGGER_GROUP`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- ----------------------------
-- Table structure for QRTZ_SCHEDULER_STATE
-- ----------------------------
DROP TABLE IF EXISTS `QRTZ_SCHEDULER_STATE`;
CREATE TABLE `QRTZ_SCHEDULER_STATE` (
`SCHED_NAME` varchar(120) NOT NULL,
`INSTANCE_NAME` varchar(200) NOT NULL,
`LAST_CHECKIN_TIME` bigint(13) NOT NULL,
`CHECKIN_INTERVAL` bigint(13) NOT NULL,
PRIMARY KEY (`SCHED_NAME`,`INSTANCE_NAME`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- ----------------------------
-- Table structure for QRTZ_SIMPLE_TRIGGERS
-- ----------------------------
DROP TABLE IF EXISTS `QRTZ_SIMPLE_TRIGGERS`;
CREATE TABLE `QRTZ_SIMPLE_TRIGGERS` (
`SCHED_NAME` varchar(120) NOT NULL,
`TRIGGER_NAME` varchar(200) NOT NULL,
`TRIGGER_GROUP` varchar(200) NOT NULL,
`REPEAT_COUNT` bigint(7) NOT NULL,
`REPEAT_INTERVAL` bigint(12) NOT NULL,
`TIMES_TRIGGERED` bigint(10) NOT NULL,
PRIMARY KEY (`SCHED_NAME`,`TRIGGER_NAME`,`TRIGGER_GROUP`),
CONSTRAINT `qrtz_simple_triggers_ibfk_1` FOREIGN KEY (`SCHED_NAME`, `TRIGGER_NAME`, `TRIGGER_GROUP`) REFERENCES `QRTZ_TRIGGERS` (`SCHED_NAME`, `TRIGGER_NAME`, `TRIGGER_GROUP`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- ----------------------------
-- Table structure for QRTZ_SIMPROP_TRIGGERS
-- ----------------------------
DROP TABLE IF EXISTS `QRTZ_SIMPROP_TRIGGERS`;
CREATE TABLE `QRTZ_SIMPROP_TRIGGERS` (
`SCHED_NAME` varchar(120) NOT NULL,
`TRIGGER_NAME` varchar(200) NOT NULL,
`TRIGGER_GROUP` varchar(200) NOT NULL,
`STR_PROP_1` varchar(512) DEFAULT NULL,
`STR_PROP_2` varchar(512) DEFAULT NULL,
`STR_PROP_3` varchar(512) DEFAULT NULL,
`INT_PROP_1` int(11) DEFAULT NULL,
`INT_PROP_2` int(11) DEFAULT NULL,
`LONG_PROP_1` bigint(20) DEFAULT NULL,
`LONG_PROP_2` bigint(20) DEFAULT NULL,
`DEC_PROP_1` decimal(13,4) DEFAULT NULL,
`DEC_PROP_2` decimal(13,4) DEFAULT NULL,
`BOOL_PROP_1` varchar(1) DEFAULT NULL,
`BOOL_PROP_2` varchar(1) DEFAULT NULL,
PRIMARY KEY (`SCHED_NAME`,`TRIGGER_NAME`,`TRIGGER_GROUP`),
CONSTRAINT `qrtz_simprop_triggers_ibfk_1` FOREIGN KEY (`SCHED_NAME`, `TRIGGER_NAME`, `TRIGGER_GROUP`) REFERENCES `QRTZ_TRIGGERS` (`SCHED_NAME`, `TRIGGER_NAME`, `TRIGGER_GROUP`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- ----------------------------
-- Table structure for QRTZ_TRIGGERS
-- ----------------------------
DROP TABLE IF EXISTS `QRTZ_TRIGGERS`;
CREATE TABLE `QRTZ_TRIGGERS` (
`SCHED_NAME` varchar(120) NOT NULL,
`TRIGGER_NAME` varchar(200) NOT NULL,
`TRIGGER_GROUP` varchar(200) NOT NULL,
`JOB_NAME` varchar(200) NOT NULL,
`JOB_GROUP` varchar(200) NOT NULL,
`DESCRIPTION` varchar(250) DEFAULT NULL,
`NEXT_FIRE_TIME` bigint(13) DEFAULT NULL,
`PREV_FIRE_TIME` bigint(13) DEFAULT NULL,
`PRIORITY` int(11) DEFAULT NULL,
`TRIGGER_STATE` varchar(16) NOT NULL,
`TRIGGER_TYPE` varchar(8) NOT NULL,
`START_TIME` bigint(13) NOT NULL,
`END_TIME` bigint(13) DEFAULT NULL,
`CALENDAR_NAME` varchar(200) DEFAULT NULL,
`MISFIRE_INSTR` smallint(2) DEFAULT NULL,
`JOB_DATA` blob,
PRIMARY KEY (`SCHED_NAME`,`TRIGGER_NAME`,`TRIGGER_GROUP`),
KEY `IDX_QRTZ_T_J` (`SCHED_NAME`,`JOB_NAME`,`JOB_GROUP`),
KEY `IDX_QRTZ_T_JG` (`SCHED_NAME`,`JOB_GROUP`),
KEY `IDX_QRTZ_T_C` (`SCHED_NAME`,`CALENDAR_NAME`),
KEY `IDX_QRTZ_T_G` (`SCHED_NAME`,`TRIGGER_GROUP`),
KEY `IDX_QRTZ_T_STATE` (`SCHED_NAME`,`TRIGGER_STATE`),
KEY `IDX_QRTZ_T_N_STATE` (`SCHED_NAME`,`TRIGGER_NAME`,`TRIGGER_GROUP`,`TRIGGER_STATE`),
KEY `IDX_QRTZ_T_N_G_STATE` (`SCHED_NAME`,`TRIGGER_GROUP`,`TRIGGER_STATE`),
KEY `IDX_QRTZ_T_NEXT_FIRE_TIME` (`SCHED_NAME`,`NEXT_FIRE_TIME`),
KEY `IDX_QRTZ_T_NFT_ST` (`SCHED_NAME`,`TRIGGER_STATE`,`NEXT_FIRE_TIME`),
KEY `IDX_QRTZ_T_NFT_MISFIRE` (`SCHED_NAME`,`MISFIRE_INSTR`,`NEXT_FIRE_TIME`),
KEY `IDX_QRTZ_T_NFT_ST_MISFIRE` (`SCHED_NAME`,`MISFIRE_INSTR`,`NEXT_FIRE_TIME`,`TRIGGER_STATE`),
KEY `IDX_QRTZ_T_NFT_ST_MISFIRE_GRP` (`SCHED_NAME`,`MISFIRE_INSTR`,`NEXT_FIRE_TIME`,`TRIGGER_GROUP`,`TRIGGER_STATE`),
CONSTRAINT `qrtz_triggers_ibfk_1` FOREIGN KEY (`SCHED_NAME`, `JOB_NAME`, `JOB_GROUP`) REFERENCES `QRTZ_JOB_DETAILS` (`SCHED_NAME`, `JOB_NAME`, `JOB_GROUP`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- ----------------------------
-- Table structure for area
-- ----------------------------
DROP TABLE IF EXISTS `area`;
CREATE TABLE `area` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`create_date` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建日期',
`modify_date` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '更新日期',
`version` bigint(20) NOT NULL DEFAULT '0',
`orders` int(11) DEFAULT NULL,
`full_name` longtext NOT NULL,
`grade` int(11) NOT NULL,
`name` varchar(255) NOT NULL,
`tree_path` varchar(255) NOT NULL,
`parent_id` bigint(20) DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `ind_area_parent` (`parent_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='地区';
-- ----------------------------
-- Table structure for campaign
-- ----------------------------
DROP TABLE IF EXISTS `campaign`;
CREATE TABLE `campaign` (
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'id',
`type` smallint(2) DEFAULT NULL COMMENT '类型 1-主页banner',
`param_name1` varchar(255) DEFAULT NULL,
`param_value1` varchar(255) DEFAULT NULL,
`param_name2` varchar(255) DEFAULT NULL,
`param_value2` varchar(255) DEFAULT NULL,
`param_name3` varchar(255) DEFAULT NULL,
`param_value3` varchar(255) DEFAULT NULL,
`start_time` datetime DEFAULT NULL,
`end_time` datetime DEFAULT NULL,
`create_date` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
`update_date` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-- ----------------------------
-- Table structure for cart
-- ----------------------------
DROP TABLE IF EXISTS `cart`;
CREATE TABLE `cart` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`user_id` varchar(50) NOT NULL,
`product_id` varchar(50) NOT NULL COMMENT '商品id',
`quantity` int(11) NOT NULL COMMENT '数量',
`create_date` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`update_date` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '更新时间',
PRIMARY KEY (`id`),
KEY `user_id_index` (`user_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- ----------------------------
-- Table structure for delivery_corp
-- ----------------------------
DROP TABLE IF EXISTS `delivery_corp`;
CREATE TABLE `delivery_corp` (
`code` varchar(255) NOT NULL,
`name` varchar(255) NOT NULL,
`url` varchar(255) NOT NULL,
PRIMARY KEY (`code`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- ----------------------------
-- Table structure for favorite_goods
-- ----------------------------
DROP TABLE IF EXISTS `favorite_goods`;
CREATE TABLE `favorite_goods` (
`favorite_user` varchar(50) NOT NULL COMMENT '[用户ID]',
`favorite_goods` varchar(255) NOT NULL COMMENT '[商品ID]',
PRIMARY KEY (`favorite_user`,`favorite_goods`),
KEY `idx_user_favorite_goods` (`favorite_goods`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- ----------------------------
-- Table structure for goods
-- ----------------------------
DROP TABLE IF EXISTS `goods`;
CREATE TABLE `goods` (
`sn` varchar(50) NOT NULL COMMENT '编号',
`name` varchar(255) NOT NULL COMMENT '名称',
`model` varchar(50) DEFAULT NULL COMMENT '型号',
`caption` varchar(255) NOT NULL COMMENT '副标题',
`image` varchar(255) NOT NULL COMMENT '展示图片',
`price` decimal(21,2) NOT NULL DEFAULT '0.00' COMMENT '销售价',
`is_delivery` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否需要物流',
`is_marketable` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否上架',
`parameter_values` longtext NOT NULL COMMENT '参数值',
`specification_items` longtext COMMENT '规格项',
`introduction` longtext NOT NULL COMMENT '介绍',
`product_images` longtext NOT NULL COMMENT '商品图片',
`campaign` int(11) DEFAULT NULL COMMENT '活动,位运算,1-拼团',
`groupon_count` int(11) DEFAULT NULL COMMENT '拼团人数',
`weight` float(11,0) NOT NULL COMMENT '重量',
`unit` varchar(255) NOT NULL COMMENT '单位',
`product_category_id` bigint(20) NOT NULL COMMENT '货品分类',
`create_date` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建日期',
`update_date` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '更新日期',
PRIMARY KEY (`sn`),
KEY `idx_name` (`name`),
KEY `idx_is_marketable` (`is_marketable`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- ----------------------------
-- Table structure for logistics
-- ----------------------------
DROP TABLE IF EXISTS `logistics`;
CREATE TABLE `logistics` (
`tracking_no` varchar(255) NOT NULL,
`check_state` smallint(4) NOT NULL DEFAULT '0' COMMENT '订阅状态-0未订阅 1已订阅 2订阅失败',
`order_state` smallint(4) DEFAULT NULL COMMENT '物流状态包括0在途中、1已揽收、2疑难、3已签收、4退签、5同城派送中、6退回、7转单等7个状态',
`data` longtext COMMENT '物流跟踪数据',
`create_date` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`update_date` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '更新时间',
PRIMARY KEY (`tracking_no`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- ----------------------------
-- Table structure for order_detail
-- ----------------------------
DROP TABLE IF EXISTS `order_detail`;
CREATE TABLE `order_detail` (
`detail_id` varchar(32) NOT NULL,
`order_id` varchar(32) NOT NULL,
`product_id` varchar(32) NOT NULL,
`product_name` varchar(64) NOT NULL COMMENT '商品名称',
`product_model` varchar(50) DEFAULT NULL COMMENT '型号',
`product_spec` varchar(50) DEFAULT NULL COMMENT '规格',
`group_price` decimal(21,2) DEFAULT NULL COMMENT '团购价',
`product_price` decimal(21,2) NOT NULL COMMENT '当前价格,单位分',
`product_quantity` int(11) NOT NULL COMMENT '数量',
`product_icon` varchar(512) DEFAULT NULL COMMENT '小图',
`create_date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`update_date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
PRIMARY KEY (`detail_id`),
KEY `idx_order_id` (`order_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-- ----------------------------
-- Table structure for order_master
-- ----------------------------
DROP TABLE IF EXISTS `order_master`;
CREATE TABLE `order_master` (
`order_id` varchar(32) NOT NULL,
`buyer_name` varchar(32) NOT NULL COMMENT '买家名字',
`buyer_phone` varchar(32) NOT NULL COMMENT '买家电话',
`buyer_address` varchar(128) NOT NULL COMMENT '买家地址',
`buyer_id` varchar(64) NOT NULL COMMENT '买家id',
`need_invoice` smallint(1) DEFAULT NULL COMMENT '是否需要开票 0-不需要 1-需要',
`invoice_type` smallint(1) DEFAULT NULL COMMENT '发票类型 0-单位 1-个人',
`groupon` smallint(1) DEFAULT NULL COMMENT '拼团',
`groupon_id` varchar(50) DEFAULT NULL COMMENT '拼团id',
`groupon_count` int(11) DEFAULT NULL COMMENT '拼团人数',
`title` varchar(255) DEFAULT NULL COMMENT '发票抬头',
`tax_number` varchar(255) DEFAULT NULL COMMENT '抬头税号',
`company_address` varchar(255) DEFAULT NULL COMMENT '单位地址',
`telephone` varchar(255) DEFAULT NULL COMMENT '开票手机号码',
`bank_name` varchar(255) DEFAULT NULL COMMENT '银行名称',
`bank_account` varchar(255) DEFAULT NULL COMMENT '银行账号',
`order_amount` decimal(21,2) NOT NULL COMMENT '订单总金额',
`order_status` tinyint(3) NOT NULL DEFAULT '0' COMMENT '订单状态, 默认为新下单',
`tracking_number` varchar(255) DEFAULT NULL COMMENT '快递单号',
`delivery_code` varchar(255) DEFAULT NULL COMMENT '快递公司代码',
`refund_trade_no` varchar(255) DEFAULT NULL COMMENT '退款交易流水号',
`pay_trade_no` varchar(255) DEFAULT NULL COMMENT '支付交易流水号',
`pay_status` tinyint(3) NOT NULL DEFAULT '0' COMMENT '支付状态, 默认未支付',
`remark` varchar(255) DEFAULT NULL COMMENT ' 买家备注',
`contract` varchar(255) DEFAULT NULL COMMENT '合同',
`create_date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`update_date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
PRIMARY KEY (`order_id`),
KEY `idx_buyer_id` (`buyer_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-- ----------------------------
-- Table structure for product
-- ----------------------------
DROP TABLE IF EXISTS `product`;
CREATE TABLE `product` (
`sn` varchar(255) NOT NULL COMMENT '商品编号',
`price` decimal(21,2) NOT NULL DEFAULT '0.00' COMMENT '销售价',
`group_price` decimal(21,2) NOT NULL DEFAULT '0.00' COMMENT '拼团价',
`cost` decimal(21,2) NOT NULL DEFAULT '0.00' COMMENT '成本价',
`is_default` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否默认',
`specification_values` longtext COMMENT '规格值',
`stock` int(11) NOT NULL DEFAULT '0' COMMENT '库存',
`goods_sn` varchar(255) NOT NULL COMMENT '货品编号',
`enable` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否启用',
`create_date` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建日期',
`update_date` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '修改日期',
PRIMARY KEY (`sn`),
KEY `ind_product_goods` (`goods_sn`),
KEY `ind_product_is_default` (`is_default`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- ----------------------------
-- Table structure for product_category
-- ----------------------------
DROP TABLE IF EXISTS `product_category`;
CREATE TABLE `product_category` (
`id` bigint(20) NOT NULL COMMENT 'ID',
`name` varchar(255) NOT NULL COMMENT '名称',
`parent_id` bigint(20) DEFAULT NULL COMMENT '父节点',
`tree_path` varchar(255) DEFAULT NULL COMMENT '全路径',
`order` int(11) NOT NULL DEFAULT '99' COMMENT '优先级 值小在前面 值大的在后面',
`create_date` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建日期',
`update_date` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '更新日期',
PRIMARY KEY (`id`),
KEY `ind_product_category_parent` (`parent_id`),
KEY `idx_order` (`order`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- ----------------------------
-- Table structure for receiver
-- ----------------------------
DROP TABLE IF EXISTS `receiver`;
CREATE TABLE `receiver` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`address` varchar(255) NOT NULL,
`area_name` varchar(255) NOT NULL,
`consignee` varchar(255) NOT NULL,
`is_default` tinyint(1) NOT NULL,
`phone` varchar(255) NOT NULL,
`zip_code` varchar(255) DEFAULT NULL,
`area_id` bigint(20) NOT NULL,
`member_id` varchar(50) NOT NULL,
`create_date` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建日期',
`update_date` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '更新日期',
PRIMARY KEY (`id`),
KEY `ind_receiver_area` (`area_id`),
KEY `ind_receiver_member` (`member_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- ----------------------------
-- Table structure for schedule_job
-- ----------------------------
DROP TABLE IF EXISTS `schedule_job`;
CREATE TABLE `schedule_job` (
`job_id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '任务id',
`bean_name` varchar(200) DEFAULT NULL COMMENT 'spring bean名称',
`method_name` varchar(100) DEFAULT NULL COMMENT '方法名',
`params` varchar(2000) DEFAULT NULL COMMENT '参数',
`cron_expression` varchar(100) DEFAULT NULL COMMENT 'cron表达式',
`status` tinyint(4) DEFAULT NULL COMMENT '任务状态 0:正常 1:暂停',
`remark` varchar(255) DEFAULT NULL COMMENT '备注',
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
PRIMARY KEY (`job_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='定时任务';
-- ----------------------------
-- Table structure for schedule_job_log
-- ----------------------------
DROP TABLE IF EXISTS `schedule_job_log`;
CREATE TABLE `schedule_job_log` (
`log_id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '任务日志id',
`job_id` bigint(20) NOT NULL COMMENT '任务id',
`bean_name` varchar(200) DEFAULT NULL COMMENT 'spring bean名称',
`method_name` varchar(100) DEFAULT NULL COMMENT '方法名',
`params` varchar(2000) DEFAULT NULL COMMENT '参数',
`status` tinyint(4) NOT NULL COMMENT '任务状态 0:成功 1:失败',
`error` varchar(2000) DEFAULT NULL COMMENT '失败信息',
`times` int(11) NOT NULL COMMENT '耗时(单位:毫秒)',
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
PRIMARY KEY (`log_id`),
KEY `job_id` (`job_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='定时任务日志';
-- ----------------------------
-- Table structure for sn
-- ----------------------------
DROP TABLE IF EXISTS `sn`;
CREATE TABLE `sn` (
`type` int(11) NOT NULL COMMENT '类型',
`last_value` bigint(20) NOT NULL COMMENT '末值',
`create_date` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建日期',
`modify_date` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '修改日期',
PRIMARY KEY (`type`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='序列号';
-- ----------------------------
-- Table structure for specification
-- ----------------------------
DROP TABLE IF EXISTS `specification`;
CREATE TABLE `specification` (
`id` bigint(20) NOT NULL COMMENT 'id',
`parent_id` bigint(20) DEFAULT NULL COMMENT '父节点',
`type` int(11) NOT NULL COMMENT '0-规格组 1-规格参数',
`order` int(11) NOT NULL DEFAULT '0' COMMENT '排序',
`name` varchar(50) NOT NULL COMMENT '名称',
`category_id` bigint(20) DEFAULT NULL COMMENT '分类id',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-- ----------------------------
-- Table structure for sys_captcha
-- ----------------------------
DROP TABLE IF EXISTS `sys_captcha`;
CREATE TABLE `sys_captcha` (
`uuid` char(36) NOT NULL COMMENT 'uuid',
`code` varchar(6) NOT NULL COMMENT '验证码',
`expire_time` datetime DEFAULT NULL COMMENT '过期时间',
PRIMARY KEY (`uuid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='系统验证码';
-- ----------------------------
-- Table structure for sys_config
-- ----------------------------
DROP TABLE IF EXISTS `sys_config`;
CREATE TABLE `sys_config` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`param_key` varchar(50) DEFAULT NULL COMMENT 'key',
`param_value` varchar(2000) DEFAULT NULL COMMENT 'value',
`status` tinyint(4) DEFAULT '1' COMMENT '状态 0:隐藏 1:显示',
`remark` varchar(500) DEFAULT NULL COMMENT '备注',
PRIMARY KEY (`id`),
UNIQUE KEY `param_key` (`param_key`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='系统配置信息表';
-- ----------------------------
-- Table structure for sys_log
-- ----------------------------
DROP TABLE IF EXISTS `sys_log`;
CREATE TABLE `sys_log` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`username` varchar(50) DEFAULT NULL COMMENT '用户名',
`operation` varchar(50) DEFAULT NULL COMMENT '用户操作',
`method` varchar(200) DEFAULT NULL COMMENT '请求方法',
`params` varchar(5000) DEFAULT NULL COMMENT '请求参数',
`time` bigint(20) NOT NULL COMMENT '执行时长(毫秒)',
`ip` varchar(64) DEFAULT NULL COMMENT 'IP地址',
`create_date` datetime DEFAULT NULL COMMENT '创建时间',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='系统日志';
-- ----------------------------
-- Table structure for sys_menu
-- ----------------------------
DROP TABLE IF EXISTS `sys_menu`;
CREATE TABLE `sys_menu` (
`menu_id` bigint(20) NOT NULL AUTO_INCREMENT,
`parent_id` bigint(20) DEFAULT NULL COMMENT '父菜单ID,一级菜单为0',
`name` varchar(50) DEFAULT NULL COMMENT '菜单名称',
`url` varchar(200) DEFAULT NULL COMMENT '菜单URL',
`perms` varchar(500) DEFAULT NULL COMMENT '授权(多个用逗号分隔,如:user:list,user:create)',
`type` int(11) DEFAULT NULL COMMENT '类型 0:目录 1:菜单 2:按钮',
`icon` varchar(50) DEFAULT NULL COMMENT '菜单图标',
`order_num` int(11) DEFAULT NULL COMMENT '排序',
PRIMARY KEY (`menu_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='菜单管理';
-- ----------------------------
-- Table structure for sys_oss
-- ----------------------------
DROP TABLE IF EXISTS `sys_oss`;
CREATE TABLE `sys_oss` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`url` varchar(200) DEFAULT NULL COMMENT 'URL地址',
`create_date` datetime DEFAULT NULL COMMENT '创建时间',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='文件上传';
-- ----------------------------
-- Table structure for sys_role
-- ----------------------------
DROP TABLE IF EXISTS `sys_role`;
CREATE TABLE `sys_role` (
`role_id` bigint(20) NOT NULL AUTO_INCREMENT,
`role_name` varchar(100) DEFAULT NULL COMMENT '角色名称',
`remark` varchar(100) DEFAULT NULL COMMENT '备注',
`create_user_id` bigint(20) DEFAULT NULL COMMENT '创建者ID',
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
PRIMARY KEY (`role_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='角色';
-- ----------------------------
-- Table structure for sys_role_menu
-- ----------------------------
DROP TABLE IF EXISTS `sys_role_menu`;
CREATE TABLE `sys_role_menu` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`role_id` bigint(20) DEFAULT NULL COMMENT '角色ID',
`menu_id` bigint(20) DEFAULT NULL COMMENT '菜单ID',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='角色与菜单对应关系';
-- ----------------------------
-- Table structure for sys_user
-- ----------------------------
DROP TABLE IF EXISTS `sys_user`;
CREATE TABLE `sys_user` (
`user_id` bigint(20) NOT NULL AUTO_INCREMENT,
`username` varchar(50) NOT NULL COMMENT '用户名',
`password` varchar(100) DEFAULT NULL COMMENT '密码',
`salt` varchar(20) DEFAULT NULL COMMENT '盐',
`email` varchar(100) DEFAULT NULL COMMENT '邮箱',
`mobile` varchar(100) DEFAULT NULL COMMENT '手机号',
`status` tinyint(4) DEFAULT NULL COMMENT '状态 0:禁用 1:正常',
`create_user_id` bigint(20) DEFAULT NULL COMMENT '创建者ID',
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
PRIMARY KEY (`user_id`),
UNIQUE KEY `username` (`username`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='系统用户';
-- ----------------------------
-- Table structure for sys_user_role
-- ----------------------------
DROP TABLE IF EXISTS `sys_user_role`;
CREATE TABLE `sys_user_role` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`user_id` bigint(20) DEFAULT NULL COMMENT '用户ID',
`role_id` bigint(20) DEFAULT NULL COMMENT '角色ID',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='用户与角色对应关系';
-- ----------------------------
-- Table structure for sys_user_token
-- ----------------------------
DROP TABLE IF EXISTS `sys_user_token`;
CREATE TABLE `sys_user_token` (
`user_id` bigint(20) NOT NULL,
`token` varchar(100) NOT NULL COMMENT 'token',
`expire_time` datetime DEFAULT NULL COMMENT '过期时间',
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
PRIMARY KEY (`user_id`),
UNIQUE KEY `token` (`token`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='系统用户Token';
-- ----------------------------
-- Table structure for test_table
-- ----------------------------
DROP TABLE IF EXISTS `test_table`;
CREATE TABLE `test_table` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT '[ID]',
`name` varchar(255) DEFAULT NULL COMMENT '[姓名]',
`sex` smallint(2) DEFAULT NULL COMMENT '[性别] 1-男 2-女',
`create_date` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '[创建时间]',
`update_date` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '[更新时间]',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-- ----------------------------
-- Table structure for user
-- ----------------------------
DROP TABLE IF EXISTS `user`;
CREATE TABLE `user` (
`user_id` varchar(50) NOT NULL COMMENT 'ID',
`username` varchar(50) DEFAULT NULL COMMENT '用户名',
`ma_open_id` varchar(100) DEFAULT NULL COMMENT '小程序openid',
`union_id` varchar(100) DEFAULT NULL COMMENT '开放平台id',
`nickname` varchar(50) DEFAULT NULL COMMENT '昵称',
`name` varchar(50) DEFAULT NULL COMMENT '真实姓名',
`email` varchar(50) DEFAULT NULL COMMENT '邮箱',
`gender` smallint(1) DEFAULT NULL COMMENT '性别 1-男 2-女',
`area_id` smallint(10) DEFAULT NULL COMMENT '地区id',
`language` smallint(1) DEFAULT NULL COMMENT '语言 1-中文 2-英文',
`volunteer` smallint(4) DEFAULT NULL COMMENT '是否志愿者',
`avatar` varchar(255) DEFAULT NULL COMMENT '头像',
`mobile` varchar(20) DEFAULT NULL COMMENT '手机号',
`password` varchar(64) DEFAULT NULL COMMENT '密码',
`update_date` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '更新时间',
`create_date` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
PRIMARY KEY (`user_id`),
UNIQUE KEY `idx_username` (`username`) USING BTREE,
KEY `idx_maopenid` (`ma_open_id`),
KEY `idx_unionid` (`union_id`),
KEY `idx_createdate` (`create_date`),
KEY `idx_nickname` (`nickname`),
KEY `idx_name` (`name`),
KEY `idex_mobile` (`mobile`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='用户';
-- ----------------------------
-- 拼团
-- ----------------------------
DROP TABLE IF EXISTS `groupon`;
CREATE TABLE `groupon` (
`id` varchar(50) NOT NULL,
`goods_id` varchar(50) NOT NULL,
`count` int(11) NOT NULL,
`status` smallint(1) NOT NULL DEFAULT '0' COMMENT '0-等待开团 1-已开团 2-取消',
`expire_date` datetime NOT NULL,
`create_date` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
`update_date` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-- ----------------------------
-- 拼团队伍
-- ----------------------------
DROP TABLE IF EXISTS `groupon_team`;
CREATE TABLE `groupon_team` (
`groupon_id` varchar(50) NOT NULL,
`user_id` varchar(50) NOT NULL,
`captain` smallint(1) NOT NULL DEFAULT '0',
`create_date` datetime DEFAULT CURRENT_TIMESTAMP,
`update_date` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`groupon_id`,`user_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-- 初始数据
INSERT INTO `sys_user` (`user_id`, `username`, `password`, `salt`, `email`, `mobile`, `status`, `create_user_id`, `create_time`) VALUES ('1', 'admin', '9ec9750e709431dad22365cabc5c625482e574c74adaebba7dd02f1129e4ce1d', 'YzcmCZNvbXocrsz9dm8e', 'root@sdb.io', '13612345678', '1', '1', '2016-11-11 11:11:11');
INSERT INTO `sys_menu`(`menu_id`, `parent_id`, `name`, `url`, `perms`, `type`, `icon`, `order_num`) VALUES (1, 0, '系统管理', NULL, NULL, 0, 'system', 0);
INSERT INTO `sys_menu`(`menu_id`, `parent_id`, `name`, `url`, `perms`, `type`, `icon`, `order_num`) VALUES (2, 1, '管理员列表', 'sys/user', NULL, 1, 'admin', 1);
INSERT INTO `sys_menu`(`menu_id`, `parent_id`, `name`, `url`, `perms`, `type`, `icon`, `order_num`) VALUES (3, 1, '角色管理', 'sys/role', NULL, 1, 'role', 2);
INSERT INTO `sys_menu`(`menu_id`, `parent_id`, `name`, `url`, `perms`, `type`, `icon`, `order_num`) VALUES (4, 1, '菜单管理', 'sys/menu', NULL, 1, 'menu', 3);
INSERT INTO `sys_menu`(`menu_id`, `parent_id`, `name`, `url`, `perms`, `type`, `icon`, `order_num`) VALUES (5, 1, 'SQL监控', 'http://localhost:8080/sdb/druid/sql.html', NULL, 1, 'sql', 4);
INSERT INTO `sys_menu`(`menu_id`, `parent_id`, `name`, `url`, `perms`, `type`, `icon`, `order_num`) VALUES (6, 1, '定时任务', 'job/schedule', NULL, 1, 'job', 5);
INSERT INTO `sys_menu`(`menu_id`, `parent_id`, `name`, `url`, `perms`, `type`, `icon`, `order_num`) VALUES (7, 6, '查看', NULL, 'sys:schedule:list,sys:schedule:info', 2, NULL, 0);
INSERT INTO `sys_menu`(`menu_id`, `parent_id`, `name`, `url`, `perms`, `type`, `icon`, `order_num`) VALUES (8, 6, '新增', NULL, 'sys:schedule:save', 2, NULL, 0);
INSERT INTO `sys_menu`(`menu_id`, `parent_id`, `name`, `url`, `perms`, `type`, `icon`, `order_num`) VALUES (9, 6, '修改', NULL, 'sys:schedule:update', 2, NULL, 0);
INSERT INTO `sys_menu`(`menu_id`, `parent_id`, `name`, `url`, `perms`, `type`, `icon`, `order_num`) VALUES (10, 6, '删除', NULL, 'sys:schedule:delete', 2, NULL, 0);
INSERT INTO `sys_menu`(`menu_id`, `parent_id`, `name`, `url`, `perms`, `type`, `icon`, `order_num`) VALUES (11, 6, '暂停', NULL, 'sys:schedule:pause', 2, NULL, 0);
INSERT INTO `sys_menu`(`menu_id`, `parent_id`, `name`, `url`, `perms`, `type`, `icon`, `order_num`) VALUES (12, 6, '恢复', NULL, 'sys:schedule:resume', 2, NULL, 0);
INSERT INTO `sys_menu`(`menu_id`, `parent_id`, `name`, `url`, `perms`, `type`, `icon`, `order_num`) VALUES (13, 6, '立即执行', NULL, 'sys:schedule:run', 2, NULL, 0);
INSERT INTO `sys_menu`(`menu_id`, `parent_id`, `name`, `url`, `perms`, `type`, `icon`, `order_num`) VALUES (14, 6, '日志列表', NULL, 'sys:schedule:log', 2, NULL, 0);
INSERT INTO `sys_menu`(`menu_id`, `parent_id`, `name`, `url`, `perms`, `type`, `icon`, `order_num`) VALUES (15, 2, '查看', NULL, 'sys:user:list,sys:user:info', 2, NULL, 0);
INSERT INTO `sys_menu`(`menu_id`, `parent_id`, `name`, `url`, `perms`, `type`, `icon`, `order_num`) VALUES (16, 2, '新增', NULL, 'sys:user:save,sys:role:select', 2, NULL, 0);
INSERT INTO `sys_menu`(`menu_id`, `parent_id`, `name`, `url`, `perms`, `type`, `icon`, `order_num`) VALUES (17, 2, '修改', NULL, 'sys:user:update,sys:role:select', 2, NULL, 0);
INSERT INTO `sys_menu`(`menu_id`, `parent_id`, `name`, `url`, `perms`, `type`, `icon`, `order_num`) VALUES (18, 2, '删除', NULL, 'sys:user:delete', 2, NULL, 0);
INSERT INTO `sys_menu`(`menu_id`, `parent_id`, `name`, `url`, `perms`, `type`, `icon`, `order_num`) VALUES (19, 3, '查看', NULL, 'sys:role:list,sys:role:info', 2, NULL, 0);
INSERT INTO `sys_menu`(`menu_id`, `parent_id`, `name`, `url`, `perms`, `type`, `icon`, `order_num`) VALUES (20, 3, '新增', NULL, 'sys:role:save,sys:menu:list', 2, NULL, 0);
INSERT INTO `sys_menu`(`menu_id`, `parent_id`, `name`, `url`, `perms`, `type`, `icon`, `order_num`) VALUES (21, 3, '修改', NULL, 'sys:role:update,sys:menu:list', 2, NULL, 0);
INSERT INTO `sys_menu`(`menu_id`, `parent_id`, `name`, `url`, `perms`, `type`, `icon`, `order_num`) VALUES (22, 3, '删除', NULL, 'sys:role:delete', 2, NULL, 0);
INSERT INTO `sys_menu`(`menu_id`, `parent_id`, `name`, `url`, `perms`, `type`, `icon`, `order_num`) VALUES (23, 4, '查看', NULL, 'sys:menu:list,sys:menu:info', 2, NULL, 0);
INSERT INTO `sys_menu`(`menu_id`, `parent_id`, `name`, `url`, `perms`, `type`, `icon`, `order_num`) VALUES (24, 4, '新增', NULL, 'sys:menu:save,sys:menu:select', 2, NULL, 0);
INSERT INTO `sys_menu`(`menu_id`, `parent_id`, `name`, `url`, `perms`, `type`, `icon`, `order_num`) VALUES (25, 4, '修改', NULL, 'sys:menu:update,sys:menu:select', 2, NULL, 0);
INSERT INTO `sys_menu`(`menu_id`, `parent_id`, `name`, `url`, `perms`, `type`, `icon`, `order_num`) VALUES (26, 4, '删除', NULL, 'sys:menu:delete', 2, NULL, 0);
INSERT INTO `sys_menu`(`menu_id`, `parent_id`, `name`, `url`, `perms`, `type`, `icon`, `order_num`) VALUES (27, 1, '参数管理', 'sys/config', 'sys:config:list,sys:config:info,sys:config:save,sys:config:update,sys:config:delete', 1, 'config', 6);
INSERT INTO `sys_menu`(`menu_id`, `parent_id`, `name`, `url`, `perms`, `type`, `icon`, `order_num`) VALUES (29, 1, '系统日志', 'sys/log', 'sys:log:list', 1, 'log', 7);
INSERT INTO `sys_menu`(`menu_id`, `parent_id`, `name`, `url`, `perms`, `type`, `icon`, `order_num`) VALUES (30, 1, '文件上传', 'oss/oss', 'sys:oss:all', 1, 'oss', 6);
INSERT INTO `sys_menu`(`menu_id`, `parent_id`, `name`, `url`, `perms`, `type`, `icon`, `order_num`) VALUES (31, 0, '业务管理', '', '', 0, 'config', 0);
INSERT INTO `sys_menu`(`menu_id`, `parent_id`, `name`, `url`, `perms`, `type`, `icon`, `order_num`) VALUES (42, 31, '商品管理', 'sys/goods', '', 1, 'editor', 0);
INSERT INTO `sys_menu`(`menu_id`, `parent_id`, `name`, `url`, `perms`, `type`, `icon`, `order_num`) VALUES (43, 31, '订单管理', 'sys/order', '', 1, 'bianji', 0);
INSERT INTO `sys_menu`(`menu_id`, `parent_id`, `name`, `url`, `perms`, `type`, `icon`, `order_num`) VALUES (45, 31, '商品分类', 'sys/productCategory', '', 1, 'log', 0);
INSERT INTO `sys_menu`(`menu_id`, `parent_id`, `name`, `url`, `perms`, `type`, `icon`, `order_num`) VALUES (46, 31, '规格管理', 'sys/specification', '', 1, 'menu', 0);
INSERT INTO `sys_config` (`param_key`, `param_value`, `status`, `remark`) VALUES ('CLOUD_STORAGE_CONFIG_KEY', '{\"aliyunAccessKeyId\":\"\",\"aliyunAccessKeySecret\":\"\",\"aliyunBucketName\":\"\",\"aliyunDomain\":\"\",\"aliyunEndPoint\":\"\",\"aliyunPrefix\":\"\",\"qcloudBucketName\":\"\",\"qcloudDomain\":\"\",\"qcloudPrefix\":\"\",\"qcloudSecretId\":\"\",\"qcloudSecretKey\":\"\",\"qiniuAccessKey\":\"NrgMfABZxWLo5B-YYSjoE8-AZ1EISdi1Z3ubLOeZ\",\"qiniuBucketName\":\"ios-app\",\"qiniuDomain\":\"http://7xqbwh.dl1.z0.glb.clouddn.com\",\"qiniuPrefix\":\"upload\",\"qiniuSecretKey\":\"uIwJHevMRWU0VLxFvgy0tAcOdGqasdtVlJkdy6vV\",\"type\":1}', '0', '云存储配置信息');
INSERT INTO `schedule_job` (`bean_name`, `method_name`, `params`, `cron_expression`, `status`, `remark`, `create_time`) VALUES ('testTask', 'test', 'sdb', '0 0/30 * * * ?', '0', '有参数测试', '2016-12-01 23:16:46');
INSERT INTO `schedule_job` (`bean_name`, `method_name`, `params`, `cron_expression`, `status`, `remark`, `create_time`) VALUES ('testTask', 'test2', NULL, '0 0/30 * * * ?', '1', '无参数测试', '2016-12-03 14:55:56');
INSERT INTO `sn`(`type`, `last_value`, `create_date`, `modify_date`) VALUES (1, 100, '2018-05-23 14:52:55', '2018-05-23 14:52:55');
INSERT INTO `sn`(`type`, `last_value`, `create_date`, `modify_date`) VALUES (2, 100, '2018-05-23 14:52:55', '2018-05-23 14:52:55');
INSERT INTO `sn`(`type`, `last_value`, `create_date`, `modify_date`) VALUES (3, 100, '2018-05-23 14:52:55', '2018-05-23 14:52:55');
INSERT INTO `sn`(`type`, `last_value`, `create_date`, `modify_date`) VALUES (4, 100, '2018-05-23 14:52:55', '2018-05-23 14:52:55');
INSERT INTO `sn`(`type`, `last_value`, `create_date`, `modify_date`) VALUES (5, 100, '2018-05-23 14:52:55', '2018-05-23 14:52:55');
INSERT INTO `sn`(`type`, `last_value`, `create_date`, `modify_date`) VALUES (6, 100, '2018-05-23 14:52:55', '2018-05-23 14:52:55'); | the_stack |
--
-- Copyright 2020 The Android Open Source Project
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- https://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
INSERT OR REPLACE INTO power_profile VALUES
("marlin", 0, 0, 307200, 11.272),
("marlin", 0, 0, 384000, 14.842),
("marlin", 0, 0, 460800, 18.497),
("marlin", 0, 0, 537600, 22.518),
("marlin", 0, 0, 614400, 25.967),
("marlin", 0, 0, 691200, 31.694),
("marlin", 0, 0, 768000, 37.673),
("marlin", 0, 0, 844800, 42.859),
("marlin", 0, 0, 902600, 46.872),
("marlin", 0, 0, 979200, 57.92),
("marlin", 0, 0, 1056000, 67.561),
("marlin", 0, 0, 1132800, 76.303),
("marlin", 0, 0, 1209600, 87.613),
("marlin", 0, 0, 1286400, 97.045),
("marlin", 0, 0, 1363200, 109.544),
("marlin", 0, 0, 1440000, 122.054),
("marlin", 0, 0, 1516800, 136.345),
("marlin", 0, 0, 1593600, 154.435),
("marlin", 1, 0, 307200, 11.272),
("marlin", 1, 0, 384000, 14.842),
("marlin", 1, 0, 460800, 18.497),
("marlin", 1, 0, 537600, 22.518),
("marlin", 1, 0, 614400, 25.967),
("marlin", 1, 0, 691200, 31.694),
("marlin", 1, 0, 768000, 37.673),
("marlin", 1, 0, 844800, 42.859),
("marlin", 1, 0, 902600, 46.872),
("marlin", 1, 0, 979200, 57.92),
("marlin", 1, 0, 1056000, 67.561),
("marlin", 1, 0, 1132800, 76.303),
("marlin", 1, 0, 1209600, 87.613),
("marlin", 1, 0, 1286400, 97.045),
("marlin", 1, 0, 1363200, 109.544),
("marlin", 1, 0, 1440000, 122.054),
("marlin", 1, 0, 1516800, 136.345),
("marlin", 1, 0, 1593600, 154.435),
("marlin", 2, 1, 307200, 7.055),
("marlin", 2, 1, 384000, 11.483),
("marlin", 2, 1, 460800, 14.979),
("marlin", 2, 1, 537600, 19.642),
("marlin", 2, 1, 614400, 23.167),
("marlin", 2, 1, 691200, 27.479),
("marlin", 2, 1, 748800, 31.632),
("marlin", 2, 1, 825600, 39.192),
("marlin", 2, 1, 902400, 47.817),
("marlin", 2, 1, 979200, 55.659),
("marlin", 2, 1, 1056000, 64.908),
("marlin", 2, 1, 1132800, 73.824),
("marlin", 2, 1, 1209600, 85.299),
("marlin", 2, 1, 1286400, 96.036),
("marlin", 2, 1, 1363200, 109.233),
("marlin", 2, 1, 1440000, 118.56),
("marlin", 2, 1, 1516800, 132.959),
("marlin", 2, 1, 1593600, 143.692),
("marlin", 2, 1, 1670400, 161.378),
("marlin", 2, 1, 1747200, 180.616),
("marlin", 2, 1, 1824000, 193.897),
("marlin", 2, 1, 1900800, 214.361),
("marlin", 2, 1, 1977600, 238.338),
("marlin", 2, 1, 2054400, 265.759),
("marlin", 2, 1, 2150400, 297.918),
("marlin", 3, 1, 307200, 7.055),
("marlin", 3, 1, 384000, 11.483),
("marlin", 3, 1, 460800, 14.979),
("marlin", 3, 1, 537600, 19.642),
("marlin", 3, 1, 614400, 23.167),
("marlin", 3, 1, 691200, 27.479),
("marlin", 3, 1, 748800, 31.632),
("marlin", 3, 1, 825600, 39.192),
("marlin", 3, 1, 902400, 47.817),
("marlin", 3, 1, 979200, 55.659),
("marlin", 3, 1, 1056000, 64.908),
("marlin", 3, 1, 1132800, 73.824),
("marlin", 3, 1, 1209600, 85.299),
("marlin", 3, 1, 1286400, 96.036),
("marlin", 3, 1, 1363200, 109.233),
("marlin", 3, 1, 1440000, 118.56),
("marlin", 3, 1, 1516800, 132.959),
("marlin", 3, 1, 1593600, 143.692),
("marlin", 3, 1, 1670400, 161.378),
("marlin", 3, 1, 1747200, 180.616),
("marlin", 3, 1, 1824000, 193.897),
("marlin", 3, 1, 1900800, 214.361),
("marlin", 3, 1, 1977600, 238.338),
("marlin", 3, 1, 2054400, 265.759),
("marlin", 3, 1, 2150400, 297.918),
("sailfish", 0, 0, 307200, 11.272),
("sailfish", 0, 0, 384000, 14.842),
("sailfish", 0, 0, 460800, 18.497),
("sailfish", 0, 0, 537600, 22.518),
("sailfish", 0, 0, 614400, 25.967),
("sailfish", 0, 0, 691200, 31.694),
("sailfish", 0, 0, 768000, 37.673),
("sailfish", 0, 0, 844800, 42.859),
("sailfish", 0, 0, 902600, 46.872),
("sailfish", 0, 0, 979200, 57.92),
("sailfish", 0, 0, 1056000, 67.561),
("sailfish", 0, 0, 1132800, 76.303),
("sailfish", 0, 0, 1209600, 87.613),
("sailfish", 0, 0, 1286400, 97.045),
("sailfish", 0, 0, 1363200, 109.544),
("sailfish", 0, 0, 1440000, 122.054),
("sailfish", 0, 0, 1516800, 136.345),
("sailfish", 0, 0, 1593600, 154.435),
("sailfish", 1, 0, 307200, 11.272),
("sailfish", 1, 0, 384000, 14.842),
("sailfish", 1, 0, 460800, 18.497),
("sailfish", 1, 0, 537600, 22.518),
("sailfish", 1, 0, 614400, 25.967),
("sailfish", 1, 0, 691200, 31.694),
("sailfish", 1, 0, 768000, 37.673),
("sailfish", 1, 0, 844800, 42.859),
("sailfish", 1, 0, 902600, 46.872),
("sailfish", 1, 0, 979200, 57.92),
("sailfish", 1, 0, 1056000, 67.561),
("sailfish", 1, 0, 1132800, 76.303),
("sailfish", 1, 0, 1209600, 87.613),
("sailfish", 1, 0, 1286400, 97.045),
("sailfish", 1, 0, 1363200, 109.544),
("sailfish", 1, 0, 1440000, 122.054),
("sailfish", 1, 0, 1516800, 136.345),
("sailfish", 1, 0, 1593600, 154.435),
("sailfish", 2, 1, 307200, 7.055),
("sailfish", 2, 1, 384000, 11.483),
("sailfish", 2, 1, 460800, 14.979),
("sailfish", 2, 1, 537600, 19.642),
("sailfish", 2, 1, 614400, 23.167),
("sailfish", 2, 1, 691200, 27.479),
("sailfish", 2, 1, 748800, 31.632),
("sailfish", 2, 1, 825600, 39.192),
("sailfish", 2, 1, 902400, 47.817),
("sailfish", 2, 1, 979200, 55.659),
("sailfish", 2, 1, 1056000, 64.908),
("sailfish", 2, 1, 1132800, 73.824),
("sailfish", 2, 1, 1209600, 85.299),
("sailfish", 2, 1, 1286400, 96.036),
("sailfish", 2, 1, 1363200, 109.233),
("sailfish", 2, 1, 1440000, 118.56),
("sailfish", 2, 1, 1516800, 132.959),
("sailfish", 2, 1, 1593600, 143.692),
("sailfish", 2, 1, 1670400, 161.378),
("sailfish", 2, 1, 1747200, 180.616),
("sailfish", 2, 1, 1824000, 193.897),
("sailfish", 2, 1, 1900800, 214.361),
("sailfish", 2, 1, 1977600, 238.338),
("sailfish", 2, 1, 2054400, 265.759),
("sailfish", 2, 1, 2150400, 297.918),
("sailfish", 3, 1, 307200, 7.055),
("sailfish", 3, 1, 384000, 11.483),
("sailfish", 3, 1, 460800, 14.979),
("sailfish", 3, 1, 537600, 19.642),
("sailfish", 3, 1, 614400, 23.167),
("sailfish", 3, 1, 691200, 27.479),
("sailfish", 3, 1, 748800, 31.632),
("sailfish", 3, 1, 825600, 39.192),
("sailfish", 3, 1, 902400, 47.817),
("sailfish", 3, 1, 979200, 55.659),
("sailfish", 3, 1, 1056000, 64.908),
("sailfish", 3, 1, 1132800, 73.824),
("sailfish", 3, 1, 1209600, 85.299),
("sailfish", 3, 1, 1286400, 96.036),
("sailfish", 3, 1, 1363200, 109.233),
("sailfish", 3, 1, 1440000, 118.56),
("sailfish", 3, 1, 1516800, 132.959),
("sailfish", 3, 1, 1593600, 143.692),
("sailfish", 3, 1, 1670400, 161.378),
("sailfish", 3, 1, 1747200, 180.616),
("sailfish", 3, 1, 1824000, 193.897),
("sailfish", 3, 1, 1900800, 214.361),
("sailfish", 3, 1, 1977600, 238.338),
("sailfish", 3, 1, 2054400, 265.759),
("sailfish", 3, 1, 2150400, 297.918),
("walleye", 0, 0, 300000, 3.685),
("walleye", 0, 0, 364800, 3.598),
("walleye", 0, 0, 441600, 3.621),
("walleye", 0, 0, 518400, 4.202),
("walleye", 0, 0, 595200, 4.935),
("walleye", 0, 0, 672000, 5.633),
("walleye", 0, 0, 748800, 6.216),
("walleye", 0, 0, 825600, 6.71),
("walleye", 0, 0, 883200, 7.557),
("walleye", 0, 0, 960000, 8.687),
("walleye", 0, 0, 1036800, 9.882),
("walleye", 0, 0, 1094400, 10.95),
("walleye", 0, 0, 1171200, 12.075),
("walleye", 0, 0, 1248000, 12.875),
("walleye", 0, 0, 1324800, 14.424),
("walleye", 0, 0, 1401600, 15.653),
("walleye", 0, 0, 1478400, 17.345),
("walleye", 0, 0, 1555200, 18.71),
("walleye", 0, 0, 1670400, 21.587),
("walleye", 0, 0, 1747200, 25.43),
("walleye", 0, 0, 1824000, 27.165),
("walleye", 0, 0, 1900800, 31.671),
("walleye", 1, 0, 300000, 3.685),
("walleye", 1, 0, 364800, 3.598),
("walleye", 1, 0, 441600, 3.621),
("walleye", 1, 0, 518400, 4.202),
("walleye", 1, 0, 595200, 4.935),
("walleye", 1, 0, 672000, 5.633),
("walleye", 1, 0, 748800, 6.216),
("walleye", 1, 0, 825600, 6.71),
("walleye", 1, 0, 883200, 7.557),
("walleye", 1, 0, 960000, 8.687),
("walleye", 1, 0, 1036800, 9.882),
("walleye", 1, 0, 1094400, 10.95),
("walleye", 1, 0, 1171200, 12.075),
("walleye", 1, 0, 1248000, 12.875),
("walleye", 1, 0, 1324800, 14.424),
("walleye", 1, 0, 1401600, 15.653),
("walleye", 1, 0, 1478400, 17.345),
("walleye", 1, 0, 1555200, 18.71),
("walleye", 1, 0, 1670400, 21.587),
("walleye", 1, 0, 1747200, 25.43),
("walleye", 1, 0, 1824000, 27.165),
("walleye", 1, 0, 1900800, 31.671),
("walleye", 2, 0, 300000, 3.685),
("walleye", 2, 0, 364800, 3.598),
("walleye", 2, 0, 441600, 3.621),
("walleye", 2, 0, 518400, 4.202),
("walleye", 2, 0, 595200, 4.935),
("walleye", 2, 0, 672000, 5.633),
("walleye", 2, 0, 748800, 6.216),
("walleye", 2, 0, 825600, 6.71),
("walleye", 2, 0, 883200, 7.557),
("walleye", 2, 0, 960000, 8.687),
("walleye", 2, 0, 1036800, 9.882),
("walleye", 2, 0, 1094400, 10.95),
("walleye", 2, 0, 1171200, 12.075),
("walleye", 2, 0, 1248000, 12.875),
("walleye", 2, 0, 1324800, 14.424),
("walleye", 2, 0, 1401600, 15.653),
("walleye", 2, 0, 1478400, 17.345),
("walleye", 2, 0, 1555200, 18.71),
("walleye", 2, 0, 1670400, 21.587),
("walleye", 2, 0, 1747200, 25.43),
("walleye", 2, 0, 1824000, 27.165),
("walleye", 2, 0, 1900800, 31.671),
("walleye", 3, 0, 300000, 3.685),
("walleye", 3, 0, 364800, 3.598),
("walleye", 3, 0, 441600, 3.621),
("walleye", 3, 0, 518400, 4.202),
("walleye", 3, 0, 595200, 4.935),
("walleye", 3, 0, 672000, 5.633),
("walleye", 3, 0, 748800, 6.216),
("walleye", 3, 0, 825600, 6.71),
("walleye", 3, 0, 883200, 7.557),
("walleye", 3, 0, 960000, 8.687),
("walleye", 3, 0, 1036800, 9.882),
("walleye", 3, 0, 1094400, 10.95),
("walleye", 3, 0, 1171200, 12.075),
("walleye", 3, 0, 1248000, 12.875),
("walleye", 3, 0, 1324800, 14.424),
("walleye", 3, 0, 1401600, 15.653),
("walleye", 3, 0, 1478400, 17.345),
("walleye", 3, 0, 1555200, 18.71),
("walleye", 3, 0, 1670400, 21.587),
("walleye", 3, 0, 1747200, 25.43),
("walleye", 3, 0, 1824000, 27.165),
("walleye", 3, 0, 1900800, 31.671),
("walleye", 4, 1, 300000, 10.722),
("walleye", 4, 1, 345600, 11.52),
("walleye", 4, 1, 422400, 14.105),
("walleye", 4, 1, 499200, 16.68),
("walleye", 4, 1, 576000, 18.946),
("walleye", 4, 1, 652800, 21.265),
("walleye", 4, 1, 729600, 23.432),
("walleye", 4, 1, 806400, 26.019),
("walleye", 4, 1, 902400, 28.856),
("walleye", 4, 1, 979200, 31.085),
("walleye", 4, 1, 1056000, 33.615),
("walleye", 4, 1, 1132800, 35.76),
("walleye", 4, 1, 1190400, 40.608),
("walleye", 4, 1, 1267200, 43.284),
("walleye", 4, 1, 1344000, 47.347),
("walleye", 4, 1, 1420800, 52.231),
("walleye", 4, 1, 1497600, 57.225),
("walleye", 4, 1, 1574400, 63.138),
("walleye", 4, 1, 1651200, 69.251),
("walleye", 4, 1, 1728000, 76.449),
("walleye", 4, 1, 1804800, 84.71),
("walleye", 4, 1, 1881600, 102.551),
("walleye", 4, 1, 1958400, 107.115),
("walleye", 4, 1, 2035200, 129.689),
("walleye", 4, 1, 2112000, 135.832),
("walleye", 4, 1, 2208000, 164.674),
("walleye", 4, 1, 2265600, 180.279),
("walleye", 4, 1, 2323200, 197.024),
("walleye", 4, 1, 2342400, 204.511),
("walleye", 4, 1, 2361600, 211.886),
("walleye", 4, 1, 2457600, 212.147),
("walleye", 5, 1, 300000, 10.722),
("walleye", 5, 1, 345600, 11.52),
("walleye", 5, 1, 422400, 14.105),
("walleye", 5, 1, 499200, 16.68),
("walleye", 5, 1, 576000, 18.946),
("walleye", 5, 1, 652800, 21.265),
("walleye", 5, 1, 729600, 23.432),
("walleye", 5, 1, 806400, 26.019),
("walleye", 5, 1, 902400, 28.856),
("walleye", 5, 1, 979200, 31.085),
("walleye", 5, 1, 1056000, 33.615),
("walleye", 5, 1, 1132800, 35.76),
("walleye", 5, 1, 1190400, 40.608),
("walleye", 5, 1, 1267200, 43.284),
("walleye", 5, 1, 1344000, 47.347),
("walleye", 5, 1, 1420800, 52.231),
("walleye", 5, 1, 1497600, 57.225),
("walleye", 5, 1, 1574400, 63.138),
("walleye", 5, 1, 1651200, 69.251),
("walleye", 5, 1, 1728000, 76.449),
("walleye", 5, 1, 1804800, 84.71),
("walleye", 5, 1, 1881600, 102.551),
("walleye", 5, 1, 1958400, 107.115),
("walleye", 5, 1, 2035200, 129.689),
("walleye", 5, 1, 2112000, 135.832),
("walleye", 5, 1, 2208000, 164.674),
("walleye", 5, 1, 2265600, 180.279),
("walleye", 5, 1, 2323200, 197.024),
("walleye", 5, 1, 2342400, 204.511),
("walleye", 5, 1, 2361600, 211.886),
("walleye", 5, 1, 2457600, 212.147),
("walleye", 6, 1, 300000, 10.722),
("walleye", 6, 1, 345600, 11.52),
("walleye", 6, 1, 422400, 14.105),
("walleye", 6, 1, 499200, 16.68),
("walleye", 6, 1, 576000, 18.946),
("walleye", 6, 1, 652800, 21.265),
("walleye", 6, 1, 729600, 23.432),
("walleye", 6, 1, 806400, 26.019),
("walleye", 6, 1, 902400, 28.856),
("walleye", 6, 1, 979200, 31.085),
("walleye", 6, 1, 1056000, 33.615),
("walleye", 6, 1, 1132800, 35.76),
("walleye", 6, 1, 1190400, 40.608),
("walleye", 6, 1, 1267200, 43.284),
("walleye", 6, 1, 1344000, 47.347),
("walleye", 6, 1, 1420800, 52.231),
("walleye", 6, 1, 1497600, 57.225),
("walleye", 6, 1, 1574400, 63.138),
("walleye", 6, 1, 1651200, 69.251),
("walleye", 6, 1, 1728000, 76.449),
("walleye", 6, 1, 1804800, 84.71),
("walleye", 6, 1, 1881600, 102.551),
("walleye", 6, 1, 1958400, 107.115),
("walleye", 6, 1, 2035200, 129.689),
("walleye", 6, 1, 2112000, 135.832),
("walleye", 6, 1, 2208000, 164.674),
("walleye", 6, 1, 2265600, 180.279),
("walleye", 6, 1, 2323200, 197.024),
("walleye", 6, 1, 2342400, 204.511),
("walleye", 6, 1, 2361600, 211.886),
("walleye", 6, 1, 2457600, 212.147),
("walleye", 7, 1, 300000, 10.722),
("walleye", 7, 1, 345600, 11.52),
("walleye", 7, 1, 422400, 14.105),
("walleye", 7, 1, 499200, 16.68),
("walleye", 7, 1, 576000, 18.946),
("walleye", 7, 1, 652800, 21.265),
("walleye", 7, 1, 729600, 23.432),
("walleye", 7, 1, 806400, 26.019),
("walleye", 7, 1, 902400, 28.856),
("walleye", 7, 1, 979200, 31.085),
("walleye", 7, 1, 1056000, 33.615),
("walleye", 7, 1, 1132800, 35.76),
("walleye", 7, 1, 1190400, 40.608),
("walleye", 7, 1, 1267200, 43.284),
("walleye", 7, 1, 1344000, 47.347),
("walleye", 7, 1, 1420800, 52.231),
("walleye", 7, 1, 1497600, 57.225),
("walleye", 7, 1, 1574400, 63.138),
("walleye", 7, 1, 1651200, 69.251),
("walleye", 7, 1, 1728000, 76.449),
("walleye", 7, 1, 1804800, 84.71),
("walleye", 7, 1, 1881600, 102.551),
("walleye", 7, 1, 1958400, 107.115),
("walleye", 7, 1, 2035200, 129.689),
("walleye", 7, 1, 2112000, 135.832),
("walleye", 7, 1, 2208000, 164.674),
("walleye", 7, 1, 2265600, 180.279),
("walleye", 7, 1, 2323200, 197.024),
("walleye", 7, 1, 2342400, 204.511),
("walleye", 7, 1, 2361600, 211.886),
("walleye", 7, 1, 2457600, 212.147),
("taimen", 0, 0, 300000, 3.685),
("taimen", 0, 0, 364800, 3.598),
("taimen", 0, 0, 441600, 3.621),
("taimen", 0, 0, 518400, 4.202),
("taimen", 0, 0, 595200, 4.935),
("taimen", 0, 0, 672000, 5.633),
("taimen", 0, 0, 748800, 6.216),
("taimen", 0, 0, 825600, 6.71),
("taimen", 0, 0, 883200, 7.557),
("taimen", 0, 0, 960000, 8.687),
("taimen", 0, 0, 1036800, 9.882),
("taimen", 0, 0, 1094400, 10.95),
("taimen", 0, 0, 1171200, 12.075),
("taimen", 0, 0, 1248000, 12.875),
("taimen", 0, 0, 1324800, 14.424),
("taimen", 0, 0, 1401600, 15.653),
("taimen", 0, 0, 1478400, 17.345),
("taimen", 0, 0, 1555200, 18.71),
("taimen", 0, 0, 1670400, 21.587),
("taimen", 0, 0, 1747200, 25.43),
("taimen", 0, 0, 1824000, 27.165),
("taimen", 0, 0, 1900800, 31.671),
("taimen", 1, 0, 300000, 3.685),
("taimen", 1, 0, 364800, 3.598),
("taimen", 1, 0, 441600, 3.621),
("taimen", 1, 0, 518400, 4.202),
("taimen", 1, 0, 595200, 4.935),
("taimen", 1, 0, 672000, 5.633),
("taimen", 1, 0, 748800, 6.216),
("taimen", 1, 0, 825600, 6.71),
("taimen", 1, 0, 883200, 7.557),
("taimen", 1, 0, 960000, 8.687),
("taimen", 1, 0, 1036800, 9.882),
("taimen", 1, 0, 1094400, 10.95),
("taimen", 1, 0, 1171200, 12.075),
("taimen", 1, 0, 1248000, 12.875),
("taimen", 1, 0, 1324800, 14.424),
("taimen", 1, 0, 1401600, 15.653),
("taimen", 1, 0, 1478400, 17.345),
("taimen", 1, 0, 1555200, 18.71),
("taimen", 1, 0, 1670400, 21.587),
("taimen", 1, 0, 1747200, 25.43),
("taimen", 1, 0, 1824000, 27.165),
("taimen", 1, 0, 1900800, 31.671),
("taimen", 2, 0, 300000, 3.685),
("taimen", 2, 0, 364800, 3.598),
("taimen", 2, 0, 441600, 3.621),
("taimen", 2, 0, 518400, 4.202),
("taimen", 2, 0, 595200, 4.935),
("taimen", 2, 0, 672000, 5.633),
("taimen", 2, 0, 748800, 6.216),
("taimen", 2, 0, 825600, 6.71),
("taimen", 2, 0, 883200, 7.557),
("taimen", 2, 0, 960000, 8.687),
("taimen", 2, 0, 1036800, 9.882),
("taimen", 2, 0, 1094400, 10.95),
("taimen", 2, 0, 1171200, 12.075),
("taimen", 2, 0, 1248000, 12.875),
("taimen", 2, 0, 1324800, 14.424),
("taimen", 2, 0, 1401600, 15.653),
("taimen", 2, 0, 1478400, 17.345),
("taimen", 2, 0, 1555200, 18.71),
("taimen", 2, 0, 1670400, 21.587),
("taimen", 2, 0, 1747200, 25.43),
("taimen", 2, 0, 1824000, 27.165),
("taimen", 2, 0, 1900800, 31.671),
("taimen", 3, 0, 300000, 3.685),
("taimen", 3, 0, 364800, 3.598),
("taimen", 3, 0, 441600, 3.621),
("taimen", 3, 0, 518400, 4.202),
("taimen", 3, 0, 595200, 4.935),
("taimen", 3, 0, 672000, 5.633),
("taimen", 3, 0, 748800, 6.216),
("taimen", 3, 0, 825600, 6.71),
("taimen", 3, 0, 883200, 7.557),
("taimen", 3, 0, 960000, 8.687),
("taimen", 3, 0, 1036800, 9.882),
("taimen", 3, 0, 1094400, 10.95),
("taimen", 3, 0, 1171200, 12.075),
("taimen", 3, 0, 1248000, 12.875),
("taimen", 3, 0, 1324800, 14.424),
("taimen", 3, 0, 1401600, 15.653),
("taimen", 3, 0, 1478400, 17.345),
("taimen", 3, 0, 1555200, 18.71),
("taimen", 3, 0, 1670400, 21.587),
("taimen", 3, 0, 1747200, 25.43),
("taimen", 3, 0, 1824000, 27.165),
("taimen", 3, 0, 1900800, 31.671),
("taimen", 4, 1, 300000, 10.722),
("taimen", 4, 1, 345600, 11.52),
("taimen", 4, 1, 422400, 14.105),
("taimen", 4, 1, 499200, 16.68),
("taimen", 4, 1, 576000, 18.946),
("taimen", 4, 1, 652800, 21.265),
("taimen", 4, 1, 729600, 23.432),
("taimen", 4, 1, 806400, 26.019),
("taimen", 4, 1, 902400, 28.856),
("taimen", 4, 1, 979200, 31.085),
("taimen", 4, 1, 1056000, 33.615),
("taimen", 4, 1, 1132800, 35.76),
("taimen", 4, 1, 1190400, 40.608),
("taimen", 4, 1, 1267200, 43.284),
("taimen", 4, 1, 1344000, 47.347),
("taimen", 4, 1, 1420800, 52.231),
("taimen", 4, 1, 1497600, 57.225),
("taimen", 4, 1, 1574400, 63.138),
("taimen", 4, 1, 1651200, 69.251),
("taimen", 4, 1, 1728000, 76.449),
("taimen", 4, 1, 1804800, 84.71),
("taimen", 4, 1, 1881600, 102.551),
("taimen", 4, 1, 1958400, 107.115),
("taimen", 4, 1, 2035200, 129.689),
("taimen", 4, 1, 2112000, 135.832),
("taimen", 4, 1, 2208000, 164.674),
("taimen", 4, 1, 2265600, 180.279),
("taimen", 4, 1, 2323200, 197.024),
("taimen", 4, 1, 2342400, 204.511),
("taimen", 4, 1, 2361600, 211.886),
("taimen", 4, 1, 2457600, 212.147),
("taimen", 5, 1, 300000, 10.722),
("taimen", 5, 1, 345600, 11.52),
("taimen", 5, 1, 422400, 14.105),
("taimen", 5, 1, 499200, 16.68),
("taimen", 5, 1, 576000, 18.946),
("taimen", 5, 1, 652800, 21.265),
("taimen", 5, 1, 729600, 23.432),
("taimen", 5, 1, 806400, 26.019),
("taimen", 5, 1, 902400, 28.856),
("taimen", 5, 1, 979200, 31.085),
("taimen", 5, 1, 1056000, 33.615),
("taimen", 5, 1, 1132800, 35.76),
("taimen", 5, 1, 1190400, 40.608),
("taimen", 5, 1, 1267200, 43.284),
("taimen", 5, 1, 1344000, 47.347),
("taimen", 5, 1, 1420800, 52.231),
("taimen", 5, 1, 1497600, 57.225),
("taimen", 5, 1, 1574400, 63.138),
("taimen", 5, 1, 1651200, 69.251),
("taimen", 5, 1, 1728000, 76.449),
("taimen", 5, 1, 1804800, 84.71),
("taimen", 5, 1, 1881600, 102.551),
("taimen", 5, 1, 1958400, 107.115),
("taimen", 5, 1, 2035200, 129.689),
("taimen", 5, 1, 2112000, 135.832),
("taimen", 5, 1, 2208000, 164.674),
("taimen", 5, 1, 2265600, 180.279),
("taimen", 5, 1, 2323200, 197.024),
("taimen", 5, 1, 2342400, 204.511),
("taimen", 5, 1, 2361600, 211.886),
("taimen", 5, 1, 2457600, 212.147),
("taimen", 6, 1, 300000, 10.722),
("taimen", 6, 1, 345600, 11.52),
("taimen", 6, 1, 422400, 14.105),
("taimen", 6, 1, 499200, 16.68),
("taimen", 6, 1, 576000, 18.946),
("taimen", 6, 1, 652800, 21.265),
("taimen", 6, 1, 729600, 23.432),
("taimen", 6, 1, 806400, 26.019),
("taimen", 6, 1, 902400, 28.856),
("taimen", 6, 1, 979200, 31.085),
("taimen", 6, 1, 1056000, 33.615),
("taimen", 6, 1, 1132800, 35.76),
("taimen", 6, 1, 1190400, 40.608),
("taimen", 6, 1, 1267200, 43.284),
("taimen", 6, 1, 1344000, 47.347),
("taimen", 6, 1, 1420800, 52.231),
("taimen", 6, 1, 1497600, 57.225),
("taimen", 6, 1, 1574400, 63.138),
("taimen", 6, 1, 1651200, 69.251),
("taimen", 6, 1, 1728000, 76.449),
("taimen", 6, 1, 1804800, 84.71),
("taimen", 6, 1, 1881600, 102.551),
("taimen", 6, 1, 1958400, 107.115),
("taimen", 6, 1, 2035200, 129.689),
("taimen", 6, 1, 2112000, 135.832),
("taimen", 6, 1, 2208000, 164.674),
("taimen", 6, 1, 2265600, 180.279),
("taimen", 6, 1, 2323200, 197.024),
("taimen", 6, 1, 2342400, 204.511),
("taimen", 6, 1, 2361600, 211.886),
("taimen", 6, 1, 2457600, 212.147),
("taimen", 7, 1, 300000, 10.722),
("taimen", 7, 1, 345600, 11.52),
("taimen", 7, 1, 422400, 14.105),
("taimen", 7, 1, 499200, 16.68),
("taimen", 7, 1, 576000, 18.946),
("taimen", 7, 1, 652800, 21.265),
("taimen", 7, 1, 729600, 23.432),
("taimen", 7, 1, 806400, 26.019),
("taimen", 7, 1, 902400, 28.856),
("taimen", 7, 1, 979200, 31.085),
("taimen", 7, 1, 1056000, 33.615),
("taimen", 7, 1, 1132800, 35.76),
("taimen", 7, 1, 1190400, 40.608),
("taimen", 7, 1, 1267200, 43.284),
("taimen", 7, 1, 1344000, 47.347),
("taimen", 7, 1, 1420800, 52.231),
("taimen", 7, 1, 1497600, 57.225),
("taimen", 7, 1, 1574400, 63.138),
("taimen", 7, 1, 1651200, 69.251),
("taimen", 7, 1, 1728000, 76.449),
("taimen", 7, 1, 1804800, 84.71),
("taimen", 7, 1, 1881600, 102.551),
("taimen", 7, 1, 1958400, 107.115),
("taimen", 7, 1, 2035200, 129.689),
("taimen", 7, 1, 2112000, 135.832),
("taimen", 7, 1, 2208000, 164.674),
("taimen", 7, 1, 2265600, 180.279),
("taimen", 7, 1, 2323200, 197.024),
("taimen", 7, 1, 2342400, 204.511),
("taimen", 7, 1, 2361600, 211.886),
("taimen", 7, 1, 2457600, 212.147),
("crosshatch", 0, 0, 300000, 2.27),
("crosshatch", 0, 0, 403200, 3.63),
("crosshatch", 0, 0, 480000, 4.36),
("crosshatch", 0, 0, 576000, 5.21),
("crosshatch", 0, 0, 652800, 5.47),
("crosshatch", 0, 0, 748800, 6.74),
("crosshatch", 0, 0, 825600, 7.69),
("crosshatch", 0, 0, 902400, 8.57),
("crosshatch", 0, 0, 979200, 9.42),
("crosshatch", 0, 0, 1056000, 10.41),
("crosshatch", 0, 0, 1132800, 11.56),
("crosshatch", 0, 0, 1228800, 12.87),
("crosshatch", 0, 0, 1324800, 14.61),
("crosshatch", 0, 0, 1420800, 16.49),
("crosshatch", 0, 0, 1516800, 18.9),
("crosshatch", 0, 0, 1612800, 21.62),
("crosshatch", 0, 0, 1689600, 24.47),
("crosshatch", 0, 0, 1766400, 26.45),
("crosshatch", 1, 0, 300000, 2.27),
("crosshatch", 1, 0, 403200, 3.63),
("crosshatch", 1, 0, 480000, 4.36),
("crosshatch", 1, 0, 576000, 5.21),
("crosshatch", 1, 0, 652800, 5.47),
("crosshatch", 1, 0, 748800, 6.74),
("crosshatch", 1, 0, 825600, 7.69),
("crosshatch", 1, 0, 902400, 8.57),
("crosshatch", 1, 0, 979200, 9.42),
("crosshatch", 1, 0, 1056000, 10.41),
("crosshatch", 1, 0, 1132800, 11.56),
("crosshatch", 1, 0, 1228800, 12.87),
("crosshatch", 1, 0, 1324800, 14.61),
("crosshatch", 1, 0, 1420800, 16.49),
("crosshatch", 1, 0, 1516800, 18.9),
("crosshatch", 1, 0, 1612800, 21.62),
("crosshatch", 1, 0, 1689600, 24.47),
("crosshatch", 1, 0, 1766400, 26.45),
("crosshatch", 2, 0, 300000, 2.27),
("crosshatch", 2, 0, 403200, 3.63),
("crosshatch", 2, 0, 480000, 4.36),
("crosshatch", 2, 0, 576000, 5.21),
("crosshatch", 2, 0, 652800, 5.47),
("crosshatch", 2, 0, 748800, 6.74),
("crosshatch", 2, 0, 825600, 7.69),
("crosshatch", 2, 0, 902400, 8.57),
("crosshatch", 2, 0, 979200, 9.42),
("crosshatch", 2, 0, 1056000, 10.41),
("crosshatch", 2, 0, 1132800, 11.56),
("crosshatch", 2, 0, 1228800, 12.87),
("crosshatch", 2, 0, 1324800, 14.61),
("crosshatch", 2, 0, 1420800, 16.49),
("crosshatch", 2, 0, 1516800, 18.9),
("crosshatch", 2, 0, 1612800, 21.62),
("crosshatch", 2, 0, 1689600, 24.47),
("crosshatch", 2, 0, 1766400, 26.45),
("crosshatch", 3, 0, 300000, 2.27),
("crosshatch", 3, 0, 403200, 3.63),
("crosshatch", 3, 0, 480000, 4.36),
("crosshatch", 3, 0, 576000, 5.21),
("crosshatch", 3, 0, 652800, 5.47),
("crosshatch", 3, 0, 748800, 6.74),
("crosshatch", 3, 0, 825600, 7.69),
("crosshatch", 3, 0, 902400, 8.57),
("crosshatch", 3, 0, 979200, 9.42),
("crosshatch", 3, 0, 1056000, 10.41),
("crosshatch", 3, 0, 1132800, 11.56),
("crosshatch", 3, 0, 1228800, 12.87),
("crosshatch", 3, 0, 1324800, 14.61),
("crosshatch", 3, 0, 1420800, 16.49),
("crosshatch", 3, 0, 1516800, 18.9),
("crosshatch", 3, 0, 1612800, 21.62),
("crosshatch", 3, 0, 1689600, 24.47),
("crosshatch", 3, 0, 1766400, 26.45),
("crosshatch", 4, 1, 825600, 28.88),
("crosshatch", 4, 1, 902400, 32.4),
("crosshatch", 4, 1, 979200, 36.46),
("crosshatch", 4, 1, 1056000, 39.99),
("crosshatch", 4, 1, 1209600, 47.23),
("crosshatch", 4, 1, 1286400, 51.39),
("crosshatch", 4, 1, 1363200, 56.9),
("crosshatch", 4, 1, 1459200, 64.26),
("crosshatch", 4, 1, 1536000, 69.65),
("crosshatch", 4, 1, 1612800, 75.14),
("crosshatch", 4, 1, 1689600, 83.16),
("crosshatch", 4, 1, 1766400, 91.75),
("crosshatch", 4, 1, 1843200, 100.66),
("crosshatch", 4, 1, 1920000, 111.45),
("crosshatch", 4, 1, 1996800, 122.23),
("crosshatch", 4, 1, 2092800, 143.54),
("crosshatch", 4, 1, 2169600, 147.54),
("crosshatch", 4, 1, 2246400, 153.09),
("crosshatch", 4, 1, 2323200, 166.44),
("crosshatch", 4, 1, 2400000, 184.69),
("crosshatch", 4, 1, 2476800, 204.14),
("crosshatch", 4, 1, 2553600, 223.37),
("crosshatch", 4, 1, 2649600, 253.77),
("crosshatch", 5, 1, 825600, 28.88),
("crosshatch", 5, 1, 902400, 32.4),
("crosshatch", 5, 1, 979200, 36.46),
("crosshatch", 5, 1, 1056000, 39.99),
("crosshatch", 5, 1, 1209600, 47.23),
("crosshatch", 5, 1, 1286400, 51.39),
("crosshatch", 5, 1, 1363200, 56.9),
("crosshatch", 5, 1, 1459200, 64.26),
("crosshatch", 5, 1, 1536000, 69.65),
("crosshatch", 5, 1, 1612800, 75.14),
("crosshatch", 5, 1, 1689600, 83.16),
("crosshatch", 5, 1, 1766400, 91.75),
("crosshatch", 5, 1, 1843200, 100.66),
("crosshatch", 5, 1, 1920000, 111.45),
("crosshatch", 5, 1, 1996800, 122.23),
("crosshatch", 5, 1, 2092800, 143.54),
("crosshatch", 5, 1, 2169600, 147.54),
("crosshatch", 5, 1, 2246400, 153.09),
("crosshatch", 5, 1, 2323200, 166.44),
("crosshatch", 5, 1, 2400000, 184.69),
("crosshatch", 5, 1, 2476800, 204.14),
("crosshatch", 5, 1, 2553600, 223.37),
("crosshatch", 5, 1, 2649600, 253.77),
("crosshatch", 6, 1, 825600, 28.88),
("crosshatch", 6, 1, 902400, 32.4),
("crosshatch", 6, 1, 979200, 36.46),
("crosshatch", 6, 1, 1056000, 39.99),
("crosshatch", 6, 1, 1209600, 47.23),
("crosshatch", 6, 1, 1286400, 51.39),
("crosshatch", 6, 1, 1363200, 56.9),
("crosshatch", 6, 1, 1459200, 64.26),
("crosshatch", 6, 1, 1536000, 69.65),
("crosshatch", 6, 1, 1612800, 75.14),
("crosshatch", 6, 1, 1689600, 83.16),
("crosshatch", 6, 1, 1766400, 91.75),
("crosshatch", 6, 1, 1843200, 100.66),
("crosshatch", 6, 1, 1920000, 111.45),
("crosshatch", 6, 1, 1996800, 122.23),
("crosshatch", 6, 1, 2092800, 143.54),
("crosshatch", 6, 1, 2169600, 147.54),
("crosshatch", 6, 1, 2246400, 153.09),
("crosshatch", 6, 1, 2323200, 166.44),
("crosshatch", 6, 1, 2400000, 184.69),
("crosshatch", 6, 1, 2476800, 204.14),
("crosshatch", 6, 1, 2553600, 223.37),
("crosshatch", 6, 1, 2649600, 253.77),
("crosshatch", 7, 1, 825600, 28.88),
("crosshatch", 7, 1, 902400, 32.4),
("crosshatch", 7, 1, 979200, 36.46),
("crosshatch", 7, 1, 1056000, 39.99),
("crosshatch", 7, 1, 1209600, 47.23),
("crosshatch", 7, 1, 1286400, 51.39),
("crosshatch", 7, 1, 1363200, 56.9),
("crosshatch", 7, 1, 1459200, 64.26),
("crosshatch", 7, 1, 1536000, 69.65),
("crosshatch", 7, 1, 1612800, 75.14),
("crosshatch", 7, 1, 1689600, 83.16),
("crosshatch", 7, 1, 1766400, 91.75),
("crosshatch", 7, 1, 1843200, 100.66),
("crosshatch", 7, 1, 1920000, 111.45),
("crosshatch", 7, 1, 1996800, 122.23),
("crosshatch", 7, 1, 2092800, 143.54),
("crosshatch", 7, 1, 2169600, 147.54),
("crosshatch", 7, 1, 2246400, 153.09),
("crosshatch", 7, 1, 2323200, 166.44),
("crosshatch", 7, 1, 2400000, 184.69),
("crosshatch", 7, 1, 2476800, 204.14),
("crosshatch", 7, 1, 2553600, 223.37),
("crosshatch", 7, 1, 2649600, 253.77),
("blueline", 0, 0, 300000, 2.27),
("blueline", 0, 0, 403200, 3.63),
("blueline", 0, 0, 480000, 4.36),
("blueline", 0, 0, 576000, 5.21),
("blueline", 0, 0, 652800, 5.47),
("blueline", 0, 0, 748800, 6.74),
("blueline", 0, 0, 825600, 7.69),
("blueline", 0, 0, 902400, 8.57),
("blueline", 0, 0, 979200, 9.42),
("blueline", 0, 0, 1056000, 10.41),
("blueline", 0, 0, 1132800, 11.56),
("blueline", 0, 0, 1228800, 12.87),
("blueline", 0, 0, 1324800, 14.61),
("blueline", 0, 0, 1420800, 16.49),
("blueline", 0, 0, 1516800, 18.9),
("blueline", 0, 0, 1612800, 21.62),
("blueline", 0, 0, 1689600, 24.47),
("blueline", 0, 0, 1766400, 26.45),
("blueline", 1, 0, 300000, 2.27),
("blueline", 1, 0, 403200, 3.63),
("blueline", 1, 0, 480000, 4.36),
("blueline", 1, 0, 576000, 5.21),
("blueline", 1, 0, 652800, 5.47),
("blueline", 1, 0, 748800, 6.74),
("blueline", 1, 0, 825600, 7.69),
("blueline", 1, 0, 902400, 8.57),
("blueline", 1, 0, 979200, 9.42),
("blueline", 1, 0, 1056000, 10.41),
("blueline", 1, 0, 1132800, 11.56),
("blueline", 1, 0, 1228800, 12.87),
("blueline", 1, 0, 1324800, 14.61),
("blueline", 1, 0, 1420800, 16.49),
("blueline", 1, 0, 1516800, 18.9),
("blueline", 1, 0, 1612800, 21.62),
("blueline", 1, 0, 1689600, 24.47),
("blueline", 1, 0, 1766400, 26.45),
("blueline", 2, 0, 300000, 2.27),
("blueline", 2, 0, 403200, 3.63),
("blueline", 2, 0, 480000, 4.36),
("blueline", 2, 0, 576000, 5.21),
("blueline", 2, 0, 652800, 5.47),
("blueline", 2, 0, 748800, 6.74),
("blueline", 2, 0, 825600, 7.69),
("blueline", 2, 0, 902400, 8.57),
("blueline", 2, 0, 979200, 9.42),
("blueline", 2, 0, 1056000, 10.41),
("blueline", 2, 0, 1132800, 11.56),
("blueline", 2, 0, 1228800, 12.87),
("blueline", 2, 0, 1324800, 14.61),
("blueline", 2, 0, 1420800, 16.49),
("blueline", 2, 0, 1516800, 18.9),
("blueline", 2, 0, 1612800, 21.62),
("blueline", 2, 0, 1689600, 24.47),
("blueline", 2, 0, 1766400, 26.45),
("blueline", 3, 0, 300000, 2.27),
("blueline", 3, 0, 403200, 3.63),
("blueline", 3, 0, 480000, 4.36),
("blueline", 3, 0, 576000, 5.21),
("blueline", 3, 0, 652800, 5.47),
("blueline", 3, 0, 748800, 6.74),
("blueline", 3, 0, 825600, 7.69),
("blueline", 3, 0, 902400, 8.57),
("blueline", 3, 0, 979200, 9.42),
("blueline", 3, 0, 1056000, 10.41),
("blueline", 3, 0, 1132800, 11.56),
("blueline", 3, 0, 1228800, 12.87),
("blueline", 3, 0, 1324800, 14.61),
("blueline", 3, 0, 1420800, 16.49),
("blueline", 3, 0, 1516800, 18.9),
("blueline", 3, 0, 1612800, 21.62),
("blueline", 3, 0, 1689600, 24.47),
("blueline", 3, 0, 1766400, 26.45),
("blueline", 4, 1, 825600, 28.88),
("blueline", 4, 1, 902400, 32.4),
("blueline", 4, 1, 979200, 36.46),
("blueline", 4, 1, 1056000, 39.99),
("blueline", 4, 1, 1209600, 47.23),
("blueline", 4, 1, 1286400, 51.39),
("blueline", 4, 1, 1363200, 56.9),
("blueline", 4, 1, 1459200, 64.26),
("blueline", 4, 1, 1536000, 69.65),
("blueline", 4, 1, 1612800, 75.14),
("blueline", 4, 1, 1689600, 83.16),
("blueline", 4, 1, 1766400, 91.75),
("blueline", 4, 1, 1843200, 100.66),
("blueline", 4, 1, 1920000, 111.45),
("blueline", 4, 1, 1996800, 122.23),
("blueline", 4, 1, 2092800, 143.54),
("blueline", 4, 1, 2169600, 147.54),
("blueline", 4, 1, 2246400, 153.09),
("blueline", 4, 1, 2323200, 166.44),
("blueline", 4, 1, 2400000, 184.69),
("blueline", 4, 1, 2476800, 204.14),
("blueline", 4, 1, 2553600, 223.37),
("blueline", 4, 1, 2649600, 253.77),
("blueline", 5, 1, 825600, 28.88),
("blueline", 5, 1, 902400, 32.4),
("blueline", 5, 1, 979200, 36.46),
("blueline", 5, 1, 1056000, 39.99),
("blueline", 5, 1, 1209600, 47.23),
("blueline", 5, 1, 1286400, 51.39),
("blueline", 5, 1, 1363200, 56.9),
("blueline", 5, 1, 1459200, 64.26),
("blueline", 5, 1, 1536000, 69.65),
("blueline", 5, 1, 1612800, 75.14),
("blueline", 5, 1, 1689600, 83.16),
("blueline", 5, 1, 1766400, 91.75),
("blueline", 5, 1, 1843200, 100.66),
("blueline", 5, 1, 1920000, 111.45),
("blueline", 5, 1, 1996800, 122.23),
("blueline", 5, 1, 2092800, 143.54),
("blueline", 5, 1, 2169600, 147.54),
("blueline", 5, 1, 2246400, 153.09),
("blueline", 5, 1, 2323200, 166.44),
("blueline", 5, 1, 2400000, 184.69),
("blueline", 5, 1, 2476800, 204.14),
("blueline", 5, 1, 2553600, 223.37),
("blueline", 5, 1, 2649600, 253.77),
("blueline", 6, 1, 825600, 28.88),
("blueline", 6, 1, 902400, 32.4),
("blueline", 6, 1, 979200, 36.46),
("blueline", 6, 1, 1056000, 39.99),
("blueline", 6, 1, 1209600, 47.23),
("blueline", 6, 1, 1286400, 51.39),
("blueline", 6, 1, 1363200, 56.9),
("blueline", 6, 1, 1459200, 64.26),
("blueline", 6, 1, 1536000, 69.65),
("blueline", 6, 1, 1612800, 75.14),
("blueline", 6, 1, 1689600, 83.16),
("blueline", 6, 1, 1766400, 91.75),
("blueline", 6, 1, 1843200, 100.66),
("blueline", 6, 1, 1920000, 111.45),
("blueline", 6, 1, 1996800, 122.23),
("blueline", 6, 1, 2092800, 143.54),
("blueline", 6, 1, 2169600, 147.54),
("blueline", 6, 1, 2246400, 153.09),
("blueline", 6, 1, 2323200, 166.44),
("blueline", 6, 1, 2400000, 184.69),
("blueline", 6, 1, 2476800, 204.14),
("blueline", 6, 1, 2553600, 223.37),
("blueline", 6, 1, 2649600, 253.77),
("blueline", 7, 1, 825600, 28.88),
("blueline", 7, 1, 902400, 32.4),
("blueline", 7, 1, 979200, 36.46),
("blueline", 7, 1, 1056000, 39.99),
("blueline", 7, 1, 1209600, 47.23),
("blueline", 7, 1, 1286400, 51.39),
("blueline", 7, 1, 1363200, 56.9),
("blueline", 7, 1, 1459200, 64.26),
("blueline", 7, 1, 1536000, 69.65),
("blueline", 7, 1, 1612800, 75.14),
("blueline", 7, 1, 1689600, 83.16),
("blueline", 7, 1, 1766400, 91.75),
("blueline", 7, 1, 1843200, 100.66),
("blueline", 7, 1, 1920000, 111.45),
("blueline", 7, 1, 1996800, 122.23),
("blueline", 7, 1, 2092800, 143.54),
("blueline", 7, 1, 2169600, 147.54),
("blueline", 7, 1, 2246400, 153.09),
("blueline", 7, 1, 2323200, 166.44),
("blueline", 7, 1, 2400000, 184.69),
("blueline", 7, 1, 2476800, 204.14),
("blueline", 7, 1, 2553600, 223.37),
("blueline", 7, 1, 2649600, 253.77),
("bonito", 0, 0, 300000, 15.2466666667),
("bonito", 0, 0, 576000, 18.2166666667),
("bonito", 0, 0, 748800, 20.1866666667),
("bonito", 0, 0, 998400, 23.29),
("bonito", 0, 0, 1209600, 25.0116666667),
("bonito", 0, 0, 1324800, 28.485),
("bonito", 0, 0, 1516800, 31.6866666667),
("bonito", 0, 0, 1708800, 35.79),
("bonito", 1, 0, 300000, 15.2466666667),
("bonito", 1, 0, 576000, 18.2166666667),
("bonito", 1, 0, 748800, 20.1866666667),
("bonito", 1, 0, 998400, 23.29),
("bonito", 1, 0, 1209600, 25.0116666667),
("bonito", 1, 0, 1324800, 28.485),
("bonito", 1, 0, 1516800, 31.6866666667),
("bonito", 1, 0, 1708800, 35.79),
("bonito", 2, 0, 300000, 15.2466666667),
("bonito", 2, 0, 576000, 18.2166666667),
("bonito", 2, 0, 748800, 20.1866666667),
("bonito", 2, 0, 998400, 23.29),
("bonito", 2, 0, 1209600, 25.0116666667),
("bonito", 2, 0, 1324800, 28.485),
("bonito", 2, 0, 1516800, 31.6866666667),
("bonito", 2, 0, 1708800, 35.79),
("bonito", 3, 0, 300000, 15.2466666667),
("bonito", 3, 0, 576000, 18.2166666667),
("bonito", 3, 0, 748800, 20.1866666667),
("bonito", 3, 0, 998400, 23.29),
("bonito", 3, 0, 1209600, 25.0116666667),
("bonito", 3, 0, 1324800, 28.485),
("bonito", 3, 0, 1516800, 31.6866666667),
("bonito", 3, 0, 1708800, 35.79),
("bonito", 4, 0, 300000, 15.2466666667),
("bonito", 4, 0, 576000, 18.2166666667),
("bonito", 4, 0, 748800, 20.1866666667),
("bonito", 4, 0, 998400, 23.29),
("bonito", 4, 0, 1209600, 25.0116666667),
("bonito", 4, 0, 1324800, 28.485),
("bonito", 4, 0, 1516800, 31.6866666667),
("bonito", 4, 0, 1708800, 35.79),
("bonito", 5, 0, 300000, 15.2466666667),
("bonito", 5, 0, 576000, 18.2166666667),
("bonito", 5, 0, 748800, 20.1866666667),
("bonito", 5, 0, 998400, 23.29),
("bonito", 5, 0, 1209600, 25.0116666667),
("bonito", 5, 0, 1324800, 28.485),
("bonito", 5, 0, 1516800, 31.6866666667),
("bonito", 5, 0, 1708800, 35.79),
("bonito", 6, 1, 300000, 24.06),
("bonito", 6, 1, 652800, 27.56),
("bonito", 6, 1, 825600, 29.0),
("bonito", 6, 1, 979200, 31.675),
("bonito", 6, 1, 1132800, 34.53),
("bonito", 6, 1, 1363200, 38.885),
("bonito", 6, 1, 1536000, 43.075),
("bonito", 6, 1, 1747200, 48.705),
("bonito", 6, 1, 1843200, 64.57),
("bonito", 6, 1, 1996800, 69.805),
("bonito", 6, 1, 2016000, 76.545),
("bonito", 7, 1, 300000, 24.06),
("bonito", 7, 1, 652800, 27.56),
("bonito", 7, 1, 825600, 29.0),
("bonito", 7, 1, 979200, 31.675),
("bonito", 7, 1, 1132800, 34.53),
("bonito", 7, 1, 1363200, 38.885),
("bonito", 7, 1, 1536000, 43.075),
("bonito", 7, 1, 1747200, 48.705),
("bonito", 7, 1, 1843200, 64.57),
("bonito", 7, 1, 1996800, 69.805),
("bonito", 7, 1, 2016000, 76.545),
("sargo", 0, 0, 300000, 15.2466666667),
("sargo", 0, 0, 576000, 18.2166666667),
("sargo", 0, 0, 748800, 20.1866666667),
("sargo", 0, 0, 998400, 23.29),
("sargo", 0, 0, 1209600, 25.0116666667),
("sargo", 0, 0, 1324800, 28.485),
("sargo", 0, 0, 1516800, 31.6866666667),
("sargo", 0, 0, 1708800, 35.79),
("sargo", 1, 0, 300000, 15.2466666667),
("sargo", 1, 0, 576000, 18.2166666667),
("sargo", 1, 0, 748800, 20.1866666667),
("sargo", 1, 0, 998400, 23.29),
("sargo", 1, 0, 1209600, 25.0116666667),
("sargo", 1, 0, 1324800, 28.485),
("sargo", 1, 0, 1516800, 31.6866666667),
("sargo", 1, 0, 1708800, 35.79),
("sargo", 2, 0, 300000, 15.2466666667),
("sargo", 2, 0, 576000, 18.2166666667),
("sargo", 2, 0, 748800, 20.1866666667),
("sargo", 2, 0, 998400, 23.29),
("sargo", 2, 0, 1209600, 25.0116666667),
("sargo", 2, 0, 1324800, 28.485),
("sargo", 2, 0, 1516800, 31.6866666667),
("sargo", 2, 0, 1708800, 35.79),
("sargo", 3, 0, 300000, 15.2466666667),
("sargo", 3, 0, 576000, 18.2166666667),
("sargo", 3, 0, 748800, 20.1866666667),
("sargo", 3, 0, 998400, 23.29),
("sargo", 3, 0, 1209600, 25.0116666667),
("sargo", 3, 0, 1324800, 28.485),
("sargo", 3, 0, 1516800, 31.6866666667),
("sargo", 3, 0, 1708800, 35.79),
("sargo", 4, 0, 300000, 15.2466666667),
("sargo", 4, 0, 576000, 18.2166666667),
("sargo", 4, 0, 748800, 20.1866666667),
("sargo", 4, 0, 998400, 23.29),
("sargo", 4, 0, 1209600, 25.0116666667),
("sargo", 4, 0, 1324800, 28.485),
("sargo", 4, 0, 1516800, 31.6866666667),
("sargo", 4, 0, 1708800, 35.79),
("sargo", 5, 0, 300000, 15.2466666667),
("sargo", 5, 0, 576000, 18.2166666667),
("sargo", 5, 0, 748800, 20.1866666667),
("sargo", 5, 0, 998400, 23.29),
("sargo", 5, 0, 1209600, 25.0116666667),
("sargo", 5, 0, 1324800, 28.485),
("sargo", 5, 0, 1516800, 31.6866666667),
("sargo", 5, 0, 1708800, 35.79),
("sargo", 6, 1, 300000, 24.06),
("sargo", 6, 1, 652800, 27.56),
("sargo", 6, 1, 825600, 29.0),
("sargo", 6, 1, 979200, 31.675),
("sargo", 6, 1, 1132800, 34.53),
("sargo", 6, 1, 1363200, 38.885),
("sargo", 6, 1, 1536000, 43.075),
("sargo", 6, 1, 1747200, 48.705),
("sargo", 6, 1, 1843200, 64.57),
("sargo", 6, 1, 1996800, 69.805),
("sargo", 6, 1, 2016000, 76.545),
("sargo", 7, 1, 300000, 24.06),
("sargo", 7, 1, 652800, 27.56),
("sargo", 7, 1, 825600, 29.0),
("sargo", 7, 1, 979200, 31.675),
("sargo", 7, 1, 1132800, 34.53),
("sargo", 7, 1, 1363200, 38.885),
("sargo", 7, 1, 1536000, 43.075),
("sargo", 7, 1, 1747200, 48.705),
("sargo", 7, 1, 1843200, 64.57),
("sargo", 7, 1, 1996800, 69.805),
("sargo", 7, 1, 2016000, 76.545),
("coral", 0, 0, 300000, 9.86),
("coral", 0, 0, 403200, 10.335),
("coral", 0, 0, 499200, 10.8925),
("coral", 0, 0, 576000, 11.37),
("coral", 0, 0, 672000, 11.8),
("coral", 0, 0, 768000, 12.41),
("coral", 0, 0, 844800, 12.97),
("coral", 0, 0, 940800, 13.335),
("coral", 0, 0, 1036800, 14.1725),
("coral", 0, 0, 1113600, 14.695),
("coral", 0, 0, 1209600, 15.3525),
("coral", 0, 0, 1305600, 16.2775),
("coral", 0, 0, 1382400, 16.8725),
("coral", 0, 0, 1478400, 17.6525),
("coral", 0, 0, 1555200, 18.0975),
("coral", 0, 0, 1632000, 18.8575),
("coral", 0, 0, 1708800, 20.0525),
("coral", 0, 0, 1785600, 21.2625),
("coral", 1, 0, 300000, 9.86),
("coral", 1, 0, 403200, 10.335),
("coral", 1, 0, 499200, 10.8925),
("coral", 1, 0, 576000, 11.37),
("coral", 1, 0, 672000, 11.8),
("coral", 1, 0, 768000, 12.41),
("coral", 1, 0, 844800, 12.97),
("coral", 1, 0, 940800, 13.335),
("coral", 1, 0, 1036800, 14.1725),
("coral", 1, 0, 1113600, 14.695),
("coral", 1, 0, 1209600, 15.3525),
("coral", 1, 0, 1305600, 16.2775),
("coral", 1, 0, 1382400, 16.8725),
("coral", 1, 0, 1478400, 17.6525),
("coral", 1, 0, 1555200, 18.0975),
("coral", 1, 0, 1632000, 18.8575),
("coral", 1, 0, 1708800, 20.0525),
("coral", 1, 0, 1785600, 21.2625),
("coral", 2, 0, 300000, 9.86),
("coral", 2, 0, 403200, 10.335),
("coral", 2, 0, 499200, 10.8925),
("coral", 2, 0, 576000, 11.37),
("coral", 2, 0, 672000, 11.8),
("coral", 2, 0, 768000, 12.41),
("coral", 2, 0, 844800, 12.97),
("coral", 2, 0, 940800, 13.335),
("coral", 2, 0, 1036800, 14.1725),
("coral", 2, 0, 1113600, 14.695),
("coral", 2, 0, 1209600, 15.3525),
("coral", 2, 0, 1305600, 16.2775),
("coral", 2, 0, 1382400, 16.8725),
("coral", 2, 0, 1478400, 17.6525),
("coral", 2, 0, 1555200, 18.0975),
("coral", 2, 0, 1632000, 18.8575),
("coral", 2, 0, 1708800, 20.0525),
("coral", 2, 0, 1785600, 21.2625),
("coral", 3, 0, 300000, 9.86),
("coral", 3, 0, 403200, 10.335),
("coral", 3, 0, 499200, 10.8925),
("coral", 3, 0, 576000, 11.37),
("coral", 3, 0, 672000, 11.8),
("coral", 3, 0, 768000, 12.41),
("coral", 3, 0, 844800, 12.97),
("coral", 3, 0, 940800, 13.335),
("coral", 3, 0, 1036800, 14.1725),
("coral", 3, 0, 1113600, 14.695),
("coral", 3, 0, 1209600, 15.3525),
("coral", 3, 0, 1305600, 16.2775),
("coral", 3, 0, 1382400, 16.8725),
("coral", 3, 0, 1478400, 17.6525),
("coral", 3, 0, 1555200, 18.0975),
("coral", 3, 0, 1632000, 18.8575),
("coral", 3, 0, 1708800, 20.0525),
("coral", 3, 0, 1785600, 21.2625),
("coral", 4, 1, 710400, 16.7833333333),
("coral", 4, 1, 825600, 18.3733333333),
("coral", 4, 1, 940800, 20.4833333333),
("coral", 4, 1, 1056000, 23.3066666667),
("coral", 4, 1, 1171200, 25.8266666667),
("coral", 4, 1, 1286400, 28.45),
("coral", 4, 1, 1401600, 31.7233333333),
("coral", 4, 1, 1497600, 34.42),
("coral", 4, 1, 1612800, 39.3966666667),
("coral", 4, 1, 1708800, 44.24),
("coral", 4, 1, 1804800, 47.9433333333),
("coral", 4, 1, 1920000, 51.97),
("coral", 4, 1, 2016000, 63.3866666667),
("coral", 4, 1, 2131200, 71.0366666667),
("coral", 4, 1, 2227200, 79.32),
("coral", 4, 1, 2323200, 88.99),
("coral", 4, 1, 2419200, 100.68),
("coral", 5, 1, 710400, 16.7833333333),
("coral", 5, 1, 825600, 18.3733333333),
("coral", 5, 1, 940800, 20.4833333333),
("coral", 5, 1, 1056000, 23.3066666667),
("coral", 5, 1, 1171200, 25.8266666667),
("coral", 5, 1, 1286400, 28.45),
("coral", 5, 1, 1401600, 31.7233333333),
("coral", 5, 1, 1497600, 34.42),
("coral", 5, 1, 1612800, 39.3966666667),
("coral", 5, 1, 1708800, 44.24),
("coral", 5, 1, 1804800, 47.9433333333),
("coral", 5, 1, 1920000, 51.97),
("coral", 5, 1, 2016000, 63.3866666667),
("coral", 5, 1, 2131200, 71.0366666667),
("coral", 5, 1, 2227200, 79.32),
("coral", 5, 1, 2323200, 88.99),
("coral", 5, 1, 2419200, 100.68),
("coral", 6, 1, 710400, 16.7833333333),
("coral", 6, 1, 825600, 18.3733333333),
("coral", 6, 1, 940800, 20.4833333333),
("coral", 6, 1, 1056000, 23.3066666667),
("coral", 6, 1, 1171200, 25.8266666667),
("coral", 6, 1, 1286400, 28.45),
("coral", 6, 1, 1401600, 31.7233333333),
("coral", 6, 1, 1497600, 34.42),
("coral", 6, 1, 1612800, 39.3966666667),
("coral", 6, 1, 1708800, 44.24),
("coral", 6, 1, 1804800, 47.9433333333),
("coral", 6, 1, 1920000, 51.97),
("coral", 6, 1, 2016000, 63.3866666667),
("coral", 6, 1, 2131200, 71.0366666667),
("coral", 6, 1, 2227200, 79.32),
("coral", 6, 1, 2323200, 88.99),
("coral", 6, 1, 2419200, 100.68),
("coral", 7, 2, 825600, 52.7),
("coral", 7, 2, 940800, 55.9),
("coral", 7, 2, 1056000, 59.73),
("coral", 7, 2, 1171200, 63.66),
("coral", 7, 2, 1286400, 67.28),
("coral", 7, 2, 1401600, 71.66),
("coral", 7, 2, 1497600, 76.47),
("coral", 7, 2, 1612800, 80.92),
("coral", 7, 2, 1708800, 85.81),
("coral", 7, 2, 1804800, 93.19),
("coral", 7, 2, 1920000, 98.06),
("coral", 7, 2, 2016000, 119.08),
("coral", 7, 2, 2131200, 127.88),
("coral", 7, 2, 2227200, 129.85),
("coral", 7, 2, 2323200, 140.37),
("coral", 7, 2, 2419200, 151.22),
("coral", 7, 2, 2534400, 160.73),
("coral", 7, 2, 2649600, 175.5),
("coral", 7, 2, 2745600, 186.29),
("coral", 7, 2, 2841600, 223.89),
("flame", 0, 0, 300000, 9.86),
("flame", 0, 0, 403200, 10.335),
("flame", 0, 0, 499200, 10.8925),
("flame", 0, 0, 576000, 11.37),
("flame", 0, 0, 672000, 11.8),
("flame", 0, 0, 768000, 12.41),
("flame", 0, 0, 844800, 12.97),
("flame", 0, 0, 940800, 13.335),
("flame", 0, 0, 1036800, 14.1725),
("flame", 0, 0, 1113600, 14.695),
("flame", 0, 0, 1209600, 15.3525),
("flame", 0, 0, 1305600, 16.2775),
("flame", 0, 0, 1382400, 16.8725),
("flame", 0, 0, 1478400, 17.6525),
("flame", 0, 0, 1555200, 18.0975),
("flame", 0, 0, 1632000, 18.8575),
("flame", 0, 0, 1708800, 20.0525),
("flame", 0, 0, 1785600, 21.2625),
("flame", 1, 0, 300000, 9.86),
("flame", 1, 0, 403200, 10.335),
("flame", 1, 0, 499200, 10.8925),
("flame", 1, 0, 576000, 11.37),
("flame", 1, 0, 672000, 11.8),
("flame", 1, 0, 768000, 12.41),
("flame", 1, 0, 844800, 12.97),
("flame", 1, 0, 940800, 13.335),
("flame", 1, 0, 1036800, 14.1725),
("flame", 1, 0, 1113600, 14.695),
("flame", 1, 0, 1209600, 15.3525),
("flame", 1, 0, 1305600, 16.2775),
("flame", 1, 0, 1382400, 16.8725),
("flame", 1, 0, 1478400, 17.6525),
("flame", 1, 0, 1555200, 18.0975),
("flame", 1, 0, 1632000, 18.8575),
("flame", 1, 0, 1708800, 20.0525),
("flame", 1, 0, 1785600, 21.2625),
("flame", 2, 0, 300000, 9.86),
("flame", 2, 0, 403200, 10.335),
("flame", 2, 0, 499200, 10.8925),
("flame", 2, 0, 576000, 11.37),
("flame", 2, 0, 672000, 11.8),
("flame", 2, 0, 768000, 12.41),
("flame", 2, 0, 844800, 12.97),
("flame", 2, 0, 940800, 13.335),
("flame", 2, 0, 1036800, 14.1725),
("flame", 2, 0, 1113600, 14.695),
("flame", 2, 0, 1209600, 15.3525),
("flame", 2, 0, 1305600, 16.2775),
("flame", 2, 0, 1382400, 16.8725),
("flame", 2, 0, 1478400, 17.6525),
("flame", 2, 0, 1555200, 18.0975),
("flame", 2, 0, 1632000, 18.8575),
("flame", 2, 0, 1708800, 20.0525),
("flame", 2, 0, 1785600, 21.2625),
("flame", 3, 0, 300000, 9.86),
("flame", 3, 0, 403200, 10.335),
("flame", 3, 0, 499200, 10.8925),
("flame", 3, 0, 576000, 11.37),
("flame", 3, 0, 672000, 11.8),
("flame", 3, 0, 768000, 12.41),
("flame", 3, 0, 844800, 12.97),
("flame", 3, 0, 940800, 13.335),
("flame", 3, 0, 1036800, 14.1725),
("flame", 3, 0, 1113600, 14.695),
("flame", 3, 0, 1209600, 15.3525),
("flame", 3, 0, 1305600, 16.2775),
("flame", 3, 0, 1382400, 16.8725),
("flame", 3, 0, 1478400, 17.6525),
("flame", 3, 0, 1555200, 18.0975),
("flame", 3, 0, 1632000, 18.8575),
("flame", 3, 0, 1708800, 20.0525),
("flame", 3, 0, 1785600, 21.2625),
("flame", 4, 1, 710400, 16.7833333333),
("flame", 4, 1, 825600, 18.3733333333),
("flame", 4, 1, 940800, 20.4833333333),
("flame", 4, 1, 1056000, 23.3066666667),
("flame", 4, 1, 1171200, 25.8266666667),
("flame", 4, 1, 1286400, 28.45),
("flame", 4, 1, 1401600, 31.7233333333),
("flame", 4, 1, 1497600, 34.42),
("flame", 4, 1, 1612800, 39.3966666667),
("flame", 4, 1, 1708800, 44.24),
("flame", 4, 1, 1804800, 47.9433333333),
("flame", 4, 1, 1920000, 51.97),
("flame", 4, 1, 2016000, 63.3866666667),
("flame", 4, 1, 2131200, 71.0366666667),
("flame", 4, 1, 2227200, 79.32),
("flame", 4, 1, 2323200, 88.99),
("flame", 4, 1, 2419200, 100.68),
("flame", 5, 1, 710400, 16.7833333333),
("flame", 5, 1, 825600, 18.3733333333),
("flame", 5, 1, 940800, 20.4833333333),
("flame", 5, 1, 1056000, 23.3066666667),
("flame", 5, 1, 1171200, 25.8266666667),
("flame", 5, 1, 1286400, 28.45),
("flame", 5, 1, 1401600, 31.7233333333),
("flame", 5, 1, 1497600, 34.42),
("flame", 5, 1, 1612800, 39.3966666667),
("flame", 5, 1, 1708800, 44.24),
("flame", 5, 1, 1804800, 47.9433333333),
("flame", 5, 1, 1920000, 51.97),
("flame", 5, 1, 2016000, 63.3866666667),
("flame", 5, 1, 2131200, 71.0366666667),
("flame", 5, 1, 2227200, 79.32),
("flame", 5, 1, 2323200, 88.99),
("flame", 5, 1, 2419200, 100.68),
("flame", 6, 1, 710400, 16.7833333333),
("flame", 6, 1, 825600, 18.3733333333),
("flame", 6, 1, 940800, 20.4833333333),
("flame", 6, 1, 1056000, 23.3066666667),
("flame", 6, 1, 1171200, 25.8266666667),
("flame", 6, 1, 1286400, 28.45),
("flame", 6, 1, 1401600, 31.7233333333),
("flame", 6, 1, 1497600, 34.42),
("flame", 6, 1, 1612800, 39.3966666667),
("flame", 6, 1, 1708800, 44.24),
("flame", 6, 1, 1804800, 47.9433333333),
("flame", 6, 1, 1920000, 51.97),
("flame", 6, 1, 2016000, 63.3866666667),
("flame", 6, 1, 2131200, 71.0366666667),
("flame", 6, 1, 2227200, 79.32),
("flame", 6, 1, 2323200, 88.99),
("flame", 6, 1, 2419200, 100.68),
("flame", 7, 2, 825600, 52.7),
("flame", 7, 2, 940800, 55.9),
("flame", 7, 2, 1056000, 59.73),
("flame", 7, 2, 1171200, 63.66),
("flame", 7, 2, 1286400, 67.28),
("flame", 7, 2, 1401600, 71.66),
("flame", 7, 2, 1497600, 76.47),
("flame", 7, 2, 1612800, 80.92),
("flame", 7, 2, 1708800, 85.81),
("flame", 7, 2, 1804800, 93.19),
("flame", 7, 2, 1920000, 98.06),
("flame", 7, 2, 2016000, 119.08),
("flame", 7, 2, 2131200, 127.88),
("flame", 7, 2, 2227200, 129.85),
("flame", 7, 2, 2323200, 140.37),
("flame", 7, 2, 2419200, 151.22),
("flame", 7, 2, 2534400, 160.73),
("flame", 7, 2, 2649600, 175.5),
("flame", 7, 2, 2745600, 186.29),
("flame", 7, 2, 2841600, 223.89),
("sunfish", 0, 0, 300000, 5.75833333333),
("sunfish", 0, 0, 576000, 7.76166666667),
("sunfish", 0, 0, 768000, 9.14),
("sunfish", 0, 0, 1017600, 11.36),
("sunfish", 0, 0, 1248000, 13.45),
("sunfish", 0, 0, 1324800, 14.4333333333),
("sunfish", 0, 0, 1497600, 16.5216666667),
("sunfish", 0, 0, 1612800, 18.5083333333),
("sunfish", 0, 0, 1708800, 19.9316666667),
("sunfish", 0, 0, 1804800, 21.4083333333),
("sunfish", 1, 0, 300000, 5.75833333333),
("sunfish", 1, 0, 576000, 7.76166666667),
("sunfish", 1, 0, 768000, 9.14),
("sunfish", 1, 0, 1017600, 11.36),
("sunfish", 1, 0, 1248000, 13.45),
("sunfish", 1, 0, 1324800, 14.4333333333),
("sunfish", 1, 0, 1497600, 16.5216666667),
("sunfish", 1, 0, 1612800, 18.5083333333),
("sunfish", 1, 0, 1708800, 19.9316666667),
("sunfish", 1, 0, 1804800, 21.4083333333),
("sunfish", 2, 0, 300000, 5.75833333333),
("sunfish", 2, 0, 576000, 7.76166666667),
("sunfish", 2, 0, 768000, 9.14),
("sunfish", 2, 0, 1017600, 11.36),
("sunfish", 2, 0, 1248000, 13.45),
("sunfish", 2, 0, 1324800, 14.4333333333),
("sunfish", 2, 0, 1497600, 16.5216666667),
("sunfish", 2, 0, 1612800, 18.5083333333),
("sunfish", 2, 0, 1708800, 19.9316666667),
("sunfish", 2, 0, 1804800, 21.4083333333),
("sunfish", 3, 0, 300000, 5.75833333333),
("sunfish", 3, 0, 576000, 7.76166666667),
("sunfish", 3, 0, 768000, 9.14),
("sunfish", 3, 0, 1017600, 11.36),
("sunfish", 3, 0, 1248000, 13.45),
("sunfish", 3, 0, 1324800, 14.4333333333),
("sunfish", 3, 0, 1497600, 16.5216666667),
("sunfish", 3, 0, 1612800, 18.5083333333),
("sunfish", 3, 0, 1708800, 19.9316666667),
("sunfish", 3, 0, 1804800, 21.4083333333),
("sunfish", 4, 0, 300000, 5.75833333333),
("sunfish", 4, 0, 576000, 7.76166666667),
("sunfish", 4, 0, 768000, 9.14),
("sunfish", 4, 0, 1017600, 11.36),
("sunfish", 4, 0, 1248000, 13.45),
("sunfish", 4, 0, 1324800, 14.4333333333),
("sunfish", 4, 0, 1497600, 16.5216666667),
("sunfish", 4, 0, 1612800, 18.5083333333),
("sunfish", 4, 0, 1708800, 19.9316666667),
("sunfish", 4, 0, 1804800, 21.4083333333),
("sunfish", 5, 0, 300000, 5.75833333333),
("sunfish", 5, 0, 576000, 7.76166666667),
("sunfish", 5, 0, 768000, 9.14),
("sunfish", 5, 0, 1017600, 11.36),
("sunfish", 5, 0, 1248000, 13.45),
("sunfish", 5, 0, 1324800, 14.4333333333),
("sunfish", 5, 0, 1497600, 16.5216666667),
("sunfish", 5, 0, 1612800, 18.5083333333),
("sunfish", 5, 0, 1708800, 19.9316666667),
("sunfish", 5, 0, 1804800, 21.4083333333),
("sunfish", 6, 1, 300000, 21.115),
("sunfish", 6, 1, 652800, 28.46),
("sunfish", 6, 1, 806400, 31.705),
("sunfish", 6, 1, 979200, 36.515),
("sunfish", 6, 1, 1094400, 40.19),
("sunfish", 6, 1, 1209600, 43.585),
("sunfish", 6, 1, 1324800, 48.275),
("sunfish", 6, 1, 1555200, 62.805),
("sunfish", 6, 1, 1708800, 72.755),
("sunfish", 6, 1, 1843200, 91.47),
("sunfish", 6, 1, 1939200, 99.46),
("sunfish", 6, 1, 2169600, 119.27),
("sunfish", 6, 1, 2208000, 133.105),
("sunfish", 7, 1, 300000, 21.115),
("sunfish", 7, 1, 652800, 28.46),
("sunfish", 7, 1, 806400, 31.705),
("sunfish", 7, 1, 979200, 36.515),
("sunfish", 7, 1, 1094400, 40.19),
("sunfish", 7, 1, 1209600, 43.585),
("sunfish", 7, 1, 1324800, 48.275),
("sunfish", 7, 1, 1555200, 62.805),
("sunfish", 7, 1, 1708800, 72.755),
("sunfish", 7, 1, 1843200, 91.47),
("sunfish", 7, 1, 1939200, 99.46),
("sunfish", 7, 1, 2169600, 119.27),
("sunfish", 7, 1, 2208000, 133.105),
("redfin", 0, 0, 300000, 6.98666666667),
("redfin", 0, 0, 576000, 9.93166666667),
("redfin", 0, 0, 614400, 10.3216666667),
("redfin", 0, 0, 864000, 13.31),
("redfin", 0, 0, 1075200, 15.9866666667),
("redfin", 0, 0, 1363200, 20.3283333333),
("redfin", 0, 0, 1516800, 23.4533333333),
("redfin", 0, 0, 1651200, 26.53),
("redfin", 0, 0, 1804800, 29.365),
("redfin", 1, 0, 300000, 6.98666666667),
("redfin", 1, 0, 576000, 9.93166666667),
("redfin", 1, 0, 614400, 10.3216666667),
("redfin", 1, 0, 864000, 13.31),
("redfin", 1, 0, 1075200, 15.9866666667),
("redfin", 1, 0, 1363200, 20.3283333333),
("redfin", 1, 0, 1516800, 23.4533333333),
("redfin", 1, 0, 1651200, 26.53),
("redfin", 1, 0, 1804800, 29.365),
("redfin", 2, 0, 300000, 6.98666666667),
("redfin", 2, 0, 576000, 9.93166666667),
("redfin", 2, 0, 614400, 10.3216666667),
("redfin", 2, 0, 864000, 13.31),
("redfin", 2, 0, 1075200, 15.9866666667),
("redfin", 2, 0, 1363200, 20.3283333333),
("redfin", 2, 0, 1516800, 23.4533333333),
("redfin", 2, 0, 1651200, 26.53),
("redfin", 2, 0, 1804800, 29.365),
("redfin", 3, 0, 300000, 6.98666666667),
("redfin", 3, 0, 576000, 9.93166666667),
("redfin", 3, 0, 614400, 10.3216666667),
("redfin", 3, 0, 864000, 13.31),
("redfin", 3, 0, 1075200, 15.9866666667),
("redfin", 3, 0, 1363200, 20.3283333333),
("redfin", 3, 0, 1516800, 23.4533333333),
("redfin", 3, 0, 1651200, 26.53),
("redfin", 3, 0, 1804800, 29.365),
("redfin", 4, 0, 300000, 6.98666666667),
("redfin", 4, 0, 576000, 9.93166666667),
("redfin", 4, 0, 614400, 10.3216666667),
("redfin", 4, 0, 864000, 13.31),
("redfin", 4, 0, 1075200, 15.9866666667),
("redfin", 4, 0, 1363200, 20.3283333333),
("redfin", 4, 0, 1516800, 23.4533333333),
("redfin", 4, 0, 1651200, 26.53),
("redfin", 4, 0, 1804800, 29.365),
("redfin", 5, 0, 300000, 6.98666666667),
("redfin", 5, 0, 576000, 9.93166666667),
("redfin", 5, 0, 614400, 10.3216666667),
("redfin", 5, 0, 864000, 13.31),
("redfin", 5, 0, 1075200, 15.9866666667),
("redfin", 5, 0, 1363200, 20.3283333333),
("redfin", 5, 0, 1516800, 23.4533333333),
("redfin", 5, 0, 1651200, 26.53),
("redfin", 5, 0, 1804800, 29.365),
("redfin", 6, 1, 652800, 32.13),
("redfin", 6, 1, 940800, 35.98),
("redfin", 6, 1, 1152000, 40.03),
("redfin", 6, 1, 1478400, 51.02),
("redfin", 6, 1, 1728000, 77.06),
("redfin", 6, 1, 1900800, 86.25),
("redfin", 6, 1, 2092800, 97.3),
("redfin", 6, 1, 2208000, 101.61),
("redfin", 7, 2, 806400, 56.44),
("redfin", 7, 2, 1094400, 65.72),
("redfin", 7, 2, 1401600, 77.01),
("redfin", 7, 2, 1766400, 104.91),
("redfin", 7, 2, 1996800, 112.35),
("redfin", 7, 2, 2188800, 118.53),
("redfin", 7, 2, 2304000, 122.34),
("redfin", 7, 2, 2400000, 135.0),
("bramble", 0, 0, 300000, 6.98666666667),
("bramble", 0, 0, 576000, 9.93166666667),
("bramble", 0, 0, 614400, 10.3216666667),
("bramble", 0, 0, 864000, 13.31),
("bramble", 0, 0, 1075200, 15.9866666667),
("bramble", 0, 0, 1363200, 20.3283333333),
("bramble", 0, 0, 1516800, 23.4533333333),
("bramble", 0, 0, 1651200, 26.53),
("bramble", 0, 0, 1804800, 29.365),
("bramble", 1, 0, 300000, 6.98666666667),
("bramble", 1, 0, 576000, 9.93166666667),
("bramble", 1, 0, 614400, 10.3216666667),
("bramble", 1, 0, 864000, 13.31),
("bramble", 1, 0, 1075200, 15.9866666667),
("bramble", 1, 0, 1363200, 20.3283333333),
("bramble", 1, 0, 1516800, 23.4533333333),
("bramble", 1, 0, 1651200, 26.53),
("bramble", 1, 0, 1804800, 29.365),
("bramble", 2, 0, 300000, 6.98666666667),
("bramble", 2, 0, 576000, 9.93166666667),
("bramble", 2, 0, 614400, 10.3216666667),
("bramble", 2, 0, 864000, 13.31),
("bramble", 2, 0, 1075200, 15.9866666667),
("bramble", 2, 0, 1363200, 20.3283333333),
("bramble", 2, 0, 1516800, 23.4533333333),
("bramble", 2, 0, 1651200, 26.53),
("bramble", 2, 0, 1804800, 29.365),
("bramble", 3, 0, 300000, 6.98666666667),
("bramble", 3, 0, 576000, 9.93166666667),
("bramble", 3, 0, 614400, 10.3216666667),
("bramble", 3, 0, 864000, 13.31),
("bramble", 3, 0, 1075200, 15.9866666667),
("bramble", 3, 0, 1363200, 20.3283333333),
("bramble", 3, 0, 1516800, 23.4533333333),
("bramble", 3, 0, 1651200, 26.53),
("bramble", 3, 0, 1804800, 29.365),
("bramble", 4, 0, 300000, 6.98666666667),
("bramble", 4, 0, 576000, 9.93166666667),
("bramble", 4, 0, 614400, 10.3216666667),
("bramble", 4, 0, 864000, 13.31),
("bramble", 4, 0, 1075200, 15.9866666667),
("bramble", 4, 0, 1363200, 20.3283333333),
("bramble", 4, 0, 1516800, 23.4533333333),
("bramble", 4, 0, 1651200, 26.53),
("bramble", 4, 0, 1804800, 29.365),
("bramble", 5, 0, 300000, 6.98666666667),
("bramble", 5, 0, 576000, 9.93166666667),
("bramble", 5, 0, 614400, 10.3216666667),
("bramble", 5, 0, 864000, 13.31),
("bramble", 5, 0, 1075200, 15.9866666667),
("bramble", 5, 0, 1363200, 20.3283333333),
("bramble", 5, 0, 1516800, 23.4533333333),
("bramble", 5, 0, 1651200, 26.53),
("bramble", 5, 0, 1804800, 29.365),
("bramble", 6, 1, 652800, 32.13),
("bramble", 6, 1, 940800, 35.98),
("bramble", 6, 1, 1152000, 40.03),
("bramble", 6, 1, 1478400, 51.02),
("bramble", 6, 1, 1728000, 77.06),
("bramble", 6, 1, 1900800, 86.25),
("bramble", 6, 1, 2092800, 97.3),
("bramble", 6, 1, 2208000, 101.61),
("bramble", 7, 2, 806400, 56.44),
("bramble", 7, 2, 1094400, 65.72),
("bramble", 7, 2, 1401600, 77.01),
("bramble", 7, 2, 1766400, 104.91),
("bramble", 7, 2, 1996800, 112.35),
("bramble", 7, 2, 2188800, 118.53),
("bramble", 7, 2, 2304000, 122.34),
("bramble", 7, 2, 2400000, 135.0); | the_stack |
CREATE SCHEMA [Integration]
GO
/****** Object: Schema [sysdiag] Script Date: 4/9/2020 9:00:54 AM ******/
CREATE SCHEMA [sysdiag]
GO
/****** Object: Table [Integration].[City_Staging] Script Date: 5/12/2020 3:25:15 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [Integration].[City_Staging]
(
[City Staging Key] [int] IDENTITY(1,1) NOT NULL,
[WWI City ID] [int] NOT NULL,
[City] [nvarchar](50) NOT NULL,
[State Province] [nvarchar](50) NOT NULL,
[Country] [nvarchar](60) NOT NULL,
[Continent] [nvarchar](30) NOT NULL,
[Sales Territory] [nvarchar](50) NOT NULL,
[Region] [nvarchar](30) NOT NULL,
[Subregion] [nvarchar](30) NOT NULL,
[Latest Recorded Population] [bigint] NOT NULL,
[Valid From] [datetime2](7) NOT NULL,
[Valid To] [datetime2](7) NOT NULL
)
WITH
(
DISTRIBUTION = ROUND_ROBIN,
HEAP
)
GO
/****** Object: Table [Integration].[Customer_Staging] Script Date: 5/12/2020 3:25:15 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [Integration].[Customer_Staging]
(
[Customer Staging Key] [int] IDENTITY(1,1) NOT NULL,
[WWI Customer ID] [int] NOT NULL,
[Customer] [nvarchar](100) NOT NULL,
[Bill To Customer] [nvarchar](100) NOT NULL,
[Category] [nvarchar](50) NOT NULL,
[Buying Group] [nvarchar](50) NOT NULL,
[Primary Contact] [nvarchar](50) NOT NULL,
[Postal Code] [nvarchar](10) NOT NULL,
[Valid From] [datetime2](7) NOT NULL,
[Valid To] [datetime2](7) NOT NULL
)
WITH
(
DISTRIBUTION = ROUND_ROBIN,
HEAP
)
GO
/****** Object: Table [Integration].[Employee_Staging] Script Date: 5/12/2020 3:25:15 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [Integration].[Employee_Staging]
(
[Employee Staging Key] [int] IDENTITY(1,1) NOT NULL,
[WWI Employee ID] [int] NOT NULL,
[Employee] [nvarchar](50) NOT NULL,
[Preferred Name] [nvarchar](50) NOT NULL,
[Is Salesperson] [bit] NOT NULL,
[Photo] [varbinary](8000) NULL,
[Valid From] [datetime2](7) NOT NULL,
[Valid To] [datetime2](7) NOT NULL
)
WITH
(
DISTRIBUTION = ROUND_ROBIN,
HEAP
)
GO
/****** Object: Table [Integration].[ETL Cutoff] Script Date: 4/9/2020 9:00:54 AM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [Integration].[ETL Cutoff]
(
[Table Name] [nvarchar](128) NOT NULL,
[Cutoff Time] [datetime2](7) NOT NULL
)
WITH
(
DISTRIBUTION = ROUND_ROBIN,
CLUSTERED COLUMNSTORE INDEX
)
GO
/****** Object: Table [Integration].[Lineage] Script Date: 4/9/2020 9:00:54 AM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [Integration].[Lineage]
(
[Lineage Key] [int] IDENTITY(1,1) NOT NULL,
[Data Load Started] [datetime2](7) NOT NULL,
[Table Name] [nvarchar](128) NOT NULL,
[Data Load Completed] [datetime2](7) NULL,
[Was Successful] [bit] NOT NULL,
[Source System Cutoff Time] [datetime2](7) NOT NULL
)
WITH
(
DISTRIBUTION = ROUND_ROBIN,
CLUSTERED COLUMNSTORE INDEX
)
GO
/****** Object: Table [Integration].[Load_Control] Script Date: 4/9/2020 9:00:54 AM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [Integration].[Load_Control]
(
[Load_Date] [datetime2](7) NOT NULL
)
WITH
(
DISTRIBUTION = ROUND_ROBIN,
CLUSTERED COLUMNSTORE INDEX
)
GO
/****** Object: Table [Integration].[Movement_Staging] Script Date: 5/12/2020 3:25:15 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [Integration].[Movement_Staging]
(
[Movement Staging Key] [bigint] IDENTITY(1,1) NOT NULL,
[Date Key] [date] NULL,
[Stock Item Key] [int] NULL,
[Customer Key] [int] NULL,
[Supplier Key] [int] NULL,
[Transaction Type Key] [int] NULL,
[WWI Stock Item Transaction ID] [int] NULL,
[WWI Invoice ID] [int] NULL,
[WWI Purchase Order ID] [int] NULL,
[Quantity] [int] NULL,
[WWI Stock Item ID] [int] NULL,
[WWI Customer ID] [int] NULL,
[WWI Supplier ID] [int] NULL,
[WWI Transaction Type ID] [int] NULL,
[Last Modifed When] [datetime2](7) NULL
)
WITH
(
DISTRIBUTION = ROUND_ROBIN,
HEAP
)
GO
/****** Object: Table [Integration].[Order_Staging] Script Date: 5/12/2020 3:25:15 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [Integration].[Order_Staging]
(
[Order Staging Key] [bigint] IDENTITY(1,1) NOT NULL,
[City Key] [int] NULL,
[Customer Key] [int] NULL,
[Stock Item Key] [int] NULL,
[Order Date Key] [date] NULL,
[Picked Date Key] [date] NULL,
[Salesperson Key] [int] NULL,
[Picker Key] [int] NULL,
[WWI Order ID] [int] NULL,
[WWI Backorder ID] [int] NULL,
[Description] [nvarchar](100) NULL,
[Package] [nvarchar](50) NULL,
[Quantity] [int] NULL,
[Unit Price] [decimal](18, 2) NULL,
[Tax Rate] [decimal](18, 3) NULL,
[Total Excluding Tax] [decimal](18, 2) NULL,
[Tax Amount] [decimal](18, 2) NULL,
[Total Including Tax] [decimal](18, 2) NULL,
[Lineage Key] [int] NULL,
[WWI City ID] [int] NULL,
[WWI Customer ID] [int] NULL,
[WWI Stock Item ID] [int] NULL,
[WWI Salesperson ID] [int] NULL,
[WWI Picker ID] [int] NULL,
[Last Modified When] [datetime2](7) NULL
)
WITH
(
DISTRIBUTION = ROUND_ROBIN,
HEAP
)
GO
/****** Object: Table [Integration].[PaymentMethod_Staging] Script Date: 5/12/2020 3:25:15 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [Integration].[PaymentMethod_Staging]
(
[Payment Method Staging Key] [int] IDENTITY(1,1) NOT NULL,
[WWI Payment Method ID] [int] NOT NULL,
[Payment Method] [nvarchar](50) NOT NULL,
[Valid From] [datetime2](7) NOT NULL,
[Valid To] [datetime2](7) NOT NULL
)
WITH
(
DISTRIBUTION = ROUND_ROBIN,
HEAP
)
GO
/****** Object: Table [Integration].[Purchase_Staging] Script Date: 5/12/2020 3:25:15 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [Integration].[Purchase_Staging]
(
[Purchase Staging Key] [bigint] IDENTITY(1,1) NOT NULL,
[Date Key] [date] NULL,
[Supplier Key] [int] NULL,
[Stock Item Key] [int] NULL,
[WWI Purchase Order ID] [int] NULL,
[Ordered Outers] [int] NULL,
[Ordered Quantity] [int] NULL,
[Received Outers] [int] NULL,
[Package] [nvarchar](50) NULL,
[Is Order Finalized] [bit] NULL,
[WWI Supplier ID] [int] NULL,
[WWI Stock Item ID] [int] NULL,
[Last Modified When] [datetime2](7) NULL
)
WITH
(
DISTRIBUTION = ROUND_ROBIN,
CLUSTERED COLUMNSTORE INDEX
)
GO
/****** Object: Table [Integration].[Sale_Staging] Script Date: 5/12/2020 3:25:15 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [Integration].[Sale_Staging]
(
[Sale Staging Key] [bigint] IDENTITY(1,1) NOT NULL,
[City Key] [int] NULL,
[Customer Key] [int] NULL,
[Bill To Customer Key] [int] NULL,
[Stock Item Key] [int] NULL,
[Invoice Date Key] [date] NULL,
[Delivery Date Key] [date] NULL,
[Salesperson Key] [int] NULL,
[WWI Invoice ID] [int] NULL,
[Description] [nvarchar](100) NULL,
[Package] [nvarchar](50) NULL,
[Quantity] [int] NULL,
[Unit Price] [decimal](18, 2) NULL,
[Tax Rate] [decimal](18, 3) NULL,
[Total Excluding Tax] [decimal](18, 2) NULL,
[Tax Amount] [decimal](18, 2) NULL,
[Profit] [decimal](18, 2) NULL,
[Total Including Tax] [decimal](18, 2) NULL,
[Total Dry Items] [int] NULL,
[Total Chiller Items] [int] NULL,
[WWI City ID] [int] NULL,
[WWI Customer ID] [int] NULL,
[WWI Bill To Customer ID] [int] NULL,
[WWI Stock Item ID] [int] NULL,
[WWI Salesperson ID] [int] NULL,
[Last Modified When] [datetime2](7) NULL
)
WITH
(
DISTRIBUTION = ROUND_ROBIN,
HEAP
)
GO
/****** Object: Table [Integration].[StockHolding_Staging] Script Date: 5/12/2020 3:25:15 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [Integration].[StockHolding_Staging]
(
[Stock Holding Staging Key] [bigint] IDENTITY(1,1) NOT NULL,
[Stock Item Key] [int] NULL,
[Quantity On Hand] [int] NULL,
[Bin Location] [nvarchar](20) NULL,
[Last Stocktake Quantity] [int] NULL,
[Last Cost Price] [decimal](18, 2) NULL,
[Reorder Level] [int] NULL,
[Target Stock Level] [int] NULL,
[WWI Stock Item ID] [int] NULL
)
WITH
(
DISTRIBUTION = ROUND_ROBIN,
HEAP
)
GO
/****** Object: Table [Integration].[StockItem_Staging] Script Date: 5/12/2020 3:25:15 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [Integration].[StockItem_Staging]
(
[Stock Item Staging Key] [int] IDENTITY(1,1) NOT NULL,
[WWI Stock Item ID] [int] NOT NULL,
[Stock Item] [nvarchar](100) NOT NULL,
[Color] [nvarchar](20) NOT NULL,
[Selling Package] [nvarchar](50) NOT NULL,
[Buying Package] [nvarchar](50) NOT NULL,
[Brand] [nvarchar](50) NOT NULL,
[Size] [nvarchar](20) NOT NULL,
[Lead Time Days] [int] NOT NULL,
[Quantity Per Outer] [int] NOT NULL,
[Is Chiller Stock] [bit] NOT NULL,
[Barcode] [nvarchar](50) NULL,
[Tax Rate] [decimal](18, 3) NOT NULL,
[Unit Price] [decimal](18, 2) NOT NULL,
[Recommended Retail Price] [decimal](18, 2) NULL,
[Typical Weight Per Unit] [decimal](18, 3) NOT NULL,
[Photo] [varbinary](8000) NULL,
[Valid From] [datetime2](7) NOT NULL,
[Valid To] [datetime2](7) NOT NULL
)
WITH
(
DISTRIBUTION = ROUND_ROBIN,
HEAP
)
GO
/****** Object: Table [Integration].[Supplier_Staging] Script Date: 5/12/2020 3:25:15 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [Integration].[Supplier_Staging]
(
[Supplier Staging Key] [int] IDENTITY(1,1) NOT NULL,
[WWI Supplier ID] [int] NOT NULL,
[Supplier] [nvarchar](100) NOT NULL,
[Category] [nvarchar](50) NOT NULL,
[Primary Contact] [nvarchar](50) NOT NULL,
[Supplier Reference] [nvarchar](20) NULL,
[Payment Days] [int] NOT NULL,
[Postal Code] [nvarchar](10) NOT NULL,
[Valid From] [datetime2](7) NOT NULL,
[Valid To] [datetime2](7) NOT NULL
)
WITH
(
DISTRIBUTION = ROUND_ROBIN,
HEAP
)
GO
/****** Object: Table [Integration].[Transaction_Staging] Script Date: 5/12/2020 3:25:15 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [Integration].[Transaction_Staging]
(
[Transaction Staging Key] [bigint] IDENTITY(1,1) NOT NULL,
[Date Key] [date] NULL,
[Customer Key] [int] NULL,
[Bill To Customer Key] [int] NULL,
[Supplier Key] [int] NULL,
[Transaction Type Key] [int] NULL,
[Payment Method Key] [int] NULL,
[WWI Customer Transaction ID] [int] NULL,
[WWI Supplier Transaction ID] [int] NULL,
[WWI Invoice ID] [int] NULL,
[WWI Purchase Order ID] [int] NULL,
[Supplier Invoice Number] [nvarchar](20) NULL,
[Total Excluding Tax] [decimal](18, 2) NULL,
[Tax Amount] [decimal](18, 2) NULL,
[Total Including Tax] [decimal](18, 2) NULL,
[Outstanding Balance] [decimal](18, 2) NULL,
[Is Finalized] [bit] NULL,
[WWI Customer ID] [int] NULL,
[WWI Bill To Customer ID] [int] NULL,
[WWI Supplier ID] [int] NULL,
[WWI Transaction Type ID] [int] NULL,
[WWI Payment Method ID] [int] NULL,
[Last Modified When] [datetime2](7) NULL
)
WITH
(
DISTRIBUTION = ROUND_ROBIN,
HEAP
)
GO
/****** Object: Table [Integration].[TransactionType_Staging] Script Date: 5/12/2020 3:25:15 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [Integration].[TransactionType_Staging]
(
[Transaction Type Staging Key] [int] IDENTITY(1,1) NOT NULL,
[WWI Transaction Type ID] [int] NOT NULL,
[Transaction Type] [nvarchar](50) NOT NULL,
[Valid From] [datetime2](7) NOT NULL,
[Valid To] [datetime2](7) NOT NULL
)
WITH
(
DISTRIBUTION = ROUND_ROBIN,
HEAP
)
GO
/****** Object: View [Integration].[v_City_Stage] Script Date: 4/9/2020 9:00:54 AM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [Integration].[v_City_Stage]
AS SELECT c.[WWI City ID], MIN(c.[Valid From]) AS [Valid From]
FROM Integration.City_Staging AS c
GROUP BY c.[WWI City ID];
GO
/****** Object: View [Integration].[v_Customer_Stage] Script Date: 4/9/2020 9:00:54 AM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [Integration].[v_Customer_Stage]
AS SELECT c.[WWI Customer ID], MIN(c.[Valid From]) AS [Valid From]
FROM Integration.Customer_Staging AS c
GROUP BY c.[WWI Customer ID];
GO
/****** Object: View [Integration].[v_Employee_Stage] Script Date: 4/9/2020 9:00:54 AM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [Integration].[v_Employee_Stage]
AS SELECT e.[WWI Employee ID], MIN(e.[Valid From]) AS [Valid From]
FROM Integration.Employee_Staging AS e
GROUP BY e.[WWI Employee ID];
GO
/****** Object: View [Integration].[v_PaymentMethod_Stage] Script Date: 4/9/2020 9:00:54 AM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [Integration].[v_PaymentMethod_Stage]
AS SELECT pm.[WWI Payment Method ID], MIN(pm.[Valid From]) AS [Valid From]
FROM Integration.PaymentMethod_Staging AS pm
GROUP BY pm.[WWI Payment Method ID];
GO
/****** Object: View [Integration].[v_StockItem_Stage] Script Date: 4/9/2020 9:00:54 AM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [Integration].[v_StockItem_Stage]
AS SELECT s.[WWI Stock Item ID], MIN(s.[Valid From]) AS [Valid From]
FROM Integration.StockItem_Staging AS s
GROUP BY s.[WWI Stock Item ID];
GO
/****** Object: View [Integration].[v_Supplier_Stage] Script Date: 4/9/2020 9:00:54 AM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [Integration].[v_Supplier_Stage]
AS SELECT s.[WWI Supplier ID], MIN(s.[Valid From]) AS [Valid From]
FROM Integration.Supplier_Staging AS s
GROUP BY s.[WWI Supplier ID];
GO
/****** Object: View [Integration].[v_TransactionType_Stage] Script Date: 4/9/2020 9:00:54 AM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [Integration].[v_TransactionType_Stage]
AS SELECT pm.[WWI Transaction Type ID], MIN(pm.[Valid From]) AS [Valid From]
FROM Integration.TransactionType_Staging AS pm
GROUP BY pm.[WWI Transaction Type ID];
GO
/****** Object: Table [Integration].[Load_Control] Script Date: 4/8/2020 7:12:55 PM ******/
DROP TABLE [Integration].[Load_Control]
GO
/****** Object: Table [Integration].[Load_Control] Script Date: 4/8/2020 7:12:55 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [Integration].[Load_Control](
[Load_Date] [datetime2](7) NOT NULL
)
GO
INSERT INTO [Integration].[Load_Control]
([Load_Date])
VALUES
('2020-01-01 01:00:00.0000000')
GO | the_stack |
CREATE OR REPLACE PACKAGE json_printer
AS
/*
Copyright (c) 2010 Jonas Krogsboell
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
indent_string VARCHAR2 (10 CHAR) := ' '; --chr(9); for tab
newline_char VARCHAR2 (2 CHAR) := CHR (13) || CHR (10); -- Windows style
--newline_char varchar2(2) := chr(10); -- Mac style
--newline_char varchar2(2) := chr(13); -- Linux style
ascii_output BOOLEAN NOT NULL := TRUE;
escape_solidus BOOLEAN NOT NULL := FALSE;
FUNCTION pretty_print (obj json,
spaces BOOLEAN DEFAULT TRUE,
line_length NUMBER DEFAULT 0)
RETURN VARCHAR2;
FUNCTION pretty_print_list (obj json_list,
spaces BOOLEAN DEFAULT TRUE,
line_length NUMBER DEFAULT 0)
RETURN VARCHAR2;
FUNCTION pretty_print_any (json_part json_value,
spaces BOOLEAN DEFAULT TRUE,
line_length NUMBER DEFAULT 0)
RETURN VARCHAR2;
PROCEDURE pretty_print (obj json,
spaces BOOLEAN DEFAULT TRUE,
buf IN OUT NOCOPY CLOB,
line_length NUMBER DEFAULT 0,
erase_clob BOOLEAN DEFAULT TRUE);
PROCEDURE pretty_print_list (
obj json_list,
spaces BOOLEAN DEFAULT TRUE,
buf IN OUT NOCOPY CLOB,
line_length NUMBER DEFAULT 0,
erase_clob BOOLEAN DEFAULT TRUE);
PROCEDURE pretty_print_any (
json_part json_value,
spaces BOOLEAN DEFAULT TRUE,
buf IN OUT NOCOPY CLOB,
line_length NUMBER DEFAULT 0,
erase_clob BOOLEAN DEFAULT TRUE);
PROCEDURE dbms_output_clob (my_clob CLOB,
delim VARCHAR2,
jsonp VARCHAR2 DEFAULT NULL);
PROCEDURE htp_output_clob (my_clob CLOB, jsonp VARCHAR2 DEFAULT NULL);
END json_printer;
/
CREATE OR REPLACE PACKAGE BODY json_printer
AS
/*
Copyright (c) 2010 Jonas Krogsboell
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
max_line_len NUMBER := 0;
cur_line_len NUMBER := 0;
FUNCTION llcheck (str IN VARCHAR2)
RETURN VARCHAR2
AS
BEGIN
--dbms_output.put_line(cur_line_len || ' : '|| str);
IF (max_line_len > 0 AND LENGTH (str) + cur_line_len > max_line_len) THEN
cur_line_len := LENGTH (str);
RETURN newline_char || str;
ELSE
cur_line_len := cur_line_len + LENGTH (str);
RETURN str;
END IF;
END llcheck;
FUNCTION escapestring (str VARCHAR2)
RETURN VARCHAR2
AS
sb VARCHAR2 (32767) := '';
buf VARCHAR2 (40);
num NUMBER;
BEGIN
IF (str IS NULL) THEN
RETURN '';
END IF;
FOR i IN 1 .. LENGTH (str)
LOOP
buf := SUBSTR (str, i, 1);
--backspace b = U+0008
--formfeed f = U+000C
--newline n = U+000A
--carret r = U+000D
--tabulator t = U+0009
CASE buf
WHEN CHR (8) THEN
buf := '\b';
WHEN CHR (9) THEN
buf := '\t';
WHEN CHR (10) THEN
buf := '\n';
WHEN CHR (13) THEN
buf := '\f';
WHEN CHR (14) THEN
buf := '\r';
WHEN CHR (34) THEN
buf := '\"';
WHEN CHR (47) THEN
IF (escape_solidus) THEN
buf := '\/';
END IF;
WHEN CHR (92) THEN
buf := '\\';
ELSE
IF (ASCII (buf) < 32) THEN
buf :=
'\u'
|| REPLACE (
SUBSTR (TO_CHAR (ASCII (buf), 'XXXX'), 2, 4),
' ',
'0');
ELSIF (ascii_output) THEN
buf := REPLACE (ASCIISTR (buf), '\', '\u');
END IF;
END CASE;
sb := sb || buf;
END LOOP;
RETURN sb;
END escapestring;
FUNCTION newline (spaces BOOLEAN)
RETURN VARCHAR2
AS
BEGIN
cur_line_len := 0;
IF (spaces) THEN
RETURN newline_char;
ELSE
RETURN '';
END IF;
END;
/* function get_schema return varchar2 as
begin
return sys_context('userenv', 'current_schema');
end;
*/
FUNCTION tab (indent NUMBER, spaces BOOLEAN)
RETURN VARCHAR2
AS
i VARCHAR (200) := '';
BEGIN
IF (NOT spaces) THEN
RETURN '';
END IF;
FOR x IN 1 .. indent
LOOP
i := i || indent_string;
END LOOP;
RETURN i;
END;
FUNCTION getcommasep (spaces BOOLEAN)
RETURN VARCHAR2
AS
BEGIN
IF (spaces) THEN
RETURN ', ';
ELSE
RETURN ',';
END IF;
END;
FUNCTION getmemname (mem json_value, spaces BOOLEAN)
RETURN VARCHAR2
AS
BEGIN
IF (spaces) THEN
RETURN llcheck ('"' || escapestring (mem.mapname) || '"')
|| llcheck (' : ');
ELSE
RETURN llcheck ('"' || escapestring (mem.mapname) || '"')
|| llcheck (':');
END IF;
END;
/* Clob method start here */
PROCEDURE add_to_clob (buf_lob IN OUT NOCOPY CLOB,
buf_str IN OUT NOCOPY VARCHAR2,
str VARCHAR2)
AS
BEGIN
IF (LENGTHB (str) > 32767 - LENGTHB (buf_str)) THEN
-- dbms_lob.append(buf_lob, buf_str);
DBMS_LOB.writeappend (buf_lob, LENGTH (buf_str), buf_str);
buf_str := str;
ELSE
buf_str := buf_str || str;
END IF;
END add_to_clob;
PROCEDURE flush_clob (buf_lob IN OUT NOCOPY CLOB,
buf_str IN OUT NOCOPY VARCHAR2)
AS
BEGIN
-- dbms_lob.append(buf_lob, buf_str);
DBMS_LOB.writeappend (buf_lob, LENGTH (buf_str), buf_str);
END flush_clob;
PROCEDURE ppobj (obj json,
indent NUMBER,
buf IN OUT NOCOPY CLOB,
spaces BOOLEAN,
buf_str IN OUT NOCOPY VARCHAR2);
PROCEDURE ppea (input json_list,
indent NUMBER,
buf IN OUT NOCOPY CLOB,
spaces BOOLEAN,
buf_str IN OUT NOCOPY VARCHAR2)
AS
elem json_value;
arr json_value_array := input.list_data;
numbuf VARCHAR2 (4000);
BEGIN
FOR y IN 1 .. arr.COUNT
LOOP
elem := arr (y);
IF (elem IS NOT NULL) THEN
CASE elem.get_type
WHEN 'number' THEN
numbuf := '';
IF (elem.get_number < 1 AND elem.get_number > 0) THEN
numbuf := '0';
END IF;
IF (elem.get_number < 0 AND elem.get_number > -1) THEN
numbuf := '-0';
numbuf :=
numbuf
|| SUBSTR (
TO_CHAR (elem.get_number,
'TM9',
'NLS_NUMERIC_CHARACTERS=''.,'''),
2);
ELSE
numbuf :=
numbuf
|| TO_CHAR (elem.get_number,
'TM9',
'NLS_NUMERIC_CHARACTERS=''.,''');
END IF;
add_to_clob (buf, buf_str, llcheck (numbuf));
WHEN 'string' THEN
IF (elem.extended_str IS NOT NULL) THEN --clob implementation
add_to_clob (
buf,
buf_str,
CASE WHEN elem.num = 1 THEN '"' ELSE '/**/' END);
DECLARE
offset NUMBER := 1;
v_str VARCHAR (32767);
amount NUMBER := 32767;
BEGIN
WHILE (offset <=
DBMS_LOB.getlength (elem.extended_str))
LOOP
DBMS_LOB.read (elem.extended_str,
amount,
offset,
v_str);
IF (elem.num = 1) THEN
add_to_clob (buf,
buf_str,
escapestring (v_str));
ELSE
add_to_clob (buf, buf_str, v_str);
END IF;
offset := offset + amount;
END LOOP;
END;
add_to_clob (
buf,
buf_str,
CASE WHEN elem.num = 1 THEN '"' ELSE '/**/' END
|| newline_char);
ELSE
IF (elem.num = 1) THEN
add_to_clob (
buf,
buf_str,
llcheck (
'"' || escapestring (elem.get_string) || '"'));
ELSE
add_to_clob (
buf,
buf_str,
llcheck ('/**/' || elem.get_string || '/**/'));
END IF;
END IF;
WHEN 'bool' THEN
IF (elem.get_bool) THEN
add_to_clob (buf, buf_str, llcheck ('true'));
ELSE
add_to_clob (buf, buf_str, llcheck ('false'));
END IF;
WHEN 'null' THEN
add_to_clob (buf, buf_str, llcheck ('null'));
WHEN 'array' THEN
add_to_clob (buf, buf_str, llcheck ('['));
ppea (json_list (elem),
indent,
buf,
spaces,
buf_str);
add_to_clob (buf, buf_str, llcheck (']'));
WHEN 'object' THEN
ppobj (json (elem),
indent,
buf,
spaces,
buf_str);
ELSE
add_to_clob (buf, buf_str, llcheck (elem.get_type));
END CASE;
END IF;
IF (y != arr.COUNT) THEN
add_to_clob (buf, buf_str, llcheck (getcommasep (spaces)));
END IF;
END LOOP;
END ppea;
PROCEDURE ppmem (mem json_value,
indent NUMBER,
buf IN OUT NOCOPY CLOB,
spaces BOOLEAN,
buf_str IN OUT NOCOPY VARCHAR2)
AS
numbuf VARCHAR2 (4000);
BEGIN
add_to_clob (
buf,
buf_str,
llcheck (tab (indent, spaces)) || llcheck (getmemname (mem, spaces)));
CASE mem.get_type
WHEN 'number' THEN
IF (mem.get_number < 1 AND mem.get_number > 0) THEN
numbuf := '0';
END IF;
IF (mem.get_number < 0 AND mem.get_number > -1) THEN
numbuf := '-0';
numbuf :=
numbuf
|| SUBSTR (
TO_CHAR (mem.get_number,
'TM9',
'NLS_NUMERIC_CHARACTERS=''.,'''),
2);
ELSE
numbuf :=
numbuf
|| TO_CHAR (mem.get_number,
'TM9',
'NLS_NUMERIC_CHARACTERS=''.,''');
END IF;
add_to_clob (buf, buf_str, llcheck (numbuf));
WHEN 'string' THEN
IF (mem.extended_str IS NOT NULL) THEN --clob implementation
add_to_clob (buf,
buf_str,
CASE WHEN mem.num = 1 THEN '"' ELSE '/**/' END);
DECLARE
offset NUMBER := 1;
v_str VARCHAR (32767);
amount NUMBER := 32767;
BEGIN
-- dbms_output.put_line('SIZE:'||dbms_lob.getlength(mem.extended_str));
WHILE (offset <= DBMS_LOB.getlength (mem.extended_str))
LOOP
-- dbms_output.put_line('OFFSET:'||offset);
-- v_str := dbms_lob.substr(mem.extended_str, 8192, offset);
DBMS_LOB.read (mem.extended_str,
amount,
offset,
v_str);
-- dbms_output.put_line('VSTR_SIZE:'||length(v_str));
IF (mem.num = 1) THEN
add_to_clob (buf, buf_str, escapestring (v_str));
ELSE
add_to_clob (buf, buf_str, v_str);
END IF;
offset := offset + amount;
END LOOP;
END;
add_to_clob (
buf,
buf_str,
CASE WHEN mem.num = 1 THEN '"' ELSE '/**/' END
|| newline_char);
ELSE
IF (mem.num = 1) THEN
add_to_clob (
buf,
buf_str,
llcheck ('"' || escapestring (mem.get_string) || '"'));
ELSE
add_to_clob (buf,
buf_str,
llcheck ('/**/' || mem.get_string || '/**/'));
END IF;
END IF;
WHEN 'bool' THEN
IF (mem.get_bool) THEN
add_to_clob (buf, buf_str, llcheck ('true'));
ELSE
add_to_clob (buf, buf_str, llcheck ('false'));
END IF;
WHEN 'null' THEN
add_to_clob (buf, buf_str, llcheck ('null'));
WHEN 'array' THEN
add_to_clob (buf, buf_str, llcheck ('['));
ppea (json_list (mem),
indent,
buf,
spaces,
buf_str);
add_to_clob (buf, buf_str, llcheck (']'));
WHEN 'object' THEN
ppobj (json (mem),
indent,
buf,
spaces,
buf_str);
ELSE
add_to_clob (buf, buf_str, llcheck (mem.get_type));
END CASE;
END ppmem;
PROCEDURE ppobj (obj json,
indent NUMBER,
buf IN OUT NOCOPY CLOB,
spaces BOOLEAN,
buf_str IN OUT NOCOPY VARCHAR2)
AS
BEGIN
add_to_clob (buf, buf_str, llcheck ('{') || newline (spaces));
FOR m IN 1 .. obj.json_data.COUNT
LOOP
ppmem (obj.json_data (m),
indent + 1,
buf,
spaces,
buf_str);
IF (m != obj.json_data.COUNT) THEN
add_to_clob (buf, buf_str, llcheck (',') || newline (spaces));
ELSE
add_to_clob (buf, buf_str, newline (spaces));
END IF;
END LOOP;
add_to_clob (buf,
buf_str,
llcheck (tab (indent, spaces)) || llcheck ('}')); -- || chr(13);
END ppobj;
PROCEDURE pretty_print (obj json,
spaces BOOLEAN DEFAULT TRUE,
buf IN OUT NOCOPY CLOB,
line_length NUMBER DEFAULT 0,
erase_clob BOOLEAN DEFAULT TRUE)
AS
buf_str VARCHAR2 (32767);
amount NUMBER := DBMS_LOB.getlength (buf);
BEGIN
IF (erase_clob AND amount > 0) THEN
DBMS_LOB.TRIM (buf, 0);
DBMS_LOB.ERASE (buf, amount);
END IF;
max_line_len := line_length;
cur_line_len := 0;
ppobj (obj,
0,
buf,
spaces,
buf_str);
flush_clob (buf, buf_str);
END;
PROCEDURE pretty_print_list (
obj json_list,
spaces BOOLEAN DEFAULT TRUE,
buf IN OUT NOCOPY CLOB,
line_length NUMBER DEFAULT 0,
erase_clob BOOLEAN DEFAULT TRUE)
AS
buf_str VARCHAR2 (32767);
amount NUMBER := DBMS_LOB.getlength (buf);
BEGIN
IF (erase_clob AND amount > 0) THEN
DBMS_LOB.TRIM (buf, 0);
DBMS_LOB.ERASE (buf, amount);
END IF;
max_line_len := line_length;
cur_line_len := 0;
add_to_clob (buf, buf_str, llcheck ('['));
ppea (obj,
0,
buf,
spaces,
buf_str);
add_to_clob (buf, buf_str, llcheck (']'));
flush_clob (buf, buf_str);
END;
PROCEDURE pretty_print_any (
json_part json_value,
spaces BOOLEAN DEFAULT TRUE,
buf IN OUT NOCOPY CLOB,
line_length NUMBER DEFAULT 0,
erase_clob BOOLEAN DEFAULT TRUE)
AS
buf_str VARCHAR2 (32767) := '';
numbuf VARCHAR2 (4000);
amount NUMBER := DBMS_LOB.getlength (buf);
BEGIN
IF (erase_clob AND amount > 0) THEN
DBMS_LOB.TRIM (buf, 0);
DBMS_LOB.ERASE (buf, amount);
END IF;
CASE json_part.get_type
WHEN 'number' THEN
IF (json_part.get_number < 1 AND json_part.get_number > 0) THEN
numbuf := '0';
END IF;
IF (json_part.get_number < 0 AND json_part.get_number > -1) THEN
numbuf := '-0';
numbuf :=
numbuf
|| SUBSTR (
TO_CHAR (json_part.get_number,
'TM9',
'NLS_NUMERIC_CHARACTERS=''.,'''),
2);
ELSE
numbuf :=
numbuf
|| TO_CHAR (json_part.get_number,
'TM9',
'NLS_NUMERIC_CHARACTERS=''.,''');
END IF;
add_to_clob (buf, buf_str, numbuf);
WHEN 'string' THEN
IF (json_part.extended_str IS NOT NULL) THEN --clob implementation
add_to_clob (
buf,
buf_str,
CASE WHEN json_part.num = 1 THEN '"' ELSE '/**/' END);
DECLARE
offset NUMBER := 1;
v_str VARCHAR (32767);
amount NUMBER := 32767;
BEGIN
WHILE (offset <=
DBMS_LOB.getlength (json_part.extended_str))
LOOP
DBMS_LOB.read (json_part.extended_str,
amount,
offset,
v_str);
IF (json_part.num = 1) THEN
add_to_clob (buf, buf_str, escapestring (v_str));
ELSE
add_to_clob (buf, buf_str, v_str);
END IF;
offset := offset + amount;
END LOOP;
END;
add_to_clob (
buf,
buf_str,
CASE WHEN json_part.num = 1 THEN '"' ELSE '/**/' END);
ELSE
IF (json_part.num = 1) THEN
add_to_clob (
buf,
buf_str,
llcheck (
'"' || escapestring (json_part.get_string) || '"'));
ELSE
add_to_clob (
buf,
buf_str,
llcheck ('/**/' || json_part.get_string || '/**/'));
END IF;
END IF;
WHEN 'bool' THEN
IF (json_part.get_bool) THEN
add_to_clob (buf, buf_str, 'true');
ELSE
add_to_clob (buf, buf_str, 'false');
END IF;
WHEN 'null' THEN
add_to_clob (buf, buf_str, 'null');
WHEN 'array' THEN
pretty_print_list (json_list (json_part),
spaces,
buf,
line_length);
RETURN;
WHEN 'object' THEN
pretty_print (json (json_part),
spaces,
buf,
line_length);
RETURN;
ELSE
add_to_clob (buf, buf_str, 'unknown type:' || json_part.get_type);
END CASE;
flush_clob (buf, buf_str);
END;
/* Clob method end here */
/* Varchar2 method start here */
PROCEDURE ppobj (obj json,
indent NUMBER,
buf IN OUT NOCOPY VARCHAR2,
spaces BOOLEAN);
PROCEDURE ppea (input json_list,
indent NUMBER,
buf IN OUT VARCHAR2,
spaces BOOLEAN)
AS
elem json_value;
arr json_value_array := input.list_data;
str VARCHAR2 (400);
BEGIN
FOR y IN 1 .. arr.COUNT
LOOP
elem := arr (y);
IF (elem IS NOT NULL) THEN
CASE elem.get_type
WHEN 'number' THEN
str := '';
IF (elem.get_number < 1 AND elem.get_number > 0) THEN
str := '0';
END IF;
IF (elem.get_number < 0 AND elem.get_number > -1) THEN
str :=
'-0'
|| SUBSTR (
TO_CHAR (elem.get_number,
'TM9',
'NLS_NUMERIC_CHARACTERS=''.,'''),
2);
ELSE
str :=
str
|| TO_CHAR (elem.get_number,
'TM9',
'NLS_NUMERIC_CHARACTERS=''.,''');
END IF;
buf := buf || llcheck (str);
WHEN 'string' THEN
IF (elem.num = 1) THEN
buf :=
buf
|| llcheck (
'"' || escapestring (elem.get_string) || '"');
ELSE
buf :=
buf || llcheck ('/**/' || elem.get_string || '/**/');
END IF;
WHEN 'bool' THEN
IF (elem.get_bool) THEN
buf := buf || llcheck ('true');
ELSE
buf := buf || llcheck ('false');
END IF;
WHEN 'null' THEN
buf := buf || llcheck ('null');
WHEN 'array' THEN
buf := buf || llcheck ('[');
ppea (json_list (elem),
indent,
buf,
spaces);
buf := buf || llcheck (']');
WHEN 'object' THEN
ppobj (json (elem),
indent,
buf,
spaces);
ELSE
buf := buf || llcheck (elem.get_type); /* should never happen */
END CASE;
END IF;
IF (y != arr.COUNT) THEN
buf := buf || llcheck (getcommasep (spaces));
END IF;
END LOOP;
END ppea;
PROCEDURE ppmem (mem json_value,
indent NUMBER,
buf IN OUT NOCOPY VARCHAR2,
spaces BOOLEAN)
AS
str VARCHAR2 (400) := '';
BEGIN
buf :=
buf || llcheck (tab (indent, spaces)) || getmemname (mem, spaces);
CASE mem.get_type
WHEN 'number' THEN
IF (mem.get_number < 1 AND mem.get_number > 0) THEN
str := '0';
END IF;
IF (mem.get_number < 0 AND mem.get_number > -1) THEN
str :=
'-0'
|| SUBSTR (
TO_CHAR (mem.get_number,
'TM9',
'NLS_NUMERIC_CHARACTERS=''.,'''),
2);
ELSE
str :=
str
|| TO_CHAR (mem.get_number,
'TM9',
'NLS_NUMERIC_CHARACTERS=''.,''');
END IF;
buf := buf || llcheck (str);
WHEN 'string' THEN
IF (mem.num = 1) THEN
buf :=
buf
|| llcheck ('"' || escapestring (mem.get_string) || '"');
ELSE
buf := buf || llcheck ('/**/' || mem.get_string || '/**/');
END IF;
WHEN 'bool' THEN
IF (mem.get_bool) THEN
buf := buf || llcheck ('true');
ELSE
buf := buf || llcheck ('false');
END IF;
WHEN 'null' THEN
buf := buf || llcheck ('null');
WHEN 'array' THEN
buf := buf || llcheck ('[');
ppea (json_list (mem),
indent,
buf,
spaces);
buf := buf || llcheck (']');
WHEN 'object' THEN
ppobj (json (mem),
indent,
buf,
spaces);
ELSE
buf := buf || llcheck (mem.get_type); /* should never happen */
END CASE;
END ppmem;
PROCEDURE ppobj (obj json,
indent NUMBER,
buf IN OUT NOCOPY VARCHAR2,
spaces BOOLEAN)
AS
BEGIN
buf := buf || llcheck ('{') || newline (spaces);
FOR m IN 1 .. obj.json_data.COUNT
LOOP
ppmem (obj.json_data (m),
indent + 1,
buf,
spaces);
IF (m != obj.json_data.COUNT) THEN
buf := buf || llcheck (',') || newline (spaces);
ELSE
buf := buf || newline (spaces);
END IF;
END LOOP;
buf := buf || llcheck (tab (indent, spaces)) || llcheck ('}'); -- || chr(13);
END ppobj;
FUNCTION pretty_print (obj json,
spaces BOOLEAN DEFAULT TRUE,
line_length NUMBER DEFAULT 0)
RETURN VARCHAR2
AS
buf VARCHAR2 (32767) := '';
BEGIN
max_line_len := line_length;
cur_line_len := 0;
ppobj (obj,
0,
buf,
spaces);
RETURN buf;
END pretty_print;
FUNCTION pretty_print_list (obj json_list,
spaces BOOLEAN DEFAULT TRUE,
line_length NUMBER DEFAULT 0)
RETURN VARCHAR2
AS
buf VARCHAR2 (32767);
BEGIN
max_line_len := line_length;
cur_line_len := 0;
buf := llcheck ('[');
ppea (obj,
0,
buf,
spaces);
buf := buf || llcheck (']');
RETURN buf;
END;
FUNCTION pretty_print_any (json_part json_value,
spaces BOOLEAN DEFAULT TRUE,
line_length NUMBER DEFAULT 0)
RETURN VARCHAR2
AS
buf VARCHAR2 (32767) := '';
BEGIN
CASE json_part.get_type
WHEN 'number' THEN
IF (json_part.get_number () < 1 AND json_part.get_number () > 0) THEN
buf := buf || '0';
END IF;
IF (json_part.get_number () < 0 AND json_part.get_number () > -1) THEN
buf := buf || '-0';
buf :=
buf
|| SUBSTR (
TO_CHAR (json_part.get_number (),
'TM9',
'NLS_NUMERIC_CHARACTERS=''.,'''),
2);
ELSE
buf :=
buf
|| TO_CHAR (json_part.get_number (),
'TM9',
'NLS_NUMERIC_CHARACTERS=''.,''');
END IF;
WHEN 'string' THEN
IF (json_part.num = 1) THEN
buf :=
buf || '"' || escapestring (json_part.get_string) || '"';
ELSE
buf := buf || '/**/' || json_part.get_string || '/**/';
END IF;
WHEN 'bool' THEN
IF (json_part.get_bool) THEN
buf := 'true';
ELSE
buf := 'false';
END IF;
WHEN 'null' THEN
buf := 'null';
WHEN 'array' THEN
buf :=
pretty_print_list (json_list (json_part), spaces, line_length);
WHEN 'object' THEN
buf := pretty_print (json (json_part), spaces, line_length);
ELSE
buf := 'weird error: ' || json_part.get_type;
END CASE;
RETURN buf;
END;
PROCEDURE dbms_output_clob (my_clob CLOB,
delim VARCHAR2,
jsonp VARCHAR2 DEFAULT NULL)
AS
prev NUMBER := 1;
indx NUMBER := 1;
size_of_nl NUMBER := LENGTHB (delim);
v_str VARCHAR2 (32767);
amount NUMBER := 32767;
BEGIN
IF (jsonp IS NOT NULL) THEN
DBMS_OUTPUT.put_line (jsonp || '(');
END IF;
WHILE (indx != 0)
LOOP
--read every line
indx := DBMS_LOB.INSTR (my_clob, delim, prev + 1);
-- dbms_output.put_line(prev || ' to ' || indx);
IF (indx = 0) THEN
--emit from prev to end;
amount := 32767;
-- dbms_output.put_line(' mycloblen ' || dbms_lob.getlength(my_clob));
LOOP
DBMS_LOB.read (my_clob,
amount,
prev,
v_str);
DBMS_OUTPUT.put_line (v_str);
prev := prev + amount - 1;
EXIT WHEN prev >= DBMS_LOB.getlength (my_clob);
END LOOP;
ELSE
amount := indx - prev;
IF (amount > 32767) THEN
amount := 32767;
-- dbms_output.put_line(' mycloblen ' || dbms_lob.getlength(my_clob));
LOOP
DBMS_LOB.read (my_clob,
amount,
prev,
v_str);
DBMS_OUTPUT.put_line (v_str);
prev := prev + amount - 1;
amount := indx - prev;
EXIT WHEN prev >= indx - 1;
IF (amount > 32767) THEN
amount := 32767;
END IF;
END LOOP;
prev := indx + size_of_nl;
ELSE
DBMS_LOB.read (my_clob,
amount,
prev,
v_str);
DBMS_OUTPUT.put_line (v_str);
prev := indx + size_of_nl;
END IF;
END IF;
END LOOP;
IF (jsonp IS NOT NULL) THEN
DBMS_OUTPUT.put_line (')');
END IF;
/* while (amount != 0) loop
indx := dbms_lob.instr(my_clob, delim, prev+1);
-- dbms_output.put_line(prev || ' to ' || indx);
if(indx = 0) then
indx := dbms_lob.getlength(my_clob)+1;
end if;
if(indx-prev > 32767) then
indx := prev+32767;
end if;
-- dbms_output.put_line(prev || ' to ' || indx);
--substr doesnt work properly on all platforms! (come on oracle - error on Oracle VM for virtualbox)
-- dbms_output.put_line(dbms_lob.substr(my_clob, indx-prev, prev));
amount := indx-prev;
-- dbms_output.put_line('amount'||amount);
dbms_lob.read(my_clob, amount, prev, v_str);
dbms_output.put_line(v_str);
prev := indx+size_of_nl;
if(amount = 32767) then prev := prev-size_of_nl-1; end if;
end loop;
if(jsonp is not null) then dbms_output.put_line(')'); end if;*/
END;
/* procedure dbms_output_clob(my_clob clob, delim varchar2, jsonp varchar2 default null) as
prev number := 1;
indx number := 1;
size_of_nl number := lengthb(delim);
v_str varchar2(32767);
amount number;
begin
if(jsonp is not null) then dbms_output.put_line(jsonp||'('); end if;
while (indx != 0) loop
indx := dbms_lob.instr(my_clob, delim, prev+1);
-- dbms_output.put_line(prev || ' to ' || indx);
if(indx-prev > 32767) then
indx := prev+32767;
end if;
-- dbms_output.put_line(prev || ' to ' || indx);
--substr doesnt work properly on all platforms! (come on oracle - error on Oracle VM for virtualbox)
if(indx = 0) then
-- dbms_output.put_line(dbms_lob.substr(my_clob, dbms_lob.getlength(my_clob)-prev+size_of_nl, prev));
amount := dbms_lob.getlength(my_clob)-prev+size_of_nl;
dbms_lob.read(my_clob, amount, prev, v_str);
else
-- dbms_output.put_line(dbms_lob.substr(my_clob, indx-prev, prev));
amount := indx-prev;
-- dbms_output.put_line('amount'||amount);
dbms_lob.read(my_clob, amount, prev, v_str);
end if;
dbms_output.put_line(v_str);
prev := indx+size_of_nl;
if(amount = 32767) then prev := prev-size_of_nl-1; end if;
end loop;
if(jsonp is not null) then dbms_output.put_line(')'); end if;
end;
*/
PROCEDURE htp_output_clob (my_clob CLOB, jsonp VARCHAR2 DEFAULT NULL)
AS
/*amount number := 4096;
pos number := 1;
len number;
*/
l_amt NUMBER DEFAULT 30;
l_off NUMBER DEFAULT 1;
l_str VARCHAR2 (4096);
BEGIN
IF (jsonp IS NOT NULL) THEN
HTP.prn (jsonp || '(');
END IF;
BEGIN
LOOP
DBMS_LOB.read (my_clob,
l_amt,
l_off,
l_str);
-- it is vital to use htp.PRN to avoid
-- spurious line feeds getting added to your
-- document
HTP.prn (l_str);
l_off := l_off + l_amt;
l_amt := 4096;
END LOOP;
EXCEPTION
WHEN NO_DATA_FOUND THEN
NULL;
END;
/*
len := dbms_lob.getlength(my_clob);
while(pos < len) loop
htp.prn(dbms_lob.substr(my_clob, amount, pos)); -- should I replace substr with dbms_lob.read?
--dbms_output.put_line(dbms_lob.substr(my_clob, amount, pos));
pos := pos + amount;
end loop;
*/
IF (jsonp IS NOT NULL) THEN
HTP.prn (')');
END IF;
END;
END json_printer;
/ | the_stack |
-- start_matchsubs
-- m/ERROR: tuple concurrently updated \(heapam\.c\:\d+\)/
-- s/\(heapam\.c:\d+\)//
-- end_matchsubs
CREATE EXTENSION dblink;
-- This function execute commands N times.
-- % in command will be replaced by number specified by range1 sequentially
-- # in command will be replaced by number specified by range2 randomly
-- range, eg: 1-10
-- Notice: now it only support SELECT statement return single integer
CREATE or replace FUNCTION exec_commands_n /*in func*/
(dl_name text, command1 text, /*in func*/
command2 text, command3 text, /*in func*/
times integer, range1 text, range2 text, fail_on_error bool) /*in func*/
RETURNS integer AS $$ /*in func*/
DECLARE /*in func*/
cmd text; /*in func*/
res int; /*in func*/
s_r1 int; /*in func*/
e_r1 int; /*in func*/
s_r2 int; /*in func*/
e_r2 int; /*in func*/
BEGIN /*in func*/
s_r1 = 0; /*in func*/
e_r1 = 0; /*in func*/
s_r2 = 0; /*in func*/
e_r2 = 0; /*in func*/
IF length(range1) > 0 THEN /*in func*/
select t[1]::int, t[2]::int into s_r1, e_r1 from regexp_split_to_array(range1, '-') t; /*in func*/
END IF; /*in func*/
IF length(range2) > 0 THEN /*in func*/
select t[1]::int, t[2]::int into s_r2, e_r2 from regexp_split_to_array(range2, '-') t; /*in func*/
END IF; /*in func*/
FOR i IN 0..(times - 1) LOOP /*in func*/
IF length(command1) > 0 THEN /*in func*/
cmd = regexp_replace(command1, '%', (s_r1 + i % (e_r1 - s_r1 + 1))::text, 'g'); /*in func*/
cmd = regexp_replace(cmd, '#', (s_r2 + ((random()*100)::int) % (e_r2 - s_r2 + 1))::text, 'g'); /*in func*/
RAISE NOTICE '%', cmd; /*in func*/
IF lower(cmd) like 'select %' THEN /*in func*/
select * into res from dblink(dl_name, cmd, fail_on_error) t(c1 integer); /*in func*/
ELSE /*in func*/
perform dblink_exec(dl_name, cmd , fail_on_error); /*in func*/
END IF; /*in func*/
END IF; /*in func*/
IF length(command2) > 0 THEN /*in func*/
cmd = regexp_replace(command2, '%', (s_r1 + i % (e_r1 - s_r1 + 1))::text, 'g'); /*in func*/
cmd = regexp_replace(cmd, '#', (s_r2 + ((random()*100)::int) % (e_r2 - s_r2 + 1))::text, 'g'); /*in func*/
RAISE NOTICE '%', cmd; /*in func*/
IF lower(cmd) like 'select %' THEN /*in func*/
select * into res from dblink(dl_name, cmd, fail_on_error) t(c1 integer); /*in func*/
ELSE /*in func*/
perform dblink_exec(dl_name, cmd, fail_on_error); /*in func*/
END IF; /*in func*/
END IF; /*in func*/
IF length(command3) > 0 THEN /*in func*/
cmd = regexp_replace(command3, '%', (s_r1 + i % (e_r1 - s_r1 + 1))::text, 'g'); /*in func*/
cmd = regexp_replace(cmd, '#', (s_r2 + ((random()*100)::int) % (e_r2 - s_r2 + 1))::text, 'g'); /*in func*/
RAISE NOTICE '%', cmd; /*in func*/
IF lower(cmd) like 'select %' THEN /*in func*/
select * into res from dblink(dl_name, cmd, fail_on_error) t(c1 integer); /*in func*/
ELSE /*in func*/
perform dblink_exec(dl_name, cmd, fail_on_error); /*in func*/
END IF; /*in func*/
END IF; /*in func*/
END LOOP; /*in func*/
return times; /*in func*/
END;$$ /*in func*/
LANGUAGE 'plpgsql';
--
-- DDLs vs DDLs
--
1:select dblink_connect('dblink_rg_test1', 'dbname=isolation2resgrouptest');
2:select dblink_connect('dblink_rg_test2', 'dbname=isolation2resgrouptest');
3:select dblink_connect('dblink_rg_test3', 'dbname=isolation2resgrouptest');
4:select dblink_connect('dblink_rg_test4', 'dbname=isolation2resgrouptest');
5:select dblink_connect('dblink_rg_test5', 'dbname=isolation2resgrouptest');
6:select dblink_connect('dblink_rg_test6', 'dbname=isolation2resgrouptest');
1>:select exec_commands_n('dblink_rg_test1','CREATE RESOURCE GROUP rg_test_g# WITH (concurrency=#, cpu_rate_limit=#, memory_limit=#)', 'DROP RESOURCE GROUP rg_test_g#', 'ALTER RESOURCE GROUP rg_test_g# set concurrency #', 60, '', '1-6', false);
2>:select exec_commands_n('dblink_rg_test2','CREATE RESOURCE GROUP rg_test_g# WITH (concurrency=#, cpu_rate_limit=#, memory_limit=#)', 'DROP RESOURCE GROUP rg_test_g#', 'ALTER RESOURCE GROUP rg_test_g# set concurrency#', 60, '', '1-6', false);
3>:select exec_commands_n('dblink_rg_test3','CREATE RESOURCE GROUP rg_test_g# WITH (concurrency=#, cpu_rate_limit=#, memory_limit=#)', 'DROP RESOURCE GROUP rg_test_g#', 'ALTER RESOURCE GROUP rg_test_g# set cpu_rate_limit #', 60, '', '1-6', false);
4>:select exec_commands_n('dblink_rg_test4','CREATE RESOURCE GROUP rg_test_g# WITH (concurrency=#, cpu_rate_limit=#, memory_limit=#)', 'DROP RESOURCE GROUP rg_test_g#', 'ALTER RESOURCE GROUP rg_test_g# set memory_limit #', 60, '', '1-6', false);
5>:select exec_commands_n('dblink_rg_test5','CREATE RESOURCE GROUP rg_test_g# WITH (concurrency=#, cpu_rate_limit=#, memory_limit=#)', 'DROP RESOURCE GROUP rg_test_g#', 'ALTER RESOURCE GROUP rg_test_g# set memory_shared_quota #', 60, '', '1-6', false);
6>:select exec_commands_n('dblink_rg_test6','CREATE RESOURCE GROUP rg_test_g# WITH (concurrency=#, cpu_rate_limit=#, memory_limit=#)', 'DROP RESOURCE GROUP rg_test_g#', 'ALTER RESOURCE GROUP rg_test_g# set memory_limit #', 60, '', '1-6', false);
1<:
2<:
3<:
4<:
5<:
6<:
1: select dblink_disconnect('dblink_rg_test1');
2: select dblink_disconnect('dblink_rg_test2');
3: select dblink_disconnect('dblink_rg_test3');
4: select dblink_disconnect('dblink_rg_test4');
5: select dblink_disconnect('dblink_rg_test5');
6: select dblink_disconnect('dblink_rg_test6');
1q:
2q:
3q:
4q:
5q:
6q:
--
-- DDLs vs DMLs
--
-- Prepare resource groups and roles and tables
create table rg_test_foo as select i as c1, i as c2 from generate_series(1,1000) i;
create table rg_test_bar as select i as c1, i as c2 from generate_series(1,1000) i;
grant all on rg_test_foo to public;
grant all on rg_test_bar to public;
-- start_ignore
select dblink_connect('dblink_rg_test', 'dbname=isolation2resgrouptest');
select exec_commands_n('dblink_rg_test','DROP ROLE rg_test_r%', '', '', 7, '1-7', '', false);
select exec_commands_n('dblink_rg_test','DROP RESOURCE GROUP rg_test_g%', '', '', 7, '1-7', '', false);
-- end_ignore
-- create 6 roles and 6 resource groups
select exec_commands_n('dblink_rg_test','CREATE RESOURCE GROUP rg_test_g% WITH (concurrency=9, cpu_rate_limit=1, memory_limit=7)', '', '', 6, '1-6', '', true);
select exec_commands_n('dblink_rg_test','CREATE ROLE rg_test_r% login resource group rg_test_g%;', '', '', 6, '1-6', '', true);
select exec_commands_n('dblink_rg_test','GRANT ALL ON rg_test_foo to rg_test_r%;', '', '', 6, '1-6', '', true);
select exec_commands_n('dblink_rg_test','GRANT ALL ON rg_test_bar to rg_test_r%;', '', '', 6, '1-6', '', true);
select dblink_disconnect('dblink_rg_test');
select groupname, concurrency, cpu_rate_limit from gp_toolkit.gp_resgroup_config where groupname like 'rg_test_g%' order by groupname;
--
-- 2* : DMLs
--
-- start 6 session to concurrently change resource group and run simple queries randomly
-- BEGIN/END
21: select dblink_connect('dblink_rg_test21', 'dbname=isolation2resgrouptest');
21>: select exec_commands_n('dblink_rg_test21', 'set role rg_test_r#', 'BEGIN', 'END', 24000, '', '1-6', true);
-- BEGIN/ABORT
22: select dblink_connect('dblink_rg_test22', 'dbname=isolation2resgrouptest');
22>: select exec_commands_n('dblink_rg_test22', 'set role rg_test_r#', 'BEGIN', 'ABORT', 24000, '', '1-6', true);
-- query with memory sensitive node
23: select dblink_connect('dblink_rg_test23', 'dbname=isolation2resgrouptest');
23>: select exec_commands_n('dblink_rg_test23', 'set role rg_test_r#', 'insert into rg_test_foo values (#, #)', 'select count(*) from rg_test_bar t1, rg_test_foo t2 where t1.c2=t2.c2 group by t1.c2', 3000, '', '1-6', true);
-- high cpu
24: select dblink_connect('dblink_rg_test24', 'dbname=isolation2resgrouptest');
24>: select exec_commands_n('dblink_rg_test24', 'set role rg_test_r#', 'insert into rg_test_bar values (#, #)', 'select count(*) from rg_test_bar where c2! = 1000', 60, '', '1-6', true);
-- simple select
25: select dblink_connect('dblink_rg_test25', 'dbname=isolation2resgrouptest');
25>: select exec_commands_n('dblink_rg_test25', 'set role rg_test_r#', 'select count(*) from rg_test_foo', 'select count(*) from rg_test_bar', 6000, '', '1-6', true);
-- vacuum
26: select dblink_connect('dblink_rg_test26', 'dbname=isolation2resgrouptest');
26>: select exec_commands_n('dblink_rg_test26', 'set role rg_test_r#', 'vacuum rg_test_bar', 'vacuum rg_test_foo', 6000, '', '1-6', true);
--
-- 3* : Alter groups
--
-- start a new session to alter concurrency randomly
31: select dblink_connect('dblink_rg_test31', 'dbname=isolation2resgrouptest');
31>: select exec_commands_n('dblink_rg_test31', 'alter resource group rg_test_g% set concurrency #', 'select 1 from pg_sleep(0.1)', '', 1000, '1-6', '0-5', true);
-- start a new session to alter cpu_rate_limit randomly
32: select dblink_connect('dblink_rg_test32', 'dbname=isolation2resgrouptest');
32>: select exec_commands_n('dblink_rg_test32', 'alter resource group rg_test_g% set cpu_rate_limit #', 'select 1 from pg_sleep(0.1)', '', 1000, '1-6', '1-6', true);
-- start a new session to alter memory_limit randomly
33: select dblink_connect('dblink_rg_test33', 'dbname=isolation2resgrouptest');
33>: select exec_commands_n('dblink_rg_test33', 'alter resource group rg_test_g% set memory_limit #', 'select 1 from pg_sleep(0.1)', '', 1000, '1-6', '1-7', true);
-- start a new session to alter memory_shared_quota randomly
34: select dblink_connect('dblink_rg_test34', 'dbname=isolation2resgrouptest');
34>: select exec_commands_n('dblink_rg_test34', 'alter resource group rg_test_g% set memory_shared_quota #', 'select 1 from pg_sleep(0.1)', '', 1000, '1-6', '1-80', true);
--
-- 4* : CREATE/DROP tables & groups
--
-- start a new session to create and drop table, it will cause massive catchup interrupt.
41: select dblink_connect('dblink_rg_test41', 'dbname=isolation2resgrouptest');
41>: select exec_commands_n('dblink_rg_test41', 'drop table if exists rg_test_t%', 'create table rg_test_t% (c1 int, c2 int)' ,'', 3000, '1-6', '', true);
-- start a new session to create & drop resource group
42: select dblink_connect('dblink_rg_test42', 'dbname=isolation2resgrouptest');
42>: select exec_commands_n('dblink_rg_test42', 'create resource group rg_test_g7 with (cpu_rate_limit=1, memory_limit=1)', 'drop resource group rg_test_g7', '', 1000, '', '', true);
31<:
31: select exec_commands_n('dblink_rg_test31', 'alter resource group rg_test_g% set concurrency #', 'select 1 from pg_sleep(0.1)', '', 6, '1-6', '1-5', true);
-- start a new session to acquire the status of resource groups
44: select dblink_connect('dblink_rg_test44', 'dbname=isolation2resgrouptest');
44>: select exec_commands_n('dblink_rg_test44', 'select count(*) from gp_toolkit.gp_resgroup_status;', '', '', 100, '', '', true);
-- wait all sessions to finish
21<:
22<:
23<:
24<:
25<:
26<:
32<:
33<:
34<:
41<:
42<:
44<:
21: select dblink_disconnect('dblink_rg_test21');
22: select dblink_disconnect('dblink_rg_test22');
23: select dblink_disconnect('dblink_rg_test23');
24: select dblink_disconnect('dblink_rg_test24');
25: select dblink_disconnect('dblink_rg_test25');
26: select dblink_disconnect('dblink_rg_test26');
31: select dblink_disconnect('dblink_rg_test31');
32: select dblink_disconnect('dblink_rg_test32');
33: select dblink_disconnect('dblink_rg_test33');
34: select dblink_disconnect('dblink_rg_test34');
41: select dblink_disconnect('dblink_rg_test41');
42: select dblink_disconnect('dblink_rg_test42');
44: select dblink_disconnect('dblink_rg_test44');
21q:
22q:
23q:
24q:
25q:
26q:
31q:
32q:
33q:
34q:
41q:
42q:
select groupname, concurrency::int < 7, cpu_rate_limit::int < 7 from gp_toolkit.gp_resgroup_config where groupname like 'rg_test_g%' order by groupname;
-- Beacuse concurrency of each resource group is changed between 1..6, so the num_queued must be larger than 0
select num_queued > 0 from gp_toolkit.gp_resgroup_status where rsgname like 'rg_test_g%' order by rsgname;
-- After all queries finished in each resource group, the memory_usage should be zero, no memory leak
with t_1 as
(
select rsgname, row_to_json(json_each(memory_usage::json)) as j from gp_toolkit.gp_resgroup_status where rsgname like 'rg_test_g%' order by rsgname
)
select rsgname, sum(((j->'value')->>'used')::int) from t_1 group by rsgname ;
-- start_ignore
drop table rg_test_foo;
drop table rg_test_bar;
select dblink_connect('dblink_rg_test', 'dbname=isolation2resgrouptest');
select exec_commands_n('dblink_rg_test','DROP ROLE rg_test_r%', '', '', 6, '1-6', '', true);
select exec_commands_n('dblink_rg_test','DROP RESOURCE GROUP rg_test_g%', '', '', 6, '1-6', '', true);
select dblink_disconnect('dblink_rg_test');
-- end_ignore
--
-- 5*: Test connections in utility mode are not governed by resource group
--
create resource group rg_test_g8 with (concurrency= 1, cpu_rate_limit=1, memory_limit=1);
create role rg_test_r8 login resource group rg_test_g8;
51:select dblink_connect('dblink_rg_test51', 'dbname=isolation2resgrouptest user=rg_test_r8 options=''-c gp_role=utility''');
52:select dblink_connect('dblink_rg_test52', 'dbname=isolation2resgrouptest user=rg_test_r8 options=''-c gp_role=utility''');
53:select dblink_connect('dblink_rg_test53', 'dbname=isolation2resgrouptest user=rg_test_r8 options=''-c gp_role=utility''');
51>:select exec_commands_n('dblink_rg_test51', 'select 1', 'begin', 'end', 100, '', '', true);
51<:
52>:select exec_commands_n('dblink_rg_test52', 'select 1', 'select 1', 'select 1', 100, '', '', true);
52<:
53>:select exec_commands_n('dblink_rg_test53', 'select 1', 'begin', 'abort', 100, '', '', true);
53<:
51: select dblink_disconnect('dblink_rg_test51');
52: select dblink_disconnect('dblink_rg_test52');
53: select dblink_disconnect('dblink_rg_test53');
51q:
52q:
53q:
-- num_executed and num_queued must be zero
select num_queued, num_executed from gp_toolkit.gp_resgroup_status where rsgname = 'rg_test_g8';
drop role rg_test_r8;
drop resource group rg_test_g8;
-- clean up
select * from gp_toolkit.gp_resgroup_config; | the_stack |
-- phpMyAdmin SQL Dump
-- version 4.8.5
-- https://www.phpmyadmin.net/
--
-- 主机: localhost
-- 生成日期: 2020-06-20 23:02:14
-- 服务器版本: 8.0.12
-- PHP 版本: 7.3.4
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
START TRANSACTION;
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
--
-- 数据库: `systemdb`
--
-- --------------------------------------------------------
--
-- 表的结构 `system_article`
--
DROP TABLE IF EXISTS `system_article`;
CREATE TABLE `system_article` (
`id` bigint(20) UNSIGNED NOT NULL COMMENT '主键',
`author` int(10) NOT NULL DEFAULT '0' COMMENT '作者',
`importance` tinyint(4) UNSIGNED NOT NULL DEFAULT '1' COMMENT '重要级别',
`status` tinyint(4) NOT NULL DEFAULT '0' COMMENT '状态(0:draft,1:published,10:deleted)',
`title` varchar(200) NOT NULL DEFAULT '' COMMENT '标题',
`content` text NOT NULL COMMENT '内容',
`content_short` varchar(500) NOT NULL DEFAULT '' COMMENT '摘要',
`source_uri` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '来源',
`ctime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间',
`image_uri` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '图片',
`comment_disabled` tinyint(4) NOT NULL DEFAULT '0' COMMENT '是否展示评论',
`display_time` datetime NOT NULL COMMENT '发布时间',
`mtime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间'
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
--
-- 转存表中的数据 `system_article`
--
INSERT INTO `system_article` (`id`, `author`, `importance`, `status`, `title`, `content`, `content_short`, `source_uri`, `ctime`, `image_uri`, `comment_disabled`, `display_time`, `mtime`) VALUES
(1, 1, 2, 1, 'fasd', '<p>fasdffasdf</p>', 'a发生的发生', '', 1585670400, '20200407/ftxqfEY9EjWGyHS7CFaDWkYYh2SLYUIY.jpeg', 0, '2020-04-10 00:00:00', '2020-04-09 15:14:31'),
(2, 1, 2, 1, 'fasd', '<p>fasdffasdf</p>', 'a', 'https://www.baidu.com/', 1585670400, '20200407/jbsW7XXW5nFcj6rNEydZhs9ma4BerLpB.jpeg', 0, '2020-04-01 00:00:00', '2020-03-31 16:00:00'),
(3, 1, 2, 1, '测试', '<p><img class=\"wscnph\" src=\"http://localhost:8090/showimage?imgname=upload/20200413/8GMq0TEmC7rZcXLrDoSM0gNEYsUcdc6z.png\" />asdfasdf<img class=\"wscnph\" src=\"http://localhost:8090/showimage?imgname=upload/20200413/CBgqld3ZFuR4uBs3w9XJM9xPtQlhjflT.png\" /></p>', 'fasd', '', 1586707200, '20200413/yjJiBlZMs42Ag1YOWxW6PuuBU3Ut9XSe.png', 0, '2020-04-13 00:00:00', '2020-04-13 15:06:59'),
(4, 1, 2, 1, '测试', '<p><img class=\"wscnph\" src=\"http://localhost:8090/showimage?imgname=upload/20200413/y0hBc2CFylSBcxIFOFhFkloXewmrViVg.png\" />asdfasdf<img class=\"wscnph\" src=\"http://localhost:8090/showimage?imgname=upload/20200413/wXVgmVtr5WLdV6BMR6frCOkqAU5XElW9.png\" /></p>', 'fasd', '', 1586707200, '20200413/SRiwahWF5RqPZWMrRUeT3CmX5Bxveyko.png', 0, '2020-04-13 00:00:00', '2020-04-12 16:00:00'),
(5, 1, 3, 1, 'fasd', '<p>fasdfasdf</p>', 'fasd', '', 1588780800, '20200515/KRUo3oEEZt51nh3ygS02Fc9JWvMb8ZuM.jpeg', 0, '2020-05-07 00:00:00', '2020-05-06 16:00:00');
-- --------------------------------------------------------
--
-- 表的结构 `system_log`
--
DROP TABLE IF EXISTS `system_log`;
CREATE TABLE `system_log` (
`id` bigint(20) NOT NULL COMMENT '主键',
`system_user_id` int(11) DEFAULT '0' COMMENT '主键',
`title` varchar(300) NOT NULL DEFAULT '' COMMENT '日志标题',
`content` text COMMENT '日志内容记录SQL',
`relation_id` bigint(20) NOT NULL DEFAULT '0' COMMENT '相关对应表主键',
`relation_table` int(4) NOT NULL DEFAULT '1' COMMENT '对应表(1 system_user,2 system_menu,3 system_role)',
`ip` varchar(50) NOT NULL DEFAULT '' COMMENT 'ip',
`url` varchar(500) NOT NULL DEFAULT '',
`ctime` datetime NOT NULL DEFAULT '0000-00-00 00:00:00' COMMENT '时间'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='操作日志';
-- --------------------------------------------------------
--
-- 表的结构 `system_menu`
--
DROP TABLE IF EXISTS `system_menu`;
CREATE TABLE `system_menu` (
`id` int(11) NOT NULL COMMENT '主键',
`name` varchar(100) NOT NULL DEFAULT '' COMMENT '名称',
`path` varchar(50) NOT NULL DEFAULT '' COMMENT '路径',
`component` varchar(100) NOT NULL DEFAULT '' COMMENT '组件',
`redirect` varchar(200) NOT NULL DEFAULT '' COMMENT '重定向',
`url` varchar(200) NOT NULL DEFAULT '' COMMENT '访问url',
`meta_title` varchar(50) NOT NULL DEFAULT '' COMMENT 'meta标题',
`meta_icon` varchar(50) NOT NULL DEFAULT '' COMMENT 'meta icon',
`meta_nocache` tinyint(4) NOT NULL DEFAULT '0' COMMENT '是否缓存(1:是 0:否)',
`alwaysshow` tinyint(4) NOT NULL DEFAULT '0' COMMENT '是否总是显示(1:是0:否)',
`meta_affix` tinyint(4) NOT NULL DEFAULT '0' COMMENT '是否加固(1:是0:否)',
`type` tinyint(4) NOT NULL DEFAULT '2' COMMENT '类型(1:固定,2:权限配置3特殊)',
`hidden` tinyint(4) NOT NULL DEFAULT '0' COMMENT '是否隐藏(0否1是)',
`pid` int(11) NOT NULL DEFAULT '0' COMMENT '父ID',
`sort` int(11) NOT NULL DEFAULT '0' COMMENT '排序',
`status` tinyint(4) NOT NULL DEFAULT '1' COMMENT '状态(0禁止1启动)',
`level` tinyint(4) NOT NULL DEFAULT '0' COMMENT '层级',
`ctime` datetime NOT NULL DEFAULT '0000-00-00 00:00:00' COMMENT '时间'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='权限';
--
-- 转存表中的数据 `system_menu`
--
INSERT INTO `system_menu` (`id`, `name`, `path`, `component`, `redirect`, `url`, `meta_title`, `meta_icon`, `meta_nocache`, `alwaysshow`, `meta_affix`, `type`, `hidden`, `pid`, `sort`, `status`, `level`, `ctime`) VALUES
(1, '系统管理', '#', '#', '', '#', '系统管理', 'fafa-adjust', 0, 0, 0, 2, 0, 0, 0, 1, 0, '2019-12-02 06:14:15'),
(2, '用户管理', '/system/user', '/system/user/index', '', '/user', '用户管理', '#', 0, 0, 0, 2, 0, 1, 0, 1, 1, '2019-12-02 00:00:00'),
(3, '菜单管理', '/system/menu', '/system/menu/index', '', '/menu', '菜单管理', '#', 0, 0, 0, 2, 0, 1, 0, 1, 1, '2019-12-02 00:00:00'),
(26, '角色管理', '/system/role', '/system/role/index', '', '/roles', '角色管理', '#', 0, 1, 0, 0, 0, 1, 0, 1, 1, '2019-12-25 19:44:16'),
(27, '添加用户', '/system/user/create', '/system/user/create/index', '', '/user/create', '添加用户', '#', 0, 1, 0, 0, 0, 2, 0, 1, 2, '2019-12-25 20:43:21'),
(28, '用户列表', '/system/user/list', '/system/user/list/index', '', '/user/index', '用户列表', '#', 0, 0, 0, 0, 0, 2, 0, 1, 2, '2019-12-31 09:16:43'),
(29, '用户编辑', '/system/user/edit/:id(\\d+)', '/system/user/edit/index', '', '/user/edit', '用户编辑', '#', 0, 1, 0, 0, 1, 2, 0, 1, 2, '2019-12-31 09:17:41'),
(30, '内容管理', '#', '#', '', '/article', '内容管理', '#', 0, 1, 0, 0, 0, 0, 0, 1, 0, '2019-12-31 09:49:54'),
(31, '创建文章', '/articles/create', '/articles/create/index', '', '/articles/create', '创建文章', '#', 0, 1, 0, 0, 0, 30, 0, 1, 1, '2019-12-31 09:51:12'),
(32, '文章编辑', '/articles/edit/:id(\\d+)', '/articles/edit/index', '', '/articles/edit', '文章编辑', '#', 0, 1, 0, 0, 1, 30, 0, 1, 1, '2019-12-31 09:51:56'),
(33, '文章列表', '/articles/list', '/articles/list/index', '', '/articles/list', '文章列表', '#', 0, 1, 0, 0, 0, 30, 0, 1, 1, '2019-12-31 09:52:36'),
(34, '上传图片', '/upload/image', '/upload/image', '', '/upload/image', '上传图片', '#', 0, 0, 0, 0, 1, 30, 0, 1, 1, '2020-06-19 18:24:32'),
(35, '删除上传图片', '/del/image', '/del/image', '', '/del/image', '删除上传图片', '#', 0, 0, 0, 0, 1, 30, 0, 1, 1, '2020-06-19 18:26:14');
-- --------------------------------------------------------
--
-- 表的结构 `system_role`
--
DROP TABLE IF EXISTS `system_role`;
CREATE TABLE `system_role` (
`id` int(11) NOT NULL COMMENT '主键',
`name` varchar(100) NOT NULL COMMENT '角色名称',
`alias_name` varchar(50) NOT NULL DEFAULT '' COMMENT '别名',
`description` varchar(200) NOT NULL DEFAULT '' COMMENT '描述',
`status` tinyint(4) NOT NULL DEFAULT '1' COMMENT '角色状态(0无效1有效)',
`type` int(4) NOT NULL DEFAULT '1' COMMENT '属于哪个应用',
`ctime` datetime NOT NULL COMMENT '创建时间'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='角色';
--
-- 转存表中的数据 `system_role`
--
INSERT INTO `system_role` (`id`, `name`, `alias_name`, `description`, `status`, `type`, `ctime`) VALUES
(1, 'admin', 'admin', '超级管理员具有所有权限', 1, 1, '2019-11-07 16:22:29'),
(2, 'editor', 'editor', '运营者', 1, 1, '2019-11-07 16:22:29'),
(3, 'normal', 'normal', '普通管理员', 0, 0, '0001-01-01 00:00:00');
-- --------------------------------------------------------
--
-- 表的结构 `system_role_menu`
--
DROP TABLE IF EXISTS `system_role_menu`;
CREATE TABLE `system_role_menu` (
`id` int(11) NOT NULL COMMENT '主键',
`system_role_id` int(11) NOT NULL DEFAULT '0' COMMENT '角色主键',
`system_menu_id` int(11) NOT NULL DEFAULT '0' COMMENT '菜单主键'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='角色与菜单关联表';
--
-- 转存表中的数据 `system_role_menu`
--
INSERT INTO `system_role_menu` (`id`, `system_role_id`, `system_menu_id`) VALUES
(14, 1, 1),
(15, 1, 2),
(19, 1, 3),
(20, 1, 26),
(16, 1, 27),
(17, 1, 28),
(18, 1, 29),
(21, 1, 30),
(22, 1, 31),
(23, 1, 32),
(24, 1, 33),
(25, 1, 34),
(26, 1, 35);
-- --------------------------------------------------------
--
-- 表的结构 `system_user`
--
DROP TABLE IF EXISTS `system_user`;
CREATE TABLE `system_user` (
`id` int(11) NOT NULL COMMENT '主键',
`name` varchar(50) CHARACTER SET utf8mb4 NOT NULL COMMENT '登录名',
`nickname` varchar(50) CHARACTER SET utf8mb4 NOT NULL DEFAULT '' COMMENT '用户昵称',
`password` varchar(50) NOT NULL COMMENT '密码',
`salt` varchar(4) NOT NULL COMMENT '盐',
`phone` varchar(11) NOT NULL DEFAULT '' COMMENT '手机号',
`avatar` varchar(300) NOT NULL DEFAULT '' COMMENT '头像',
`introduction` varchar(300) NOT NULL DEFAULT '' COMMENT '简介',
`status` tinyint(4) NOT NULL DEFAULT '1' COMMENT '状态(0 停止1启动)',
`utime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
`last_login_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '上次登录时间',
`last_login_ip` varchar(50) NOT NULL DEFAULT '' COMMENT '最近登录IP',
`ctime` datetime NOT NULL COMMENT '注册时间'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='管理账户表';
--
-- 转存表中的数据 `system_user`
--
INSERT INTO `system_user` (`id`, `name`, `nickname`, `password`, `salt`, `phone`, `avatar`, `introduction`, `status`, `utime`, `last_login_time`, `last_login_ip`, `ctime`) VALUES
(1, 'admin', 'admin', '297f8efd64f95e37a7d792d926a7b5db47c58403', 'MbBQ', '11111111111', 'https://wpimg.wallstcn.com/f778738c-e4f8-4870-b634-56703b4acafe.gif', '', 1, '2019-11-01 07:02:33', '0001-01-01 00:00:00', '', '2019-10-24 20:20:34'),
(3, 'admin1', 'admin1', '297f8efd64f95e37a7d792d926a7b5db47c58403', 'MbBQ', '11111111111', 'https://wpimg.wallstcn.com/f778738c-e4f8-4870-b634-56703b4acafe.gif', '', 1, '2020-03-18 15:15:55', '0000-00-00 00:00:00', '', '2019-10-24 20:20:34'),
(4, 'admin2', 'admin12', '297f8efd64f95e37a7d792d926a7b5db47c58403', 'MbBQ', '11111111111', 'https://wpimg.wallstcn.com/f778738c-e4f8-4870-b634-56703b4acafe.gif', '', 1, '2020-03-18 15:16:01', '0000-00-00 00:00:00', '', '2019-10-24 20:20:34'),
(5, 'admin3', 'admin123', '297f8efd64f95e37a7d792d926a7b5db47c58403', 'MbBQ', '11111111111', 'https://wpimg.wallstcn.com/f778738c-e4f8-4870-b634-56703b4acafe.gif', '', 1, '2020-03-18 15:16:06', '0000-00-00 00:00:00', '', '2019-10-24 20:20:34');
-- --------------------------------------------------------
--
-- 表的结构 `system_user_role`
--
DROP TABLE IF EXISTS `system_user_role`;
CREATE TABLE `system_user_role` (
`id` int(11) NOT NULL COMMENT '主键',
`system_user_id` int(11) NOT NULL COMMENT '用户主键',
`system_role_id` int(11) NOT NULL COMMENT '角色主键'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='账户和角色关联表';
--
-- 转存表中的数据 `system_user_role`
--
INSERT INTO `system_user_role` (`id`, `system_user_id`, `system_role_id`) VALUES
(4, 1, 1),
(5, 1, 2);
--
-- 转储表的索引
--
--
-- 表的索引 `system_article`
--
ALTER TABLE `system_article`
ADD PRIMARY KEY (`id`);
--
-- 表的索引 `system_log`
--
ALTER TABLE `system_log`
ADD PRIMARY KEY (`id`),
ADD KEY `RELATION_ID` (`relation_id`),
ADD KEY `SYSTEM_USER_ID` (`system_user_id`),
ADD KEY `CTIME` (`ctime`),
ADD KEY `RELATION_TABLE` (`relation_table`);
--
-- 表的索引 `system_menu`
--
ALTER TABLE `system_menu`
ADD PRIMARY KEY (`id`),
ADD KEY `idx_list` (`pid`,`sort`,`status`) USING BTREE,
ADD KEY `path` (`path`);
--
-- 表的索引 `system_role`
--
ALTER TABLE `system_role`
ADD PRIMARY KEY (`id`),
ADD KEY `TYPE` (`type`),
ADD KEY `STATUS` (`status`);
--
-- 表的索引 `system_role_menu`
--
ALTER TABLE `system_role_menu`
ADD PRIMARY KEY (`id`),
ADD KEY `system_role_id` (`system_role_id`,`system_menu_id`);
--
-- 表的索引 `system_user`
--
ALTER TABLE `system_user`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `NICKNAME` (`nickname`),
ADD KEY `PASSWORD` (`password`);
--
-- 表的索引 `system_user_role`
--
ALTER TABLE `system_user_role`
ADD PRIMARY KEY (`id`),
ADD KEY `system_user_id` (`system_user_id`,`system_role_id`);
--
-- 在导出的表使用AUTO_INCREMENT
--
--
-- 使用表AUTO_INCREMENT `system_article`
--
ALTER TABLE `system_article`
MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '主键', AUTO_INCREMENT=6;
--
-- 使用表AUTO_INCREMENT `system_log`
--
ALTER TABLE `system_log`
MODIFY `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键';
--
-- 使用表AUTO_INCREMENT `system_menu`
--
ALTER TABLE `system_menu`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键', AUTO_INCREMENT=37;
--
-- 使用表AUTO_INCREMENT `system_role`
--
ALTER TABLE `system_role`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键', AUTO_INCREMENT=4;
--
-- 使用表AUTO_INCREMENT `system_role_menu`
--
ALTER TABLE `system_role_menu`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键', AUTO_INCREMENT=27;
--
-- 使用表AUTO_INCREMENT `system_user`
--
ALTER TABLE `system_user`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键', AUTO_INCREMENT=6;
--
-- 使用表AUTO_INCREMENT `system_user_role`
--
ALTER TABLE `system_user_role`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键', AUTO_INCREMENT=6;
COMMIT;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; | the_stack |
DROP FUNCTION IF EXISTS report.getProductPriceAndAttributes(
M_ProductPrice_ID numeric,
M_HU_PI_Item_Product_ID numeric)
;
CREATE OR REPLACE FUNCTION report.getProductPriceAndAttributes(
M_ProductPrice_ID numeric, -- 1
M_HU_PI_Item_Product_ID numeric -- 2
)
RETURNS TABLE
(
M_ProductPrice_ID numeric,
M_AttributeSetInstance_ID numeric,
PriceStd numeric,
IsActive char(1),
M_HU_PI_Item_Product_ID numeric,
attributes text,
signature text,
M_PriceList_Version_ID numeric
)
AS
$$
SELECT pp.M_ProductPrice_ID,
COALESCE(ai.M_AttributeSetInstance_ID, pp.M_AttributeSetInstance_ID) AS m_attributesetinstance_id,
pp.PriceStd,
pp.IsActive,
pp.M_HU_PI_Item_Product_ID,
STRING_AGG(av.value, ', ' ORDER BY av.value) AS Attributes,
/** Create a column, that allows us to identify Attribute prices with the same AttributeSet
* That column will be filled with an empty string if all relevant data is null. this is important to prevent
* attribute prices to be compared with regular prices */
(
COALESCE(pp.M_HU_PI_Item_Product_ID || ' ', '') ||
COALESCE(pp.isDefault || ' ', '') ||
COALESCE(STRING_AGG(ai.M_Attribute_ID::text || ' ' || ai.M_Attributevalue_ID::text, ',' ORDER BY ai.M_Attribute_ID), '')
) AS signature,
pp.M_PriceList_Version_ID
FROM M_ProductPrice pp
--LEFT OUTER JOIN M_ProductPrice_Attribute_Line ppal ON ppa.M_ProductPrice_Attribute_ID = ppal.M_ProductPrice_Attribute_ID AND ppal.isActive = 'Y'
LEFT OUTER JOIN M_AttributeInstance ai ON pp.m_attributesetinstance_id = ai.m_attributesetinstance_id AND ai.isActive = 'Y'
LEFT OUTER JOIN (
SELECT av.isActive,
av.M_Attributevalue_ID,
CASE
WHEN a.Value = '1000015' AND av.value = '01' THEN NULL -- ADR & Keine/Leer
WHEN a.Value = '1000015' AND av.value IS NOT NULL THEN 'AdR' -- ADR
WHEN a.Value = '1000001' THEN av.value -- Herkunft
ELSE av.name
END AS value
FROM M_Attributevalue av
LEFT OUTER JOIN M_Attribute a ON av.M_Attribute_ID = a.M_Attribute_ID
) av ON ai.M_Attributevalue_ID = av.M_Attributevalue_ID AND av.IsActive = 'Y' AND av.value IS NOT NULL
WHERE pp.m_productprice_id = $1
AND (pp.m_hu_pi_item_product_id = $2 OR pp.m_hu_pi_item_product_id IS NULL)
AND pp.IsActive = 'Y'
GROUP BY pp.m_productprice_id, ai.m_attributesetinstance_id, pp.m_attributesetinstance_id, pp.pricestd, pp.isactive, pp.m_hu_pi_item_product_id
$$
LANGUAGE sql
STABLE
;
/*
* #%L
* de.metas.fresh.base
* %%
* Copyright (C) 2021 metas GmbH
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 2 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program. If not, see
* <http://www.gnu.org/licenses/gpl-2.0.html>.
* #L%
*/
DROP FUNCTION IF EXISTS report.reportPriceListComparation(
C_BPartner_ID numeric, -- 1
M_PriceList_Version_ID numeric, -- 2
Alt_PriceList_Version_ID numeric -- 3
)
;
CREATE OR REPLACE FUNCTION report.reportPriceListComparation(
C_BPartner_ID numeric, -- 1
M_PriceList_Version_ID numeric, -- 2
Alt_PriceList_Version_ID numeric -- 3
)
RETURNS TABLE
(
-- Displayed pricelist data
ProductCategory varchar,
ProductCategoryValue varchar,
M_Product_ID numeric,
Value varchar,
ProductName varchar,
IsSeasonFixedPrice char(1),
ItemProductName varchar,
PackingMaterialName varchar,
PriceStd numeric,
PricePattern1 varchar,
AltPriceStd numeric,
PricePattern2 varchar,
HasAltPrice integer,
UOMSymbol varchar,
attributes text,
SeqNo numeric,
-- Filter Columns
C_BPartner_ID numeric,
M_PriceList_Version_ID numeric,
Alt_PriceList_Version_ID numeric,
-- Additional internal infos to be used
M_ProductPrice_ID numeric,
M_AttributeSetInstance_ID numeric,
M_HU_PI_Item_Product_ID numeric,
UOM_X12DE355 varchar,
QtyCUsPerTU numeric,
m_hu_pi_version_id numeric,
currency char(3),
currency2 char(3)
)
AS
$$
/*
IMPORTANT: keep in sync with report.reportPriceListComparation_With_PP_PI
*/
SELECT -- Displayed pricelist data
pc.Name AS ProductCategory,
pc.value AS ProductCategoryValue,
pp.M_Product_ID AS M_Product_ID,
p.Value AS Value,
p.Name AS ProductName,
pp.IsSeasonFixedPrice AS IsSeasonFixedPrice,
hupip.Name AS ItemProductName,
pm.Name AS PackingMaterialName,
COALESCE(ppa.PriceStd, pp.PriceStd) AS PriceStd,
(CASE WHEN pl.priceprecision = 0 THEN '#,##0' ELSE SUBSTRING('#,##0.000' FROM 0 FOR 7 + pl.priceprecision :: integer) END) AS PricePattern1,
pp2.PriceStd AS AltPriceStd,
(CASE WHEN pl.priceprecision = 0 THEN '#,##0' ELSE SUBSTRING('#,##0.000' FROM 0 FOR 7 + pl2.priceprecision :: integer) END) AS PricePattern2,
CASE WHEN pp2.PriceStd IS NULL THEN 0 ELSE 1 END AS HasAltPrice,
uom.UOMSymbol AS UOMSymbol,
COALESCE(ppa.Attributes, '') AS attributes,
pp.seqNo AS SeqNo,
-- Filter Columns
$1 AS C_BPartner_ID,
plv.M_Pricelist_Version_ID AS M_Pricelist_Version_ID,
plv2.M_Pricelist_Version_ID AS Alt_PriceList_Version_ID,
-- Additional internal infos to be used
pp.M_ProductPrice_ID AS M_ProductPrice_ID,
ppa.m_attributesetinstance_ID AS m_attributesetinstance_ID,
bpProductPackingMaterial.M_HU_PI_Item_Product_ID AS M_HU_PI_Item_Product_ID,
uom.X12DE355 AS UOM_X12DE355,
hupip.Qty AS QtyCUsPerTU,
it.m_hu_pi_version_id AS m_hu_pi_version_id,
c.iso_code AS currency,
c2.iso_code AS currency2
FROM M_ProductPrice pp
INNER JOIN M_Product p ON pp.M_Product_ID = p.M_Product_ID AND p.isActive = 'Y'
INNER JOIN M_Product_Category pc ON p.M_Product_Category_ID = pc.M_Product_Category_ID AND pc.isActive = 'Y'
INNER JOIN C_UOM uom ON pp.C_UOM_ID = uom.C_UOM_ID AND uom.isActive = 'Y'
/*
* We know if there are packing instructions limited to the BPartner/product-combination. If so,
* we will use only those. If not, we will use only the non limited ones
*/
LEFT OUTER JOIN LATERAL
(
SELECT vip.M_HU_PI_Item_Product_ID, vip.M_Product_ID
FROM report.Valid_PI_Item_Product_V vip
-- WHERE isInfiniteCapacity = 'N' -- task 09045/09788: we can also export PiiPs with infinite capacity
WHERE vip.M_Product_ID = pp.M_Product_ID
AND CASE
WHEN
EXISTS(SELECT 1 FROM report.Valid_PI_Item_Product_V v WHERE v.M_Product_ID = pp.M_Product_ID AND v.hasPartner IS TRUE AND v.C_BPartner_ID = $1)
THEN vip.C_BPartner_ID = $1
ELSE vip.C_BPartner_ID IS NULL
END
) bpProductPackingMaterial ON TRUE
LEFT OUTER JOIN LATERAL report.getProductPriceAndAttributes(M_ProductPrice_ID := pp.M_ProductPrice_ID, M_HU_PI_Item_Product_ID := bpProductPackingMaterial.m_hu_pi_item_product_id) ppa ON TRUE
LEFT OUTER JOIN m_hu_pi_item_product hupip ON (CASE
WHEN pp.m_hu_pi_item_product_id IS NULL
THEN hupip.m_hu_pi_item_product_id = bpProductPackingMaterial.m_hu_pi_item_product_ID AND hupip.isActive = 'Y'
ELSE hupip.m_product_id = bpProductPackingMaterial.m_product_id AND hupip.isActive = 'Y'
END)
LEFT OUTER JOIN m_hu_pi_item it ON it.M_HU_PI_Item_ID = hupip.M_HU_PI_Item_ID AND it.isActive = 'Y'
LEFT OUTER JOIN m_hu_pi_item pmit ON pmit.m_hu_pi_version_id = it.m_hu_pi_version_id AND pmit.itemtype::TEXT = 'PM'::TEXT AND pmit.isActive = 'Y'
LEFT OUTER JOIN m_hu_packingmaterial pm ON pm.m_hu_packingmaterial_id = pmit.m_hu_packingmaterial_id AND pm.isActive = 'Y'
INNER JOIN M_PriceList_Version plv ON plv.M_PriceList_Version_ID = pp.M_PriceList_Version_ID AND plv.IsActive = 'Y'
--
-- Get Comparison Prices
--
-- Get all PriceList_Versions of the PriceList (we need all available PriceList_Version_IDs for outside filtering)
-- limited to the same PriceList because the Parameter validation rule is enforcing this
LEFT JOIN M_PriceList_Version plv2 ON plv2.M_PriceList_ID = plv.M_PriceList_ID AND plv2.IsActive = 'Y'
LEFT OUTER JOIN LATERAL (
SELECT COALESCE(ppa2.PriceStd, pp2.PriceStd) AS PriceStd, ppa2.signature
FROM M_ProductPrice pp2
INNER JOIN report.getProductPriceAndAttributes(M_ProductPrice_ID := pp2.M_ProductPrice_ID, M_HU_PI_Item_Product_ID := bpProductPackingMaterial.m_hu_pi_item_product_id) ppa2 ON TRUE
WHERE pp2.M_Product_ID = pp.M_Product_ID
AND pp2.M_Pricelist_Version_ID = plv2.M_Pricelist_Version_ID
AND pp2.IsActive = 'Y'
AND (pp2.m_hu_pi_item_product_ID = pp.m_hu_pi_item_product_ID OR
(pp2.m_hu_pi_item_product_ID IS NULL AND pp.m_hu_pi_item_product_ID IS NULL))
AND pp2.isAttributeDependant = pp.isAttributeDependant
--avoid comparing different product prices in same pricelist
AND (CASE WHEN pp2.M_PriceList_Version_ID = pp.M_PriceList_Version_ID THEN pp2.M_ProductPrice_ID = pp.M_ProductPrice_ID ELSE TRUE END)
/* we have to make sure that only prices with the same attributes and packing instructions are compared. Note:
* - If there is an Existing Attribute Price but no signature related columns are filled the signature will be ''
* - If there are no Attribute Prices the signature will be null
* This is important, because otherwise an empty attribute price will be compared to the regular price AND the alternate attribute price */
AND (ppa.signature = ppa2.signature)
) pp2 ON TRUE
INNER JOIN M_Pricelist pl ON plv.M_Pricelist_ID = pl.M_PriceList_ID AND pl.isActive = 'Y'
LEFT JOIN M_Pricelist pl2 ON plv2.M_PriceList_ID = pl2.M_Pricelist_ID AND pl2.isActive = 'Y'
INNER JOIN C_Currency c ON pl.C_Currency_ID = c.C_Currency_ID AND c.isActive = 'Y'
LEFT JOIN C_Currency c2 ON pl2.C_Currency_ID = c2.C_CUrrency_ID AND c2.isActive = 'Y'
WHERE plv.M_Pricelist_Version_ID = $2
AND plv2.M_Pricelist_Version_ID = COALESCE($3, plv.m_pricelist_version_id)
AND CASE WHEN $3 IS NOT NULL THEN COALESCE(ppa.PriceStd, pp.PriceStd) != 0 ELSE COALESCE(ppa.PriceStd, pp.PriceStd) != 0 OR pp2.PriceStd != 0 END
AND pp.isActive = 'Y'
AND (pp.M_Attributesetinstance_ID = ppa.M_Attributesetinstance_ID OR pp.M_Attributesetinstance_ID IS NULL)
AND (pp.M_HU_PI_Item_Product_ID = bpProductPackingMaterial.M_HU_PI_Item_Product_ID OR pp.M_HU_PI_Item_Product_ID IS NULL)
AND (CASE WHEN plv2.M_PriceList_Version_ID = plv.M_PriceList_Version_ID THEN ppa.signature = pp2.signature ELSE TRUE END)
$$
LANGUAGE sql
STABLE
;
/*
* #%L
* de.metas.fresh.base
* %%
* Copyright (C) 2021 metas GmbH
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 2 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program. If not, see
* <http://www.gnu.org/licenses/gpl-2.0.html>.
* #L%
*/
DROP FUNCTION IF EXISTS report.reportPriceListComparation_With_PP_PI(
C_BPartner_ID numeric, -- 1
M_PriceList_Version_ID numeric, -- 2
Alt_PriceList_Version_ID numeric -- 3
)
;
CREATE OR REPLACE FUNCTION report.reportPriceListComparation_With_PP_PI(
C_BPartner_ID numeric, -- 1
M_PriceList_Version_ID numeric, -- 2
Alt_PriceList_Version_ID numeric -- 3
)
RETURNS TABLE
(
-- Displayed pricelist data
ProductCategory varchar,
ProductCategoryValue varchar,
M_Product_ID numeric,
Value varchar,
ProductName varchar,
IsSeasonFixedPrice char(1),
ItemProductName varchar,
PackingMaterialName varchar,
PriceStd numeric,
PricePattern1 varchar,
AltPriceStd numeric,
PricePattern2 varchar,
HasAltPrice integer,
UOMSymbol varchar,
attributes text,
SeqNo numeric,
-- Filter Columns
C_BPartner_ID numeric,
M_PriceList_Version_ID numeric,
Alt_PriceList_Version_ID numeric,
-- Additional internal infos to be used
M_ProductPrice_ID numeric,
M_AttributeSetInstance_ID numeric,
M_HU_PI_Item_Product_ID numeric,
UOM_X12DE355 varchar,
QtyCUsPerTU numeric,
m_hu_pi_version_id numeric,
currency char(3),
currency2 char(3)
)
AS
$$
/*
IMPORTANT: keep in sync with report.reportPriceListComparation
*/
SELECT
-- Displayed pricelist data
pc.Name AS ProductCategory,
pc.value AS ProductCategoryValue,
pp.M_Product_ID AS M_Product_ID,
p.Value AS Value,
p.Name AS ProductName,
pp.IsSeasonFixedPrice AS IsSeasonFixedPrice,
hupip.Name AS ItemProductName,
pm.Name AS PackingMaterialName,
COALESCE(ppa.PriceStd, pp.PriceStd) AS PriceStd,
(CASE WHEN pl.priceprecision = 0 THEN '#,##0' ELSE SUBSTRING('#,##0.000' FROM 0 FOR 7 + pl.priceprecision :: integer) END) AS PricePattern1,
pp2.PriceStd AS AltPriceStd,
(CASE WHEN pl.priceprecision = 0 THEN '#,##0' ELSE SUBSTRING('#,##0.000' FROM 0 FOR 7 + pl2.priceprecision :: integer) END) AS PricePattern2,
CASE WHEN pp2.PriceStd IS NULL THEN 0 ELSE 1 END AS HasAltPrice,
uom.UOMSymbol AS UOMSymbol,
COALESCE(ppa.Attributes, '') AS attributes,
pp.seqNo AS SeqNo,
-- Filter Columns
$1 AS C_BPartner_ID,
plv.M_Pricelist_Version_ID AS M_Pricelist_Version_ID,
plv2.M_Pricelist_Version_ID AS Alt_PriceList_Version_ID,
-- Additional internal infos to be used
pp.M_ProductPrice_ID AS M_ProductPrice_ID,
ppa.m_attributesetinstance_ID AS m_attributesetinstance_ID,
pp.M_HU_PI_Item_Product_ID AS M_HU_PI_Item_Product_ID,
uom.X12DE355 AS UOM_X12DE355,
hupip.Qty AS QtyCUsPerTU,
it.m_hu_pi_version_id AS m_hu_pi_version_id,
c.iso_code AS currency,
c2.iso_code AS currency2
FROM M_ProductPrice pp
INNER JOIN M_Product p ON pp.M_Product_ID = p.M_Product_ID AND p.isActive = 'Y'
INNER JOIN M_Product_Category pc ON p.M_Product_Category_ID = pc.M_Product_Category_ID AND pc.isActive = 'Y'
INNER JOIN C_UOM uom ON pp.C_UOM_ID = uom.C_UOM_ID AND uom.isActive = 'Y'
/*
* We know if there are packing instructions limited to the BPartner/product-combination. If so,
* we will use only those. If not, we will use only the non limited ones
*/
LEFT OUTER JOIN LATERAL
(
SELECT vip.M_HU_PI_Item_Product_ID
FROM report.Valid_PI_Item_Product_V vip
-- WHERE isInfiniteCapacity = 'N' -- task 09045/09788: we can also export PiiPs with infinite capacity
WHERE vip.M_Product_ID = pp.M_Product_ID
AND CASE
WHEN
EXISTS(SELECT 1 FROM report.Valid_PI_Item_Product_V v WHERE v.M_Product_ID = pp.M_Product_ID AND v.hasPartner IS TRUE AND v.C_BPartner_ID = $1)
THEN vip.C_BPartner_ID = $1
ELSE vip.C_BPartner_ID IS NULL
END
) bpProductPackingMaterial ON TRUE
LEFT OUTER JOIN LATERAL report.getProductPriceAndAttributes(M_ProductPrice_ID := pp.M_ProductPrice_ID, M_HU_PI_Item_Product_ID := bpProductPackingMaterial.m_hu_pi_item_product_id) ppa ON TRUE
LEFT OUTER JOIN m_hu_pi_item_product hupip ON hupip.m_hu_pi_item_product_id = pp.m_hu_pi_item_product_ID AND hupip.isActive = 'Y'
LEFT OUTER JOIN m_hu_pi_item it ON it.M_HU_PI_Item_ID = hupip.M_HU_PI_Item_ID AND it.isActive = 'Y'
LEFT OUTER JOIN m_hu_pi_item pmit ON pmit.m_hu_pi_version_id = it.m_hu_pi_version_id AND pmit.itemtype::TEXT = 'PM'::TEXT AND pmit.isActive = 'Y'
LEFT OUTER JOIN m_hu_packingmaterial pm ON pm.m_hu_packingmaterial_id = pmit.m_hu_packingmaterial_id AND pm.isActive = 'Y'
INNER JOIN M_PriceList_Version plv ON plv.M_PriceList_Version_ID = pp.M_PriceList_Version_ID AND plv.IsActive = 'Y'
--
-- Get Comparison Prices
--
-- Get all PriceList_Versions of the PriceList (we need all available PriceList_Version_IDs for outside filtering)
-- limited to the same PriceList because the Parameter validation rule is enforcing this
LEFT JOIN M_PriceList_Version plv2 ON plv2.M_PriceList_ID = plv.M_PriceList_ID AND plv2.IsActive = 'Y'
LEFT OUTER JOIN LATERAL (
SELECT COALESCE(ppa2.PriceStd, pp2.PriceStd) AS PriceStd, ppa2.signature
FROM M_ProductPrice pp2
INNER JOIN report.getProductPriceAndAttributes(M_ProductPrice_ID := pp2.M_ProductPrice_ID, M_HU_PI_Item_Product_ID := bpProductPackingMaterial.m_hu_pi_item_product_id) ppa2 ON TRUE
WHERE pp2.M_Product_ID = pp.M_Product_ID
AND pp2.M_Pricelist_Version_ID = plv2.M_Pricelist_Version_ID
AND pp2.IsActive = 'Y'
AND (pp2.m_hu_pi_item_product_ID = pp.m_hu_pi_item_product_ID OR (pp2.m_hu_pi_item_product_ID IS NULL AND pp.m_hu_pi_item_product_ID IS NULL))
AND pp2.isAttributeDependant = pp.isAttributeDependant
--avoid comparing different product prices in same pricelist
AND (CASE WHEN pp2.M_PriceList_Version_ID = pp.M_PriceList_Version_ID THEN pp2.M_ProductPrice_ID = pp.M_ProductPrice_ID ELSE TRUE END)
/* we have to make sure that only prices with the same attributes and packing instructions are compared. Note:
* - If there is an Existing Attribute Price but no signature related columns are filled the signature will be ''
* - If there are no Attribute Prices the signature will be null
* This is important, because otherwise an empty attribute price will be compared to the regular price AND the alternate attribute price */
AND (ppa.signature = ppa2.signature)
) pp2 ON TRUE
INNER JOIN M_Pricelist pl ON plv.M_Pricelist_ID = pl.M_PriceList_ID AND pl.isActive = 'Y'
LEFT JOIN M_Pricelist pl2 ON plv2.M_PriceList_ID = pl2.M_Pricelist_ID AND pl2.isActive = 'Y'
INNER JOIN C_Currency c ON pl.C_Currency_ID = c.C_Currency_ID AND c.isActive = 'Y'
LEFT JOIN C_Currency c2 ON pl2.C_Currency_ID = c2.C_CUrrency_ID AND c2.isActive = 'Y'
WHERE plv.M_Pricelist_Version_ID = $2
AND plv2.M_Pricelist_Version_ID = COALESCE($3, plv.m_pricelist_version_id)
AND CASE WHEN $3 IS NOT NULL THEN COALESCE(ppa.PriceStd, pp.PriceStd) != 0 ELSE COALESCE(ppa.PriceStd, pp.PriceStd) != 0 OR pp2.PriceStd != 0 END
AND pp.isActive = 'Y'
AND (pp.M_Attributesetinstance_ID = ppa.M_Attributesetinstance_ID OR pp.M_Attributesetinstance_ID IS NULL)
AND (pp.M_HU_PI_Item_Product_ID = bpProductPackingMaterial.M_HU_PI_Item_Product_ID OR pp.M_HU_PI_Item_Product_ID IS NULL)
AND (CASE WHEN plv2.M_PriceList_Version_ID = plv.M_PriceList_Version_ID THEN ppa.signature = pp2.signature ELSE TRUE END)
GROUP BY pp.M_ProductPrice_ID,
pp.AD_Client_ID,
pp.Created,
pp.CreatedBy,
pp.Updated,
pp.UpdatedBy,
pp.IsActive,
pc.Name,
pc.value,
p.M_Product_ID,
p.Value,
p.Name,
pp.IsSeasonFixedPrice,
hupip.Name,
pm.Name,
COALESCE(ppa.PriceStd, pp.PriceStd),
pl.priceprecision,
pp2.PriceStd,
pl2.priceprecision,
CASE WHEN pp2.PriceStd IS NULL THEN 0 ELSE 1 END,
uom.UOMSymbol,
COALESCE(ppa.Attributes, ''),
pp.seqNo,
plv.M_Pricelist_Version_ID,
plv2.M_Pricelist_Version_ID,
pp.AD_Org_ID,
ppa.m_attributesetinstance_ID,
pp.M_HU_PI_Item_Product_ID,
uom.X12DE355,
hupip.Qty,
it.m_hu_pi_version_id,
c.iso_code,
c2.iso_code
$$
LANGUAGE sql
STABLE
;
DROP FUNCTION IF EXISTS report.fresh_PriceList_Details_Report(numeric,
numeric,
numeric,
character varying,
text)
;
CREATE OR REPLACE FUNCTION report.fresh_pricelist_details_report(IN p_c_bpartner_id numeric,
IN p_m_pricelist_version_id numeric,
IN p_alt_pricelist_version_id numeric,
IN p_ad_language character varying,
IN p_show_product_price_pi_flag text)
RETURNS TABLE
(
bp_value text,
bp_name text,
productcategory text,
m_product_id integer,
value text,
customerproductnumber text,
productname text,
isseasonfixedprice character,
itemproductname character varying,
qtycuspertu numeric,
packingmaterialname text,
pricestd numeric,
PricePattern1 text,
altpricestd numeric,
PricePattern2 text,
hasaltprice integer,
uomsymbol text,
uom_x12de355 text,
attributes text,
m_productprice_id integer,
m_attributesetinstance_id integer,
m_hu_pi_item_product_id integer,
currency character(3),
currency2 character(3),
show_product_price_pi_flag text
)
AS
$BODY$
/**
IMPORTANT: keep in sync with report.fresh_PriceList_Details_Report_With_PP_PI
*/
SELECT --
bp.value AS BP_Value,
bp.name AS BP_Name,
plc.ProductCategory,
plc.M_Product_ID::integer,
plc.Value,
bpp.ProductNo AS CustomerProductNumber,
COALESCE(p_trl.name, plc.ProductName) AS ProductName,
plc.IsSeasonFixedPrice,
CASE WHEN plc.m_hu_pi_version_id = 101 THEN NULL ELSE plc.ItemProductName END AS ItemProductName,
plc.QtyCUsPerTU,
plc.PackingMaterialName,
plc.PriceStd,
PricePattern1,
plc.AltPriceStd,
PricePattern2,
plc.HasAltPrice,
plc.UOMSymbol,
plc.UOM_X12DE355::text,
CASE WHEN p_ad_language = 'fr_CH' THEN REPLACE(plc.Attributes, 'AdR', 'DLR') ELSE plc.Attributes END AS Attributes,
plc.M_ProductPrice_ID::integer,
plc.M_AttributeSetInstance_ID::integer,
plc.M_HU_PI_Item_Product_ID::integer,
plc.currency AS currency,
plc.currency2 AS currency2,
p_show_product_price_pi_flag AS show_product_price_pi_flag
FROM report.reportPriceListComparation(
C_BPartner_ID := p_c_bpartner_id,
M_PriceList_Version_ID := p_m_pricelist_version_id,
Alt_PriceList_Version_ID := p_alt_pricelist_version_id
) plc
LEFT OUTER JOIN M_Product_Trl p_trl ON p_trl.M_Product_ID = plc.M_Product_ID AND p_trl.AD_Language = p_ad_language AND p_trl.isActive = 'Y'
LEFT OUTER JOIN C_BPartner bp ON bp.C_BPartner_ID = plc.C_BPartner_ID AND bp.isActive = 'Y'
LEFT OUTER JOIN C_BPartner_Product bpp ON bpp.C_BPartner_ID = plc.C_BPartner_ID AND bpp.M_Product_ID = plc.M_Product_ID AND bpp.isActive = 'Y'
ORDER BY plc.ProductCategoryValue,
plc.ProductName,
plc.seqNo,
plc.attributes,
plc.ItemProductName;
--
$BODY$
LANGUAGE sql STABLE
COST 100
ROWS 1000
;
DROP FUNCTION IF EXISTS report.fresh_PriceList_Details_Report_With_PP_PI(numeric,
numeric,
numeric,
character varying,
text)
;
CREATE OR REPLACE FUNCTION report.fresh_pricelist_details_report_With_PP_PI(IN p_c_bpartner_id numeric,
IN p_m_pricelist_version_id numeric,
IN p_alt_pricelist_version_id numeric,
IN p_ad_language character varying,
IN p_show_product_price_pi_flag text)
RETURNS TABLE
(
bp_value text,
bp_name text,
productcategory text,
m_product_id integer,
value text,
customerproductnumber text,
productname text,
isseasonfixedprice character,
itemproductname character varying,
qtycuspertu numeric,
packingmaterialname text,
pricestd numeric,
PricePattern1 text,
altpricestd numeric,
PricePattern2 text,
hasaltprice integer,
uomsymbol text,
uom_x12de355 text,
attributes text,
m_productprice_id integer,
m_attributesetinstance_id integer,
m_hu_pi_item_product_id integer,
currency character(3),
currency2 character(3),
show_product_price_pi_flag text
)
AS
$BODY$
/**
IMPORTANT: keep in sync with report.fresh_PriceList_Details_Report
*/
SELECT --
bp.value AS BP_Value,
bp.name AS BP_Name,
plc.ProductCategory,
plc.M_Product_ID::integer,
plc.Value,
bpp.ProductNo AS CustomerProductNumber,
COALESCE(p_trl.name, plc.ProductName) AS ProductName,
plc.IsSeasonFixedPrice,
CASE WHEN plc.m_hu_pi_version_id = 101 THEN NULL ELSE plc.ItemProductName END AS ItemProductName,
plc.QtyCUsPerTU,
plc.PackingMaterialName,
plc.PriceStd,
PricePattern1,
plc.AltPriceStd,
PricePattern2,
plc.HasAltPrice,
plc.UOMSymbol,
plc.UOM_X12DE355::text,
CASE WHEN p_ad_language = 'fr_CH' THEN REPLACE(plc.Attributes, 'AdR', 'DLR') ELSE plc.Attributes END AS Attributes,
plc.M_ProductPrice_ID::integer,
plc.M_AttributeSetInstance_ID::integer,
plc.M_HU_PI_Item_Product_ID::integer,
plc.currency AS currency,
plc.currency2 AS currency2,
p_show_product_price_pi_flag AS show_product_price_pi_flag
FROM report.reportPriceListComparation_With_PP_PI(
C_BPartner_ID := p_c_bpartner_id,
M_PriceList_Version_ID := p_m_pricelist_version_id,
Alt_PriceList_Version_ID := p_alt_pricelist_version_id
) plc
LEFT OUTER JOIN M_Product_Trl p_trl ON p_trl.M_Product_ID = plc.M_Product_ID AND p_trl.AD_Language = p_ad_language AND p_trl.isActive = 'Y'
LEFT OUTER JOIN C_BPartner bp ON bp.C_BPartner_ID = plc.C_BPartner_ID AND bp.isActive = 'Y'
LEFT OUTER JOIN C_BPartner_Product bpp ON bpp.C_BPartner_ID = plc.C_BPartner_ID AND bpp.M_Product_ID = plc.M_Product_ID AND bpp.isActive = 'Y'
ORDER BY plc.ProductCategoryValue,
plc.ProductName,
plc.seqNo,
plc.attributes,
plc.ItemProductName;
--
$BODY$
LANGUAGE sql STABLE
COST 100
ROWS 1000
; | the_stack |
--
-- PostgreSQL database dump
--
SET statement_timeout = 0;
SET lock_timeout = 0;
SET client_encoding = 'UTF8';
SET standard_conforming_strings = on;
SET check_function_bodies = false;
SET client_min_messages = warning;
--
-- Name: plpgsql; Type: EXTENSION; Schema: -; Owner: -
--
CREATE EXTENSION IF NOT EXISTS plpgsql WITH SCHEMA pg_catalog;
--
-- Name: EXTENSION plpgsql; Type: COMMENT; Schema: -; Owner: -
--
COMMENT ON EXTENSION plpgsql IS 'PL/pgSQL procedural language';
--
-- Name: dblink; Type: EXTENSION; Schema: -; Owner: -
--
CREATE EXTENSION IF NOT EXISTS dblink WITH SCHEMA public;
--
-- Name: EXTENSION dblink; Type: COMMENT; Schema: -; Owner: -
--
COMMENT ON EXTENSION dblink IS 'connect to other PostgreSQL databases from within a database';
--
-- Name: hstore; Type: EXTENSION; Schema: -; Owner: -
--
CREATE EXTENSION IF NOT EXISTS hstore WITH SCHEMA public;
--
-- Name: EXTENSION hstore; Type: COMMENT; Schema: -; Owner: -
--
COMMENT ON EXTENSION hstore IS 'data type for storing sets of (key, value) pairs';
SET search_path = public, pg_catalog;
SET default_tablespace = '';
SET default_with_oids = false;
--
-- Name: accounts; Type: TABLE; Schema: public; Owner: -; Tablespace:
--
CREATE TABLE accounts (
id integer NOT NULL,
first_name character varying(40),
last_name character varying(40),
email character varying(100),
hashed_password character varying(255),
created_at timestamp without time zone,
updated_at timestamp without time zone,
identities hstore,
language character varying(3) DEFAULT 'eng'::character varying,
document_language character varying(3) DEFAULT 'eng'::character varying
);
--
-- Name: accounts_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--
CREATE SEQUENCE accounts_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
--
-- Name: accounts_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--
ALTER SEQUENCE accounts_id_seq OWNED BY accounts.id;
--
-- Name: annotations; Type: TABLE; Schema: public; Owner: -; Tablespace:
--
CREATE TABLE annotations (
id integer NOT NULL,
organization_id integer NOT NULL,
account_id integer NOT NULL,
document_id integer NOT NULL,
page_number integer NOT NULL,
access integer NOT NULL,
title text NOT NULL,
content text,
location character varying(40),
created_at timestamp without time zone,
updated_at timestamp without time zone
);
--
-- Name: annotations_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--
CREATE SEQUENCE annotations_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
--
-- Name: annotations_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--
ALTER SEQUENCE annotations_id_seq OWNED BY annotations.id;
--
-- Name: app_constants; Type: TABLE; Schema: public; Owner: -; Tablespace:
--
CREATE TABLE app_constants (
id integer NOT NULL,
key character varying(255),
value character varying(255)
);
--
-- Name: app_constants_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--
CREATE SEQUENCE app_constants_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
--
-- Name: app_constants_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--
ALTER SEQUENCE app_constants_id_seq OWNED BY app_constants.id;
--
-- Name: bull_proof_china_shop_account_requests; Type: TABLE; Schema: public; Owner: -; Tablespace:
--
CREATE TABLE bull_proof_china_shop_account_requests (
id integer NOT NULL,
created_at timestamp without time zone,
updated_at timestamp without time zone,
requester_email character varying(255),
requester_first_name character varying(255),
requester_last_name character varying(255),
requester_notes text,
organization_name character varying(255),
organization_url character varying(255),
approver_email character varying(255),
approver_first_name character varying(255),
approver_last_name character varying(255),
country character varying(255) NOT NULL,
verification_notes text,
status integer DEFAULT 1,
agreed_to_terms boolean DEFAULT false,
authorized_posting boolean DEFAULT false,
token character varying(255),
industry character varying(255),
use_case text,
reference_links text,
marketing_optin boolean DEFAULT false,
in_market boolean DEFAULT false,
requester_position character varying
);
--
-- Name: bull_proof_china_shop_account_requests_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--
CREATE SEQUENCE bull_proof_china_shop_account_requests_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
--
-- Name: bull_proof_china_shop_account_requests_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--
ALTER SEQUENCE bull_proof_china_shop_account_requests_id_seq OWNED BY bull_proof_china_shop_account_requests.id;
--
-- Name: bull_proof_china_shop_accounts; Type: TABLE; Schema: public; Owner: -; Tablespace:
--
CREATE TABLE bull_proof_china_shop_accounts (
id integer NOT NULL,
stripe_customer_id character varying,
billing_email text,
dc_membership_id integer,
dc_membership_role integer,
dc_organization_id integer,
dc_account_id integer,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL
);
--
-- Name: bull_proof_china_shop_accounts_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--
CREATE SEQUENCE bull_proof_china_shop_accounts_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
--
-- Name: bull_proof_china_shop_accounts_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--
ALTER SEQUENCE bull_proof_china_shop_accounts_id_seq OWNED BY bull_proof_china_shop_accounts.id;
--
-- Name: bull_proof_china_shop_permits; Type: TABLE; Schema: public; Owner: -; Tablespace:
--
CREATE TABLE bull_proof_china_shop_permits (
id integer NOT NULL,
stripe_plan_id character varying,
stripe_customer_id character varying,
stripe_card_id character varying,
dc_membership_id integer,
dc_account_id integer,
dc_organization_id integer,
dc_membership_role integer,
status integer DEFAULT 1,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL,
stripe_subscription_id character varying,
stripe_customer_email character varying,
stripe_card_last4 integer,
account_id integer,
start_date timestamp without time zone,
end_date_scheduled timestamp without time zone,
end_date_actual timestamp without time zone
);
--
-- Name: bull_proof_china_shop_permits_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--
CREATE SEQUENCE bull_proof_china_shop_permits_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
--
-- Name: bull_proof_china_shop_permits_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--
ALTER SEQUENCE bull_proof_china_shop_permits_id_seq OWNED BY bull_proof_china_shop_permits.id;
--
-- Name: collaborations; Type: TABLE; Schema: public; Owner: -; Tablespace:
--
CREATE TABLE collaborations (
id integer NOT NULL,
project_id integer NOT NULL,
account_id integer NOT NULL,
creator_id integer
);
--
-- Name: collaborations_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--
CREATE SEQUENCE collaborations_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
--
-- Name: collaborations_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--
ALTER SEQUENCE collaborations_id_seq OWNED BY collaborations.id;
--
-- Name: docdata; Type: TABLE; Schema: public; Owner: -; Tablespace:
--
CREATE TABLE docdata (
id integer NOT NULL,
document_id integer NOT NULL,
data hstore
);
--
-- Name: docdata_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--
CREATE SEQUENCE docdata_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
--
-- Name: docdata_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--
ALTER SEQUENCE docdata_id_seq OWNED BY docdata.id;
--
-- Name: document_reviewers; Type: TABLE; Schema: public; Owner: -; Tablespace:
--
CREATE TABLE document_reviewers (
id integer NOT NULL,
account_id integer NOT NULL,
document_id integer NOT NULL,
created_at timestamp without time zone,
updated_at timestamp without time zone
);
--
-- Name: document_reviewers_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--
CREATE SEQUENCE document_reviewers_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
--
-- Name: document_reviewers_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--
ALTER SEQUENCE document_reviewers_id_seq OWNED BY document_reviewers.id;
--
-- Name: documents; Type: TABLE; Schema: public; Owner: -; Tablespace:
--
CREATE TABLE documents (
id integer NOT NULL,
organization_id integer NOT NULL,
account_id integer NOT NULL,
access integer NOT NULL,
page_count integer DEFAULT 0 NOT NULL,
title character varying(1000) NOT NULL,
slug character varying(255) NOT NULL,
source character varying(1000),
language character varying(3),
description text,
calais_id character varying(40),
publication_date date,
created_at timestamp without time zone,
updated_at timestamp without time zone,
related_article text,
detected_remote_url text,
remote_url text,
publish_at timestamp without time zone,
text_changed boolean DEFAULT false NOT NULL,
hit_count integer DEFAULT 0 NOT NULL,
public_note_count integer DEFAULT 0 NOT NULL,
file_size integer DEFAULT 0 NOT NULL,
reviewer_count integer DEFAULT 0 NOT NULL,
char_count integer DEFAULT 0 NOT NULL,
original_extension character varying(255),
file_hash text
);
--
-- Name: documents_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--
CREATE SEQUENCE documents_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
--
-- Name: documents_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--
ALTER SEQUENCE documents_id_seq OWNED BY documents.id;
--
-- Name: entities; Type: TABLE; Schema: public; Owner: -; Tablespace:
--
CREATE TABLE entities (
id integer NOT NULL,
organization_id integer NOT NULL,
account_id integer NOT NULL,
document_id integer NOT NULL,
access integer NOT NULL,
kind character varying(40) NOT NULL,
value character varying(255) NOT NULL,
relevance double precision DEFAULT 0.0 NOT NULL,
calais_id character varying(40),
occurrences text
);
--
-- Name: entity_dates; Type: TABLE; Schema: public; Owner: -; Tablespace:
--
CREATE TABLE entity_dates (
id integer NOT NULL,
organization_id integer NOT NULL,
account_id integer NOT NULL,
document_id integer NOT NULL,
access integer NOT NULL,
date date NOT NULL,
occurrences text
);
--
-- Name: featured_reports; Type: TABLE; Schema: public; Owner: -; Tablespace:
--
CREATE TABLE featured_reports (
id integer NOT NULL,
url character varying(255) NOT NULL,
title character varying(255) NOT NULL,
organization character varying(255) NOT NULL,
article_date date NOT NULL,
writeup text NOT NULL,
present_order integer DEFAULT 0 NOT NULL,
created_at timestamp without time zone,
updated_at timestamp without time zone
);
--
-- Name: featured_reports_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--
CREATE SEQUENCE featured_reports_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
--
-- Name: featured_reports_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--
ALTER SEQUENCE featured_reports_id_seq OWNED BY featured_reports.id;
--
-- Name: projects; Type: TABLE; Schema: public; Owner: -; Tablespace:
--
CREATE TABLE projects (
id integer NOT NULL,
account_id integer,
title character varying(255),
description text,
hidden boolean DEFAULT false NOT NULL
);
--
-- Name: labels_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--
CREATE SEQUENCE labels_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
--
-- Name: labels_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--
ALTER SEQUENCE labels_id_seq OWNED BY projects.id;
--
-- Name: memberships; Type: TABLE; Schema: public; Owner: -; Tablespace:
--
CREATE TABLE memberships (
id integer NOT NULL,
organization_id integer NOT NULL,
account_id integer NOT NULL,
role integer NOT NULL,
"default" boolean DEFAULT false,
concealed boolean DEFAULT false
);
--
-- Name: memberships_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--
CREATE SEQUENCE memberships_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
--
-- Name: memberships_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--
ALTER SEQUENCE memberships_id_seq OWNED BY memberships.id;
--
-- Name: metadata_dates_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--
CREATE SEQUENCE metadata_dates_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
--
-- Name: metadata_dates_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--
ALTER SEQUENCE metadata_dates_id_seq OWNED BY entity_dates.id;
--
-- Name: metadata_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--
CREATE SEQUENCE metadata_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
--
-- Name: metadata_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--
ALTER SEQUENCE metadata_id_seq OWNED BY entities.id;
--
-- Name: organizations; Type: TABLE; Schema: public; Owner: -; Tablespace:
--
CREATE TABLE organizations (
id integer NOT NULL,
name character varying(100) NOT NULL,
slug character varying(100) NOT NULL,
created_at timestamp without time zone,
updated_at timestamp without time zone,
demo boolean DEFAULT false NOT NULL,
language character varying(3) DEFAULT 'eng'::character varying,
document_language character varying(3) DEFAULT 'eng'::character varying
);
--
-- Name: organizations_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--
CREATE SEQUENCE organizations_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
--
-- Name: organizations_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--
ALTER SEQUENCE organizations_id_seq OWNED BY organizations.id;
--
-- Name: page_count; Type: TABLE; Schema: public; Owner: -; Tablespace:
--
CREATE TABLE page_count (
document_id integer,
count bigint
);
--
-- Name: pages; Type: TABLE; Schema: public; Owner: -; Tablespace:
--
CREATE TABLE pages (
id integer NOT NULL,
organization_id integer NOT NULL,
account_id integer NOT NULL,
document_id integer NOT NULL,
access integer NOT NULL,
page_number integer NOT NULL,
text text NOT NULL,
start_offset integer,
end_offset integer,
aspect_ratio double precision
);
--
-- Name: pages_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--
CREATE SEQUENCE pages_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
--
-- Name: pages_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--
ALTER SEQUENCE pages_id_seq OWNED BY pages.id;
--
-- Name: processing_jobs; Type: TABLE; Schema: public; Owner: -; Tablespace:
--
CREATE TABLE processing_jobs (
id integer NOT NULL,
account_id integer NOT NULL,
cloud_crowd_id integer NOT NULL,
title character varying(1000) NOT NULL,
document_id integer,
action character varying,
options character varying,
complete boolean DEFAULT false
);
--
-- Name: processing_jobs_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--
CREATE SEQUENCE processing_jobs_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
--
-- Name: processing_jobs_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--
ALTER SEQUENCE processing_jobs_id_seq OWNED BY processing_jobs.id;
--
-- Name: project_memberships; Type: TABLE; Schema: public; Owner: -; Tablespace:
--
CREATE TABLE project_memberships (
id integer NOT NULL,
project_id integer NOT NULL,
document_id integer NOT NULL
);
--
-- Name: project_memberships_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--
CREATE SEQUENCE project_memberships_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
--
-- Name: project_memberships_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--
ALTER SEQUENCE project_memberships_id_seq OWNED BY project_memberships.id;
--
-- Name: schema_migrations; Type: TABLE; Schema: public; Owner: -; Tablespace:
--
CREATE TABLE schema_migrations (
version character varying(255) NOT NULL
);
--
-- Name: sections; Type: TABLE; Schema: public; Owner: -; Tablespace:
--
CREATE TABLE sections (
id integer NOT NULL,
organization_id integer NOT NULL,
account_id integer NOT NULL,
document_id integer NOT NULL,
access integer NOT NULL,
title text NOT NULL,
page_number integer NOT NULL
);
--
-- Name: sections_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--
CREATE SEQUENCE sections_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
--
-- Name: sections_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--
ALTER SEQUENCE sections_id_seq OWNED BY sections.id;
--
-- Name: security_keys; Type: TABLE; Schema: public; Owner: -; Tablespace:
--
CREATE TABLE security_keys (
id integer NOT NULL,
securable_type character varying(40) NOT NULL,
securable_id integer NOT NULL,
key character varying(40)
);
--
-- Name: security_keys_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--
CREATE SEQUENCE security_keys_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
--
-- Name: security_keys_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--
ALTER SEQUENCE security_keys_id_seq OWNED BY security_keys.id;
--
-- Name: upload_mailboxes; Type: TABLE; Schema: public; Owner: -; Tablespace:
--
CREATE TABLE upload_mailboxes (
id integer NOT NULL,
membership_id integer NOT NULL,
sender character varying(255) NOT NULL,
recipient character varying(255) NOT NULL,
upload_count integer DEFAULT 0,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL
);
--
-- Name: upload_mailboxes_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--
CREATE SEQUENCE upload_mailboxes_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
--
-- Name: upload_mailboxes_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--
ALTER SEQUENCE upload_mailboxes_id_seq OWNED BY upload_mailboxes.id;
--
-- Name: id; Type: DEFAULT; Schema: public; Owner: -
--
ALTER TABLE ONLY accounts ALTER COLUMN id SET DEFAULT nextval('accounts_id_seq'::regclass);
--
-- Name: id; Type: DEFAULT; Schema: public; Owner: -
--
ALTER TABLE ONLY annotations ALTER COLUMN id SET DEFAULT nextval('annotations_id_seq'::regclass);
--
-- Name: id; Type: DEFAULT; Schema: public; Owner: -
--
ALTER TABLE ONLY app_constants ALTER COLUMN id SET DEFAULT nextval('app_constants_id_seq'::regclass);
--
-- Name: id; Type: DEFAULT; Schema: public; Owner: -
--
ALTER TABLE ONLY bull_proof_china_shop_account_requests ALTER COLUMN id SET DEFAULT nextval('bull_proof_china_shop_account_requests_id_seq'::regclass);
--
-- Name: id; Type: DEFAULT; Schema: public; Owner: -
--
ALTER TABLE ONLY bull_proof_china_shop_accounts ALTER COLUMN id SET DEFAULT nextval('bull_proof_china_shop_accounts_id_seq'::regclass);
--
-- Name: id; Type: DEFAULT; Schema: public; Owner: -
--
ALTER TABLE ONLY bull_proof_china_shop_permits ALTER COLUMN id SET DEFAULT nextval('bull_proof_china_shop_permits_id_seq'::regclass);
--
-- Name: id; Type: DEFAULT; Schema: public; Owner: -
--
ALTER TABLE ONLY collaborations ALTER COLUMN id SET DEFAULT nextval('collaborations_id_seq'::regclass);
--
-- Name: id; Type: DEFAULT; Schema: public; Owner: -
--
ALTER TABLE ONLY docdata ALTER COLUMN id SET DEFAULT nextval('docdata_id_seq'::regclass);
--
-- Name: id; Type: DEFAULT; Schema: public; Owner: -
--
ALTER TABLE ONLY document_reviewers ALTER COLUMN id SET DEFAULT nextval('document_reviewers_id_seq'::regclass);
--
-- Name: id; Type: DEFAULT; Schema: public; Owner: -
--
ALTER TABLE ONLY documents ALTER COLUMN id SET DEFAULT nextval('documents_id_seq'::regclass);
--
-- Name: id; Type: DEFAULT; Schema: public; Owner: -
--
ALTER TABLE ONLY entities ALTER COLUMN id SET DEFAULT nextval('metadata_id_seq'::regclass);
--
-- Name: id; Type: DEFAULT; Schema: public; Owner: -
--
ALTER TABLE ONLY entity_dates ALTER COLUMN id SET DEFAULT nextval('metadata_dates_id_seq'::regclass);
--
-- Name: id; Type: DEFAULT; Schema: public; Owner: -
--
ALTER TABLE ONLY featured_reports ALTER COLUMN id SET DEFAULT nextval('featured_reports_id_seq'::regclass);
--
-- Name: id; Type: DEFAULT; Schema: public; Owner: -
--
ALTER TABLE ONLY memberships ALTER COLUMN id SET DEFAULT nextval('memberships_id_seq'::regclass);
--
-- Name: id; Type: DEFAULT; Schema: public; Owner: -
--
ALTER TABLE ONLY organizations ALTER COLUMN id SET DEFAULT nextval('organizations_id_seq'::regclass);
--
-- Name: id; Type: DEFAULT; Schema: public; Owner: -
--
ALTER TABLE ONLY pages ALTER COLUMN id SET DEFAULT nextval('pages_id_seq'::regclass);
--
-- Name: id; Type: DEFAULT; Schema: public; Owner: -
--
ALTER TABLE ONLY processing_jobs ALTER COLUMN id SET DEFAULT nextval('processing_jobs_id_seq'::regclass);
--
-- Name: id; Type: DEFAULT; Schema: public; Owner: -
--
ALTER TABLE ONLY project_memberships ALTER COLUMN id SET DEFAULT nextval('project_memberships_id_seq'::regclass);
--
-- Name: id; Type: DEFAULT; Schema: public; Owner: -
--
ALTER TABLE ONLY projects ALTER COLUMN id SET DEFAULT nextval('labels_id_seq'::regclass);
--
-- Name: id; Type: DEFAULT; Schema: public; Owner: -
--
ALTER TABLE ONLY sections ALTER COLUMN id SET DEFAULT nextval('sections_id_seq'::regclass);
--
-- Name: id; Type: DEFAULT; Schema: public; Owner: -
--
ALTER TABLE ONLY security_keys ALTER COLUMN id SET DEFAULT nextval('security_keys_id_seq'::regclass);
--
-- Name: id; Type: DEFAULT; Schema: public; Owner: -
--
ALTER TABLE ONLY upload_mailboxes ALTER COLUMN id SET DEFAULT nextval('upload_mailboxes_id_seq'::regclass);
--
-- Name: accounts_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
--
ALTER TABLE ONLY accounts
ADD CONSTRAINT accounts_pkey PRIMARY KEY (id);
--
-- Name: annotations_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
--
ALTER TABLE ONLY annotations
ADD CONSTRAINT annotations_pkey PRIMARY KEY (id);
--
-- Name: app_constants_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
--
ALTER TABLE ONLY app_constants
ADD CONSTRAINT app_constants_pkey PRIMARY KEY (id);
--
-- Name: bull_proof_china_shop_account_requests_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
--
ALTER TABLE ONLY bull_proof_china_shop_account_requests
ADD CONSTRAINT bull_proof_china_shop_account_requests_pkey PRIMARY KEY (id);
--
-- Name: bull_proof_china_shop_accounts_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
--
ALTER TABLE ONLY bull_proof_china_shop_accounts
ADD CONSTRAINT bull_proof_china_shop_accounts_pkey PRIMARY KEY (id);
--
-- Name: bull_proof_china_shop_permits_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
--
ALTER TABLE ONLY bull_proof_china_shop_permits
ADD CONSTRAINT bull_proof_china_shop_permits_pkey PRIMARY KEY (id);
--
-- Name: collaborations_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
--
ALTER TABLE ONLY collaborations
ADD CONSTRAINT collaborations_pkey PRIMARY KEY (id);
--
-- Name: docdata_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
--
ALTER TABLE ONLY docdata
ADD CONSTRAINT docdata_pkey PRIMARY KEY (id);
--
-- Name: document_reviewers_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
--
ALTER TABLE ONLY document_reviewers
ADD CONSTRAINT document_reviewers_pkey PRIMARY KEY (id);
--
-- Name: documents_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
--
ALTER TABLE ONLY documents
ADD CONSTRAINT documents_pkey PRIMARY KEY (id);
--
-- Name: featured_reports_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
--
ALTER TABLE ONLY featured_reports
ADD CONSTRAINT featured_reports_pkey PRIMARY KEY (id);
--
-- Name: labels_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
--
ALTER TABLE ONLY projects
ADD CONSTRAINT labels_pkey PRIMARY KEY (id);
--
-- Name: memberships_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
--
ALTER TABLE ONLY memberships
ADD CONSTRAINT memberships_pkey PRIMARY KEY (id);
--
-- Name: metadata_dates_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
--
ALTER TABLE ONLY entity_dates
ADD CONSTRAINT metadata_dates_pkey PRIMARY KEY (id);
--
-- Name: metadata_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
--
ALTER TABLE ONLY entities
ADD CONSTRAINT metadata_pkey PRIMARY KEY (id);
--
-- Name: organizations_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
--
ALTER TABLE ONLY organizations
ADD CONSTRAINT organizations_pkey PRIMARY KEY (id);
--
-- Name: pages_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
--
ALTER TABLE ONLY pages
ADD CONSTRAINT pages_pkey PRIMARY KEY (id);
--
-- Name: processing_jobs_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
--
ALTER TABLE ONLY processing_jobs
ADD CONSTRAINT processing_jobs_pkey PRIMARY KEY (id);
--
-- Name: project_memberships_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
--
ALTER TABLE ONLY project_memberships
ADD CONSTRAINT project_memberships_pkey PRIMARY KEY (id);
--
-- Name: sections_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
--
ALTER TABLE ONLY sections
ADD CONSTRAINT sections_pkey PRIMARY KEY (id);
--
-- Name: security_keys_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
--
ALTER TABLE ONLY security_keys
ADD CONSTRAINT security_keys_pkey PRIMARY KEY (id);
--
-- Name: upload_mailboxes_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
--
ALTER TABLE ONLY upload_mailboxes
ADD CONSTRAINT upload_mailboxes_pkey PRIMARY KEY (id);
--
-- Name: index_accounts_on_email; Type: INDEX; Schema: public; Owner: -; Tablespace:
--
CREATE UNIQUE INDEX index_accounts_on_email ON accounts USING btree (email);
--
-- Name: index_accounts_on_identites; Type: INDEX; Schema: public; Owner: -; Tablespace:
--
CREATE INDEX index_accounts_on_identites ON accounts USING gin (identities);
--
-- Name: index_annotations_on_document_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
--
CREATE INDEX index_annotations_on_document_id ON annotations USING btree (document_id);
--
-- Name: index_docdata_on_data; Type: INDEX; Schema: public; Owner: -; Tablespace:
--
CREATE INDEX index_docdata_on_data ON docdata USING gin (data);
--
-- Name: index_docdata_on_document_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
--
CREATE INDEX index_docdata_on_document_id ON docdata USING btree (document_id);
--
-- Name: index_documents_on_access; Type: INDEX; Schema: public; Owner: -; Tablespace:
--
CREATE INDEX index_documents_on_access ON documents USING btree (access);
--
-- Name: index_documents_on_access_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
--
CREATE INDEX index_documents_on_access_id ON documents USING btree (access, id);
--
-- Name: index_documents_on_access_orgnaization_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
--
CREATE INDEX index_documents_on_access_orgnaization_id ON documents USING btree (access, organization_id);
--
-- Name: index_documents_on_account_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
--
CREATE INDEX index_documents_on_account_id ON documents USING btree (account_id);
--
-- Name: index_documents_on_file_hash; Type: INDEX; Schema: public; Owner: -; Tablespace:
--
CREATE INDEX index_documents_on_file_hash ON documents USING btree (file_hash);
--
-- Name: index_documents_on_hit_count; Type: INDEX; Schema: public; Owner: -; Tablespace:
--
CREATE INDEX index_documents_on_hit_count ON documents USING btree (hit_count);
--
-- Name: index_documents_on_public_note_count; Type: INDEX; Schema: public; Owner: -; Tablespace:
--
CREATE INDEX index_documents_on_public_note_count ON documents USING btree (public_note_count);
--
-- Name: index_entities_on_value; Type: INDEX; Schema: public; Owner: -; Tablespace:
--
CREATE INDEX index_entities_on_value ON entities USING btree (lower((value)::text));
--
-- Name: index_labels_on_account_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
--
CREATE INDEX index_labels_on_account_id ON projects USING btree (account_id);
--
-- Name: index_memberships_on_account_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
--
CREATE INDEX index_memberships_on_account_id ON memberships USING btree (account_id);
--
-- Name: index_memberships_on_organization_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
--
CREATE INDEX index_memberships_on_organization_id ON memberships USING btree (organization_id);
--
-- Name: index_metadata_dates_on_document_id_and_date; Type: INDEX; Schema: public; Owner: -; Tablespace:
--
CREATE UNIQUE INDEX index_metadata_dates_on_document_id_and_date ON entity_dates USING btree (document_id, date);
--
-- Name: index_metadata_on_document_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
--
CREATE INDEX index_metadata_on_document_id ON entities USING btree (document_id);
--
-- Name: index_metadata_on_kind; Type: INDEX; Schema: public; Owner: -; Tablespace:
--
CREATE INDEX index_metadata_on_kind ON entities USING btree (kind);
--
-- Name: index_organizations_on_name; Type: INDEX; Schema: public; Owner: -; Tablespace:
--
CREATE UNIQUE INDEX index_organizations_on_name ON organizations USING btree (name);
--
-- Name: index_organizations_on_slug; Type: INDEX; Schema: public; Owner: -; Tablespace:
--
CREATE UNIQUE INDEX index_organizations_on_slug ON organizations USING btree (slug);
--
-- Name: index_pages_on_document_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
--
CREATE INDEX index_pages_on_document_id ON pages USING btree (document_id);
--
-- Name: index_pages_on_page_number; Type: INDEX; Schema: public; Owner: -; Tablespace:
--
CREATE INDEX index_pages_on_page_number ON pages USING btree (page_number);
--
-- Name: index_pages_on_start_offset_and_end_offset; Type: INDEX; Schema: public; Owner: -; Tablespace:
--
CREATE INDEX index_pages_on_start_offset_and_end_offset ON pages USING btree (start_offset, end_offset);
--
-- Name: index_processing_jobs_on_account_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
--
CREATE INDEX index_processing_jobs_on_account_id ON processing_jobs USING btree (account_id);
--
-- Name: index_processing_jobs_on_action; Type: INDEX; Schema: public; Owner: -; Tablespace:
--
CREATE INDEX index_processing_jobs_on_action ON processing_jobs USING btree (action);
--
-- Name: index_processing_jobs_on_cloud_crowd_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
--
CREATE INDEX index_processing_jobs_on_cloud_crowd_id ON processing_jobs USING btree (cloud_crowd_id);
--
-- Name: index_processing_jobs_on_document_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
--
CREATE INDEX index_processing_jobs_on_document_id ON processing_jobs USING btree (document_id);
--
-- Name: index_project_memberships_on_document_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
--
CREATE INDEX index_project_memberships_on_document_id ON project_memberships USING btree (document_id);
--
-- Name: index_project_memberships_on_project_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
--
CREATE INDEX index_project_memberships_on_project_id ON project_memberships USING btree (project_id);
--
-- Name: index_sections_on_document_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
--
CREATE INDEX index_sections_on_document_id ON sections USING btree (document_id);
--
-- Name: unique_schema_migrations; Type: INDEX; Schema: public; Owner: -; Tablespace:
--
CREATE UNIQUE INDEX unique_schema_migrations ON schema_migrations USING btree (version);
--
-- Name: public; Type: ACL; Schema: -; Owner: -
--
REVOKE ALL ON SCHEMA public FROM PUBLIC;
REVOKE ALL ON SCHEMA public FROM postgres;
GRANT ALL ON SCHEMA public TO postgres;
GRANT ALL ON SCHEMA public TO PUBLIC;
--
-- PostgreSQL database dump complete
--
--
-- PostgreSQL database dump
--
SET statement_timeout = 0;
SET lock_timeout = 0;
SET client_encoding = 'UTF8';
SET standard_conforming_strings = on;
SET check_function_bodies = false;
SET client_min_messages = warning;
SET search_path = public, pg_catalog;
--
-- Data for Name: schema_migrations; Type: TABLE DATA; Schema: public; Owner: -
--
COPY schema_migrations (version) FROM stdin;
1
20100108163304
20100108172251
20100109025746
20100109035508
20100109041445
20100112143144
20100114170350
20100120194128
20100120205426
20100125165305
20100208131000
20100208151651
20100212130932
20100218193708
20100219175757
20100301200857
20100304154343
20100316001441
20100317145034
20100317181051
20100401192921
20100413132825
20100607182008
20100624142442
20100625143140
20100630131224
20100701132413
20100823172339
20100928204710
20101025202334
20101028194006
20101101192020
20101103173409
20101207203607
20101209175540
20110111192934
20110113204915
20110114143536
20110217161649
20110217171353
20101110170100
20101214171909
20110207212034
20110216180521
20110224153154
20110303200824
20110303202721
20110304213500
20110308170707
20110310000919
20110502200512
20110505172648
20110429150927
20110512193718
20110603223356
20111026200513
20120131180323
20120927202457
20121108160450
20130107193641
20130108201748
20130109194211
20130327170939
20150603190250
20150612202649
20150617201312
20150629180149
20150629210433
20150713194717
20150812163030
20151111214857
20160120214245
20150817174942
20150820160300
20150820174640
20150820224857
20150820224935
20150826194337
20150826213441
20150826214706
20150826220106
20150827185809
20160129000705
20160929174005
\.
--
-- PostgreSQL database dump complete
-- | the_stack |
---------------
--allow RM-credit memo in manual SO-invoices
-- 11.08.2015 07:55
-- URL zum Konzept
UPDATE AD_Val_Rule SET Code='( C_DocType.DocBaseType IN (''API'',''APC'')
OR (C_DocType.DocBaseType IN (''ARC'',''ARI'') AND C_DocType.DocSubType IS NULL) /*only the default types*/
OR (C_DocType.DocBaseType=''ARC'' AND C_DocType.DocSubType = ''CS'') /*only the RMA-credit-memo*/
)
AND C_DocType.IsSOTrx=''@IsSOTrx@''', Description='Document Type AR/AP Invoice and Credit Memos, PLUS return material credit memo. Excludes other special-purpose invoice and credit memo types that are available via the "C_Invoice_Create CreditMemo" proc',Updated=TO_TIMESTAMP('2015-08-11 07:55:51','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Val_Rule_ID=540294
;
--------------
-- add OrderPOReference to the export-format and the cctop-500-view
-- 11.08.2015 12:17
-- URL zum Konzept
INSERT INTO AD_Element (AD_Client_ID,AD_Element_ID,AD_Org_ID,ColumnName,Created,CreatedBy,EntityType,IsActive,Name,PrintName,Updated,UpdatedBy) VALUES (0,542872,0,'OrderPOReference',TO_TIMESTAMP('2015-08-11 12:17:43','YYYY-MM-DD HH24:MI:SS'),100,'de.metas.esb.edi','Y','Auftragsreferenz','Auftragsreferenz',TO_TIMESTAMP('2015-08-11 12:17:43','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 11.08.2015 12:17
-- URL zum Konzept
INSERT INTO AD_Element_Trl (AD_Language,AD_Element_ID, Description,Help,Name,PO_Description,PO_Help,PO_Name,PO_PrintName,PrintName, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Element_ID, t.Description,t.Help,t.Name,t.PO_Description,t.PO_Help,t.PO_Name,t.PO_PrintName,t.PrintName, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Element t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Element_ID=542872 AND NOT EXISTS (SELECT * FROM AD_Element_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Element_ID=t.AD_Element_ID)
;
-- 11.08.2015 12:19
-- URL zum Konzept
INSERT INTO AD_Column (AD_Client_ID,AD_Column_ID,AD_Element_ID,AD_Org_ID,AD_Reference_ID,AD_Table_ID,AllowZoomTo,ColumnName,Created,CreatedBy,DDL_NoForeignKey,EntityType,FieldLength,IsActive,IsAdvancedText,IsAllowLogging,IsAlwaysUpdateable,IsAutocomplete,IsCalculated,IsDimension,IsEncrypted,IsGenericZoomKeyColumn,IsGenericZoomOrigin,IsIdentifier,IsKey,IsLazyLoading,IsMandatory,IsParent,IsSelectionColumn,IsStaleable,IsSyncDatabase,IsTranslated,IsUpdateable,IsUseDocSequence,Name,SeqNo,Updated,UpdatedBy,Version) VALUES (0,552627,542872,0,10,540463,'N','OrderPOReference',TO_TIMESTAMP('2015-08-11 12:19:10','YYYY-MM-DD HH24:MI:SS'),100,'N','de.metas.esb.edi',40,'Y','N','Y','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','Auftragsreferenz',0,TO_TIMESTAMP('2015-08-11 12:19:10','YYYY-MM-DD HH24:MI:SS'),100,0)
;
-- 11.08.2015 12:19
-- URL zum Konzept
INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=552627 AND NOT EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Column_ID=t.AD_Column_ID)
;
-- 11.08.2015 12:48
-- URL zum Konzept
INSERT INTO EXP_FormatLine (AD_Client_ID,AD_Column_ID,AD_Org_ID,Created,CreatedBy,EntityType,EXP_Format_ID,EXP_FormatLine_ID,IsActive,IsMandatory,IsPartUniqueIndex,Name,Position,Type,Updated,UpdatedBy,Value) VALUES (0,552627,0,TO_TIMESTAMP('2015-08-11 12:48:40','YYYY-MM-DD HH24:MI:SS'),100,'de.metas.esb.edi',540221,550145,'Y','N','N','OrderPOReference',195,'E',TO_TIMESTAMP('2015-08-11 12:48:40','YYYY-MM-DD HH24:MI:SS'),100,'OrderPOReference')
;
------------------
COMMIT;
-- DDL
DROP VIEW IF EXISTS edi_cctop_invoic_500_v;
CREATE OR REPLACE VIEW edi_cctop_invoic_500_v AS
SELECT
-- this aggregation is a workaround for the problem of sometimes having multiple invoice lines (within one invoice) for one EDI ORDERS line
SUM(il.qtyentered) AS qtyinvoiced, -- we output the Qty in the customer's UOM (i.e. QtyEntered)
MIN(il.c_invoiceline_id) AS edi_cctop_invoic_500_v_id,
SUM(il.linenetamt) AS linenetamt,
MIN(il.line) AS line,
il.c_invoice_id, il.c_invoice_id AS edi_cctop_invoic_v_id,
il.priceactual, il.pricelist,
pp.upc, -- in the invoic the customer expects the CU-EANs, not the TU-EANs (so we don't select upc_TU here)
p.value,
pp.productno AS vendorproductno,
substr(p.name::text, 1, 35) AS name,
substr(p.name::text, 36, 70) AS name2,
t.rate,
CASE
WHEN u.x12de355::text = 'TU'::text THEN 'PCE'::character varying
ELSE u.x12de355
END AS eancom_uom,
CASE
WHEN u_price.x12de355::text = 'TU'::text THEN 'PCE'::character varying
ELSE u_price.x12de355
END AS eancom_price_uom,
CASE
WHEN t.rate = 0::numeric THEN 'Y'::text
ELSE ''::text
END AS taxfree,
c.iso_code, il.ad_client_id, il.ad_org_id,
MIN(il.created) AS created,
MIN(il.createdby)::numeric(10,0) AS createdBy,
MAX(il.updated) AS updated,
MAX(il.updatedby)::numeric(10,0) AS updatedby,
il.isactive,
CASE pc.value
WHEN 'Leergut'::text THEN 'P'::text
ELSE ''::text
END AS leergut,
COALESCE(pp.productdescription, pp.description, p.description, p.name) AS productdescription, -- fallback from customer's description to our own description
ol.line AS OrderLine,
o.POReference AS OrderPOReference, -- task 09182
il.C_OrderLine_ID, -- grouping by C_OrderLine_ID to make sure that we don't aggregate too much
SUM(il.taxamtinfo) AS taxamtinfo
FROM c_invoiceline il
LEFT JOIN c_orderline ol ON ol.c_orderline_id = il.c_orderline_id
LEFT JOIN c_order o ON o.c_order_id = ol.c_order_id -- task 09182
LEFT JOIN c_currency c ON c.c_currency_id = ol.c_currency_id
LEFT JOIN m_product p ON p.m_product_id = il.m_product_id
LEFT JOIN m_product_category pc ON pc.m_product_category_id = p.m_product_category_id
LEFT JOIN c_invoice i ON i.c_invoice_id = il.c_invoice_id
LEFT JOIN c_bpartner_product pp ON pp.c_bpartner_id = i.c_bpartner_id AND pp.m_product_id = il.m_product_id
LEFT JOIN c_tax t ON t.c_tax_id = il.c_tax_id
LEFT JOIN c_uom u ON u.c_uom_id = il.c_uom_id -- do export the il's UOM because that's the UOM the customere ordered in (and it matches Qtyentered)
LEFT JOIN c_uom u_price ON u_price.c_uom_id = il.price_uom_id
WHERE il.m_product_id IS NOT NULL
GROUP BY
il.c_invoice_id,
il.priceactual, il.pricelist,
pp.upc,
p.value,
pp.productno,
substr(p.name::text, 1, 35), -- name
substr(p.name::text, 36, 70), -- name2
t.rate,
eancom_uom,
eancom_price_uom,
taxfree, c.iso_code, il.ad_client_id, il.ad_org_id,
il.isactive,
leergut,
COALESCE(pp.productdescription, pp.description, p.description, p.name), -- productdescription
OrderPOReference,
OrderLine,
il.C_OrderLine_ID -- grouping by C_OrderLine_ID to make sure that we don't aggregate too much
ORDER BY ol.line
;
COMMENT ON VIEW edi_cctop_invoic_500_v IS 'Notes:
we output the Qty in the customer''s UOM (i.e. QtyEntered), but we call it QtyInved for historical reasons.
task 08878: Note: we try to aggregate ils which have the same order line. Grouping by C_OrderLine_ID to make sure that we don''t aggregate too much;
';
-- View: EDI_Cctop_INVOIC_v
CREATE OR REPLACE VIEW EDI_Cctop_INVOIC_v AS
SELECT
i.C_Invoice_ID AS EDI_Cctop_INVOIC_v_ID
, i.C_Invoice_ID
, i.C_Order_ID
, i.DocumentNo AS Invoice_DocumentNo
, i.DateInvoiced
, (CASE
WHEN i.POReference::TEXT <> ''::TEXT AND i.POReference IS NOT NULL /* task 09182: if there is a POReference, then export it */
THEN i.POReference
ELSE NULL::CHARACTER VARYING
END) AS POReference
, (CASE
WHEN i.DateOrdered IS NOT NULL /* task 09182: if there is an orderDate, then export it */
THEN i.DateOrdered
ELSE NULL::TIMESTAMP WITHOUT TIME ZONE
END) AS DateOrdered
, (CASE dt.DocBaseType
WHEN 'ARI'::BPChar THEN (CASE
WHEN dt.DocSubType IS NULL OR TRIM(BOTH ' ' FROM dt.DocSubType)='' THEN '380'::TEXT
WHEN dt.DocSubType IS NULL OR TRIM(BOTH ' ' FROM dt.DocSubType)='AQ' THEN '383'::TEXT
WHEN dt.DocSubType IS NULL OR TRIM(BOTH ' ' FROM dt.DocSubType)='AP' THEN '84'::TEXT
ELSE 'ERROR EAN_DocType'::TEXT
END)
WHEN 'ARC'::BPChar THEN (CASE
/* CQ => "GS - Lieferdifferenz"; CS => "GS - Retoure" */
WHEN dt.DocSubType IS NULL OR TRIM(BOTH ' ' FROM dt.DocSubType) IN ('CQ','CS') THEN '381'
WHEN dt.DocSubType IS NULL OR TRIM(BOTH ' ' FROM dt.DocSubType)='CR' THEN '83'::TEXT
ELSE 'ERROR EAN_DocType'::TEXT
END)
ELSE 'ERROR EAN_DocType'::TEXT
END) AS EANCOM_DocType
, i.GrandTotal
, i.TotalLines
/* IF docSubType is CS, the we don't reference the original shipment*/
, CASE WHEN dt.DocSubType='CS' THEN NULL ELSE s.MovementDate END AS MovementDate
, CASE WHEN dt.DocSubType='CS' THEN NULL ELSE s.DocumentNo END AS Shipment_DocumentNo
, t.TotalVAT
, t.TotalTaxBaseAmt
, rl.GLN AS ReceiverGLN
, rl.C_BPartner_Location_ID
, (
SELECT DISTINCT ON (sl.GLN)
sl.GLN
FROM C_BPartner_Location sl
WHERE true
AND sl.C_BPartner_ID = sp.C_BPartner_ID
AND sl.IsRemitTo = 'Y'::BPChar
AND sl.GLN IS NOT NULL
AND sl.IsActive = 'Y'::BPChar
) AS SenderGLN
, sp.VATaxId
, c.ISO_Code
, i.CreditMemoReason
, (
SELECT
Name
FROM AD_Ref_List
WHERE AD_Reference_ID=540014 -- C_CreditMemo_Reason
AND Value=i.CreditMemoReason
) AS CreditMemoReasonText
, cc.CountryCode
, cc.CountryCode_3Digit
, cc.CountryCode as AD_Language
, i.AD_Client_ID , i.AD_Org_ID, i.Created, i.CreatedBy, i.Updated, i.UpdatedBy, i.IsActive
FROM C_Invoice i
LEFT JOIN C_DocType dt ON dt.C_DocType_ID = i.C_DocTypetarget_ID
LEFT JOIN C_Order o ON o.C_Order_ID=i.C_Order_ID
LEFT JOIN EDI_Desadv s ON s.EDI_Desadv_ID = o.EDI_Desadv_ID -- note that we don't use the M_InOut, but the desadv. there might be multiple InOuts, all with the same POReference and the same desadv_id
LEFT JOIN C_BPartner_Location rl ON rl.C_BPartner_Location_ID = i.C_BPartner_Location_ID
LEFT JOIN C_Currency c ON c.C_Currency_ID = i.C_Currency_ID
LEFT JOIN C_Location l ON l.C_Location_ID = rl.C_Location_ID
LEFT JOIN C_Country cc ON cc.C_Country_ID = l.C_Country_ID
LEFT JOIN (
SELECT
C_InvoiceTax.C_Invoice_ID
, SUM(C_InvoiceTax.TaxAmt) AS TotalVAT
, SUM(C_InvoiceTax.TaxBaseAmt) AS TotalTaxBaseAmt
FROM C_InvoiceTax
GROUP BY C_InvoiceTax.C_Invoice_ID
) t ON t.C_Invoice_ID = i.C_Invoice_ID
LEFT JOIN C_BPartner sp ON sp.AD_OrgBP_ID = i.AD_Org_ID
; | the_stack |
CREATE SCHEMA gtt_function;
CREATE USER gtt_user PASSWORD 'Gauss@123';
set search_path=gtt_function,sys;
create global temp table gtt1(a int primary key, b text);
create global temp table gtt2(a int primary key, b text) on commit delete rows;
create global temp table gtt3(a int primary key, b text) on commit PRESERVE rows;
create global temp table gtt6(n int) with (on_commit_delete_rows=true);
begin;
insert into gtt6 values (9);
-- 1 row
select * from gtt6;
commit;
-- 0 row
select * from gtt6;
-- ok
cluster gtt1 using gtt1_pkey;
-- ok
create index CONCURRENTLY idx_gtt1 on gtt1 (b);
--ERROR
alter index idx_gtt1 SET TABLESPACE pg_default;
alter index idx_gtt1 SET (on_commit_delete_rows='true');
alter index idx_gtt1 RESET (on_commit_delete_rows='false');
--ok
alter index idx_gtt1 REBUILD;
alter index idx_gtt1 UNUSABLE;
alter index idx_gtt1 RENAME TO gtt1_idx;
-- ERROR
create table gtt1(a int primary key, b text) on commit delete rows;
-- ERROR
create table gtt1(a int primary key, b text) with(on_commit_delete_rows=true);
-- ERROR
alter table gtt1 SET TABLESPACE pg_default;
-- ok
alter table gtt1 OWNER TO gtt_user;
-- ERROR
alter table gtt1 SET COMPRESS;
-- ERROR
alter table gtt1 set (on_commit_delete_rows='true');
alter table gtt1 reset (on_commit_delete_rows='false');
--ok
alter table gtt1 DISABLE TRIGGER ALL;
alter table gtt1 ENABLE TRIGGER ALL;
alter table gtt1 DISABLE ROW LEVEL SECURITY;
alter table gtt1 ENABLE ROW LEVEL SECURITY;
alter table gtt1 FORCE ROW LEVEL SECURITY;
alter table gtt1 NO FORCE ROW LEVEL SECURITY;
--ok
CREATE INDEX idx_b ON gtt1(b);
alter table gtt1 CLUSTER ON idx_b;
alter table gtt1 SET WITHOUT CLUSTER;
-- ERROR
create or replace global temp view gtt_v as select 5;
-- ERROR
create global temp sequence seq1 start 50;
create global temp table foo();
-- ERROR
alter table foo set (on_commit_delete_rows='true');
-- ERROR
create global temp table cgtt(id int, b text) with (ORIENTATION=column);
-- ERROR
CREATE global temp TABLE measurement (
logdate date not null,
peaktemp int,
unitsales int
) PARTITION BY RANGE (logdate) (
PARTITION P1 VALUES LESS THAN('2019-01-01 00:00:00'),
PARTITION P2 VALUES LESS THAN('2020-01-01 00:00:00')
);
-- ERROR
CREATE global temp TABLE p_table01 (
id bigserial NOT NULL,
cre_time timestamp without time zone,
note varchar(30)
)
WITH (OIDS = FALSE)
on commit delete rows
PARTITION BY RANGE (cre_time) (
PARTITION P1 VALUES LESS THAN('2018-01-01 00:00:00'),
PARTITION P2 VALUES LESS THAN('2019-01-01 00:00:00')
);
--CREATE global temp TABLE p_table01_2018
--PARTITION OF p_table01
--FOR VALUES FROM ('2018-01-01 00:00:00') TO ('2019-01-01 00:00:00') on commit delete rows;
--CREATE global temp TABLE p_table01_2017
--PARTITION OF p_table01
--FOR VALUES FROM ('2017-01-01 00:00:00') TO ('2018-01-01 00:00:00') on commit delete rows;
--begin;
--insert into p_table01 values(1,'2018-01-02 00:00:00','test1');
--insert into p_table01 values(1,'2018-01-02 00:00:00','test2');
--select count(*) from p_table01;
--commit;
--select count(*) from p_table01;
-- ERROR
CREATE global temp TABLE p_table02 (
id bigserial NOT NULL,
cre_time timestamp without time zone,
note varchar(30)
)
WITH (OIDS = FALSE)
on commit PRESERVE rows
PARTITION BY RANGE (cre_time) (
PARTITION P1 VALUES LESS THAN('2018-01-01 00:00:00'),
PARTITION P2 VALUES LESS THAN('2019-01-01 00:00:00')
);
--CREATE global temp TABLE p_table02_2018
--PARTITION OF p_table02
--FOR VALUES FROM ('2018-01-01 00:00:00') TO ('2019-01-01 00:00:00');
--CREATE global temp TABLE p_table02_2017
--PARTITION OF p_table02
--FOR VALUES FROM ('2017-01-01 00:00:00') TO ('2018-01-01 00:00:00');
create table tbl_inherits_parent(
a int not null,
b varchar(32) not null default 'Got u',
c int check (c > 0),
d date not null
);
create global temp table tbl_inherits_parent_global_temp(
a int not null,
b varchar(32) not null default 'Got u',
c int check (c > 0),
d date not null
)on commit delete rows;
-- ERROR
create global temp table tbl_inherits_partition() inherits (tbl_inherits_parent);
-- ERROR
create global temp table tbl_inherits_partition() inherits (tbl_inherits_parent_global_temp) on commit delete rows;
select relname ,relkind, relpersistence, reloptions from pg_class where relname like 'p_table0%' or relname like 'tbl_inherits%' order by relname;
-- ERROR
create global temp table gtt3(a int primary key, b text) on commit drop;
-- ok
create global temp table gtt10(a int primary key, b text) with(on_commit_delete_rows=true) on commit preserve rows;
-- ok
create global temp table gtt4(a int primary key, b text) with(on_commit_delete_rows=true) on commit delete rows;
-- ok
create global temp table gtt5(a int primary key, b text) with(on_commit_delete_rows=true);
-- ok
create table tb1 (like gtt2 including reloptions);
-- ok
create temp table ltb1 (like gtt1 including reloptions) on commit delete rows;
-- ok
create global temp table gtt11 (like gtt2 including reloptions) on commit preserve rows;
-- ok
create global temp table gtt7 (like gtt2 including reloptions) on commit delete rows;
-- ok
create global temp table gtt8 on commit delete rows as select * from gtt3;
-- ok
select * into global temp table gtt9 from gtt2;
create global temp table gtt_test_rename(a int, b text);
--ok
alter table gtt_test_rename rename to gtt_test_new;
alter table gtt_test_new rename column b to bb;
--ok
alter table gtt_test_new add constraint pk1 primary key(a);
alter table gtt_test_new rename constraint pk1 to gtt_test_pk1;
--ok
alter table gtt_test_new add constraint chk1 check(a > 0);
alter table gtt_test_new validate constraint chk1;
--ok
alter table gtt_test_new drop constraint gtt_test_pk1;
--ok
ALTER TABLE gtt_test_new ADD COLUMN address integer;
--ok
insert into gtt_test_new values(1, 'hello postgres', 128);
-- ok
ALTER TABLE gtt_test_new MODIFY (address varchar(1024));
--ok
ALTER TABLE gtt_test_new ALTER address SET NOT NULL;
ALTER TABLE gtt_test_new ALTER address SET (n_distinct=1);
ALTER TABLE gtt_test_new ALTER bb SET STORAGE PLAIN;
--ok
ALTER TABLE gtt_test_new ADD STATISTICS ((a, address));
--ok
select * from gtt_test_new;
--ok
ALTER TABLE gtt_test_new DROP address;
--ok
ALTER TABLE gtt_test_new SET SCHEMA public;
--gtt statistic test
create global temp table gtt_statistic_test(id int);
insert into gtt_statistic_test values (generate_series(1,1000));
analyze gtt_statistic_test;
select attname,avg_width from pg_gtt_stats where tablename='gtt_statistic_test';
--add column
alter table gtt_statistic_test add column text varchar(128);
\d gtt_statistic_test
select attname,avg_width from pg_gtt_stats where tablename='gtt_statistic_test';
insert into gtt_statistic_test values (generate_series(1,1000),'hello gtt');
analyze gtt_statistic_test;
select attname,avg_width from pg_gtt_stats where tablename='gtt_statistic_test';
--modify column
alter table gtt_statistic_test modify id varchar(128);
\d gtt_statistic_test
select attname,avg_width from pg_gtt_stats where tablename='gtt_statistic_test';
--drop column
alter table gtt_statistic_test drop text;
\d gtt_statistic_test
select attname,avg_width from pg_gtt_stats where tablename='gtt_statistic_test';
CREATE global temp TABLE products (
product_no integer PRIMARY KEY,
name text,
price numeric
);
-- ERROR
CREATE TABLE orders (
order_id integer PRIMARY KEY,
product_no integer REFERENCES products (product_no),
quantity integer
);
-- ok
CREATE global temp TABLE orders (
order_id integer PRIMARY KEY,
product_no integer REFERENCES products (product_no),
quantity integer
)on commit delete rows;
--ERROR
insert into orders values(1,1,1);
--ok
insert into products values(1,'test',1.0);
begin;
insert into orders values(1,1,1);
commit;
select count(*) from products;
select count(*) from orders;
-- ok
CREATE GLOBAL TEMPORARY TABLE mytable (
id SERIAL PRIMARY KEY,
data text
) on commit preserve rows;
-- ok
--create global temp table gtt_seq(id int GENERATED ALWAYS AS IDENTITY (START WITH 2) primary key, a int) on commit PRESERVE rows;
--insert into gtt_seq (a) values(1);
--insert into gtt_seq (a) values(2);
--select * from gtt_seq order by id;
--truncate gtt_seq;
--select * from gtt_seq order by id;
--insert into gtt_seq (a) values(3);
--select * from gtt_seq order by id;
--ERROR
--CREATE MATERIALIZED VIEW mv_gtt1 as select * from gtt1;
-- ok
create index idx_gtt1_1 on gtt1 using btree (a);
create index idx_gtt1_2 on gtt1 using hash (a);
create global temp table tmp_t0(c0 tsvector,c1 varchar(100));
create index idx_tmp_t0_1 on tmp_t0 using gin (c0);
create index idx_tmp_t0_2 on tmp_t0 using gist (c0);
--ok
create global temp table gt (a SERIAL,b int);
begin;
set transaction_read_only = true;
insert into gt (b) values(1);
select * from gt;
commit;
--create sequence seq_1;
CREATE GLOBAL TEMPORARY TABLE gtt_s_1(c1 int PRIMARY KEY) ON COMMIT DELETE ROWS;
CREATE GLOBAL TEMPORARY TABLE gtt_s_2(c1 int PRIMARY KEY) ON COMMIT PRESERVE ROWS;
--alter table gtt_s_1 add c2 int default nextval('seq_1');
--alter table gtt_s_2 add c2 int default nextval('seq_1');
begin;
insert into gtt_s_1 (c1)values(1);
insert into gtt_s_2 (c1)values(1);
insert into gtt_s_1 (c1)values(2);
insert into gtt_s_2 (c1)values(2);
select * from gtt_s_1 order by c1;
commit;
select * from gtt_s_1 order by c1;
select * from gtt_s_2 order by c1;
--ok
create global temp table gt1(a int);
insert into gt1 values(generate_series(1,100000));
create index idx_gt1_1 on gt1 (a);
create index idx_gt1_2 on gt1((a + 1));
create index idx_gt1_3 on gt1((a*10),(a+a),(a-1));
explain (costs off) select * from gt1 where a=1;
explain (costs off) select * from gt1 where a=200000;
explain (costs off) select * from gt1 where a*10=300;
explain (costs off) select * from gt1 where a*10=3;
analyze gt1;
explain (costs off) select * from gt1 where a=1;
explain (costs off) select * from gt1 where a=200000;
explain (costs off) select * from gt1 where a*10=300;
explain (costs off) select * from gt1 where a*10=3;
--ok
create global temp table gtt_test0(c1 int) with(on_commit_delete_rows='true');
create global temp table gtt_test1(c1 int) with(on_commit_delete_rows='1');
create global temp table gtt_test2(c1 int) with(on_commit_delete_rows='0');
create global temp table gtt_test3(c1 int) with(on_commit_delete_rows='t');
create global temp table gtt_test4(c1 int) with(on_commit_delete_rows='f');
create global temp table gtt_test5(c1 int) with(on_commit_delete_rows='yes');
create global temp table gtt_test6(c1 int) with(on_commit_delete_rows='no');
create global temp table gtt_test7(c1 int) with(on_commit_delete_rows='y');
create global temp table gtt_test8(c1 int) with(on_commit_delete_rows='n');
create global temp table gtt_test9(c1 int) with(on_commit_delete_rows='tr');
create global temp table gtt_test10(c1 int) with(on_commit_delete_rows='ye');
-- ERROR
create global temp table gtt_test11(c1 int) with(on_commit_delete_rows='o');
create global temp table gtt_test11(c1 int) with(on_commit_delete_rows='');
--ok
create global temp table gtt_test12(c0 TEXT , c1 boolean , UNIQUE(c0, c1), CHECK(gtt_test12.c1));
insert into gtt_test12(c0) values('8x');
alter table only gtt_test12 alter c0 set data type CLOB;
reindex index gtt_test12_c0_c1_key;
reset search_path;
drop schema gtt_function cascade;
drop table public.gtt_test_new;
drop user gtt_user; | the_stack |
-- phpMyAdmin SQL Dump
-- version 4.8.5
-- https://www.phpmyadmin.net/
--
-- 主机: 127.0.0.1:3307
-- 生成日期: 2020-05-08 09:05:19
-- 服务器版本: 10.3.14-MariaDB
-- PHP 版本: 7.3.5
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
START TRANSACTION;
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
--
-- 数据库: `cell_blog`
--
-- --------------------------------------------------------
--
-- 表的结构 `admin_menu`
--
DROP TABLE IF EXISTS `admin_menu`;
CREATE TABLE IF NOT EXISTS `admin_menu` (
`id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
`parent_id` int(11) NOT NULL DEFAULT 0,
`order` int(11) NOT NULL DEFAULT 0,
`title` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL,
`icon` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL,
`uri` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`permission` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=18 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- 转存表中的数据 `admin_menu`
--
INSERT INTO `admin_menu` (`id`, `parent_id`, `order`, `title`, `icon`, `uri`, `permission`, `created_at`, `updated_at`) VALUES
(1, 0, 1, 'Dashboard', 'fa-bar-chart', '/', NULL, NULL, NULL),
(2, 0, 2, 'Admin', 'fa-tasks', '', NULL, NULL, NULL),
(3, 2, 3, 'Users', 'fa-users', 'auth/users', NULL, NULL, NULL),
(4, 2, 4, 'Roles', 'fa-user', 'auth/roles', NULL, NULL, NULL),
(5, 2, 5, 'Permission', 'fa-ban', 'auth/permissions', NULL, NULL, NULL),
(6, 2, 6, 'Menu', 'fa-bars', 'auth/menu', NULL, NULL, NULL),
(7, 2, 7, 'Operation log', 'fa-history', 'auth/logs', NULL, NULL, NULL),
(8, 0, 8, 'Media manager', 'fa-file', 'media', NULL, '2020-05-08 09:03:55', '2020-05-08 09:03:55'),
(9, 0, 9, 'Article', 'fa-edit', '', NULL, NULL, NULL),
(10, 9, 10, 'Articles', 'fa-edit', '/articles', NULL, NULL, NULL),
(11, 9, 11, 'Categories', 'fa-th', '/categories', NULL, NULL, NULL),
(12, 9, 12, 'Tags', 'fa-tags', '/tags', NULL, NULL, NULL),
(13, 0, 13, 'Pages', 'fa-pagelines', '/pages', NULL, NULL, NULL),
(14, 0, 14, 'Navigations', 'fa-navicon', '/navigations', NULL, NULL, NULL),
(15, 0, 15, 'Mottoes', 'fa-book', '/mottoes', NULL, NULL, NULL),
(16, 0, 16, 'Links', 'fa-user-plus', '/links', NULL, NULL, NULL),
(17, 0, 17, 'Systems', 'fa-toggle-on', '/systems', NULL, NULL, NULL);
-- --------------------------------------------------------
--
-- 表的结构 `admin_operation_log`
--
DROP TABLE IF EXISTS `admin_operation_log`;
CREATE TABLE IF NOT EXISTS `admin_operation_log` (
`id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
`user_id` int(11) NOT NULL,
`path` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`method` varchar(10) COLLATE utf8mb4_unicode_ci NOT NULL,
`ip` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`input` text COLLATE utf8mb4_unicode_ci NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `admin_operation_log_user_id_index` (`user_id`)
) ENGINE=MyISAM AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- 转存表中的数据 `admin_operation_log`
--
INSERT INTO `admin_operation_log` (`id`, `user_id`, `path`, `method`, `ip`, `input`, `created_at`, `updated_at`) VALUES
(1, 1, 'admin', 'GET', '127.0.0.1', '[]', '2020-05-08 09:03:21', '2020-05-08 09:03:21'),
(2, 1, 'admin', 'GET', '127.0.0.1', '[]', '2020-05-08 09:03:26', '2020-05-08 09:03:26'),
(3, 1, 'admin', 'GET', '127.0.0.1', '[]', '2020-05-08 09:04:42', '2020-05-08 09:04:42');
-- --------------------------------------------------------
--
-- 表的结构 `admin_permissions`
--
DROP TABLE IF EXISTS `admin_permissions`;
CREATE TABLE IF NOT EXISTS `admin_permissions` (
`id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
`name` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL,
`slug` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL,
`http_method` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`http_path` text COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `admin_permissions_name_unique` (`name`),
UNIQUE KEY `admin_permissions_slug_unique` (`slug`)
) ENGINE=MyISAM AUTO_INCREMENT=14 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- 转存表中的数据 `admin_permissions`
--
INSERT INTO `admin_permissions` (`id`, `name`, `slug`, `http_method`, `http_path`, `created_at`, `updated_at`) VALUES
(1, 'All permission', '*', '', '*', NULL, NULL),
(2, 'Dashboard', 'dashboard', 'GET', '/', NULL, NULL),
(3, 'Login', 'auth.login', '', '/auth/login\r\n/auth/logout', NULL, NULL),
(4, 'User setting', 'auth.setting', 'GET,PUT', '/auth/setting', NULL, NULL),
(5, 'Auth management', 'auth.management', '', '/auth/roles\r\n/auth/permissions\r\n/auth/menu\r\n/auth/logs', NULL, NULL),
(6, 'Media manager', 'ext.media-manager', '', '/media*', '2020-05-08 09:03:55', '2020-05-08 09:03:55'),
(7, 'article', 'article', '', '/articles*', NULL, NULL),
(8, 'category', 'category', '', '/categories*', NULL, NULL),
(9, 'tag', 'tag', '', '/tags*', NULL, NULL),
(10, 'page', 'page', '', '/pages*', NULL, NULL),
(11, 'motto', 'motto', '', '/mottoes*', NULL, NULL),
(12, 'friendship-link', 'friendship link', '', '/links*', NULL, NULL),
(13, 'system', 'system config', '', '/systems*', NULL, NULL);
-- --------------------------------------------------------
--
-- 表的结构 `admin_roles`
--
DROP TABLE IF EXISTS `admin_roles`;
CREATE TABLE IF NOT EXISTS `admin_roles` (
`id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
`name` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL,
`slug` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `admin_roles_name_unique` (`name`),
UNIQUE KEY `admin_roles_slug_unique` (`slug`)
) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- 转存表中的数据 `admin_roles`
--
INSERT INTO `admin_roles` (`id`, `name`, `slug`, `created_at`, `updated_at`) VALUES
(1, 'Administrator', 'administrator', '2020-05-08 09:02:09', '2020-05-08 09:02:09');
-- --------------------------------------------------------
--
-- 表的结构 `admin_role_menu`
--
DROP TABLE IF EXISTS `admin_role_menu`;
CREATE TABLE IF NOT EXISTS `admin_role_menu` (
`role_id` int(11) NOT NULL,
`menu_id` int(11) NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
KEY `admin_role_menu_role_id_menu_id_index` (`role_id`,`menu_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- 转存表中的数据 `admin_role_menu`
--
INSERT INTO `admin_role_menu` (`role_id`, `menu_id`, `created_at`, `updated_at`) VALUES
(1, 2, NULL, NULL);
-- --------------------------------------------------------
--
-- 表的结构 `admin_role_permissions`
--
DROP TABLE IF EXISTS `admin_role_permissions`;
CREATE TABLE IF NOT EXISTS `admin_role_permissions` (
`role_id` int(11) NOT NULL,
`permission_id` int(11) NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
KEY `admin_role_permissions_role_id_permission_id_index` (`role_id`,`permission_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- 转存表中的数据 `admin_role_permissions`
--
INSERT INTO `admin_role_permissions` (`role_id`, `permission_id`, `created_at`, `updated_at`) VALUES
(1, 1, NULL, NULL);
-- --------------------------------------------------------
--
-- 表的结构 `admin_role_users`
--
DROP TABLE IF EXISTS `admin_role_users`;
CREATE TABLE IF NOT EXISTS `admin_role_users` (
`role_id` int(11) NOT NULL,
`user_id` int(11) NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
KEY `admin_role_users_role_id_user_id_index` (`role_id`,`user_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- 转存表中的数据 `admin_role_users`
--
INSERT INTO `admin_role_users` (`role_id`, `user_id`, `created_at`, `updated_at`) VALUES
(1, 1, NULL, NULL);
-- --------------------------------------------------------
--
-- 表的结构 `admin_users`
--
DROP TABLE IF EXISTS `admin_users`;
CREATE TABLE IF NOT EXISTS `admin_users` (
`id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
`username` varchar(190) COLLATE utf8mb4_unicode_ci NOT NULL,
`password` varchar(60) COLLATE utf8mb4_unicode_ci NOT NULL,
`name` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`avatar` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`remember_token` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `admin_users_username_unique` (`username`)
) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- 转存表中的数据 `admin_users`
--
INSERT INTO `admin_users` (`id`, `username`, `password`, `name`, `avatar`, `remember_token`, `created_at`, `updated_at`) VALUES
(1, 'admin', '$2y$10$jbEOt2eBNsCJfv070/mdZODpJA4NdyukNp9.L9tzR7qMpuHtr6DW.', 'Administrator', NULL, NULL, '2020-05-08 09:02:09', '2020-05-08 09:02:09');
-- --------------------------------------------------------
--
-- 表的结构 `admin_user_permissions`
--
DROP TABLE IF EXISTS `admin_user_permissions`;
CREATE TABLE IF NOT EXISTS `admin_user_permissions` (
`user_id` int(11) NOT NULL,
`permission_id` int(11) NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
KEY `admin_user_permissions_user_id_permission_id_index` (`user_id`,`permission_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- --------------------------------------------------------
--
-- 表的结构 `articles`
--
DROP TABLE IF EXISTS `articles`;
CREATE TABLE IF NOT EXISTS `articles` (
`id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '文章表主键',
`title` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '标题',
`user_id` int(10) UNSIGNED NOT NULL DEFAULT 0 COMMENT '作者ID',
`category_id` int(10) UNSIGNED NOT NULL DEFAULT 0 COMMENT '分类ID',
`description` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '描述',
`keywords` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '关键词',
`sort` int(10) UNSIGNED NOT NULL DEFAULT 0 COMMENT '置顶排序',
`comments` tinyint(1) NOT NULL DEFAULT 1 COMMENT '评论: 1打开 0关闭',
`status` tinyint(1) NOT NULL DEFAULT 1 COMMENT '状态: 1发布 0草稿',
`password` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '文章密码',
`views` int(10) UNSIGNED NOT NULL DEFAULT 0 COMMENT '阅读数量',
`markdown` longtext COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'markdown文章内容',
`html` longtext COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'markdown转的html页面',
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- --------------------------------------------------------
--
-- 表的结构 `article_tags`
--
DROP TABLE IF EXISTS `article_tags`;
CREATE TABLE IF NOT EXISTS `article_tags` (
`article_id` int(10) UNSIGNED NOT NULL COMMENT '文章id',
`tag_id` int(10) UNSIGNED NOT NULL COMMENT '标签id',
KEY `article_tags_article_id_index` (`article_id`),
KEY `article_tags_tag_id_index` (`tag_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- --------------------------------------------------------
--
-- 表的结构 `categories`
--
DROP TABLE IF EXISTS `categories`;
CREATE TABLE IF NOT EXISTS `categories` (
`id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '分类主键',
`name` varchar(20) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '分类名称',
`description` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '描述',
`keywords` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '关键词',
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `categories_name_unique` (`name`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- --------------------------------------------------------
--
-- 表的结构 `failed_jobs`
--
DROP TABLE IF EXISTS `failed_jobs`;
CREATE TABLE IF NOT EXISTS `failed_jobs` (
`id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT,
`connection` text COLLATE utf8mb4_unicode_ci NOT NULL,
`queue` text COLLATE utf8mb4_unicode_ci NOT NULL,
`payload` longtext COLLATE utf8mb4_unicode_ci NOT NULL,
`exception` longtext COLLATE utf8mb4_unicode_ci NOT NULL,
`failed_at` timestamp NOT NULL DEFAULT current_timestamp(),
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- --------------------------------------------------------
--
-- 表的结构 `friendship_links`
--
DROP TABLE IF EXISTS `friendship_links`;
CREATE TABLE IF NOT EXISTS `friendship_links` (
`id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '友链主键',
`name` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '链接名',
`url` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '链接地址',
`avatar` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '头像地址',
`description` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '友链描述',
`sort` tinyint(4) NOT NULL DEFAULT 0 COMMENT '排序',
`status` tinyint(1) NOT NULL DEFAULT 1 COMMENT '状态: 1启用 0关闭',
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- --------------------------------------------------------
--
-- 表的结构 `migrations`
--
DROP TABLE IF EXISTS `migrations`;
CREATE TABLE IF NOT EXISTS `migrations` (
`id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
`migration` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`batch` int(11) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=12 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- 转存表中的数据 `migrations`
--
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES
(1, '2016_01_04_173148_create_admin_tables', 1),
(2, '2019_08_19_000000_create_failed_jobs_table', 1),
(3, '2020_04_17_120903_create_articles_table', 1),
(4, '2020_04_17_121103_create_tags_table', 1),
(5, '2020_04_17_121112_create_categories_table', 1),
(6, '2020_04_17_154157_create_article_tags_table', 1),
(7, '2020_04_24_144638_create_navigations_table', 1),
(8, '2020_04_24_154338_create_friendship_links_table', 1),
(9, '2020_04_24_160607_create_pages_table', 1),
(10, '2020_04_24_165142_create_systems_table', 1),
(11, '2020_05_06_222451_create_mottoes_table', 1);
-- --------------------------------------------------------
--
-- 表的结构 `mottoes`
--
DROP TABLE IF EXISTS `mottoes`;
CREATE TABLE IF NOT EXISTS `mottoes` (
`id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '格言主键',
`motto` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '格言',
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- --------------------------------------------------------
--
-- 表的结构 `navigations`
--
DROP TABLE IF EXISTS `navigations`;
CREATE TABLE IF NOT EXISTS `navigations` (
`id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '导航主键',
`name` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '导航名',
`url` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '链接',
`icon` varchar(20) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'globe' COMMENT '图标',
`target` tinyint(1) NOT NULL DEFAULT 0 COMMENT '打开方式: 1外部 0内部',
`status` tinyint(1) NOT NULL DEFAULT 1 COMMENT '状态: 1显示 0隐藏',
`sort` tinyint(4) NOT NULL DEFAULT 0 COMMENT '排序',
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- --------------------------------------------------------
--
-- 表的结构 `pages`
--
DROP TABLE IF EXISTS `pages`;
CREATE TABLE IF NOT EXISTS `pages` (
`id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '页面主键',
`title` varchar(200) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '页面标题',
`link_alias` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '链接别名',
`keywords` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '关键词',
`description` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '描述',
`comments` tinyint(1) NOT NULL DEFAULT 1 COMMENT '评论: 1打开 0关闭',
`status` tinyint(1) NOT NULL DEFAULT 1 COMMENT '状态: 1发布 0草稿',
`password` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '页面密码',
`markdown` longtext COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'markdown页面内容',
`html` longtext COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'markdown转的html页面',
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `pages_link_alias_unique` (`link_alias`),
KEY `pages_link_alias_index` (`link_alias`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- --------------------------------------------------------
--
-- 表的结构 `systems`
--
DROP TABLE IF EXISTS `systems`;
CREATE TABLE IF NOT EXISTS `systems` (
`id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '设置主键',
`name` varchar(30) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '设置名称',
`system_key` varchar(30) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '设置项',
`system_value` text COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '设置值',
`status` tinyint(1) NOT NULL DEFAULT 1 COMMENT '状态: 1启用 0关闭',
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `systems_system_key_unique` (`system_key`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- --------------------------------------------------------
--
-- 表的结构 `tags`
--
DROP TABLE IF EXISTS `tags`;
CREATE TABLE IF NOT EXISTS `tags` (
`id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '标签主键',
`name` varchar(20) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '标签名称',
`description` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '描述',
`keywords` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '关键词',
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `tags_name_unique` (`name`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
COMMIT;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; | the_stack |
--1.function
--a
create table list_partition_truncate_table
(
c1 int ,
c2 int
)
partition by list (c1)
(
partition p1 values (1000),
partition p2 values (2000),
partition p3 values (3000),
partition p4 values (4000),
partition p5 values (5000)
);
insert into list_partition_truncate_table values(1000),(2000),(3000),(4000),(5000);
select count(*) from list_partition_truncate_table;
--5 rows
alter table list_partition_truncate_table truncate partition p1;
select count(*) from list_partition_truncate_table;
--4 rows
alter table list_partition_truncate_table truncate partition for (2000);
select count(*) from list_partition_truncate_table;
--3 rows
truncate table list_partition_truncate_table;
select count(*) from list_partition_truncate_table;
-- 0 rows
drop table list_partition_truncate_table;
--b
create table list_partition_truncate_table
(
c1 int ,
c2 int
)
partition by list (c1)
(
partition p1 values (1000),
partition p2 values (2000),
partition p3 values (3000),
partition p4 values (4000),
partition p5 values (5000)
);
insert into list_partition_truncate_table values(1000),(2000),(3000),(4000),(5000);
alter table list_partition_truncate_table truncate partition for (6000);
--error
alter table list_partition_truncate_table truncate partition for (5000), truncate partition for (6000);
select count(*) from list_partition_truncate_table;
-- 5 rows
alter table list_partition_truncate_table truncate partition for (5000), truncate partition p6;
select count(*) from list_partition_truncate_table;
-- 5 rows
alter table list_partition_truncate_table truncate partition for (5000), truncate partition p2;
select count(*) from list_partition_truncate_table;
-- 3 rows
drop table list_partition_truncate_table;
--2.sytax test
create table list_partition_truncate_table
(
c1 int ,
c2 int
)
partition by list (c1)
(
partition p1 values (1000),
partition p2 values (2000),
partition p3 values (3000),
partition p4 values (4000),
partition p5 values (5000)
);
alter table list_partition_truncate_table truncate p1;
--error
alter table list_partition_truncate_table truncate partition;
--error
drop table list_partition_truncate_table;
--3.index
create table list_partition_truncate_table
(
c1 int ,
c2 int
)
partition by list (c1)
(
partition p1 values (1000),
partition p2 values (2000),
partition p3 values (3000),
partition p4 values (4000),
partition p5 values (5000)
);
create index on list_partition_truncate_table(c1,c2) local;
insert into list_partition_truncate_table values(1000),(2000),(3000),(4000),(5000);
select count(*) from list_partition_truncate_table;
--5 rows
alter table list_partition_truncate_table truncate partition p1;
select count(*) from list_partition_truncate_table;
--4 rows
alter table list_partition_truncate_table truncate partition for (2000);
select count(*) from list_partition_truncate_table;
--3 rows
drop table list_partition_truncate_table;
--4.toast table partition
create table list_partition_truncate_table
(
c1 int ,
c2 text
)
partition by list (c1)
(
partition p1 values (1000),
partition p2 values (2000),
partition p3 values (3000),
partition p4 values (4000),
partition p5 values (5000)
);
create index on list_partition_truncate_table(c1,c2) local;
insert into list_partition_truncate_table values(1000,'0'),(2000,'0'),(3000,'0'),(4000,'0'),(5000,'0');
select count(*) from list_partition_truncate_table;
--5 rows
alter table list_partition_truncate_table truncate partition p1;
select count(*) from list_partition_truncate_table;
--4 rows
alter table list_partition_truncate_table truncate partition for (2000);
select count(*) from list_partition_truncate_table;
--3 rows
drop table list_partition_truncate_table;
--5.transaction
--truncate command and create table in same transaction
start transaction ;
create table list_partition_truncate_table
(
c1 int ,
c2 text
)
partition by list (c1)
(
partition p1 values (1000),
partition p2 values (2000),
partition p3 values (3000),
partition p4 values (4000),
partition p5 values (5000)
);
create index on list_partition_truncate_table(c1,c2) local;
insert into list_partition_truncate_table values(1000,'0'),(2000,'0'),(3000,'0'),(4000,'0'),(5000,'0');
select count(*) from list_partition_truncate_table;
--5 rows
alter table list_partition_truncate_table truncate partition p1;
select count(*) from list_partition_truncate_table;
--4 rows
rollback;
select count(*) from list_partition_truncate_table;
--error
start transaction ;
create table list_partition_truncate_table
(
c1 int ,
c2 text
)
partition by list (c1)
(
partition p1 values (1000),
partition p2 values (2000),
partition p3 values (3000),
partition p4 values (4000),
partition p5 values (5000)
);
create index on list_partition_truncate_table(c1,c2) local;
insert into list_partition_truncate_table values(1000,'0'),(2000,'0'),(3000,'0'),(4000,'0'),(5000,'0');
select count(*) from list_partition_truncate_table;
--5 rows
alter table list_partition_truncate_table truncate partition p1;
select count(*) from list_partition_truncate_table;
--4 rows
commit;
select count(*) from list_partition_truncate_table;
--4 rows
drop table list_partition_truncate_table;
--truncate partiton and drop parttion in same transaction
create table list_partition_truncate_table
(
c1 int ,
c2 text
)
partition by list (c1)
(
partition p1 values (1000),
partition p2 values (2000),
partition p3 values (3000),
partition p4 values (4000),
partition p5 values (5000)
);
create index on list_partition_truncate_table(c1,c2) local;
insert into list_partition_truncate_table values(1000,'0'),(2000,'0'),(3000,'0'),(4000,'0'),(5000,'0');
select count(*) from list_partition_truncate_table;
--5 rows
start transaction ;
alter table list_partition_truncate_table truncate partition p1;
select count(*) from list_partition_truncate_table;
--4 rows
alter table list_partition_truncate_table drop partition p1;
rollback;
select count(*) from list_partition_truncate_table;
--5 rows
start transaction ;
alter table list_partition_truncate_table truncate partition p1;
select count(*) from list_partition_truncate_table;
--4 rows
commit;
select count(*) from list_partition_truncate_table;
--4 rows
drop table list_partition_truncate_table;
--truncate partiton and add parttion in same transaction
create table list_partition_truncate_table
(
c1 int ,
c2 text
)
partition by list (c1)
(
partition p1 values (1000),
partition p2 values (2000),
partition p3 values (3000),
partition p4 values (4000),
partition p5 values (5000)
);
create index on list_partition_truncate_table(c1,c2) local;
insert into list_partition_truncate_table values(1000,'0'),(2000,'0'),(3000,'0'),(4000,'0'),(5000,'0');
select count(*) from list_partition_truncate_table;
--5 rows
start transaction ;
alter table list_partition_truncate_table add partition p6 values (6000);
insert into list_partition_truncate_table values(6000,'0');
select count(*) from list_partition_truncate_table;
--6 rows
alter table list_partition_truncate_table truncate partition p6;
select count(*) from list_partition_truncate_table;
--5 rows
rollback;
select count(*) from list_partition_truncate_table;
--5 rows
drop table list_partition_truncate_table;
create table list_partition_truncate_table
(
c1 int ,
c2 text
)
partition by list (c1)
(
partition p1 values (1000),
partition p2 values (2000),
partition p3 values (3000),
partition p4 values (4000),
partition p5 values (5000)
);
create index on list_partition_truncate_table(c1,c2) local;
insert into list_partition_truncate_table values(1000,'0'),(2000,'0'),(3000,'0'),(4000,'0'),(5000,'0');
select count(*) from list_partition_truncate_table;
--5 rows
start transaction ;
alter table list_partition_truncate_table add partition p6 values (6000);
insert into list_partition_truncate_table values(6000,'0');
select count(*) from list_partition_truncate_table;
--6 rows
alter table list_partition_truncate_table truncate partition p6;
select count(*) from list_partition_truncate_table;
--5 rows
commit;
select count(*) from list_partition_truncate_table;
--5 rows
drop table list_partition_truncate_table;
--truncate same partition in a command
create table list_partition_truncate_table
(
c1 int ,
c2 text
)
partition by list (c1)
(
partition p1 values (1000),
partition p2 values (2000),
partition p3 values (3000),
partition p4 values (4000),
partition p5 values (5000)
);
insert into list_partition_truncate_table values(1000,'0'),(2000,'0'),(3000,'0'),(4000,'0'),(5000,'0');
select count(*) from list_partition_truncate_table;
--5 rows
alter table list_partition_truncate_table truncate partition p1, truncate partition for(1000);
select count(*) from list_partition_truncate_table;
--4 rows
truncate list_partition_truncate_table;
start transaction;
alter table list_partition_truncate_table add partition p6 values (6000);
insert into list_partition_truncate_table values(6000,'0');
alter table list_partition_truncate_table truncate partition p6, truncate partition for(6000);
select count(*) from list_partition_truncate_table partition(p6);
--0 rows
rollback;
select count(*) from list_partition_truncate_table partition(p6);
--error
start transaction;
alter table list_partition_truncate_table add partition p6 values (6000);
insert into list_partition_truncate_table values(6000,'0');
alter table list_partition_truncate_table truncate partition p6, truncate partition for(6000);
select count(*) from list_partition_truncate_table partition(p6);
--0 rows
commit;
select count(*) from list_partition_truncate_table partition(p6);
--0 rows
drop table list_partition_truncate_table;
--4. global index
--drop table and index
drop table if exists alter_table;
create table alter_table
(
INV_DATE_SK integer not null,
INV_ITEM_SK integer not null,
INV_WAREHOUSE_SK integer not null,
INV_QUANTITY_ON_HAND integer
)
partition by list(inv_date_sk)
(
partition p0 values (1000,2000,3000,4000,5000),
partition p1 values (10000,12000,14000,16000,18000),
partition p2 values (20000,22000,24000,26000,28000)
);
--succeed
insert into alter_table values (generate_series(1000,5000,1000),generate_series(1000,5000,1000),generate_series(1000,5000,1000));
insert into alter_table values (generate_series(10000,18000,2000),generate_series(10000,18000,2000),generate_series(10000,18000,2000));
insert into alter_table values (generate_series(20000,28000,2000),generate_series(20000,28000,2000),generate_series(20000,28000,2000));
--succeed
create index local_alter_table_index1 on alter_table(INV_DATE_SK) local;
create index global_alter_table_index1 on alter_table(INV_ITEM_SK) global;
create index global_alter_table_index2 on alter_table(INV_WAREHOUSE_SK) global;
explain (costs off) select count(*) from alter_table where INV_DATE_SK < 10000;
select count(*) from alter_table where INV_DATE_SK < 10000;
explain (costs off) select count(*) from alter_table where INV_DATE_SK < 20000;
select count(*) from alter_table where INV_DATE_SK < 20000;
explain (costs off) select count(*) from alter_table where INV_ITEM_SK < 10000;
select count(*) from alter_table where INV_ITEM_SK < 10000;
explain (costs off) select count(*) from alter_table where INV_ITEM_SK < 10000;
select count(*) from alter_table where INV_ITEM_SK < 20000;
explain (costs off) select count(*) from alter_table where INV_WAREHOUSE_SK < 10000;
select count(*) from alter_table where INV_WAREHOUSE_SK < 10000;
explain (costs off) select count(*) from alter_table where INV_WAREHOUSE_SK < 20000;
select count(*) from alter_table where INV_WAREHOUSE_SK < 20000;
explain (costs off) select count(*) from alter_table where INV_WAREHOUSE_SK < 30000;
select count(*) from alter_table where INV_WAREHOUSE_SK < 30000;
select part.relname, part.indextblid, part.parttype, part.rangenum, part.intervalnum, part.partstrategy, part.relallvisible,
part.reltoastrelid, part.partkey, part.interval, part.boundaries, part.reltuples
from pg_class class, pg_partition part, pg_index ind where class.relname = 'alter_table' and ind.indrelid = class.oid and part.parentid = ind.indrelid
order by 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11;
ALTER TABLE alter_table TRUNCATE partition p2 update global index;
select part.relname, part.indextblid, part.parttype, part.rangenum, part.intervalnum, part.partstrategy, part.relallvisible,
part.reltoastrelid, part.partkey, part.interval, part.boundaries, part.reltuples
from pg_class class, pg_partition part, pg_index ind where class.relname = 'alter_table' and ind.indrelid = class.oid and part.parentid = ind.indrelid
order by 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11;
explain (costs off) select count(*) from alter_table where INV_DATE_SK < 10000;
select count(*) from alter_table where INV_DATE_SK < 10000;
explain (costs off) select count(*) from alter_table where INV_DATE_SK < 20000;
select count(*) from alter_table where INV_DATE_SK < 20000;
explain (costs off) select count(*) from alter_table where INV_ITEM_SK < 10000;
select count(*) from alter_table where INV_ITEM_SK < 10000;
explain (costs off) select count(*) from alter_table where INV_ITEM_SK < 20000;
select count(*) from alter_table where INV_ITEM_SK < 20000;
explain (costs off) select count(*) from alter_table where INV_WAREHOUSE_SK < 10000;
select count(*) from alter_table where INV_WAREHOUSE_SK < 10000;
explain (costs off) select count(*) from alter_table where INV_WAREHOUSE_SK < 20000;
select count(*) from alter_table where INV_WAREHOUSE_SK < 20000;
explain (costs off) select count(*) from alter_table where INV_WAREHOUSE_SK < 30000;
select count(*) from alter_table where INV_WAREHOUSE_SK < 30000;
--clean
drop index if exists local_alter_table_index1;
drop index if exists global_alter_table_index1;
drop index if exists global_alter_table_index2;
drop table if exists alter_table;
--5. Ustore
--a
create table list_partition_truncate_table
(
c1 int ,
c2 int
) WITH (STORAGE_TYPE = USTORE, init_td=32)
partition by list (c1)
(
partition p1 values (1000),
partition p2 values (2000),
partition p3 values (3000),
partition p4 values (4000),
partition p5 values (5000)
);
insert into list_partition_truncate_table values(1000),(2000),(3000),(4000),(5000);
select count(*) from list_partition_truncate_table;
--5 rows
alter table list_partition_truncate_table truncate partition p1;
select count(*) from list_partition_truncate_table;
--4 rows
alter table list_partition_truncate_table truncate partition for (2000);
select count(*) from list_partition_truncate_table;
--3 rows
truncate table list_partition_truncate_table;
select count(*) from list_partition_truncate_table;
-- 0 rows
drop table list_partition_truncate_table;
--b
create table list_partition_truncate_table
(
c1 int ,
c2 int
)
partition by list (c1)
(
partition p1 values (1000),
partition p2 values (2000),
partition p3 values (3000),
partition p4 values (4000),
partition p5 values (5000)
);
insert into list_partition_truncate_table values(1000),(2000),(3000),(4000),(5000);
alter table list_partition_truncate_table truncate partition for (6000);
--error
alter table list_partition_truncate_table truncate partition for (5000), truncate partition for (6000);
select count(*) from list_partition_truncate_table;
-- 5 rows
alter table list_partition_truncate_table truncate partition for (5000), truncate partition p6;
select count(*) from list_partition_truncate_table;
-- 5 rows
alter table list_partition_truncate_table truncate partition for (5000), truncate partition p2;
select count(*) from list_partition_truncate_table;
-- 3 rows
drop table list_partition_truncate_table; | the_stack |
-- 2017-08-21T12:46:17.520
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Element SET Name='Bereitstellungszeit 1',Updated=TO_TIMESTAMP('2017-08-21 12:46:17','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=542176
;
-- 2017-08-21T12:46:17.533
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Column SET ColumnName='PreparationTime_1', Name='Bereitstellungszeit 1', Description='Preparation time for monday', Help=NULL WHERE AD_Element_ID=542176
;
-- 2017-08-21T12:46:17.550
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Process_Para SET ColumnName='PreparationTime_1', Name='Bereitstellungszeit 1', Description='Preparation time for monday', Help=NULL, AD_Element_ID=542176 WHERE UPPER(ColumnName)='PREPARATIONTIME_1' AND IsCentrallyMaintained='Y' AND AD_Element_ID IS NULL
;
-- 2017-08-21T12:46:17.552
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Process_Para SET ColumnName='PreparationTime_1', Name='Bereitstellungszeit 1', Description='Preparation time for monday', Help=NULL WHERE AD_Element_ID=542176 AND IsCentrallyMaintained='Y'
;
-- 2017-08-21T12:46:17.553
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Field SET Name='Bereitstellungszeit 1', Description='Preparation time for monday', Help=NULL WHERE AD_Column_ID IN (SELECT AD_Column_ID FROM AD_Column WHERE AD_Element_ID=542176) AND IsCentrallyMaintained='Y'
;
-- 2017-08-21T12:46:17.570
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_PrintFormatItem pi SET PrintName='Preparation Time', Name='Bereitstellungszeit 1' WHERE IsCentrallyMaintained='Y' AND EXISTS (SELECT * FROM AD_Column c WHERE c.AD_Column_ID=pi.AD_Column_ID AND c.AD_Element_ID=542176)
;
-- 2017-08-21T12:46:33.856
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Element SET Name='Bereitstellungszeit Di', PrintName='Bereitstellungszeit Di',Updated=TO_TIMESTAMP('2017-08-21 12:46:33','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=542177
;
-- 2017-08-21T12:46:33.858
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Column SET ColumnName='PreparationTime_2', Name='Bereitstellungszeit Di', Description='Preparation time for tuesday', Help=NULL WHERE AD_Element_ID=542177
;
-- 2017-08-21T12:46:33.872
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Process_Para SET ColumnName='PreparationTime_2', Name='Bereitstellungszeit Di', Description='Preparation time for tuesday', Help=NULL, AD_Element_ID=542177 WHERE UPPER(ColumnName)='PREPARATIONTIME_2' AND IsCentrallyMaintained='Y' AND AD_Element_ID IS NULL
;
-- 2017-08-21T12:46:33.874
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Process_Para SET ColumnName='PreparationTime_2', Name='Bereitstellungszeit Di', Description='Preparation time for tuesday', Help=NULL WHERE AD_Element_ID=542177 AND IsCentrallyMaintained='Y'
;
-- 2017-08-21T12:46:33.875
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Field SET Name='Bereitstellungszeit Di', Description='Preparation time for tuesday', Help=NULL WHERE AD_Column_ID IN (SELECT AD_Column_ID FROM AD_Column WHERE AD_Element_ID=542177) AND IsCentrallyMaintained='Y'
;
-- 2017-08-21T12:46:33.891
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_PrintFormatItem pi SET PrintName='Bereitstellungszeit Di', Name='Bereitstellungszeit Di' WHERE IsCentrallyMaintained='Y' AND EXISTS (SELECT * FROM AD_Column c WHERE c.AD_Column_ID=pi.AD_Column_ID AND c.AD_Element_ID=542177)
;
-- 2017-08-21T12:46:47.976
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Element SET Name='Bereitstellungszeit Mo', PrintName='Bereitstellungszeit Mo',Updated=TO_TIMESTAMP('2017-08-21 12:46:47','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=542176
;
-- 2017-08-21T12:46:47.979
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Column SET ColumnName='PreparationTime_1', Name='Bereitstellungszeit Mo', Description='Preparation time for monday', Help=NULL WHERE AD_Element_ID=542176
;
-- 2017-08-21T12:46:47.988
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Process_Para SET ColumnName='PreparationTime_1', Name='Bereitstellungszeit Mo', Description='Preparation time for monday', Help=NULL, AD_Element_ID=542176 WHERE UPPER(ColumnName)='PREPARATIONTIME_1' AND IsCentrallyMaintained='Y' AND AD_Element_ID IS NULL
;
-- 2017-08-21T12:46:47.989
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Process_Para SET ColumnName='PreparationTime_1', Name='Bereitstellungszeit Mo', Description='Preparation time for monday', Help=NULL WHERE AD_Element_ID=542176 AND IsCentrallyMaintained='Y'
;
-- 2017-08-21T12:46:47.990
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Field SET Name='Bereitstellungszeit Mo', Description='Preparation time for monday', Help=NULL WHERE AD_Column_ID IN (SELECT AD_Column_ID FROM AD_Column WHERE AD_Element_ID=542176) AND IsCentrallyMaintained='Y'
;
-- 2017-08-21T12:46:48
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_PrintFormatItem pi SET PrintName='Bereitstellungszeit Mo', Name='Bereitstellungszeit Mo' WHERE IsCentrallyMaintained='Y' AND EXISTS (SELECT * FROM AD_Column c WHERE c.AD_Column_ID=pi.AD_Column_ID AND c.AD_Element_ID=542176)
;
-- 2017-08-21T12:47:02.604
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Element SET Name='Bereitstellungszeit Mi', PrintName='Bereitstellungszeit Mi',Updated=TO_TIMESTAMP('2017-08-21 12:47:02','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=542178
;
-- 2017-08-21T12:47:02.605
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Column SET ColumnName='PreparationTime_3', Name='Bereitstellungszeit Mi', Description='Preparation time for wednesday', Help=NULL WHERE AD_Element_ID=542178
;
-- 2017-08-21T12:47:02.618
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Process_Para SET ColumnName='PreparationTime_3', Name='Bereitstellungszeit Mi', Description='Preparation time for wednesday', Help=NULL, AD_Element_ID=542178 WHERE UPPER(ColumnName)='PREPARATIONTIME_3' AND IsCentrallyMaintained='Y' AND AD_Element_ID IS NULL
;
-- 2017-08-21T12:47:02.620
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Process_Para SET ColumnName='PreparationTime_3', Name='Bereitstellungszeit Mi', Description='Preparation time for wednesday', Help=NULL WHERE AD_Element_ID=542178 AND IsCentrallyMaintained='Y'
;
-- 2017-08-21T12:47:02.621
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Field SET Name='Bereitstellungszeit Mi', Description='Preparation time for wednesday', Help=NULL WHERE AD_Column_ID IN (SELECT AD_Column_ID FROM AD_Column WHERE AD_Element_ID=542178) AND IsCentrallyMaintained='Y'
;
-- 2017-08-21T12:47:02.634
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_PrintFormatItem pi SET PrintName='Bereitstellungszeit Mi', Name='Bereitstellungszeit Mi' WHERE IsCentrallyMaintained='Y' AND EXISTS (SELECT * FROM AD_Column c WHERE c.AD_Column_ID=pi.AD_Column_ID AND c.AD_Element_ID=542178)
;
-- 2017-08-21T12:47:16.074
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Element SET Name='Preparation Time Do', PrintName='Preparation Time Do',Updated=TO_TIMESTAMP('2017-08-21 12:47:16','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=542179
;
-- 2017-08-21T12:47:16.076
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Column SET ColumnName='PreparationTime_4', Name='Preparation Time Do', Description='Preparation time for thursday', Help=NULL WHERE AD_Element_ID=542179
;
-- 2017-08-21T12:47:16.089
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Process_Para SET ColumnName='PreparationTime_4', Name='Preparation Time Do', Description='Preparation time for thursday', Help=NULL, AD_Element_ID=542179 WHERE UPPER(ColumnName)='PREPARATIONTIME_4' AND IsCentrallyMaintained='Y' AND AD_Element_ID IS NULL
;
-- 2017-08-21T12:47:16.090
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Process_Para SET ColumnName='PreparationTime_4', Name='Preparation Time Do', Description='Preparation time for thursday', Help=NULL WHERE AD_Element_ID=542179 AND IsCentrallyMaintained='Y'
;
-- 2017-08-21T12:47:16.092
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Field SET Name='Preparation Time Do', Description='Preparation time for thursday', Help=NULL WHERE AD_Column_ID IN (SELECT AD_Column_ID FROM AD_Column WHERE AD_Element_ID=542179) AND IsCentrallyMaintained='Y'
;
-- 2017-08-21T12:47:16.107
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_PrintFormatItem pi SET PrintName='Preparation Time Do', Name='Preparation Time Do' WHERE IsCentrallyMaintained='Y' AND EXISTS (SELECT * FROM AD_Column c WHERE c.AD_Column_ID=pi.AD_Column_ID AND c.AD_Element_ID=542179)
;
-- 2017-08-21T12:47:26.248
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Element SET Name='Preparation Time Fr', PrintName='Preparation Time Fr',Updated=TO_TIMESTAMP('2017-08-21 12:47:26','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=542180
;
-- 2017-08-21T12:47:26.249
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Column SET ColumnName='PreparationTime_5', Name='Preparation Time Fr', Description='Preparation time for Friday', Help=NULL WHERE AD_Element_ID=542180
;
-- 2017-08-21T12:47:26.263
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Process_Para SET ColumnName='PreparationTime_5', Name='Preparation Time Fr', Description='Preparation time for Friday', Help=NULL, AD_Element_ID=542180 WHERE UPPER(ColumnName)='PREPARATIONTIME_5' AND IsCentrallyMaintained='Y' AND AD_Element_ID IS NULL
;
-- 2017-08-21T12:47:26.264
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Process_Para SET ColumnName='PreparationTime_5', Name='Preparation Time Fr', Description='Preparation time for Friday', Help=NULL WHERE AD_Element_ID=542180 AND IsCentrallyMaintained='Y'
;
-- 2017-08-21T12:47:26.266
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Field SET Name='Preparation Time Fr', Description='Preparation time for Friday', Help=NULL WHERE AD_Column_ID IN (SELECT AD_Column_ID FROM AD_Column WHERE AD_Element_ID=542180) AND IsCentrallyMaintained='Y'
;
-- 2017-08-21T12:47:26.280
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_PrintFormatItem pi SET PrintName='Preparation Time Fr', Name='Preparation Time Fr' WHERE IsCentrallyMaintained='Y' AND EXISTS (SELECT * FROM AD_Column c WHERE c.AD_Column_ID=pi.AD_Column_ID AND c.AD_Element_ID=542180)
;
-- 2017-08-21T12:47:39.542
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Element SET Name='Bereitstellungszeit Sa', PrintName='Bereitstellungszeit Sa',Updated=TO_TIMESTAMP('2017-08-21 12:47:39','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=542181
;
-- 2017-08-21T12:47:39.544
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Column SET ColumnName='PreparationTime_6', Name='Bereitstellungszeit Sa', Description='Preparation time for Saturday', Help=NULL WHERE AD_Element_ID=542181
;
-- 2017-08-21T12:47:39.557
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Process_Para SET ColumnName='PreparationTime_6', Name='Bereitstellungszeit Sa', Description='Preparation time for Saturday', Help=NULL, AD_Element_ID=542181 WHERE UPPER(ColumnName)='PREPARATIONTIME_6' AND IsCentrallyMaintained='Y' AND AD_Element_ID IS NULL
;
-- 2017-08-21T12:47:39.558
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Process_Para SET ColumnName='PreparationTime_6', Name='Bereitstellungszeit Sa', Description='Preparation time for Saturday', Help=NULL WHERE AD_Element_ID=542181 AND IsCentrallyMaintained='Y'
;
-- 2017-08-21T12:47:39.560
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Field SET Name='Bereitstellungszeit Sa', Description='Preparation time for Saturday', Help=NULL WHERE AD_Column_ID IN (SELECT AD_Column_ID FROM AD_Column WHERE AD_Element_ID=542181) AND IsCentrallyMaintained='Y'
;
-- 2017-08-21T12:47:39.575
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_PrintFormatItem pi SET PrintName='Bereitstellungszeit Sa', Name='Bereitstellungszeit Sa' WHERE IsCentrallyMaintained='Y' AND EXISTS (SELECT * FROM AD_Column c WHERE c.AD_Column_ID=pi.AD_Column_ID AND c.AD_Element_ID=542181)
;
-- 2017-08-21T12:47:51.624
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Element SET Name='Bereitstellungszeit So', PrintName='Bereitstellungszeit So',Updated=TO_TIMESTAMP('2017-08-21 12:47:51','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=542182
;
-- 2017-08-21T12:47:51.625
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Column SET ColumnName='PreparationTime_7', Name='Bereitstellungszeit So', Description='Preparation time for Sunday', Help=NULL WHERE AD_Element_ID=542182
;
-- 2017-08-21T12:47:51.639
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Process_Para SET ColumnName='PreparationTime_7', Name='Bereitstellungszeit So', Description='Preparation time for Sunday', Help=NULL, AD_Element_ID=542182 WHERE UPPER(ColumnName)='PREPARATIONTIME_7' AND IsCentrallyMaintained='Y' AND AD_Element_ID IS NULL
;
-- 2017-08-21T12:47:51.641
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Process_Para SET ColumnName='PreparationTime_7', Name='Bereitstellungszeit So', Description='Preparation time for Sunday', Help=NULL WHERE AD_Element_ID=542182 AND IsCentrallyMaintained='Y'
;
-- 2017-08-21T12:47:51.642
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Field SET Name='Bereitstellungszeit So', Description='Preparation time for Sunday', Help=NULL WHERE AD_Column_ID IN (SELECT AD_Column_ID FROM AD_Column WHERE AD_Element_ID=542182) AND IsCentrallyMaintained='Y'
;
-- 2017-08-21T12:47:51.658
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_PrintFormatItem pi SET PrintName='Bereitstellungszeit So', Name='Bereitstellungszeit So' WHERE IsCentrallyMaintained='Y' AND EXISTS (SELECT * FROM AD_Column c WHERE c.AD_Column_ID=pi.AD_Column_ID AND c.AD_Element_ID=542182)
;
-- 2017-08-21T12:48:21.636
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Element SET Name='Bereitstellungszeit Do', PrintName='Bereitstellungszeit Do',Updated=TO_TIMESTAMP('2017-08-21 12:48:21','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=542179
;
-- 2017-08-21T12:48:21.637
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Column SET ColumnName='PreparationTime_4', Name='Bereitstellungszeit Do', Description='Preparation time for thursday', Help=NULL WHERE AD_Element_ID=542179
;
-- 2017-08-21T12:48:21.649
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Process_Para SET ColumnName='PreparationTime_4', Name='Bereitstellungszeit Do', Description='Preparation time for thursday', Help=NULL, AD_Element_ID=542179 WHERE UPPER(ColumnName)='PREPARATIONTIME_4' AND IsCentrallyMaintained='Y' AND AD_Element_ID IS NULL
;
-- 2017-08-21T12:48:21.651
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Process_Para SET ColumnName='PreparationTime_4', Name='Bereitstellungszeit Do', Description='Preparation time for thursday', Help=NULL WHERE AD_Element_ID=542179 AND IsCentrallyMaintained='Y'
;
-- 2017-08-21T12:48:21.651
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Field SET Name='Bereitstellungszeit Do', Description='Preparation time for thursday', Help=NULL WHERE AD_Column_ID IN (SELECT AD_Column_ID FROM AD_Column WHERE AD_Element_ID=542179) AND IsCentrallyMaintained='Y'
;
-- 2017-08-21T12:48:21.666
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_PrintFormatItem pi SET PrintName='Bereitstellungszeit Do', Name='Bereitstellungszeit Do' WHERE IsCentrallyMaintained='Y' AND EXISTS (SELECT * FROM AD_Column c WHERE c.AD_Column_ID=pi.AD_Column_ID AND c.AD_Element_ID=542179)
;
-- 2017-08-21T12:48:40.420
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Element SET Name='Bereitstellungszeit Fr', PrintName='Bereitstellungszeit Fr',Updated=TO_TIMESTAMP('2017-08-21 12:48:40','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=542180
;
-- 2017-08-21T12:48:40.426
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Column SET ColumnName='PreparationTime_5', Name='Bereitstellungszeit Fr', Description='Preparation time for Friday', Help=NULL WHERE AD_Element_ID=542180
;
-- 2017-08-21T12:48:40.440
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Process_Para SET ColumnName='PreparationTime_5', Name='Bereitstellungszeit Fr', Description='Preparation time for Friday', Help=NULL, AD_Element_ID=542180 WHERE UPPER(ColumnName)='PREPARATIONTIME_5' AND IsCentrallyMaintained='Y' AND AD_Element_ID IS NULL
;
-- 2017-08-21T12:48:40.441
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Process_Para SET ColumnName='PreparationTime_5', Name='Bereitstellungszeit Fr', Description='Preparation time for Friday', Help=NULL WHERE AD_Element_ID=542180 AND IsCentrallyMaintained='Y'
;
-- 2017-08-21T12:48:40.442
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Field SET Name='Bereitstellungszeit Fr', Description='Preparation time for Friday', Help=NULL WHERE AD_Column_ID IN (SELECT AD_Column_ID FROM AD_Column WHERE AD_Element_ID=542180) AND IsCentrallyMaintained='Y'
;
-- 2017-08-21T12:48:40.461
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_PrintFormatItem pi SET PrintName='Bereitstellungszeit Fr', Name='Bereitstellungszeit Fr' WHERE IsCentrallyMaintained='Y' AND EXISTS (SELECT * FROM AD_Column c WHERE c.AD_Column_ID=pi.AD_Column_ID AND c.AD_Element_ID=542180)
;
-- 2017-08-21T12:51:36.112
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Field SET Name='Feiertage ausfallen',Updated=TO_TIMESTAMP('2017-08-21 12:51:36','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=558083
;
-- 2017-08-21T12:51:49.332
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Field SET Name='Lieferung verschieben',Updated=TO_TIMESTAMP('2017-08-21 12:51:49','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=558084
;
-- 2017-08-21T12:52:54.621
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=10,Updated=TO_TIMESTAMP('2017-08-21 12:52:54','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=543019
;
-- 2017-08-21T12:52:54.624
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=20,Updated=TO_TIMESTAMP('2017-08-21 12:52:54','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=542992
;
-- 2017-08-21T12:53:50.802
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Field SET SortNo=-1.000000000000,Updated=TO_TIMESTAMP('2017-08-21 12:53:50','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=558082
;
-- 2017-08-21T12:54:23.651
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Field SET SortNo=2.000000000000,Updated=TO_TIMESTAMP('2017-08-21 12:54:23','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=558076
;
-- 2017-08-21T12:54:55.253
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Field SET SortNo=NULL,Updated=TO_TIMESTAMP('2017-08-21 12:54:55','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=558088
;
-- 2017-08-21T12:54:57.343
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Field SET SortNo=NULL,Updated=TO_TIMESTAMP('2017-08-21 12:54:57','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=558090
;
-- 2017-08-21T12:54:59.304
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Field SET SortNo=NULL,Updated=TO_TIMESTAMP('2017-08-21 12:54:59','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=558092
;
-- 2017-08-21T12:55:00.824
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Field SET SortNo=NULL,Updated=TO_TIMESTAMP('2017-08-21 12:55:00','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=558093
;
-- 2017-08-21T12:55:02.332
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Field SET SortNo=NULL,Updated=TO_TIMESTAMP('2017-08-21 12:55:02','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=558094
;
-- 2017-08-21T12:55:03.672
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Field SET SortNo=NULL,Updated=TO_TIMESTAMP('2017-08-21 12:55:03','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=558096
;
-- 2017-08-21T12:55:05.087
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Field SET SortNo=NULL,Updated=TO_TIMESTAMP('2017-08-21 12:55:05','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=558098
;
-- 2017-08-21T12:55:10.528
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Field SET SortNo=NULL,Updated=TO_TIMESTAMP('2017-08-21 12:55:10','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=558100
;
-- 2017-08-21T12:55:34.789
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=110,Updated=TO_TIMESTAMP('2017-08-21 12:55:34','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=543034
;
-- 2017-08-21T12:56:19.347
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,Created,CreatedBy,IsActive,IsAdvancedField,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,558107,0,540801,540257,547367,TO_TIMESTAMP('2017-08-21 12:56:19','YYYY-MM-DD HH24:MI:SS'),100,'Y','N','Y','N','N','Sektion',10,0,0,TO_TIMESTAMP('2017-08-21 12:56:19','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 2017-08-21T12:56:30.117
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,Created,CreatedBy,IsActive,IsAdvancedField,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,558106,0,540801,540257,547368,TO_TIMESTAMP('2017-08-21 12:56:30','YYYY-MM-DD HH24:MI:SS'),100,'Y','N','Y','N','N','Mandant',20,0,0,TO_TIMESTAMP('2017-08-21 12:56:30','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 2017-08-21T12:56:40.789
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET SeqNo=10,Updated=TO_TIMESTAMP('2017-08-21 12:56:40','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=542987
;
-- 2017-08-21T12:56:45.505
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET SeqNo=20,Updated=TO_TIMESTAMP('2017-08-21 12:56:45','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=542988
;
-- 2017-08-21T12:56:47.855
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET SeqNo=30,Updated=TO_TIMESTAMP('2017-08-21 12:56:47','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=542989
;
-- 2017-08-21T12:56:49.837
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET SeqNo=40,Updated=TO_TIMESTAMP('2017-08-21 12:56:49','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=542990
;
-- 2017-08-21T12:56:52.132
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET SeqNo=50,Updated=TO_TIMESTAMP('2017-08-21 12:56:52','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=542991
;
-- 2017-08-21T12:56:54.653
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET SeqNo=60,Updated=TO_TIMESTAMP('2017-08-21 12:56:54','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=547367
;
-- 2017-08-21T12:56:57.167
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET SeqNo=70,Updated=TO_TIMESTAMP('2017-08-21 12:56:57','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=547368
;
-- 2017-08-21T12:57:01.739
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=60,Updated=TO_TIMESTAMP('2017-08-21 12:57:01','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=547367
;
-- 2017-08-21T12:57:59.559
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,Created,CreatedBy,IsActive,IsAdvancedField,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,558115,0,540801,540257,547369,TO_TIMESTAMP('2017-08-21 12:57:59','YYYY-MM-DD HH24:MI:SS'),100,'Y','N','N','N','N','Standort',0,0,0,TO_TIMESTAMP('2017-08-21 12:57:59','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 2017-08-21T12:58:17.375
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=30,Updated=TO_TIMESTAMP('2017-08-21 12:58:17','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=547369
;
-- 2017-08-21T12:58:17.377
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=40,Updated=TO_TIMESTAMP('2017-08-21 12:58:17','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=542989
;
-- 2017-08-21T12:58:17.378
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=50,Updated=TO_TIMESTAMP('2017-08-21 12:58:17','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=542990
;
-- 2017-08-21T12:58:17.379
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=60,Updated=TO_TIMESTAMP('2017-08-21 12:58:17','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=542991
;
-- 2017-08-21T12:58:17.380
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=70,Updated=TO_TIMESTAMP('2017-08-21 12:58:17','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=547367
; | the_stack |
--
create or replace package XFILES_USER_SERVICES
AUTHID CURRENT_USER
as
procedure RESETUSEROPTIONS(P_NEW_PASSWORD VARCHAR2 DEFAULT NULL,P_RESET_HOME_FOLDER BOOLEAN DEFAULT FALSE, P_RECREATE_HOME_PAGE BOOLEAN DEFAULT FALSE, P_RESET_PUBLIC_FOLDER BOOLEAN DEFAULT FALSE, P_RECREATE_PUBLIC_PAGE BOOLEAN DEFAULT FALSE);
function GETUSERPRIVILEGES return XMLType;
end;
/
show errors
--
create or replace package body XFILES_USER_SERVICES
as
procedure writeLogRecord(P_NAME VARCHAR2, P_INIT_TIME TIMESTAMP WITH TIME ZONE, P_PARAMETERS XMLType)
as
begin
XFILES_LOGGING.writeLogRecord('/orawsv/&XFILES_SCHEMA/XFILES_USER_SERVICES/',P_NAME, P_INIT_TIME, P_PARAMETERS);
end;
--
procedure writeErrorRecord(P_NAME VARCHAR2, P_INIT_TIME TIMESTAMP WITH TIME ZONE, P_PARAMETERS XMLType, P_STACK_TRACE XMLType)
as
begin
XFILES_LOGGING.writeErrorRecord('/orawsv/&XFILES_SCHEMA/XFILES_USER_SERVICES/',P_NAME, P_INIT_TIME, P_PARAMETERS, P_STACK_TRACE);
end;
--
--
procedure resetHomePage
as
V_FOLDER_PATH VARCHAR(1024) := XDB_CONSTANTS.FOLDER_HOME || '/' || USER;
begin
-- Create a dummy index.html for the user's public folder and apply the XFILES_REDIRECT ResConfig to dynamically generate the correct content.
XDB_REPOSITORY_SERVICES.createIndexPage(V_FOLDER_PATH);
end;
--
procedure resetPublicPage
as
V_FOLDER_PATH VARCHAR(1024) := XDB_CONSTANTS.FOLDER_HOME || '/' || USER || XDB_CONSTANTS.FOLDER_PUBLIC;
begin
-- Create a dummy index.html for the user's public folder and apply the XFILES_INDEX_PAGE ResConfig to dynamically generate the correct content.
XDB_REPOSITORY_SERVICES.createIndexPage(V_FOLDER_PATH);
end;
--
procedure RESETUSEROPTIONS(P_NEW_PASSWORD VARCHAR2 DEFAULT NULL,P_RESET_HOME_FOLDER BOOLEAN DEFAULT FALSE, P_RECREATE_HOME_PAGE BOOLEAN DEFAULT FALSE, P_RESET_PUBLIC_FOLDER BOOLEAN DEFAULT FALSE, P_RECREATE_PUBLIC_PAGE BOOLEAN DEFAULT FALSE)
as
V_STACK_TRACE XMLType;
V_PARAMETERS XMLType;
V_INIT TIMESTAMP WITH TIME ZONE := SYSTIMESTAMP;
V_STATEMENT VARCHAR2(4000) := null;
V_RESET_HOME_FOLDER VARCHAR2(5) := XDB_DOM_UTILITIES.BOOLEAN_TO_VARCHAR(P_RESET_HOME_FOLDER);
V_RECREATE_HOME_PAGE VARCHAR2(5) := XDB_DOM_UTILITIES.BOOLEAN_TO_VARCHAR(P_RECREATE_HOME_PAGE);
V_RESET_PUBLIC_FOLDER VARCHAR2(5) := XDB_DOM_UTILITIES.BOOLEAN_TO_VARCHAR(P_RESET_PUBLIC_FOLDER);
V_RECREATE_PUBLIC_PAGE VARCHAR2(5) := XDB_DOM_UTILITIES.BOOLEAN_TO_VARCHAR(P_RECREATE_PUBLIC_PAGE);
begin
select xmlConcat
(
xmlElement("User",sys_context('USERENV', 'CURRENT_USER')),
case
when P_NEW_PASSWORD is not null
then xmlElement("newPassword",null)
end,
case
when V_RESET_HOME_FOLDER = 'TRUE'
then xmlElement("resetHomeFolder",null)
end,
case
when V_RECREATE_HOME_PAGE = 'TRUE'
then xmlElement("recreateHomePage",null)
end,
case
when V_RESET_PUBLIC_FOLDER = 'TRUE'
then xmlElement("resetHomeFolder",null)
end,
case
when V_RECREATE_PUBLIC_PAGE = 'TRUE'
then xmlElement("recreateHomePage",null)
end
)
into V_PARAMETERS
from dual;
if (P_NEW_PASSWORD is not NULL) then
V_STATEMENT := 'alter user "' || USER || '" identified by ' || DBMS_ASSERT.ENQUOTE_NAME(P_NEW_PASSWORD,false);
execute immediate V_STATEMENT;
end if;
if (P_RESET_HOME_FOLDER) then
xdb_utilities.createHomeFolder();
resetHomePage();
end if;
if (P_RECREATE_HOME_PAGE) then
resetHomePage();
end if;
if (P_RESET_PUBLIC_FOLDER) then
xdb_utilities.createPublicFolder();
resetPublicPage();
end if;
if (P_RECREATE_PUBLIC_PAGE) then
resetPublicPage();
end if;
writeLogRecord('RESETUSEROPTIONS',V_INIT,V_PARAMETERS);
exception
when others then
V_STACK_TRACE := XFILES_LOGGING.captureStackTrace();
rollback;
writeErrorRecord('RESETUSEROPTIONS',V_INIT,V_PARAMETERS,V_STACK_TRACE);
raise;
end;
--
function getUserPrivileges
return XMLType
as
V_STACK_TRACE XMLType;
V_PARAMETERS XMLType;
V_INIT TIMESTAMP WITH TIME ZONE := SYSTIMESTAMP;
V_HAS_CREATE_USER NUMBER := 0;
V_HAS_DBA NUMBER := 0;
V_HAS_XDBADMIN NUMBER := 0;
V_HAS_XFILES_ADMINISTRATOR NUMBER := 0;
V_HAS_GRANT_OPTION NUMBER := 0;
V_USER_PRIVILEGES XMLType;
cursor getSystemPrivileges
is
select PRIVILEGE
from ROLE_SYS_PRIVS
where PRIVILEGE in ('CREATE USER')
union all
select PRIVILEGE
from USER_SYS_PRIVS
where PRIVILEGE in ('CREATE USER');
cursor getGrantedRoles
is
select GRANTED_ROLE, ADMIN_OPTION
from ROLE_ROLE_PRIVS
where GRANTED_ROLE in ('DBA','XDBADMIN','XFILES_ADMINISTRATOR')
union all
select GRANTED_ROLE, ADMIN_OPTION
from USER_ROLE_PRIVS
where GRANTED_ROLE in ('DBA','XDBADMIN','XFILES_ADMINISTRATOR');
begin
select xmlConcat
(
xmlElement("User",sys_context('USERENV', 'CURRENT_USER')),
xmlElement("Password")
)
into V_PARAMETERS
from dual;
for p in getSystemPrivileges loop
if p.PRIVILEGE = 'CREATE USER' then
V_HAS_CREATE_USER := 1;
end if;
end loop;
for p in getGrantedRoles loop
if p.GRANTED_ROLE = 'DBA' then
V_HAS_DBA := 1;
end if;
if p.GRANTED_ROLE = 'XDBADMIN' then
V_HAS_XDBADMIN := 1;
end if;
if p.GRANTED_ROLE = 'XFILES_ADMINISTRATOR' then
V_HAS_XFILES_ADMINISTRATOR := 1;
if p.ADMIN_OPTION = 'YES' then
V_HAS_GRANT_OPTION := 1;
end if;
end if;
end loop;
select XMLElement
(
"UserPrivileges",
XMLElement("createUser",V_HAS_CREATE_USER),
XMLElement("dba",V_HAS_CREATE_USER),
XMLElement("xdbAdmin",V_HAS_CREATE_USER),
XMLElement("xfilesAdmin",xmlAttributes(V_HAS_GRANT_OPTION as "withGrant"),V_HAS_XFILES_ADMINISTRATOR),
XMLElement
(
"userList",
(
select XMLAgg
(
XMLElement("user",username)
)
from ALL_USERS
)
)
)
into V_USER_PRIVILEGES
from dual;
writeLogRecord('GETUSERPRIVILEGES',V_INIT,V_PARAMETERS);
return V_USER_PRIVILEGES;
exception
when others then
V_STACK_TRACE := XFILES_LOGGING.captureStackTrace();
rollback;
writeErrorRecord('GETUSERPRIVILEGES',V_INIT,V_PARAMETERS,V_STACK_TRACE);
raise;
end;
--
end;
/
show errors
--
create or replace package XFILES_ADMIN_SERVICES
AUTHID CURRENT_USER
as
procedure CREATEXFILESUSER(P_PRINCIPLE_NAME VARCHAR2,P_PASSWORD VARCHAR2);
procedure REVOKEXFILES(P_PRINCIPLE_NAME VARCHAR2);
procedure GRANTXFILESUSER(P_PRINCIPLE_NAME VARCHAR2);
procedure GRANTXFILESADMINISTRATOR(P_PRINCIPLE_NAME VARCHAR2);
end;
/
show errors
--
create or replace package body XFILES_ADMIN_SERVICES
as
procedure writeLogRecord(P_NAME VARCHAR2, P_INIT_TIME TIMESTAMP WITH TIME ZONE, P_PARAMETERS XMLType)
as
begin
XFILES_LOGGING.writeLogRecord('/orawsv/&XFILES_SCHEMA/XFILES_ADMIN_SERVICES/',P_NAME, P_INIT_TIME, P_PARAMETERS);
end;
--
procedure writeErrorRecord(P_NAME VARCHAR2, P_INIT_TIME TIMESTAMP WITH TIME ZONE, P_PARAMETERS XMLType, P_STACK_TRACE XMLType)
as
begin
XFILES_LOGGING.writeErrorRecord('/orawsv/&XFILES_SCHEMA/XFILES_ADMIN_SERVICES/',P_NAME, P_INIT_TIME, P_PARAMETERS, P_STACK_TRACE);
end;
--
procedure REVOKEXFILES(P_PRINCIPLE_NAME VARCHAR2)
as
V_STACK_TRACE XMLType;
V_PARAMETERS XMLType;
V_INIT TIMESTAMP WITH TIME ZONE := SYSTIMESTAMP;
role_not_granted exception;
PRAGMA EXCEPTION_INIT( role_not_granted , -01951 );
begin
select xmlConcat
(
xmlElement("xfilesAdministrator",USER),
xmlElement("User",P_PRINCIPLE_NAME)
)
into V_PARAMETERS
from dual;
begin
execute immediate 'REVOKE XFILES_ADMINISTRATOR from ' || DBMS_ASSERT.ENQUOTE_NAME(P_PRINCIPLE_NAME,false);
exception
when role_not_granted then
null;
end;
begin
execute immediate 'REVOKE XFILES_USER from ' || DBMS_ASSERT.ENQUOTE_NAME(P_PRINCIPLE_NAME,false);
exception
when role_not_granted then
null;
end;
writeLogRecord('REVOKEXFILES',V_INIT,V_PARAMETERS);
exception
when others then
V_STACK_TRACE := XFILES_LOGGING.captureStackTrace();
rollback;
writeErrorRecord('REVOKEXFILES',V_INIT,V_PARAMETERS,V_STACK_TRACE);
raise;
end;
--
procedure GRANTXFILESUSER(P_PRINCIPLE_NAME VARCHAR2)
as
V_STACK_TRACE XMLType;
V_PARAMETERS XMLType;
V_INIT TIMESTAMP WITH TIME ZONE := SYSTIMESTAMP;
role_not_granted exception;
PRAGMA EXCEPTION_INIT( role_not_granted , -01951 );
begin
select xmlConcat
(
xmlElement("xfilesAdministrator",USER),
xmlElement("User",P_PRINCIPLE_NAME)
)
into V_PARAMETERS
from dual;
begin
execute immediate 'REVOKE XFILES_ADMINISTRATOR from ' || DBMS_ASSERT.ENQUOTE_NAME(P_PRINCIPLE_NAME,false);
exception
when role_not_granted then
null;
end;
execute immediate 'GRANT XFILES_USER to ' || DBMS_ASSERT.ENQUOTE_NAME(P_PRINCIPLE_NAME,false);
writeLogRecord('GRANTXFILESUSER',V_INIT,V_PARAMETERS);
exception
when others then
V_STACK_TRACE := XFILES_LOGGING.captureStackTrace();
rollback;
writeErrorRecord('GRANTXFILESUSER',V_INIT,V_PARAMETERS,V_STACK_TRACE);
raise;
end;
--
procedure GRANTXFILESADMINISTRATOR(P_PRINCIPLE_NAME VARCHAR2)
as
V_STACK_TRACE XMLType;
V_PARAMETERS XMLType;
V_INIT TIMESTAMP WITH TIME ZONE := SYSTIMESTAMP;
role_not_granted exception;
PRAGMA EXCEPTION_INIT( role_not_granted , -01951 );
begin
select xmlConcat
(
xmlElement("xfilesAdministrator",USER),
xmlElement("User",P_PRINCIPLE_NAME)
)
into V_PARAMETERS
from dual;
begin
execute immediate 'REVOKE XFILES_USER from ' || DBMS_ASSERT.ENQUOTE_NAME(P_PRINCIPLE_NAME,false);
exception
when role_not_granted then
null;
end;
execute immediate 'GRANT XFILES_ADMINISTRATOR to ' || DBMS_ASSERT.ENQUOTE_NAME(P_PRINCIPLE_NAME,false);
writeLogRecord('GRANTXFILESADMINISTRATOR',V_INIT,V_PARAMETERS);
exception
when others then
V_STACK_TRACE := XFILES_LOGGING.captureStackTrace();
rollback;
writeErrorRecord('GRANTXFILESADMINISTRATOR',V_INIT,V_PARAMETERS,V_STACK_TRACE);
raise;
end;
--
procedure CREATEXFILESUSER(P_PRINCIPLE_NAME VARCHAR2, P_PASSWORD VARCHAR2)
as
V_STACK_TRACE XMLType;
V_PARAMETERS XMLType;
V_INIT TIMESTAMP WITH TIME ZONE := SYSTIMESTAMP;
V_STATEMENT VARCHAR2(4000) :=null;
V_USER_EXISTS BOOLEAN := FALSE;
cursor checkUser
is
select USERNAME
from ALL_USERS
where USERNAME = P_PRINCIPLE_NAME;
begin
select xmlConcat
(
xmlElement("Administrator",USER),
xmlElement("NewUser",P_PRINCIPLE_NAME),
xmlElement("Password")
)
into V_PARAMETERS
from dual;
V_STATEMENT := 'create user ' || DBMS_ASSERT.ENQUOTE_NAME(P_PRINCIPLE_NAME,false) || ' identified by ' || DBMS_ASSERT.ENQUOTE_NAME(P_PASSWORD,false) || ' account unlock';
for u in checkUser loop
V_STATEMENT := 'alter user ' || DBMS_ASSERT.ENQUOTE_NAME(P_PRINCIPLE_NAME,false) || ' identified by ' || DBMS_ASSERT.ENQUOTE_NAME(P_PASSWORD,false) || ' account unlock';
end loop;
execute immediate V_STATEMENT;
execute immediate 'grant connect to ' || DBMS_ASSERT.ENQUOTE_NAME(P_PRINCIPLE_NAME,false);
execute immediate 'grant XFILES_USER to ' || DBMS_ASSERT.ENQUOTE_NAME(P_PRINCIPLE_NAME,false);
writeLogRecord('CREATEUSER',V_INIT,V_PARAMETERS);
exception
when others then
V_STACK_TRACE := XFILES_LOGGING.captureStackTrace();
rollback;
writeErrorRecord('CREATEUSER',V_INIT,V_PARAMETERS,V_STACK_TRACE);
raise;
end;
--
end;
/
show errors
-- | the_stack |
create or replace package body moats as
-- Internal types and global arrays for caching collections of
-- SYSSTAT/ASH data for querying within MOATS...
-- ------------------------------------------------------------------
type moats_stat_ntt_aat is table of moats_stat_ntt
index by pls_integer;
g_stats moats_stat_ntt_aat;
type moats_ash_ntt_aat is table of moats_ash_ntt
index by pls_integer;
g_ash moats_ash_ntt_aat;
-- Internal type and variable for storing simple MOATS parameters...
-- -----------------------------------------------------------------
type parameter_aat is table of integer
index by pls_integer;
g_params parameter_aat;
-- Variables for maintaining ASH/SYSSTAT collections...
-- ----------------------------------------------------
g_ash_size pls_integer := 0;
g_stat_size pls_integer := 0;
-- General constants...
-- --------------------
gc_space constant moats_output_ot := moats_output_ot(null);
gc_mb constant pls_integer := 1048576;
gc_gb constant pls_integer := 1048576*1024;
gc_screen_size constant pls_integer := 36;
gc_newline constant varchar2(1) := chr(10);
----------------------------------------------------------------------------
procedure p( p_str in varchar2 ) is
begin
dbms_output.put_line(p_str);
end p;
----------------------------------------------------------------------------
procedure po( p_str in moats_output_ot ) is
begin
p(p_str.output);
end po;
-- ----------------------------------------------------------------------------
-- procedure dump_ash is
-- pragma autonomous_transaction;
-- begin
-- insert into moats_ash_dump select * from table(moats.get_ash);
-- commit;
-- end dump_ash;
----------------------------------------------------------------------------
procedure show_snaps is
v_indx pls_integer;
begin
p('ASH snaps...');
p('------------------------------------');
v_indx := g_ash.first;
while v_indx is not null loop
p(utl_lms.format_message('Index=[%d] Count=[%d]', v_indx, g_ash(v_indx).count));
v_indx := g_ash.next(v_indx);
end loop;
p('STAT snaps...');
p('------------------------------------');
v_indx := g_stats.first;
while v_indx is not null loop
p(utl_lms.format_message('Index=[%d] Count=[%d]', v_indx, g_stats(v_indx).count));
v_indx := g_stats.next(v_indx);
end loop;
end show_snaps;
----------------------------------------------------------------------------
function banner return moats_output_ntt is
begin
return moats_output_ntt(
moats_output_ot('MOATS: The Mother Of All Tuning Scripts v1.0 by Adrian Billington & Tanel Poder'),
moats_output_ot(' http://www.oracle-developer.net & http://www.e2sn.com')
);
end banner;
----------------------------------------------------------------------------
function to_string ( p_collection in moats_v2_ntt,
p_delimiter in varchar2 default ',',
p_elements in pls_integer default null ) return varchar2 is
v_str varchar2(4000);
begin
for i in 1 .. least(nvl(p_elements, p_collection.count), p_collection.count) loop
v_str := v_str || p_delimiter || p_collection(i);
end loop;
return ltrim(v_str, p_delimiter);
end to_string;
----------------------------------------------------------------------------
procedure format_window is
v_banner moats_output_ntt := banner();
c_boundary varchar2(110) := rpad('-',110,'-');
procedure spaces( p_spaces in pls_integer ) is
begin
for i in 1 .. p_spaces loop
po(gc_space);
end loop;
end spaces;
begin
p(c_boundary);
spaces(2);
for i in 1 .. v_banner.count loop
p(v_banner(i).output);
end loop;
spaces(3);
p(' MOATS.FORMAT_WINDOW');
p(' -------------------');
p(' Align sqlplus window size to dotted lines for optimal output');
spaces(gc_screen_size-10);
p(c_boundary);
end format_window;
----------------------------------------------------------------------------
procedure set_parameter( p_parameter_code in pls_integer,
p_parameter_value in integer ) is
begin
g_params(p_parameter_code) := p_parameter_value;
end set_parameter;
----------------------------------------------------------------------------
function get_parameter ( p_parameter_code in pls_integer ) return integer is
begin
return g_params(p_parameter_code);
end get_parameter;
----------------------------------------------------------------------------
procedure restore_default_parameters is
begin
set_parameter(moats.gc_ash_polling_rate, 1);
set_parameter(moats.gc_ash_threshold, 1000);
set_parameter(moats.gc_top_refresh_rate, 10);
-- By default don't use a trailing ASH window
set_parameter(moats.gc_ash_window_size, NULL);
end restore_default_parameters;
----------------------------------------------------------------------------
function get_sql( p_select in varchar2,
p_from in varchar2,
p_where in varchar2,
p_group_by in varchar2,
p_order_by in varchar2 ) return varchar2 is
v_sql varchar2(32767);
begin
v_sql := 'select ' || nvl(p_select, '*') || ' from ' || p_from;
if p_where is not null then
v_sql := v_sql || ' where ' || p_where;
end if;
if p_group_by is not null then
v_sql := v_sql || ' group by ' || p_group_by;
end if;
if p_order_by is not null then
v_sql := v_sql || ' order by ' || p_order_by;
end if;
return v_sql;
end get_sql;
----------------------------------------------------------------------------
function ash_history return interval day to second is
begin
return g_ash(g_ash.last)(1).snaptime - g_ash(g_ash.first)(1).snaptime;
end ash_history;
----------------------------------------------------------------------------
function ash_sample_count( p_lower_snap in pls_integer,
p_upper_snap in pls_integer ) return pls_integer is
v_samples pls_integer := 0;
v_snap pls_integer;
v_exit boolean := false;
begin
v_snap := p_lower_snap;
while v_snap is not null and not v_exit loop
-- Ignore dummy record
if not (g_ash(v_snap).count = 1 and g_ash(v_snap)(1).sid is null) then
v_samples := v_samples + g_ash(v_snap).count;
end if;
v_exit := (v_snap = p_upper_snap);
v_snap := g_ash.next(v_snap);
end loop;
return greatest(v_samples,1);
end ash_sample_count;
----------------------------------------------------------------------------
procedure maintain_ash_collection( p_index in pls_integer ) is
begin
if g_ash(p_index).count = 0 then
g_ash.delete(p_index);
else
g_ash_size := g_ash_size + g_ash(p_index).count;
while g_ash_size > g_params(moats.gc_ash_threshold) loop
g_ash_size := g_ash_size - g_ash(g_ash.first).count;
g_ash.delete(g_ash.first);
end loop;
end if;
end maintain_ash_collection;
----------------------------------------------------------------------------
procedure snap_ash( p_index in pls_integer ) is
v_sql_template varchar2(32767);
v_sql varchar2(32767);
begin
-- TODO: conditional compilation to get correct column list for version or
-- select a small bunch of useful columns
-- Use dynamic SQL to avoid explicit grants on V$SESSION. Prepare the start
-- of the SQL as it will be used twice...
-- ------------------------------------------------------------------------
v_sql_template := q'[select moats_ash_ot(
systimestamp, saddr, %sid%, serial#, audsid, paddr, user#,
username, command, ownerid, taddr, lockwait,
status, server, schema#, schemaname, osuser,
process, machine, terminal, program, type,
sql_address, sql_hash_value, sql_id, sql_child_number,
prev_sql_addr, prev_hash_value, prev_sql_id,
prev_child_number, module, module_hash, action,
action_hash, client_info, fixed_table_sequence,
row_wait_obj#, row_wait_file#, row_wait_block#,
row_wait_row#, logon_time, last_call_et, pdml_enabled,
failover_type, failover_method, failed_over,
resource_consumer_group, pdml_status, pddl_status,
pq_status, current_queue_duration, client_identifier,
blocking_session_status, blocking_instance,
blocking_session, seq#, event#, case when state = 'WAITING' then event else 'ON CPU' end, p1text, p1,
p1raw, p2text, p2, p2raw, p3text, p3, p3raw,
wait_class_id, wait_class#, case when state = 'WAITING' then wait_class else 'ON CPU' end, wait_time,
seconds_in_wait, state, service_name, sql_trace,
sql_trace_waits, sql_trace_binds
)
from v$session
where %preds%]';
v_sql := replace( v_sql_template, '%sid%', 'sid');
v_sql := replace( v_sql, '%preds%', q'[ status = 'ACTIVE'
and (wait_class != 'Idle' or state != 'WAITING')
and sid != sys_context('userenv', 'sid')]' );
execute immediate v_sql bulk collect into g_ash(p_index);
-- If we have nothing to snap, add a dummy record that will be ignored
-- in GET_ASH and GET_ASH_SAMPLE_COUNT...
-- -------------------------------------------------------------------
if g_ash(p_index).count = 0 then
v_sql := replace( v_sql_template, '%sid%', 'null');
v_sql := replace( v_sql, '%preds%', q'[sid = sys_context('userenv', 'sid')]' );
execute immediate v_sql bulk collect into g_ash(p_index);
end if;
maintain_ash_collection(p_index);
end snap_ash;
----------------------------------------------------------------------------
procedure reset_stats_collection is
begin
g_stats.delete;
end reset_stats_collection;
----------------------------------------------------------------------------
procedure snap_stats( p_index in pls_integer,
p_reset in boolean default false ) is
begin
if p_reset then
reset_stats_collection();
end if;
-- Use dynamic SQL to avoid explicit grants on V$ views...
-- -------------------------------------------------------
execute immediate
q'[select moats_stat_ot(type, name, value)
from (
select 'STAT' as type
, sn.name
, ss.value
from v$statname sn
, v$sysstat ss
where sn.statistic# = ss.statistic#
union all
select 'LATCH'
, name
, gets
from v$latch
union all
select 'TIMER'
, 'moats timer'
, hsecs
from v$timer
)]'
bulk collect into g_stats(p_index);
end snap_stats;
----------------------------------------------------------------------------
function instance_summary ( p_lower_snap in pls_integer,
p_upper_snap in pls_integer ) return moats_output_ntt is
type metric_aat is table of number
index by pls_integer;
v_rows moats_output_ntt := moats_output_ntt();
v_metrics metric_aat;
v_secs number; --<-- seconds between 2 stats snaps
v_hivl interval day to second; --<-- interval of ASH history saved
v_hstr varchar2(30); --<-- formatted hh:mi:ss string of history
begin
-- Get long and short metrics for range of stats. Order for fixed array offset...
-- ------------------------------------------------------------------------------
select upr.value - lwr.value
bulk collect into v_metrics
from table(g_stats(p_lower_snap)) lwr
, table(g_stats(p_upper_snap)) upr
where lwr.name = upr.name
and lwr.name in ('execute count', 'parse count (hard)', 'parse count (total)',
'physical read total IO requests', 'physical read total bytes',
'physical write total IO requests', 'physical write total bytes',
'redo size', 'redo writes', 'session cursor cache hits',
'session logical reads', 'user calls', 'user commits',
'moats timer')
order by
lwr.name;
-- 1 execute count
-- 2 moats timer
-- 3 parse count (hard)
-- 4 parse count (total)
-- 5 physical read total IO requests
-- 6 physical read total bytes
-- 7 physical write total IO requests
-- 8 physical write total bytes
-- 9 redo size
-- 10 redo writes
-- 11 session cursor cache hits
-- 12 session logical reads
-- 13 user calls
-- 14 user commits
-- Execs/s: execute count
-- sParse/s: parse count (total)
-- LIOs/s: session logical reads
-- Read MB/s: physical read total bytes / 1048576
-- Calls/s: user calls
-- hParse/s: parse count (hard)
-- PhyRD/s: physical read total IO requests
-- PhyWR/s: physical write total IO requests
-- Write MB/s: physical write total bytes / 1048576
-- History:
-- Commits/s: user commits
-- ccHits/s: session cursor cache hits
-- Redo MB/s: redo size
-- Calculate number of seconds...
-- ------------------------------
v_secs := v_metrics(2)/100;
-- Calculate ASH history...
-- ------------------------
v_hivl := ash_history();
v_hstr := to_char(extract(hour from v_hivl)) || 'h ' ||
to_char(extract(minute from v_hivl)) || 'm ' ||
to_char(trunc(extract(second from v_hivl))) || 's';
-- Set the instance summary output...
-- ----------------------------------
v_rows.extend(5);
v_rows(1) := moats_output_ot(rpad('+ INSTANCE SUMMARY ',109,'-') || '+');
v_rows(2) := moats_output_ot(
rpad('| Instance: ' || sys_context('userenv','instance_name'), 28) ||
' | Execs/s: ' || lpad(to_char(v_metrics(1)/v_secs, 'fm99990.0'), 7) ||
' | sParse/s: ' || lpad(to_char((v_metrics(4)-v_metrics(3))/v_secs, 'fm99990.0'), 7) ||
' | LIOs/s: ' || lpad(to_char(v_metrics(12)/v_secs, 'fm9999990.0'), 9) ||
' | Read MB/s: ' || lpad(to_char(v_metrics(6)/v_secs/gc_mb, 'fm99990.0'), 7) ||
' |');
v_rows(3) := moats_output_ot(
rpad('| Cur Time: ' || to_char(sysdate, 'DD-Mon hh24:mi:ss'), 28) ||
' | Calls/s: ' || lpad(to_char(v_metrics(13)/v_secs, 'fm99990.0'), 7) ||
' | hParse/s: ' || lpad(to_char(v_metrics(3)/v_secs, 'fm99990.0'), 7) ||
' | PhyRD/s: ' || lpad(to_char(v_metrics(5)/v_secs, 'fm999990.0'), 8) ||
' | Write MB/s: ' || lpad(to_char(v_metrics(8)/v_secs/gc_mb, 'fm9990.0'), 6) ||
' |');
v_rows(4) := moats_output_ot(
rpad('| History: ' || v_hstr, 28) ||
' | Commit/s: ' || lpad(to_char(v_metrics(14)/v_secs, 'fm99990'), 6) ||
' | ccHits/s: ' || lpad(to_char(v_metrics(11)/v_secs, 'fm99990.0'), 7) ||
' | PhyWR/s: ' || lpad(to_char(v_metrics(7)/v_secs, 'fm999990.0'), 8) ||
' | Redo MB/s: ' || lpad(to_char(v_metrics(9)/v_secs/gc_mb, 'fm99990.0'), 7) ||
' |');
v_rows(5) := moats_output_ot(rpad('+-',109,'-') || '+');
return v_rows;
end instance_summary;
----------------------------------------------------------------------------
function top_summary ( p_lower_snap in pls_integer,
p_upper_snap in pls_integer ) return moats_output_ntt is
type top_sql_rt is record
( sql_id varchar2(64)
, sql_child_number number
, occurrences number
, top_sids moats_v2_ntt );
type top_waits_rt is record
( wait_name varchar2(64)
, wait_class varchar2(64)
, occurrences number );
type top_sql_aat is table of top_sql_rt
index by pls_integer;
type top_waits_aat is table of top_waits_rt
index by pls_integer;
v_row varchar2(4000);
v_rows moats_output_ntt := moats_output_ntt();
v_top_sqls top_sql_aat;
v_top_waits top_waits_aat;
v_samples pls_integer;
begin
-- Calculate number of ASH samples for this output...
-- --------------------------------------------------
v_samples := ash_sample_count( p_lower_snap => p_lower_snap,
p_upper_snap => p_upper_snap );
-- Begin TOP summary...
-- --------------------
v_rows.extend;
v_rows(1) := moats_output_ot(
rpad('+ TOP SQL_ID (child#) ',27,'-') ||
rpad('+ TOP SESSIONS ',24,'-') ||
rpad('+',7) ||
rpad('+ TOP WAITS ',37,'-') || '+ WAIT CLASS -+'
);
-- Top SQL_IDs...
-- --------------
with ash_data as (
select sid, sql_id, sql_child_number
from table(
moats.get_ash(
p_lower_snap, p_upper_snap, moats.gc_all_rows))
)
select o_ash.sql_id
, o_ash.sql_child_number
, o_ash.occurrences
, cast(
multiset(
select i_ash.sid
from ash_data i_ash
where i_ash.sql_id = o_ash.sql_id
and i_ash.sql_child_number = o_ash.sql_child_number
group by
i_ash.sid
order by
count(*) desc
) as moats_v2_ntt) as top_sids
bulk collect into v_top_sqls
from (
select sql_id
, sql_child_number
, count(*) as occurrences
from ash_data
group by
sql_id
, sql_child_number
order by
count(*) desc
) o_ash
where rownum <= 5;
-- Top waits...
-- ------------
select substr(event,1,48)
, wait_class
, occurrences
bulk collect into v_top_waits
from (
select event
, wait_class
, count(*) as occurrences
from table(
moats.get_ash(
p_lower_snap, p_upper_snap, moats.gc_all_rows))
group by
event
, wait_class
order by
count(*) desc
)
where rownum <= 5;
-- Summary output...
-- -----------------
for i in 1 .. greatest(v_top_sqls.count, v_top_waits.count) loop
v_rows.extend;
v_row := case
when v_top_sqls.exists(i)
then '|' || lpad(to_char((v_top_sqls(i).occurrences/v_samples)*100, 'fm9999'),4) || '% ' ||
rpad('| ' || v_top_sqls(i).sql_id || ' (' || v_top_sqls(i).sql_child_number || ')', 20) ||
rpad('| ' || to_string(v_top_sqls(i).top_sids, p_elements => 5), 23) ||
rpad(' |', 8)
else rpad('|', 7) ||
rpad('| ', 20) ||
rpad('| ', 23) ||
rpad(' |', 8)
end;
v_row := v_row ||
case
when v_top_waits.exists(i)
then '|' || lpad(to_char((v_top_waits(i).occurrences/v_samples)*100, 'fm9999'),4) || '% ' ||
rpad('| ' || substr(v_top_waits(i).wait_name,1,35), 29) ||
rpad(' | ' || v_top_waits(i).wait_class, 15) || '|'
else rpad('|', 7) ||
rpad('| ', 29) ||
rpad(' | ', 15) ||
'|'
end;
v_rows(v_rows.last) := moats_output_ot(v_row);
end loop;
v_rows.extend(2);
v_rows(v_rows.last-1) := moats_output_ot(
rpad('+',51,'-') || rpad('+',7) || rpad('+',51,'-') || '+'
);
v_rows(v_rows.last) := gc_space;
-- Top SQL output - we're going to deliberately loop r-b-r for the sql_ids...
-- --------------------------------------------------------------------------
v_rows.extend;
v_rows(v_rows.last) := moats_output_ot(
rpad('+ TOP SQL_ID ----+ PLAN_HASH_VALUE + SQL TEXT ', 109, '-') || '+'
);
for i in 1 .. v_top_sqls.count loop
for r_sql in (select sql_id, child_number, sql_text, plan_hash_value
from v$sql
where sql_id = v_top_sqls(i).sql_id
and child_number = v_top_sqls(i).sql_child_number)
loop
v_rows.extend;
v_rows(v_rows.last) := moats_output_ot(
rpad('| ' || r_sql.sql_id, 17) ||
rpad('| ' || r_sql.plan_hash_value, 18) ||
rpad('| ' || substr(r_sql.sql_text, 1, 71), 73) || ' |'
);
if length(r_sql.sql_text) > 74 then
v_rows.extend;
v_rows(v_rows.last) := moats_output_ot(
rpad('| ', 17) ||
rpad('| ', 18) ||
rpad('| ' || substr(r_sql.sql_text, 72, 71), 73) || ' |'
);
end if;
v_rows.extend;
v_rows(v_rows.last) := moats_output_ot(
rpad('+ ', 17, '-') ||
rpad('-', 18, '-') ||
rpad('-', 73, '-') || ' +'
);
end loop;
end loop;
return v_rows;
end top_summary;
----------------------------------------------------------------------------
procedure poll( p_refresh_rate in integer,
p_include_ash in boolean,
p_include_stat in boolean,
p_lower_snap out pls_integer,
p_upper_snap out pls_integer ) is
v_index pls_integer;
v_refresh_rate integer := nvl(p_refresh_rate, g_params(moats.gc_top_refresh_rate));
function snap_index return pls_integer is
begin
return dbms_utility.get_time();
end snap_index;
begin
-- Set starting snap index...
-- --------------------------
v_index := snap_index();
p_lower_snap := v_index;
-- Snap SYSSTAT if required...
-- ---------------------------
if p_include_stat then
snap_stats(v_index, true);
end if;
-- Snap ASH if required...
-- -----------------------
if p_include_ash then
for i in 1 .. ceil(v_refresh_rate/g_params(moats.gc_ash_polling_rate)) loop
if i > 1 then
v_index := snap_index;
end if;
snap_ash(v_index);
dbms_lock.sleep(g_params(moats.gc_ash_polling_rate));
end loop;
end if;
-- If no ASH samples taken, sleep for refresh rate instead...
-- ----------------------------------------------------------
if p_include_stat and not p_include_ash then
dbms_lock.sleep(v_refresh_rate);
v_index := snap_index;
end if;
-- Snap SYSSTAT again if required...
-- ---------------------------------
if p_include_stat then
snap_stats(v_index);
end if;
-- Set end snap index...
-- ---------------------
p_upper_snap := v_index;
end poll;
----------------------------------------------------------------------------
-- Determine ASH trailing window size
----------------------------------------------------------------------------
function get_ash_window_lower_snap (
p_lower_snap in pls_integer,
p_upper_snap in pls_integer,
p_refresh_rate in pls_integer,
p_ash_window_size in pls_integer
) return pls_integer is
v_snap_count pls_integer;
v_snap pls_integer;
v_ash_window_size pls_integer;
begin
v_ash_window_size := nvl(p_ash_window_size, get_parameter(moats.gc_ash_window_size));
-- By default no ASH trailing window or if refresh rate greater than window size
-- -----------------------------------------------------------------------------
if v_ash_window_size is null or p_refresh_rate >= v_ash_window_size then
v_snap := p_lower_snap;
else
v_snap_count := 1;
v_snap := p_upper_snap;
while v_snap_count < v_ash_window_size and g_ash.prior(v_snap) is not null loop
v_snap_count := v_snap_count + 1;
v_snap := g_ash.prior(v_snap);
end loop;
end if;
return v_snap;
end get_ash_window_lower_snap;
----------------------------------------------------------------------------
function top (
p_refresh_rate in integer default null,
p_ash_window_size in integer default null
) return moats_output_ntt pipelined is
v_lower_snap pls_integer;
v_upper_snap pls_integer;
v_row varchar2(4000);
v_rows moats_output_ntt := moats_output_ntt();
v_cnt pls_integer := 0;
begin
-- Initial clear screen and stabiliser...
-- --------------------------------------
v_rows := banner();
-- fill the initial "blank screen" (this is needed for arraysize = 72 to work)
for i in 1 .. gc_screen_size loop
pipe row (gc_space);
end loop;
-- print banner onto the top of the screen
for i in 1 .. v_rows.count loop
pipe row (v_rows(i));
end loop;
-- fill the rest of the visible screen
for i in 1 .. gc_screen_size-(v_rows.count+1) loop
pipe row (gc_space);
end loop;
pipe row (moats_output_ot('Please wait : fetching data for first refresh...'));
-- Begin TOP refreshes...
-- ----------------------
loop
-- Clear screen...
-- ---------------
for i in 1 .. gc_screen_size loop
pipe row (gc_space);
end loop;
-- Take some ASH/STAT samples...
-- -----------------------------
poll( p_refresh_rate => p_refresh_rate,
p_include_ash => true,
p_include_stat => true,
p_lower_snap => v_lower_snap,
p_upper_snap => v_upper_snap );
-- pipe row (moats_output_ot('Lower snap: ' || v_lower_snap || ' Upper snap: ' || v_upper_snap));
-- Banner...
-- ---------
v_rows := banner();
for i in 1 .. v_rows.count loop
pipe row (v_rows(i));
end loop;
pipe row (gc_space);
v_cnt := v_rows.count + 1;
-- Instance summary...
-- -------------------
v_rows := instance_summary( p_lower_snap => v_lower_snap,
p_upper_snap => v_upper_snap );
for i in 1 .. v_rows.count loop
pipe row (v_rows(i));
end loop;
pipe row (gc_space);
v_cnt := v_cnt + v_rows.count + 1;
v_lower_snap := get_ash_window_lower_snap( p_lower_snap => v_lower_snap,
p_upper_snap => v_upper_snap,
p_refresh_rate => p_refresh_rate,
p_ash_window_size => p_ash_window_size );
-- pipe row (moats_output_ot('Lower snap: ' || v_lower_snap || ' Upper snap: ' || v_upper_snap));
-- Top SQL and waits section...
-- ----------------------------
v_rows := top_summary( p_lower_snap => v_lower_snap,
p_upper_snap => v_upper_snap );
for i in 1 .. v_rows.count loop
pipe row (v_rows(i));
end loop;
pipe row (gc_space);
v_cnt := v_cnt + v_rows.count + 1;
-- Some blank output...
-- --------------------
if v_cnt < (gc_screen_size) then
for i in 1 .. (gc_screen_size)-v_cnt loop
pipe row (gc_space);
end loop;
end if;
end loop;
return;
exception
when NO_DATA_FOUND then
raise_application_error(-20000, 'Error: '||sqlerrm||' at:'||chr(10)||dbms_utility.format_error_backtrace);
end top;
----------------------------------------------------------------------------
function ash (
p_refresh_rate in integer default null,
p_select in varchar2 default null,
p_where in varchar2 default null,
p_group_by in varchar2 default null,
p_order_by in varchar2 default null
) return moats_output_ntt pipelined is
v_lower_snap pls_integer;
v_upper_snap pls_integer;
v_row varchar2(4000);
v_cnt pls_integer := 0;
-- DBMS_SQL variables...
-- ---------------------
v_sql varchar2(32767);
v_cursor binary_integer;
v_execute integer;
v_desc dbms_sql.desc_tab2;
v_cols integer;
v_value varchar2(4000);
begin
-- Build up the dynamic SQL...
-- ---------------------------
v_sql := get_sql( p_select => p_select,
p_from => 'TABLE(moats.get_ash(:b1, :b2))',
p_where => p_where,
p_group_by => p_group_by,
p_order_by => p_order_by );
-- Open a cursor for the ASH queries, parse and describe it...
-- -----------------------------------------------------------
v_cursor := dbms_sql.open_cursor;
dbms_sql.parse(v_cursor, v_sql, dbms_sql.native);
dbms_sql.describe_columns2(v_cursor, v_cols, v_desc);
-- Take some ASH samples...
-- ------------------------
poll( p_refresh_rate => p_refresh_rate,
p_include_ash => true,
p_include_stat => false,
p_lower_snap => v_lower_snap,
p_upper_snap => v_upper_snap );
-- Bind the ASH snapshots...
-- -------------------------
dbms_sql.bind_variable(v_cursor, 'b1', v_lower_snap);
dbms_sql.bind_variable(v_cursor, 'b2', v_upper_snap);
-- Define the columns and variable we are fetching into...
-- -------------------------------------------------------
for i in 1 .. v_cols loop
dbms_sql.define_column(v_cursor, i, v_value, 4000);
end loop;
-- Output the heading...
-- ---------------------
for i in 1 .. v_cols loop
v_row := v_row || '|' || v_desc(i).col_name;
end loop;
pipe row (moats_output_ot(v_row));
v_row := null;
-- Start fetching...
-- -----------------
v_execute := dbms_sql.execute(v_cursor);
while dbms_sql.fetch_rows(v_cursor) > 0 loop
for i in 1 .. v_cols loop
dbms_sql.column_value(v_cursor, i, v_value);
v_row := v_row || '|' || v_value;
end loop;
pipe row (moats_output_ot(v_row));
v_row := null;
end loop;
dbms_sql.close_cursor(v_cursor); --<-- will never be reached on an infinite loop with ctrl-c
return;
exception
when others then
dbms_sql.close_cursor(v_cursor);
raise_application_error (-20000, 'Error: ' || sqlerrm || ' at:' || chr(10) || dbms_utility.format_error_backtrace, true);
end ash;
----------------------------------------------------------------------------
function get_ash (
p_lower_snap in pls_integer default null,
p_upper_snap in pls_integer default null,
p_return_set in pls_integer default moats.gc_all_rows
) return moats_ash_ntt pipelined is
v_lower_snap pls_integer := nvl(p_lower_snap, g_ash.first);
v_upper_snap pls_integer := nvl(p_upper_snap, g_ash.last);
v_snap pls_integer;
v_exit boolean := false;
begin
v_snap := v_lower_snap;
while v_snap is not null and not v_exit loop
for i in 1 .. g_ash(v_snap).count loop
-- Ignore dummy records
if g_ash(v_snap)(i).sid is not null then
pipe row (g_ash(v_snap)(i));
end if;
end loop;
v_exit := (v_snap = v_upper_snap);
v_snap := case p_return_set
when moats.gc_all_rows
then g_ash.next(v_snap)
else v_upper_snap
end;
end loop;
return;
end get_ash;
begin
restore_default_parameters();
end moats;
/ | the_stack |
-- 2017-07-05T21:59:12.851
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_UI_Section (AD_Client_ID,AD_Org_ID,AD_Tab_ID,AD_UI_Section_ID,Created,CreatedBy,IsActive,SeqNo,Updated,UpdatedBy,Value) VALUES (0,0,540328,540337,TO_TIMESTAMP('2017-07-05 21:59:12','YYYY-MM-DD HH24:MI:SS'),100,'Y',10,TO_TIMESTAMP('2017-07-05 21:59:12','YYYY-MM-DD HH24:MI:SS'),100,'main')
;
-- 2017-07-05T21:59:12.855
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_UI_Section_Trl (AD_Language,AD_UI_Section_ID, Description,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_UI_Section_ID, t.Description,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_UI_Section t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_UI_Section_ID=540337 AND NOT EXISTS (SELECT 1 FROM AD_UI_Section_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_UI_Section_ID=t.AD_UI_Section_ID)
;
-- 2017-07-05T21:59:12.894
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_UI_Column (AD_Client_ID,AD_Org_ID,AD_UI_Column_ID,AD_UI_Section_ID,Created,CreatedBy,IsActive,SeqNo,Updated,UpdatedBy) VALUES (0,0,540460,540337,TO_TIMESTAMP('2017-07-05 21:59:12','YYYY-MM-DD HH24:MI:SS'),100,'Y',10,TO_TIMESTAMP('2017-07-05 21:59:12','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 2017-07-05T21:59:12.928
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_UI_Column (AD_Client_ID,AD_Org_ID,AD_UI_Column_ID,AD_UI_Section_ID,Created,CreatedBy,IsActive,SeqNo,Updated,UpdatedBy) VALUES (0,0,540461,540337,TO_TIMESTAMP('2017-07-05 21:59:12','YYYY-MM-DD HH24:MI:SS'),100,'Y',20,TO_TIMESTAMP('2017-07-05 21:59:12','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 2017-07-05T21:59:12.974
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_UI_ElementGroup (AD_Client_ID,AD_Org_ID,AD_UI_Column_ID,AD_UI_ElementGroup_ID,Created,CreatedBy,IsActive,Name,SeqNo,UIStyle,Updated,UpdatedBy) VALUES (0,0,540460,540795,TO_TIMESTAMP('2017-07-05 21:59:12','YYYY-MM-DD HH24:MI:SS'),100,'Y','default',10,'primary',TO_TIMESTAMP('2017-07-05 21:59:12','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 2017-07-05T21:59:13.034
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,Created,CreatedBy,Description,Help,IsActive,IsAdvancedField,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,547797,0,540328,540795,546352,TO_TIMESTAMP('2017-07-05 21:59:12','YYYY-MM-DD HH24:MI:SS'),100,'Organisatorische Einheit des Mandanten','Eine Organisation ist ein Bereich ihres Mandanten - z.B. Laden oder Abteilung. Sie können Daten über Organisationen hinweg gemeinsam verwenden.','Y','N','Y','Y','N','Sektion',10,10,0,TO_TIMESTAMP('2017-07-05 21:59:12','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 2017-07-05T21:59:13.070
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,Created,CreatedBy,Description,IsActive,IsAdvancedField,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,547795,0,540328,540795,546353,TO_TIMESTAMP('2017-07-05 21:59:13','YYYY-MM-DD HH24:MI:SS'),100,'Kunde, zu dem Pauschalen-Daten erfasst und ggf. abgerechnet werden sollen','Y','N','Y','Y','N','Geschäftspartner',20,20,0,TO_TIMESTAMP('2017-07-05 21:59:13','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 2017-07-05T21:59:13.107
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,Created,CreatedBy,Description,Help,IsActive,IsAdvancedField,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,548196,0,540328,540795,546354,TO_TIMESTAMP('2017-07-05 21:59:13','YYYY-MM-DD HH24:MI:SS'),100,'Definiert, ob unterhalb der Basis-Ebene bereits konkrete Daten erfasst sind.','Wenn ein Datensatz schon in Benutzung ist, dürfen die Basisdaten nicht mehr verändert werden, um Inkonsistenzen zu vermeiden.','Y','N','Y','Y','N','In Benutzung',30,30,0,TO_TIMESTAMP('2017-07-05 21:59:13','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 2017-07-05T21:59:13.141
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_UI_Section (AD_Client_ID,AD_Org_ID,AD_Tab_ID,AD_UI_Section_ID,Created,CreatedBy,IsActive,SeqNo,Updated,UpdatedBy,Value) VALUES (0,0,540340,540338,TO_TIMESTAMP('2017-07-05 21:59:13','YYYY-MM-DD HH24:MI:SS'),100,'Y',10,TO_TIMESTAMP('2017-07-05 21:59:13','YYYY-MM-DD HH24:MI:SS'),100,'main')
;
-- 2017-07-05T21:59:13.142
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_UI_Section_Trl (AD_Language,AD_UI_Section_ID, Description,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_UI_Section_ID, t.Description,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_UI_Section t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_UI_Section_ID=540338 AND NOT EXISTS (SELECT 1 FROM AD_UI_Section_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_UI_Section_ID=t.AD_UI_Section_ID)
;
-- 2017-07-05T21:59:13.175
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_UI_Column (AD_Client_ID,AD_Org_ID,AD_UI_Column_ID,AD_UI_Section_ID,Created,CreatedBy,IsActive,SeqNo,Updated,UpdatedBy) VALUES (0,0,540462,540338,TO_TIMESTAMP('2017-07-05 21:59:13','YYYY-MM-DD HH24:MI:SS'),100,'Y',10,TO_TIMESTAMP('2017-07-05 21:59:13','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 2017-07-05T21:59:13.202
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_UI_ElementGroup (AD_Client_ID,AD_Org_ID,AD_UI_Column_ID,AD_UI_ElementGroup_ID,Created,CreatedBy,IsActive,Name,SeqNo,UIStyle,Updated,UpdatedBy) VALUES (0,0,540462,540796,TO_TIMESTAMP('2017-07-05 21:59:13','YYYY-MM-DD HH24:MI:SS'),100,'Y','default',10,'primary',TO_TIMESTAMP('2017-07-05 21:59:13','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 2017-07-05T21:59:13.236
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,Created,CreatedBy,IsActive,IsAdvancedField,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,554230,0,540340,540796,546355,TO_TIMESTAMP('2017-07-05 21:59:13','YYYY-MM-DD HH24:MI:SS'),100,'Y','N','N','Y','N','Rechnungskandidat schließen',0,10,0,TO_TIMESTAMP('2017-07-05 21:59:13','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 2017-07-05T21:59:13.272
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,Created,CreatedBy,IsActive,IsAdvancedField,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,548126,0,540340,540796,546356,TO_TIMESTAMP('2017-07-05 21:59:13','YYYY-MM-DD HH24:MI:SS'),100,'Y','N','N','Y','N','Datenerfassung',0,20,0,TO_TIMESTAMP('2017-07-05 21:59:13','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 2017-07-05T21:59:13.302
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,Created,CreatedBy,IsActive,IsAdvancedField,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,548415,0,540340,540796,546357,TO_TIMESTAMP('2017-07-05 21:59:13','YYYY-MM-DD HH24:MI:SS'),100,'Y','N','N','Y','N','Planspiel',0,30,0,TO_TIMESTAMP('2017-07-05 21:59:13','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 2017-07-05T21:59:13.336
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,Created,CreatedBy,Description,Help,IsActive,IsAdvancedField,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,548127,0,540340,540796,546358,TO_TIMESTAMP('2017-07-05 21:59:13','YYYY-MM-DD HH24:MI:SS'),100,'Datum, an dem dieser Eintrag erstellt wurde','Das Feld Erstellt zeigt an, zu welchem Datum dieser Eintrag erstellt wurde.','Y','N','N','Y','N','Erstellt',0,40,0,TO_TIMESTAMP('2017-07-05 21:59:13','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 2017-07-05T21:59:13.383
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,Created,CreatedBy,Description,Help,IsActive,IsAdvancedField,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,548128,0,540340,540796,546359,TO_TIMESTAMP('2017-07-05 21:59:13','YYYY-MM-DD HH24:MI:SS'),100,'Nutzer, der diesen Eintrag erstellt hat','Das Feld Erstellt durch zeigt an, welcher Nutzer diesen Eintrag erstellt hat.','Y','N','N','Y','N','Erstellt durch',0,50,0,TO_TIMESTAMP('2017-07-05 21:59:13','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 2017-07-05T21:59:13.417
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,Created,CreatedBy,Help,IsActive,IsAdvancedField,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,548132,0,540340,540796,546360,TO_TIMESTAMP('2017-07-05 21:59:13','YYYY-MM-DD HH24:MI:SS'),100,'Wenn Vertragsbedingungen ausgewählt werden, dann werden bestimmte Pauschalen-Datensätze in Rechnung gestellt.','Y','N','N','Y','N','Pauschale - Vertragsbedingungen',0,60,0,TO_TIMESTAMP('2017-07-05 21:59:13','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 2017-07-05T21:59:13.446
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,Created,CreatedBy,Description,IsActive,IsAdvancedField,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,551046,0,540340,540796,546361,TO_TIMESTAMP('2017-07-05 21:59:13','YYYY-MM-DD HH24:MI:SS'),100,'Entscheidet, ob das System beim Fertigstellen einer neuen Vertragslaufzeit (z.B. bei automatischer Verlängerung) eine Auftragsbestätigung erzeugt.','Y','N','N','Y','N','AB bei neuer Vertragslaufzeit',0,70,0,TO_TIMESTAMP('2017-07-05 21:59:13','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 2017-07-05T21:59:13.481
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,Created,CreatedBy,Description,Help,IsActive,IsAdvancedField,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,551055,0,540340,540796,546362,TO_TIMESTAMP('2017-07-05 21:59:13','YYYY-MM-DD HH24:MI:SS'),100,'Ein Preissystem enthält beliebig viele, Länder-abhängige Preislisten.','Welche Preisliste herangezogen wird, hängt in der Regel von der Lieferaddresse des jeweiligen Gschäftspartners ab.','Y','N','N','Y','N','Preissystem',0,80,0,TO_TIMESTAMP('2017-07-05 21:59:13','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 2017-07-05T21:59:13.518
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,Created,CreatedBy,Description,Help,IsActive,IsAdvancedField,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,551054,0,540340,540796,546363,TO_TIMESTAMP('2017-07-05 21:59:13','YYYY-MM-DD HH24:MI:SS'),100,'Effektiver Preis','Der Einzelpreis oder Effektive Preis bezeichnet den Preis für das Produkt in Ausgangswährung.','Y','N','N','Y','N','Einzelpreis',0,90,0,TO_TIMESTAMP('2017-07-05 21:59:13','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 2017-07-05T21:59:13.552
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,Created,CreatedBy,Description,Help,IsActive,IsAdvancedField,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,551508,0,540340,540796,546364,TO_TIMESTAMP('2017-07-05 21:59:13','YYYY-MM-DD HH24:MI:SS'),100,'Die Währung für diesen Eintrag','Bezeichnet die auf Dokumenten oder Berichten verwendete Währung','Y','N','N','Y','N','Währung',0,100,0,TO_TIMESTAMP('2017-07-05 21:59:13','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 2017-07-05T21:59:13.590
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,Created,CreatedBy,Description,IsActive,IsAdvancedField,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,550552,0,540340,540796,546365,TO_TIMESTAMP('2017-07-05 21:59:13','YYYY-MM-DD HH24:MI:SS'),100,'Auftrag, mit der der Vertrag abgeschlossen wurde','Y','N','N','Y','N','Vertrags-Auftrag',0,110,0,TO_TIMESTAMP('2017-07-05 21:59:13','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 2017-07-05T21:59:13.625
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,Created,CreatedBy,Description,IsActive,IsAdvancedField,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,550473,0,540340,540796,546366,TO_TIMESTAMP('2017-07-05 21:59:13','YYYY-MM-DD HH24:MI:SS'),100,'Auftragszeile, mit der der Vertrag abgeschlossen wurde','Y','N','N','Y','N','Zeile',0,120,0,TO_TIMESTAMP('2017-07-05 21:59:13','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 2017-07-05T21:59:13.664
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,Created,CreatedBy,Description,IsActive,IsAdvancedField,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,550551,0,540340,540796,546367,TO_TIMESTAMP('2017-07-05 21:59:13','YYYY-MM-DD HH24:MI:SS'),100,'Auftrag, mit der der Vertrag vor dem regulären Ende gekündigt oder umgewandelt wurde','Y','N','N','Y','N','Änderungs-Auftrag',0,130,0,TO_TIMESTAMP('2017-07-05 21:59:13','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 2017-07-05T21:59:13.703
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,Created,CreatedBy,Description,IsActive,IsAdvancedField,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,550550,0,540340,540796,546368,TO_TIMESTAMP('2017-07-05 21:59:13','YYYY-MM-DD HH24:MI:SS'),100,'Auftragszeile, mit der der Vertrag vor dem regulären Ende gekündigt oder umgerwandelt wurde','Y','N','N','Y','N','Zeile',0,140,0,TO_TIMESTAMP('2017-07-05 21:59:13','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 2017-07-05T21:59:13.747
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,Created,CreatedBy,Description,Help,IsActive,IsAdvancedField,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,548492,0,540340,540796,546369,TO_TIMESTAMP('2017-07-05 21:59:13','YYYY-MM-DD HH24:MI:SS'),100,'Geschäftspartners für die Rechnungsstellung','Wenn leer, wird die Rechnung an den Geschäftspartner der Lieferung gestellt','Y','N','N','Y','N','Rechnungspartner',0,150,0,TO_TIMESTAMP('2017-07-05 21:59:13','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 2017-07-05T21:59:13.826
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_UI_ElementField (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_UI_ElementField_ID,AD_UI_Element_ID,Created,CreatedBy,IsActive,SeqNo,Updated,UpdatedBy) VALUES (0,548493,0,540160,546369,TO_TIMESTAMP('2017-07-05 21:59:13','YYYY-MM-DD HH24:MI:SS'),100,'Y',10,TO_TIMESTAMP('2017-07-05 21:59:13','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 2017-07-05T21:59:13.868
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_UI_ElementField (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_UI_ElementField_ID,AD_UI_Element_ID,Created,CreatedBy,IsActive,SeqNo,Updated,UpdatedBy) VALUES (0,548491,0,540161,546369,TO_TIMESTAMP('2017-07-05 21:59:13','YYYY-MM-DD HH24:MI:SS'),100,'Y',20,TO_TIMESTAMP('2017-07-05 21:59:13','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 2017-07-05T21:59:13.901
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,Created,CreatedBy,Description,IsActive,IsAdvancedField,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,550480,0,540340,540796,546370,TO_TIMESTAMP('2017-07-05 21:59:13','YYYY-MM-DD HH24:MI:SS'),100,'Partner von dem bzw. zu dem geliefert wird (nur bei Abo- und Leergutverträgen)','Y','N','N','Y','N','Lieferpartner',0,160,0,TO_TIMESTAMP('2017-07-05 21:59:13','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 2017-07-05T21:59:13.939
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_UI_ElementField (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_UI_ElementField_ID,AD_UI_Element_ID,Created,CreatedBy,IsActive,SeqNo,Updated,UpdatedBy) VALUES (0,550481,0,540162,546370,TO_TIMESTAMP('2017-07-05 21:59:13','YYYY-MM-DD HH24:MI:SS'),100,'Y',10,TO_TIMESTAMP('2017-07-05 21:59:13','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 2017-07-05T21:59:13.977
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_UI_ElementField (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_UI_ElementField_ID,AD_UI_Element_ID,Created,CreatedBy,IsActive,SeqNo,Updated,UpdatedBy) VALUES (0,550482,0,540163,546370,TO_TIMESTAMP('2017-07-05 21:59:13','YYYY-MM-DD HH24:MI:SS'),100,'Y',20,TO_TIMESTAMP('2017-07-05 21:59:13','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 2017-07-05T21:59:14.012
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,Created,CreatedBy,IsActive,IsAdvancedField,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,548223,0,540340,540796,546371,TO_TIMESTAMP('2017-07-05 21:59:13','YYYY-MM-DD HH24:MI:SS'),100,'Y','N','N','Y','N','Vertragsart',0,170,0,TO_TIMESTAMP('2017-07-05 21:59:13','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 2017-07-05T21:59:14.052
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,Created,CreatedBy,Description,IsActive,IsAdvancedField,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,547798,0,540340,540796,546372,TO_TIMESTAMP('2017-07-05 21:59:14','YYYY-MM-DD HH24:MI:SS'),100,'Definiert die Maßeinheiten, zu denen Pauschalen-Daten erfasst werden sollen','Y','N','N','Y','N','Einheiten-Typ',0,180,0,TO_TIMESTAMP('2017-07-05 21:59:14','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 2017-07-05T21:59:14.087
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,Created,CreatedBy,Description,Help,IsActive,IsAdvancedField,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,550474,0,540340,540796,546373,TO_TIMESTAMP('2017-07-05 21:59:14','YYYY-MM-DD HH24:MI:SS'),100,'Produkt, Leistung, Artikel','Bezeichnet eine Einheit, die in dieser Organisation gekauft oder verkauft wird.','Y','N','N','Y','N','Produkt',0,190,0,TO_TIMESTAMP('2017-07-05 21:59:14','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 2017-07-05T21:59:14.135
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,Created,CreatedBy,Description,Help,IsActive,IsAdvancedField,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,548428,0,540340,540796,546374,TO_TIMESTAMP('2017-07-05 21:59:14','YYYY-MM-DD HH24:MI:SS'),100,'Maßeinheit','Eine eindeutige (nicht monetäre) Maßeinheit','Y','N','N','Y','N','Maßeinheit',0,200,0,TO_TIMESTAMP('2017-07-05 21:59:14','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 2017-07-05T21:59:14.179
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,Created,CreatedBy,Description,IsActive,IsAdvancedField,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,548414,0,540340,540796,546375,TO_TIMESTAMP('2017-07-05 21:59:14','YYYY-MM-DD HH24:MI:SS'),100,'Geplante Menge der zu erbringenden Leistung (z.B. zu liefernde Teile), pro pauschal abzurechnender Einheit (z.B. Pflegetag).','Y','N','N','Y','N','Planmenge pro Maßeinheit',0,210,0,TO_TIMESTAMP('2017-07-05 21:59:14','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 2017-07-05T21:59:14.216
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,Created,CreatedBy,Description,IsActive,IsAdvancedField,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,548162,0,540340,540796,546376,TO_TIMESTAMP('2017-07-05 21:59:14','YYYY-MM-DD HH24:MI:SS'),100,'Legt fest, ob innerhalb der Vertragslaufzeit (in der Regel zu deren Ende) noch korrigierte Pauschalen-Mengen erfasst werden können','Y','N','N','Y','N','Abschlusskorrektur vorsehen',0,220,0,TO_TIMESTAMP('2017-07-05 21:59:14','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 2017-07-05T21:59:14.253
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,Created,CreatedBy,Description,Help,IsActive,IsAdvancedField,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,548168,0,540340,540796,546377,TO_TIMESTAMP('2017-07-05 21:59:14','YYYY-MM-DD HH24:MI:SS'),100,'Prozess zum erstellen eines Abrechnungs-Korrektur-Datensatzes und/oder eines Abrechnungs-Verrechnungs-Datensatzes','Ob und welche Datensätze erstellt werden, hängt von den gewählten Vertragsbedingungen ab','Y','N','N','Y','N','Abschlusskorrektur vorbereiten',0,230,0,TO_TIMESTAMP('2017-07-05 21:59:14','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 2017-07-05T21:59:14.298
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,Created,CreatedBy,Description,Help,IsActive,IsAdvancedField,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,548161,0,540340,540796,546378,TO_TIMESTAMP('2017-07-05 21:59:14','YYYY-MM-DD HH24:MI:SS'),100,'Legt fest, ob die pauschal abgerechenten Beträge den tatsächlich erbrachten Leistungen gegenüber gestellt werden sollen','Im Fall der Gegegenüberstellung von zu pauschal abgerechenten Beträgen und tatsächlich erbrachten Leistungen kann eine Verrechnung mit eventueller Nachzahlung oder Rückerstattung erfolgen.','Y','N','N','Y','N','Gegenüberstellung mit erbr. Leist.',0,240,0,TO_TIMESTAMP('2017-07-05 21:59:14','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 2017-07-05T21:59:14.340
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,Created,CreatedBy,Description,Help,IsActive,IsAdvancedField,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,548601,0,540340,540796,546379,TO_TIMESTAMP('2017-07-05 21:59:14','YYYY-MM-DD HH24:MI:SS'),100,'Art der Verrechnung bei der Gegenüberstellung mit tatsächliche erbrachten Leistungen','Wenn eine Gegenüberstellung mit tatsächliche erbrachten Leistungen vorgesehen ist, dann definiert dieses Feld, ob eine ggf. eine Abweichung in Rechnung gestellt werden kann.','Y','N','N','Y','N','Verrechnungsart',0,250,0,TO_TIMESTAMP('2017-07-05 21:59:14','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 2017-07-05T21:59:14.378
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,Created,CreatedBy,Description,Help,IsActive,IsAdvancedField,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,548437,0,540340,540796,546380,TO_TIMESTAMP('2017-07-05 21:59:14','YYYY-MM-DD HH24:MI:SS'),100,'Optional weitere Information für ein Dokument','Das Notiz-Feld erlaubt es, weitere Informationen zu diesem Eintrag anzugeben','Y','N','N','Y','N','Bemerkungen',0,260,0,TO_TIMESTAMP('2017-07-05 21:59:14','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 2017-07-05T21:59:14.420
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,Created,CreatedBy,Description,Help,IsActive,IsAdvancedField,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,550569,0,540340,540796,546381,TO_TIMESTAMP('2017-07-05 21:59:14','YYYY-MM-DD HH24:MI:SS'),100,'Definiert die zeitliche Steuerung von Lieferungen','The Delivery Rule indicates when an order should be delivered. For example should the order be delivered when the entire order is complete, when a line is complete or as the products become available.','Y','N','N','Y','N','Lieferart',0,270,0,TO_TIMESTAMP('2017-07-05 21:59:14','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 2017-07-05T21:59:14.453
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,Created,CreatedBy,Description,Help,IsActive,IsAdvancedField,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,550570,0,540340,540796,546382,TO_TIMESTAMP('2017-07-05 21:59:14','YYYY-MM-DD HH24:MI:SS'),100,'Wie der Auftrag geliefert wird','"Lieferung durch" gibt an, auf welche Weise die Produkte geliefert werden sollen. Beispiel: wird abgeholt oder geliefert?','Y','N','N','Y','N','Lieferung',0,280,0,TO_TIMESTAMP('2017-07-05 21:59:14','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 2017-07-05T21:59:14.490
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,Created,CreatedBy,Description,Help,IsActive,IsAdvancedField,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,548458,0,540340,540796,546383,TO_TIMESTAMP('2017-07-05 21:59:14','YYYY-MM-DD HH24:MI:SS'),100,'First effective day (inclusive)','The Start Date indicates the first or starting date','Y','N','N','Y','N','Anfangsdatum',0,290,0,TO_TIMESTAMP('2017-07-05 21:59:14','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 2017-07-05T21:59:14.531
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,Created,CreatedBy,Description,IsActive,IsAdvancedField,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,548464,0,540340,540796,546384,TO_TIMESTAMP('2017-07-05 21:59:14','YYYY-MM-DD HH24:MI:SS'),100,'Regelt z.B. die Vertragslaufzeit, Kündigungsfristen, autmatische Verlängerung usw.','Y','N','N','Y','N','Vertragsverlängerung/-übergang',0,300,0,TO_TIMESTAMP('2017-07-05 21:59:14','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 2017-07-05T21:59:14.578
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,Created,CreatedBy,Description,IsActive,IsAdvancedField,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,548461,0,540340,540796,546385,TO_TIMESTAMP('2017-07-05 21:59:14','YYYY-MM-DD HH24:MI:SS'),100,'Datum vor Ende der Vertragslaufzeit, an dem der laufende Vertrag automatisch verlängert oder aber der Betreuer informiert wird.','Y','N','N','Y','N','Kündigungs/Benachrichtigungsfrist',0,310,0,TO_TIMESTAMP('2017-07-05 21:59:14','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 2017-07-05T21:59:14.613
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,Created,CreatedBy,Description,Help,IsActive,IsAdvancedField,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,548494,0,540340,540796,546386,TO_TIMESTAMP('2017-07-05 21:59:14','YYYY-MM-DD HH24:MI:SS'),100,'Person, die bei einer Vertragsänderung oder bei einem fachlichen Problem vom System informiert wird.','Diese Einstellung kann auch nach Fertigstellung der Vertragsbedingungen noch geändert werden.','Y','N','N','Y','N','Betreuer',0,320,0,TO_TIMESTAMP('2017-07-05 21:59:14','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 2017-07-05T21:59:14.656
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,Created,CreatedBy,Description,Help,IsActive,IsAdvancedField,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,548460,0,540340,540796,546387,TO_TIMESTAMP('2017-07-05 21:59:14','YYYY-MM-DD HH24:MI:SS'),100,'Last effective date (inclusive)','The End Date indicates the last date in this range.','Y','N','N','Y','N','Enddatum',0,330,0,TO_TIMESTAMP('2017-07-05 21:59:14','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 2017-07-05T21:59:14.696
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,Created,CreatedBy,Description,IsActive,IsAdvancedField,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,548462,0,540340,540796,546388,TO_TIMESTAMP('2017-07-05 21:59:14','YYYY-MM-DD HH24:MI:SS'),100,'Wenn dieser Haken gesetzt ist, werden laufende Verträge automatisch verlängert','Y','N','N','Y','N','Vertrag autom. verlängern',0,340,0,TO_TIMESTAMP('2017-07-05 21:59:14','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 2017-07-05T21:59:14.734
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,Created,CreatedBy,IsActive,IsAdvancedField,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,548465,0,540340,540796,546389,TO_TIMESTAMP('2017-07-05 21:59:14','YYYY-MM-DD HH24:MI:SS'),100,'Y','N','N','Y','N','Vertrag jetzt verlängern',0,350,0,TO_TIMESTAMP('2017-07-05 21:59:14','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 2017-07-05T21:59:14.770
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,Created,CreatedBy,IsActive,IsAdvancedField,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,550529,0,540340,540796,546390,TO_TIMESTAMP('2017-07-05 21:59:14','YYYY-MM-DD HH24:MI:SS'),100,'Y','N','N','Y','N','Ändern oder Kündigen',0,360,0,TO_TIMESTAMP('2017-07-05 21:59:14','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 2017-07-05T21:59:14.807
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,Created,CreatedBy,IsActive,IsAdvancedField,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,548459,0,540340,540796,546391,TO_TIMESTAMP('2017-07-05 21:59:14','YYYY-MM-DD HH24:MI:SS'),100,'Y','N','N','Y','N','Verarbeitung zum Laufzeitende',0,370,0,TO_TIMESTAMP('2017-07-05 21:59:14','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 2017-07-05T21:59:14.850
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,Created,CreatedBy,IsActive,IsAdvancedField,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,548463,0,540340,540796,546392,TO_TIMESTAMP('2017-07-05 21:59:14','YYYY-MM-DD HH24:MI:SS'),100,'Y','N','N','Y','N','Nachfolgende Vertragsperiode',0,380,0,TO_TIMESTAMP('2017-07-05 21:59:14','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 2017-07-05T21:59:14.887
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,Created,CreatedBy,IsActive,IsAdvancedField,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,556855,0,540340,540796,546393,TO_TIMESTAMP('2017-07-05 21:59:14','YYYY-MM-DD HH24:MI:SS'),100,'Y','N','N','Y','N','Planmenge Folgejahr',0,390,0,TO_TIMESTAMP('2017-07-05 21:59:14','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 2017-07-05T21:59:14.925
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,Created,CreatedBy,Description,Help,IsActive,IsAdvancedField,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,548134,0,540340,540796,546394,TO_TIMESTAMP('2017-07-05 21:59:14','YYYY-MM-DD HH24:MI:SS'),100,'Derzeitiger Status des Belegs','The Document Status indicates the status of a document at this time. If you want to change the document status, use the Document Action field','Y','N','N','Y','N','Belegstatus',0,400,0,TO_TIMESTAMP('2017-07-05 21:59:14','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 2017-07-05T21:59:14.969
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,Created,CreatedBy,Description,Help,IsActive,IsAdvancedField,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,548135,0,540340,540796,546395,TO_TIMESTAMP('2017-07-05 21:59:14','YYYY-MM-DD HH24:MI:SS'),100,'Der zukünftige Status des Belegs','You find the current status in the Document Status field. The options are listed in a popup','Y','N','N','Y','N','Belegverarbeitung',0,410,0,TO_TIMESTAMP('2017-07-05 21:59:14','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 2017-07-05T21:59:15.005
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,Created,CreatedBy,Description,Help,IsActive,IsAdvancedField,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,548137,0,540340,540796,546396,TO_TIMESTAMP('2017-07-05 21:59:14','YYYY-MM-DD HH24:MI:SS'),100,'Checkbox sagt aus, ob der Beleg verarbeitet wurde. ','Verarbeitete Belege dürfen in der Regel nich mehr geändert werden.','Y','N','N','Y','N','Verarbeitet',0,420,0,TO_TIMESTAMP('2017-07-05 21:59:14','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 2017-07-05T22:28:21.857
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Field SET IsDisplayed='Y',Updated=TO_TIMESTAMP('2017-07-05 22:28:21','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=547796
;
-- 2017-07-05T22:28:31.220
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Field SET IsDisplayed='Y',Updated=TO_TIMESTAMP('2017-07-05 22:28:31','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=547788
;
-- 2017-07-05T22:29:31.517
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_UI_ElementGroup (AD_Client_ID,AD_Org_ID,AD_UI_Column_ID,AD_UI_ElementGroup_ID,Created,CreatedBy,IsActive,Name,SeqNo,UIStyle,Updated,UpdatedBy) VALUES (0,0,540460,540797,TO_TIMESTAMP('2017-07-05 22:29:31','YYYY-MM-DD HH24:MI:SS'),100,'Y','default',10,'primary',TO_TIMESTAMP('2017-07-05 22:29:31','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 2017-07-05T22:29:41.924
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_ElementGroup SET Name='advanced edit', SeqNo=90, UIStyle='',Updated=TO_TIMESTAMP('2017-07-05 22:29:41','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_ElementGroup_ID=540795
;
-- 2017-07-05T22:31:12.092
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,Created,CreatedBy,IsActive,IsAdvancedField,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,547795,0,540328,540797,546397,TO_TIMESTAMP('2017-07-05 22:31:12','YYYY-MM-DD HH24:MI:SS'),100,'Y','N','Y','N','N','Geschäftspartner',10,0,0,TO_TIMESTAMP('2017-07-05 22:31:12','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 2017-07-05T22:31:31.427
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,Created,CreatedBy,IsActive,IsAdvancedField,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,548196,0,540328,540797,546398,TO_TIMESTAMP('2017-07-05 22:31:31','YYYY-MM-DD HH24:MI:SS'),100,'Y','N','Y','N','N','In Benutzung',20,0,0,TO_TIMESTAMP('2017-07-05 22:31:31','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 2017-07-05T22:31:48.631
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_UI_ElementGroup (AD_Client_ID,AD_Org_ID,AD_UI_Column_ID,AD_UI_ElementGroup_ID,Created,CreatedBy,IsActive,Name,SeqNo,Updated,UpdatedBy) VALUES (0,0,540461,540798,TO_TIMESTAMP('2017-07-05 22:31:48','YYYY-MM-DD HH24:MI:SS'),100,'Y','flags',10,TO_TIMESTAMP('2017-07-05 22:31:48','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 2017-07-05T22:31:57.238
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,Created,CreatedBy,IsActive,IsAdvancedField,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,547788,0,540328,540798,546399,TO_TIMESTAMP('2017-07-05 22:31:57','YYYY-MM-DD HH24:MI:SS'),100,'Y','N','Y','N','N','Aktiv',10,0,0,TO_TIMESTAMP('2017-07-05 22:31:57','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 2017-07-05T22:32:03.937
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_UI_ElementGroup (AD_Client_ID,AD_Org_ID,AD_UI_Column_ID,AD_UI_ElementGroup_ID,Created,CreatedBy,IsActive,Name,SeqNo,Updated,UpdatedBy) VALUES (0,0,540461,540799,TO_TIMESTAMP('2017-07-05 22:32:03','YYYY-MM-DD HH24:MI:SS'),100,'Y','org',20,TO_TIMESTAMP('2017-07-05 22:32:03','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 2017-07-05T22:32:13.800
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,Created,CreatedBy,IsActive,IsAdvancedField,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,547797,0,540328,540799,546400,TO_TIMESTAMP('2017-07-05 22:32:13','YYYY-MM-DD HH24:MI:SS'),100,'Y','N','Y','N','N','Sektion',10,0,0,TO_TIMESTAMP('2017-07-05 22:32:13','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 2017-07-05T22:32:22.302
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,Created,CreatedBy,IsActive,IsAdvancedField,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,547796,0,540328,540799,546401,TO_TIMESTAMP('2017-07-05 22:32:22','YYYY-MM-DD HH24:MI:SS'),100,'Y','N','Y','N','N','Mandant',20,0,0,TO_TIMESTAMP('2017-07-05 22:32:22','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 2017-07-05T22:33:20.415
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_UI_ElementGroup (AD_Client_ID,AD_Org_ID,AD_UI_Column_ID,AD_UI_ElementGroup_ID,Created,CreatedBy,IsActive,Name,SeqNo,Updated,UpdatedBy) VALUES (0,0,540460,540800,TO_TIMESTAMP('2017-07-05 22:33:20','YYYY-MM-DD HH24:MI:SS'),100,'Y','rest',20,TO_TIMESTAMP('2017-07-05 22:33:20','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 2017-07-05T22:33:34.226
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,Created,CreatedBy,IsActive,IsAdvancedField,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,548196,0,540328,540800,546402,TO_TIMESTAMP('2017-07-05 22:33:34','YYYY-MM-DD HH24:MI:SS'),100,'Y','N','Y','N','N','In Benutzung',10,0,0,TO_TIMESTAMP('2017-07-05 22:33:34','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 2017-07-05T22:33:41.575
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
DELETE FROM AD_UI_Element WHERE AD_UI_Element_ID=546398
;
-- 2017-07-05T22:34:08.918
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
DELETE FROM AD_UI_Element WHERE AD_UI_Element_ID=546352
;
-- 2017-07-05T22:34:08.934
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
DELETE FROM AD_UI_Element WHERE AD_UI_Element_ID=546353
;
-- 2017-07-05T22:34:08.943
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
DELETE FROM AD_UI_Element WHERE AD_UI_Element_ID=546354
;
-- 2017-07-05T22:34:13.158
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
DELETE FROM AD_UI_ElementGroup WHERE AD_UI_ElementGroup_ID=540795
;
-- 2017-07-05T22:34:44.659
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET WidgetSize='L',Updated=TO_TIMESTAMP('2017-07-05 22:34:44','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=546397
;
-- 2017-07-05T22:34:57.129
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET WidgetSize='M',Updated=TO_TIMESTAMP('2017-07-05 22:34:57','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=546400
;
-- 2017-07-05T22:35:00.729
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET WidgetSize='M',Updated=TO_TIMESTAMP('2017-07-05 22:35:00','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=546401
;
-- 2017-07-05T22:35:13.922
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=10,Updated=TO_TIMESTAMP('2017-07-05 22:35:13','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=546397
;
-- 2017-07-05T22:35:13.926
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=20,Updated=TO_TIMESTAMP('2017-07-05 22:35:13','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=546402
;
-- 2017-07-05T22:35:13.930
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=30,Updated=TO_TIMESTAMP('2017-07-05 22:35:13','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=546399
;
-- 2017-07-05T22:35:13.933
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=40,Updated=TO_TIMESTAMP('2017-07-05 22:35:13','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=546400
;
-- 2017-07-05T22:35:13.937
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=50,Updated=TO_TIMESTAMP('2017-07-05 22:35:13','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=546401
;
-- 2017-07-05T22:35:24.209
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayed_SideList='Y', SeqNo_SideList=10,Updated=TO_TIMESTAMP('2017-07-05 22:35:24','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=546397
;
-- 2017-07-05T22:35:24.214
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayed_SideList='Y', SeqNo_SideList=20,Updated=TO_TIMESTAMP('2017-07-05 22:35:24','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=546402
;
-- 2017-07-05T22:35:24.219
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayed_SideList='Y', SeqNo_SideList=30,Updated=TO_TIMESTAMP('2017-07-05 22:35:24','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=546399
;
-- 2017-07-05T22:35:24.224
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayed_SideList='Y', SeqNo_SideList=40,Updated=TO_TIMESTAMP('2017-07-05 22:35:24','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=546400
;
-- 2017-07-05T22:35:24.229
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayed_SideList='Y', SeqNo_SideList=50,Updated=TO_TIMESTAMP('2017-07-05 22:35:24','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=546401
;
-- 2017-07-05T22:42:42.634
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayedGrid='N', SeqNoGrid=0,Updated=TO_TIMESTAMP('2017-07-05 22:42:42','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=546361
;
-- 2017-07-05T22:42:42.636
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayedGrid='N', SeqNoGrid=0,Updated=TO_TIMESTAMP('2017-07-05 22:42:42','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=546377
;
-- 2017-07-05T22:42:42.638
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayedGrid='N', SeqNoGrid=0,Updated=TO_TIMESTAMP('2017-07-05 22:42:42','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=546376
;
-- 2017-07-05T22:42:42.639
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayedGrid='N', SeqNoGrid=0,Updated=TO_TIMESTAMP('2017-07-05 22:42:42','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=546395
;
-- 2017-07-05T22:42:42.640
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayedGrid='N', SeqNoGrid=0,Updated=TO_TIMESTAMP('2017-07-05 22:42:42','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=546380
;
-- 2017-07-05T22:42:42.641
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayedGrid='N', SeqNoGrid=0,Updated=TO_TIMESTAMP('2017-07-05 22:42:42','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=546386
;
-- 2017-07-05T22:42:42.643
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayedGrid='N', SeqNoGrid=0,Updated=TO_TIMESTAMP('2017-07-05 22:42:42','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=546356
;
-- 2017-07-05T22:42:42.644
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayedGrid='N', SeqNoGrid=0,Updated=TO_TIMESTAMP('2017-07-05 22:42:42','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=546372
;
-- 2017-07-05T22:42:42.645
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayedGrid='N', SeqNoGrid=0,Updated=TO_TIMESTAMP('2017-07-05 22:42:42','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=546363
;
-- 2017-07-05T22:42:42.646
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayedGrid='N', SeqNoGrid=0,Updated=TO_TIMESTAMP('2017-07-05 22:42:42','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=546358
;
-- 2017-07-05T22:42:42.649
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayedGrid='N', SeqNoGrid=0,Updated=TO_TIMESTAMP('2017-07-05 22:42:42','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=546359
;
-- 2017-07-05T22:42:42.650
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayedGrid='N', SeqNoGrid=0,Updated=TO_TIMESTAMP('2017-07-05 22:42:42','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=546378
;
-- 2017-07-05T22:42:42.651
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayedGrid='N', SeqNoGrid=0,Updated=TO_TIMESTAMP('2017-07-05 22:42:42','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=546385
;
-- 2017-07-05T22:42:42.652
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayedGrid='N', SeqNoGrid=0,Updated=TO_TIMESTAMP('2017-07-05 22:42:42','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=546381
;
-- 2017-07-05T22:42:42.654
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayedGrid='N', SeqNoGrid=0,Updated=TO_TIMESTAMP('2017-07-05 22:42:42','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=546370
;
-- 2017-07-05T22:42:42.655
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayedGrid='N', SeqNoGrid=0,Updated=TO_TIMESTAMP('2017-07-05 22:42:42','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=546382
;
-- 2017-07-05T22:42:42.657
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayedGrid='N', SeqNoGrid=0,Updated=TO_TIMESTAMP('2017-07-05 22:42:42','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=546392
;
-- 2017-07-05T22:42:42.658
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayedGrid='N', SeqNoGrid=0,Updated=TO_TIMESTAMP('2017-07-05 22:42:42','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=546360
;
-- 2017-07-05T22:42:42.659
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayedGrid='N', SeqNoGrid=0,Updated=TO_TIMESTAMP('2017-07-05 22:42:42','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=546393
;
-- 2017-07-05T22:42:42.659
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayedGrid='N', SeqNoGrid=0,Updated=TO_TIMESTAMP('2017-07-05 22:42:42','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=546375
;
-- 2017-07-05T22:42:42.660
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayedGrid='N', SeqNoGrid=0,Updated=TO_TIMESTAMP('2017-07-05 22:42:42','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=546357
;
-- 2017-07-05T22:42:42.983
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayedGrid='N', SeqNoGrid=0,Updated=TO_TIMESTAMP('2017-07-05 22:42:42','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=546362
;
-- 2017-07-05T22:42:42.984
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayedGrid='N', SeqNoGrid=0,Updated=TO_TIMESTAMP('2017-07-05 22:42:42','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=546355
;
-- 2017-07-05T22:42:42.985
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayedGrid='N', SeqNoGrid=0,Updated=TO_TIMESTAMP('2017-07-05 22:42:42','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=546369
;
-- 2017-07-05T22:42:42.986
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayedGrid='N', SeqNoGrid=0,Updated=TO_TIMESTAMP('2017-07-05 22:42:42','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=546396
;
-- 2017-07-05T22:42:42.987
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayedGrid='N', SeqNoGrid=0,Updated=TO_TIMESTAMP('2017-07-05 22:42:42','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=546391
;
-- 2017-07-05T22:42:42.987
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayedGrid='N', SeqNoGrid=0,Updated=TO_TIMESTAMP('2017-07-05 22:42:42','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=546379
;
-- 2017-07-05T22:42:42.988
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayedGrid='N', SeqNoGrid=0,Updated=TO_TIMESTAMP('2017-07-05 22:42:42','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=546388
;
-- 2017-07-05T22:42:42.988
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayedGrid='N', SeqNoGrid=0,Updated=TO_TIMESTAMP('2017-07-05 22:42:42','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=546389
;
-- 2017-07-05T22:42:42.989
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayedGrid='N', SeqNoGrid=0,Updated=TO_TIMESTAMP('2017-07-05 22:42:42','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=546365
;
-- 2017-07-05T22:42:42.990
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayedGrid='N', SeqNoGrid=0,Updated=TO_TIMESTAMP('2017-07-05 22:42:42','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=546371
;
-- 2017-07-05T22:42:42.993
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayedGrid='N', SeqNoGrid=0,Updated=TO_TIMESTAMP('2017-07-05 22:42:42','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=546384
;
-- 2017-07-05T22:42:42.994
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayedGrid='N', SeqNoGrid=0,Updated=TO_TIMESTAMP('2017-07-05 22:42:42','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=546364
;
-- 2017-07-05T22:42:42.994
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayedGrid='N', SeqNoGrid=0,Updated=TO_TIMESTAMP('2017-07-05 22:42:42','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=546368
;
-- 2017-07-05T22:42:42.995
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayedGrid='N', SeqNoGrid=0,Updated=TO_TIMESTAMP('2017-07-05 22:42:42','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=546366
;
-- 2017-07-05T22:42:42.996
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayedGrid='N', SeqNoGrid=0,Updated=TO_TIMESTAMP('2017-07-05 22:42:42','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=546390
;
-- 2017-07-05T22:42:42.997
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayedGrid='N', SeqNoGrid=0,Updated=TO_TIMESTAMP('2017-07-05 22:42:42','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=546367
;
-- 2017-07-05T22:42:42.998
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=10,Updated=TO_TIMESTAMP('2017-07-05 22:42:42','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=546383
;
-- 2017-07-05T22:42:42.999
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=20,Updated=TO_TIMESTAMP('2017-07-05 22:42:42','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=546387
;
-- 2017-07-05T22:42:42.999
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=30,Updated=TO_TIMESTAMP('2017-07-05 22:42:42','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=546373
;
-- 2017-07-05T22:42:43
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=40,Updated=TO_TIMESTAMP('2017-07-05 22:42:43','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=546374
;
-- 2017-07-05T22:42:43.001
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=50,Updated=TO_TIMESTAMP('2017-07-05 22:42:43','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=546394
;
-- 2017-07-05T22:43:05.742
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Field SET IsDisplayed='Y',Updated=TO_TIMESTAMP('2017-07-05 22:43:05','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=548131
;
-- 2017-07-05T22:43:07.662
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Field SET IsDisplayed='Y',Updated=TO_TIMESTAMP('2017-07-05 22:43:07','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=548130
;
-- 2017-07-05T22:43:30.519
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,Created,CreatedBy,IsActive,IsAdvancedField,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,548131,0,540340,540796,546403,TO_TIMESTAMP('2017-07-05 22:43:30','YYYY-MM-DD HH24:MI:SS'),100,'Y','N','Y','N','N','Sektion',10,0,0,TO_TIMESTAMP('2017-07-05 22:43:30','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 2017-07-05T22:43:40.899
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,Created,CreatedBy,IsActive,IsAdvancedField,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,548130,0,540340,540796,546404,TO_TIMESTAMP('2017-07-05 22:43:40','YYYY-MM-DD HH24:MI:SS'),100,'Y','N','Y','N','N','Mandant',20,0,0,TO_TIMESTAMP('2017-07-05 22:43:40','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 2017-07-05T22:43:47.878
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET SeqNo=0,Updated=TO_TIMESTAMP('2017-07-05 22:43:47','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=546403
;
-- 2017-07-05T22:43:54.819
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET SeqNo=0,Updated=TO_TIMESTAMP('2017-07-05 22:43:54','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=546404
;
-- 2017-07-05T22:45:20.293
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=60,Updated=TO_TIMESTAMP('2017-07-05 22:45:20','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=546371
;
-- 2017-07-05T22:45:20.298
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=70,Updated=TO_TIMESTAMP('2017-07-05 22:45:20','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=546379
;
-- 2017-07-05T22:45:20.303
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=80,Updated=TO_TIMESTAMP('2017-07-05 22:45:20','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=546375
;
-- 2017-07-05T22:45:20.307
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=90,Updated=TO_TIMESTAMP('2017-07-05 22:45:20','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=546393
;
-- 2017-07-05T22:45:20.312
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=100,Updated=TO_TIMESTAMP('2017-07-05 22:45:20','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=546403
;
-- 2017-07-05T22:45:20.317
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=110,Updated=TO_TIMESTAMP('2017-07-05 22:45:20','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=546404
;
-- 2017-07-05T22:45:36.759
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayed_SideList='Y', SeqNo_SideList=10,Updated=TO_TIMESTAMP('2017-07-05 22:45:36','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=546383
;
-- 2017-07-05T22:45:36.761
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayed_SideList='Y', SeqNo_SideList=20,Updated=TO_TIMESTAMP('2017-07-05 22:45:36','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=546387
;
-- 2017-07-05T22:45:36.763
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayed_SideList='Y', SeqNo_SideList=30,Updated=TO_TIMESTAMP('2017-07-05 22:45:36','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=546373
;
-- 2017-07-05T22:47:28.026
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayed_SideList='Y', SeqNo_SideList=40,Updated=TO_TIMESTAMP('2017-07-05 22:47:28','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=546374
;
-- 2017-07-05T22:47:28.031
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayed_SideList='Y', SeqNo_SideList=50,Updated=TO_TIMESTAMP('2017-07-05 22:47:28','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=546394
;
-- 2017-07-05T22:47:34.264
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayed='Y',Updated=TO_TIMESTAMP('2017-07-05 22:47:34','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=546395
;
-- 2017-07-05T22:47:34.696
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayed='Y',Updated=TO_TIMESTAMP('2017-07-05 22:47:34','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=546389
;
-- 2017-07-05T22:47:35.304
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayed='Y',Updated=TO_TIMESTAMP('2017-07-05 22:47:35','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=546388
;
-- 2017-07-05T22:47:35.824
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayed='Y',Updated=TO_TIMESTAMP('2017-07-05 22:47:35','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=546379
;
-- 2017-07-05T22:47:36.480
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayed='Y',Updated=TO_TIMESTAMP('2017-07-05 22:47:36','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=546393
;
-- 2017-07-05T22:47:37.337
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayed='Y',Updated=TO_TIMESTAMP('2017-07-05 22:47:37','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=546392
;
-- 2017-07-05T22:47:37.859
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayed='Y',Updated=TO_TIMESTAMP('2017-07-05 22:47:37','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=546391
;
-- 2017-07-05T22:47:38.273
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayed='Y',Updated=TO_TIMESTAMP('2017-07-05 22:47:38','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=546387
;
-- 2017-07-05T22:47:38.696
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayed='Y',Updated=TO_TIMESTAMP('2017-07-05 22:47:38','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=546386
;
-- 2017-07-05T22:47:39.280
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayed='Y',Updated=TO_TIMESTAMP('2017-07-05 22:47:39','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=546385
;
-- 2017-07-05T22:47:39.728
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayed='Y',Updated=TO_TIMESTAMP('2017-07-05 22:47:39','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=546384
;
-- 2017-07-05T22:47:40.210
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayed='Y',Updated=TO_TIMESTAMP('2017-07-05 22:47:40','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=546380
;
-- 2017-07-05T22:47:40.823
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayed='Y',Updated=TO_TIMESTAMP('2017-07-05 22:47:40','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=546378
;
-- 2017-07-05T22:47:41.584
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayed='Y',Updated=TO_TIMESTAMP('2017-07-05 22:47:41','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=546377
;
-- 2017-07-05T22:47:42.184
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayed='Y',Updated=TO_TIMESTAMP('2017-07-05 22:47:42','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=546376
;
-- 2017-07-05T22:47:42.704
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayed='Y',Updated=TO_TIMESTAMP('2017-07-05 22:47:42','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=546372
;
-- 2017-07-05T22:47:43.233
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayed='Y',Updated=TO_TIMESTAMP('2017-07-05 22:47:43','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=546375
;
-- 2017-07-05T22:47:43.688
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayed='Y',Updated=TO_TIMESTAMP('2017-07-05 22:47:43','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=546394
;
-- 2017-07-05T22:47:44.123
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayed='Y',Updated=TO_TIMESTAMP('2017-07-05 22:47:44','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=546374
;
-- 2017-07-05T22:47:44.747
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayed='Y',Updated=TO_TIMESTAMP('2017-07-05 22:47:44','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=546373
;
-- 2017-07-05T22:47:45.449
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayed='Y',Updated=TO_TIMESTAMP('2017-07-05 22:47:45','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=546383
;
-- 2017-07-05T22:47:45.937
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayed='Y',Updated=TO_TIMESTAMP('2017-07-05 22:47:45','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=546390
;
-- 2017-07-05T22:47:46.897
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayed='Y',Updated=TO_TIMESTAMP('2017-07-05 22:47:46','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=546382
;
-- 2017-07-05T22:47:47.433
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayed='Y',Updated=TO_TIMESTAMP('2017-07-05 22:47:47','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=546381
;
-- 2017-07-05T22:47:47.987
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayed='Y',Updated=TO_TIMESTAMP('2017-07-05 22:47:47','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=546396
;
-- 2017-07-05T22:47:48.520
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayed='Y',Updated=TO_TIMESTAMP('2017-07-05 22:47:48','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=546365
;
-- 2017-07-05T22:47:48.960
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayed='Y',Updated=TO_TIMESTAMP('2017-07-05 22:47:48','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=546363
;
-- 2017-07-05T22:47:49.434
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayed='Y',Updated=TO_TIMESTAMP('2017-07-05 22:47:49','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=546362
;
-- 2017-07-05T22:47:50.178
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayed='Y',Updated=TO_TIMESTAMP('2017-07-05 22:47:50','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=546361
;
-- 2017-07-05T22:47:50.653
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayed='Y',Updated=TO_TIMESTAMP('2017-07-05 22:47:50','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=546367
;
-- 2017-07-05T22:47:51.129
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayed='Y',Updated=TO_TIMESTAMP('2017-07-05 22:47:51','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=546360
;
-- 2017-07-05T22:47:51.643
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayed='Y',Updated=TO_TIMESTAMP('2017-07-05 22:47:51','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=546369
;
-- 2017-07-05T22:47:52.535
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayed='Y',Updated=TO_TIMESTAMP('2017-07-05 22:47:52','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=546355
;
-- 2017-07-05T22:47:53.256
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayed='Y',Updated=TO_TIMESTAMP('2017-07-05 22:47:53','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=546356
;
-- 2017-07-05T22:47:54.168
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayed='Y',Updated=TO_TIMESTAMP('2017-07-05 22:47:54','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=546359
;
-- 2017-07-05T22:47:54.819
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayed='Y',Updated=TO_TIMESTAMP('2017-07-05 22:47:54','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=546358
;
-- 2017-07-05T22:47:55.218
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayed='Y',Updated=TO_TIMESTAMP('2017-07-05 22:47:55','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=546366
;
-- 2017-07-05T22:47:55.976
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayed='Y',Updated=TO_TIMESTAMP('2017-07-05 22:47:55','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=546368
;
-- 2017-07-05T22:47:57.714
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayed='Y',Updated=TO_TIMESTAMP('2017-07-05 22:47:57','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=546364
; | the_stack |
-- prepare
CREATE TABLE NATION (
N_NATIONKEY INTEGER NOT NULL,
N_NAME CHAR(25) NOT NULL,
N_REGIONKEY INTEGER NOT NULL,
N_COMMENT VARCHAR(152)
);
CREATE TABLE REGION (
R_REGIONKEY INTEGER NOT NULL,
R_NAME CHAR(25) NOT NULL,
R_COMMENT VARCHAR(152)
);
CREATE TABLE PART (
P_PARTKEY INTEGER NOT NULL,
P_NAME VARCHAR(55) NOT NULL,
P_MFGR CHAR(25) NOT NULL,
P_BRAND CHAR(10) NOT NULL,
P_TYPE VARCHAR(25) NOT NULL,
P_SIZE INTEGER NOT NULL,
P_CONTAINER CHAR(10) NOT NULL,
P_RETAILPRICE DECIMAL(15,2) NOT NULL,
P_COMMENT VARCHAR(23) NOT NULL
);
CREATE TABLE SUPPLIER (
S_SUPPKEY INTEGER NOT NULL,
S_NAME CHAR(25) NOT NULL,
S_ADDRESS VARCHAR(40) NOT NULL,
S_NATIONKEY INTEGER NOT NULL,
S_PHONE CHAR(15) NOT NULL,
S_ACCTBAL DECIMAL(15,2) NOT NULL,
S_COMMENT VARCHAR(101) NOT NULL
);
CREATE TABLE PARTSUPP (
PS_PARTKEY INTEGER NOT NULL,
PS_SUPPKEY INTEGER NOT NULL,
PS_AVAILQTY INTEGER NOT NULL,
PS_SUPPLYCOST DECIMAL(15,2) NOT NULL,
PS_COMMENT VARCHAR(199) NOT NULL
);
CREATE TABLE CUSTOMER (
C_CUSTKEY INTEGER NOT NULL,
C_NAME VARCHAR(25) NOT NULL,
C_ADDRESS VARCHAR(40) NOT NULL,
C_NATIONKEY INTEGER NOT NULL,
C_PHONE CHAR(15) NOT NULL,
C_ACCTBAL DECIMAL(15,2) NOT NULL,
C_MKTSEGMENT CHAR(10) NOT NULL,
C_COMMENT VARCHAR(117) NOT NULL
);
CREATE TABLE ORDERS (
O_ORDERKEY INTEGER NOT NULL,
O_CUSTKEY INTEGER NOT NULL,
O_ORDERSTATUS CHAR(1) NOT NULL,
O_TOTALPRICE DECIMAL(15,2) NOT NULL,
O_ORDERDATE DATE NOT NULL,
O_ORDERPRIORITY CHAR(15) NOT NULL,
O_CLERK CHAR(15) NOT NULL,
O_SHIPPRIORITY INTEGER NOT NULL,
O_COMMENT VARCHAR(79) NOT NULL
);
CREATE TABLE LINEITEM (
L_ORDERKEY INTEGER NOT NULL,
L_PARTKEY INTEGER NOT NULL,
L_SUPPKEY INTEGER NOT NULL,
L_LINENUMBER INTEGER NOT NULL,
L_QUANTITY DECIMAL(15,2) NOT NULL,
L_EXTENDEDPRICE DECIMAL(15,2) NOT NULL,
L_DISCOUNT DECIMAL(15,2) NOT NULL,
L_TAX DECIMAL(15,2) NOT NULL,
L_RETURNFLAG CHAR(1) NOT NULL,
L_LINESTATUS CHAR(1) NOT NULL,
L_SHIPDATE DATE NOT NULL,
L_COMMITDATE DATE NOT NULL,
L_RECEIPTDATE DATE NOT NULL,
L_SHIPINSTRUCT CHAR(25) NOT NULL,
L_SHIPMODE CHAR(10) NOT NULL,
L_COMMENT VARCHAR(44) NOT NULL
);
/*
*/
-- tpch-q1: TPC-H Q1
explain select
l_returnflag,
l_linestatus,
sum(l_quantity) as sum_qty,
sum(l_extendedprice) as sum_base_price,
sum(l_extendedprice * (1 - l_discount)) as sum_disc_price,
sum(l_extendedprice * (1 - l_discount) * (1 + l_tax)) as sum_charge,
avg(l_quantity) as avg_qty,
avg(l_extendedprice) as avg_price,
avg(l_discount) as avg_disc,
count(*) as count_order
from
lineitem
where
l_shipdate <= date '1998-12-01' - interval '71' day
group by
l_returnflag,
l_linestatus
order by
l_returnflag,
l_linestatus;
/*
PhysicalOrder:
[InputRef #0 (asc), InputRef #1 (asc)]
PhysicalProjection:
InputRef #0
InputRef #1
InputRef #2 (alias to sum_qty)
InputRef #3 (alias to sum_base_price)
InputRef #4 (alias to sum_disc_price)
InputRef #5 (alias to sum_charge)
(InputRef #2 / InputRef #7) (alias to avg_qty)
(InputRef #3 / InputRef #9) (alias to avg_price)
(InputRef #10 / InputRef #11) (alias to avg_disc)
InputRef #12 (alias to count_order)
PhysicalHashAgg:
InputRef #1
InputRef #2
sum(InputRef #3) -> NUMERIC(15,2)
sum(InputRef #4) -> NUMERIC(15,2)
sum((InputRef #4 * (1 - InputRef #5))) -> NUMERIC(15,2) (null)
sum(((InputRef #4 * (1 - InputRef #5)) * (1 + InputRef #6))) -> NUMERIC(15,2) (null)
sum(InputRef #3) -> NUMERIC(15,2)
count(InputRef #3) -> INT
sum(InputRef #4) -> NUMERIC(15,2)
count(InputRef #4) -> INT
sum(InputRef #5) -> NUMERIC(15,2)
count(InputRef #5) -> INT
count(InputRef #0) -> INT
PhysicalTableScan:
table #7,
columns [10, 8, 9, 4, 5, 6, 7],
with_row_handler: false,
is_sorted: false,
expr: LtEq(InputRef #0, Date(Date(10490)) (const))
*/
-- tpch-q3: TPC-H Q3
explain select
l_orderkey,
sum(l_extendedprice * (1 - l_discount)) as revenue,
o_orderdate,
o_shippriority
from
customer,
orders,
lineitem
where
c_mktsegment = 'BUILDING'
and c_custkey = o_custkey
and l_orderkey = o_orderkey
and o_orderdate < date '1995-03-15'
and l_shipdate > date '1995-03-15'
group by
l_orderkey,
o_orderdate,
o_shippriority
order by
revenue desc,
o_orderdate
limit 10;
/*
PhysicalTopN: offset: 0, limit: 10, order by [InputRef #1 (desc), InputRef #2 (asc)]
PhysicalProjection:
InputRef #0
InputRef #3 (alias to revenue)
InputRef #1
InputRef #2
PhysicalHashAgg:
InputRef #6
InputRef #4
InputRef #5
sum((InputRef #8 * (1 - InputRef #9))) -> NUMERIC(15,2) (null)
PhysicalHashJoin:
op Inner,
predicate: Eq(InputRef #3, InputRef #6)
PhysicalHashJoin:
op Inner,
predicate: Eq(InputRef #1, InputRef #2)
PhysicalTableScan:
table #5,
columns [6, 0],
with_row_handler: false,
is_sorted: false,
expr: Eq(InputRef #0, String("BUILDING") (const))
PhysicalTableScan:
table #6,
columns [1, 0, 4, 7],
with_row_handler: false,
is_sorted: false,
expr: Lt(InputRef #2, Date(Date(9204)) (const))
PhysicalTableScan:
table #7,
columns [0, 10, 5, 6],
with_row_handler: false,
is_sorted: false,
expr: Gt(InputRef #1, Date(Date(9204)) (const))
*/
-- tpch-q5: TPC-H Q5
explain select
n_name,
sum(l_extendedprice * (1 - l_discount)) as revenue
from
customer,
orders,
lineitem,
supplier,
nation,
region
where
c_custkey = o_custkey
and l_orderkey = o_orderkey
and l_suppkey = s_suppkey
and c_nationkey = s_nationkey
and s_nationkey = n_nationkey
and n_regionkey = r_regionkey
and r_name = 'AFRICA'
and o_orderdate >= date '1994-01-01'
and o_orderdate < date '1994-01-01' + interval '1' year
group by
n_name
order by
revenue desc;
/*
PhysicalOrder:
[InputRef #1 (desc)]
PhysicalProjection:
InputRef #0
InputRef #1 (alias to revenue)
PhysicalHashAgg:
InputRef #13
sum((InputRef #7 * (1 - InputRef #8))) -> NUMERIC(15,2) (null)
PhysicalHashJoin:
op Inner,
predicate: Eq(InputRef #12, InputRef #14)
PhysicalHashJoin:
op Inner,
predicate: Eq(InputRef #10, InputRef #11)
PhysicalHashJoin:
op Inner,
predicate: And(Eq(InputRef #6, InputRef #9), Eq(InputRef #1, InputRef #10))
PhysicalHashJoin:
op Inner,
predicate: Eq(InputRef #3, InputRef #5)
PhysicalHashJoin:
op Inner,
predicate: Eq(InputRef #0, InputRef #2)
PhysicalTableScan:
table #5,
columns [0, 3],
with_row_handler: false,
is_sorted: false,
expr: None
PhysicalTableScan:
table #6,
columns [1, 0, 4],
with_row_handler: false,
is_sorted: false,
expr: And(GtEq(InputRef #2, Date(Date(8766)) (const)), Lt(InputRef #2, Date(Date(9131)) (const)))
PhysicalTableScan:
table #7,
columns [0, 2, 5, 6],
with_row_handler: false,
is_sorted: false,
expr: None
PhysicalTableScan:
table #3,
columns [0, 3],
with_row_handler: false,
is_sorted: false,
expr: None
PhysicalTableScan:
table #0,
columns [0, 2, 1],
with_row_handler: false,
is_sorted: false,
expr: None
PhysicalTableScan:
table #1,
columns [0, 1],
with_row_handler: false,
is_sorted: false,
expr: Eq(InputRef #1, String("AFRICA") (const))
*/
-- tpch-q6
explain select
sum(l_extendedprice * l_discount) as revenue
from
lineitem
where
l_shipdate >= date '1994-01-01'
and l_shipdate < date '1994-01-01' + interval '1' year
and l_discount between 0.08 - 0.01 and 0.08 + 0.01
and l_quantity < 24;
/*
PhysicalProjection:
InputRef #0 (alias to revenue)
PhysicalSimpleAgg:
sum((InputRef #3 * InputRef #1)) -> NUMERIC(15,2) (null)
PhysicalTableScan:
table #7,
columns [10, 6, 4, 5],
with_row_handler: false,
is_sorted: false,
expr: And(And(And(GtEq(InputRef #0, Date(Date(8766)) (const)), Lt(InputRef #0, Date(Date(9131)) (const))), And(GtEq(InputRef #1, Decimal(0.07) (const)), LtEq(InputRef #1, Decimal(0.09) (const)))), Lt(InputRef #2, Decimal(24) (const)))
*/
-- tpch-q10: TPC-H Q10
explain select
c_custkey,
c_name,
sum(l_extendedprice * (1 - l_discount)) as revenue,
c_acctbal,
n_name,
c_address,
c_phone,
c_comment
from
customer,
orders,
lineitem,
nation
where
c_custkey = o_custkey
and l_orderkey = o_orderkey
and o_orderdate >= date '1993-10-01'
and o_orderdate < date '1993-10-01' + interval '3' month
and l_returnflag = 'R'
and c_nationkey = n_nationkey
group by
c_custkey,
c_name,
c_acctbal,
c_phone,
n_name,
c_address,
c_comment
order by
revenue desc
limit 20;
/*
PhysicalTopN: offset: 0, limit: 20, order by [InputRef #2 (desc)]
PhysicalProjection:
InputRef #0
InputRef #1
InputRef #7 (alias to revenue)
InputRef #2
InputRef #4
InputRef #5
InputRef #3
InputRef #6
PhysicalHashAgg:
InputRef #0
InputRef #2
InputRef #3
InputRef #5
InputRef #15
InputRef #4
InputRef #6
sum((InputRef #12 * (1 - InputRef #13))) -> NUMERIC(15,2) (null)
PhysicalHashJoin:
op Inner,
predicate: Eq(InputRef #1, InputRef #14)
PhysicalHashJoin:
op Inner,
predicate: Eq(InputRef #8, InputRef #10)
PhysicalHashJoin:
op Inner,
predicate: Eq(InputRef #0, InputRef #7)
PhysicalTableScan:
table #5,
columns [0, 3, 1, 5, 2, 4, 7],
with_row_handler: false,
is_sorted: false,
expr: None
PhysicalTableScan:
table #6,
columns [1, 0, 4],
with_row_handler: false,
is_sorted: false,
expr: And(GtEq(InputRef #2, Date(Date(8674)) (const)), Lt(InputRef #2, Date(Date(8766)) (const)))
PhysicalTableScan:
table #7,
columns [0, 8, 5, 6],
with_row_handler: false,
is_sorted: false,
expr: Eq(InputRef #1, String("R") (const))
PhysicalTableScan:
table #0,
columns [0, 1],
with_row_handler: false,
is_sorted: false,
expr: None
*/ | the_stack |
USE test;
DROP PROCEDURE IF EXISTS `exists_view`;
DROP PROCEDURE IF EXISTS `creatView`;
DELIMITER $$
CREATE PROCEDURE exists_view(IN viewName VARCHAR(500), OUT re BOOLEAN)
BEGIN
DECLARE num INT;
SELECT COUNT(information_schema.VIEWS.TABLE_SCHEMA) INTO num
FROM information_schema.VIEWS
WHERE (information_schema.VIEWS.TABLE_SCHEMA=viewName);
IF(num != 0 ) THEN
SET re=TRUE;
ELSE
SET re=FALSE;
END IF;
END $$
CREATE PROCEDURE creatView()
BEGIN
DECLARE isExits BOOLEAN;
CALL exists_view('insertResult',isExits);
SELECT isExits;
IF(isExits = FALSE) THEN
CREATE
/*[ALGORITHM = {UNDEFINED | MERGE | TEMPTABLE}]
[DEFINER = { user | CURRENT_USER }]
[SQL SECURITY { DEFINER | INVOKER }]*/
VIEW `insertResult` (projectID,createSchemaTime,totalPoints,totalInsertionTime,totalErrorPoint,totalElapseTime,avg,midAvg,min,max,p1,p5,p50,p90,p95,p99,p999,p9999)
AS
(SELECT a.projectID,a.result_value,b.result_value,c.result_value,d.result_value,e.result_value,
f1.result_value,f2.result_value,f3.result_value,f4.result_value,f5.result_value,f6.result_value,
f7.result_value,f8.result_value,f9.result_value,f10.result_value,f11.result_value,f12.result_value FROM
(SELECT projectID, result_value FROM RESULT WHERE result_key = 'createSchemaTime(s)') a JOIN
(SELECT projectID, result_value FROM RESULT WHERE result_key = 'totalPoints') b ON a.projectID = b.projectID JOIN
(SELECT projectID, result_value FROM RESULT WHERE result_key = 'totalInsertionTime(s)') c ON a.projectID = c.projectID JOIN
(SELECT projectID, result_value FROM RESULT WHERE result_key = 'totalErrorPoint') d ON a.projectID = d.projectID JOIN
(SELECT projectID, result_value FROM RESULT WHERE result_key = 'totalElapseTime(s)') e ON a.projectID = e.projectID JOIN
(SELECT projectID, result_value FROM RESULT WHERE result_key = 'avg') f1 ON a.projectID = f1.projectID JOIN
(SELECT projectID, result_value FROM RESULT WHERE result_key = 'middleAvg') f2 ON a.projectID = f2.projectID JOIN
(SELECT projectID, result_value FROM RESULT WHERE result_key = 'min') f3 ON a.projectID = f3.projectID JOIN
(SELECT projectID, result_value FROM RESULT WHERE result_key = 'max') f4 ON a.projectID = f4.projectID JOIN
(SELECT projectID, result_value FROM RESULT WHERE result_key = 'p1') f5 ON a.projectID = f5.projectID JOIN
(SELECT projectID, result_value FROM RESULT WHERE result_key = 'p5') f6 ON a.projectID = f6.projectID JOIN
(SELECT projectID, result_value FROM RESULT WHERE result_key = 'p50') f7 ON a.projectID = f7.projectID JOIN
(SELECT projectID, result_value FROM RESULT WHERE result_key = 'p90') f8 ON a.projectID = f8.projectID JOIN
(SELECT projectID, result_value FROM RESULT WHERE result_key = 'p95') f9 ON a.projectID = f9.projectID JOIN
(SELECT projectID, result_value FROM RESULT WHERE result_key = 'p99') f10 ON a.projectID = f10.projectID JOIN
(SELECT projectID, result_value FROM RESULT WHERE result_key = 'p999') f11 ON a.projectID = f11.projectID JOIN
(SELECT projectID, result_value FROM RESULT WHERE result_key = 'p9999') f12 ON a.projectID = f12.projectID
);
END IF;
CALL exists_view('queryResult',isExits);
SELECT isExits;
IF(isExits = FALSE) THEN
CREATE
/*[ALGORITHM = {UNDEFINED | MERGE | TEMPTABLE}]
[DEFINER = { user | CURRENT_USER }]
[SQL SECURITY { DEFINER | INVOKER }]*/
VIEW `queryResult`(projectID,queryNumber,totalPoints,totalTimes,totalErrorPoint,resultPointPerSecond,avg,midAvg,min,max,p1,p5,p50,p90,p95,p99,p999,p9999)
AS
(SELECT a.projectID,a.result_value,b.result_value,c.result_value,d.result_value,e.result_value,
f1.result_value,f2.result_value,f3.result_value,f4.result_value,f5.result_value,f6.result_value,
f7.result_value,f8.result_value,f9.result_value,f10.result_value,f11.result_value,f12.result_value
FROM
(SELECT projectID, result_value FROM RESULT WHERE result_key = 'queryNumber') a JOIN
(SELECT projectID, result_value FROM RESULT WHERE result_key = 'totalPoint') b ON a.projectID = b.projectID JOIN
(SELECT projectID, result_value FROM RESULT WHERE result_key = 'totalTime(s)') c ON a.projectID = c.projectID JOIN
(SELECT projectID, result_value FROM RESULT WHERE result_key = 'totalErrorQuery') d ON a.projectID = d.projectID JOIN
(SELECT projectID, result_value FROM RESULT WHERE result_key = 'resultPointPerSecond(points/s)') e ON a.projectID = e.projectID JOIN
(SELECT projectID, result_value FROM RESULT WHERE result_key = 'avgQueryLatency') f1 ON a.projectID = f1.projectID JOIN
(SELECT projectID, result_value FROM RESULT WHERE result_key = 'middleAvgQueryLatency') f2 ON a.projectID = f2.projectID JOIN
(SELECT projectID, result_value FROM RESULT WHERE result_key = 'minQueryLatency') f3 ON a.projectID = f3.projectID JOIN
(SELECT projectID, result_value FROM RESULT WHERE result_key = 'maxQueryLatency') f4 ON a.projectID = f4.projectID JOIN
(SELECT projectID, result_value FROM RESULT WHERE result_key = 'p1QueryLatency') f5 ON a.projectID = f5.projectID JOIN
(SELECT projectID, result_value FROM RESULT WHERE result_key = 'p5QueryLatency') f6 ON a.projectID = f6.projectID JOIN
(SELECT projectID, result_value FROM RESULT WHERE result_key = 'p50QueryLatency') f7 ON a.projectID = f7.projectID JOIN
(SELECT projectID, result_value FROM RESULT WHERE result_key = 'p90QueryLatency') f8 ON a.projectID = f8.projectID JOIN
(SELECT projectID, result_value FROM RESULT WHERE result_key = 'p95QueryLatency') f9 ON a.projectID = f9.projectID JOIN
(SELECT projectID, result_value FROM RESULT WHERE result_key = 'p99QueryLatency') f10 ON a.projectID = f10.projectID JOIN
(SELECT projectID, result_value FROM RESULT WHERE result_key = 'p999QueryLatency') f11 ON a.projectID = f11.projectID JOIN
(SELECT projectID, result_value FROM RESULT WHERE result_key = 'p9999QueryLatency') f12 ON a.projectID = f12.projectID
);
END IF;
CALL exists_view('configCommonInfo',isExits);
SELECT isExits;
IF(isExits = FALSE) THEN
CREATE
/*[ALGORITHM = {UNDEFINED | MERGE | TEMPTABLE}]
[DEFINER = { user | CURRENT_USER }]
[SQL SECURITY { DEFINER | INVOKER }]*/
VIEW `configCommonInfo`(projectID,`mode`,dbSwitch,`version`,clientNumber,`loop`,serverIP,clientName)
AS
(SELECT a.projectID,a.configuration_value,b.configuration_value,c.configuration_value,d.configuration_value,e.configuration_value ,f.configuration_value,g.configuration_value FROM
(SELECT projectID, configuration_value FROM CONFIG WHERE configuration_item = 'MODE') a JOIN
(SELECT projectID, configuration_value FROM CONFIG WHERE configuration_item = 'DB_SWITCH') b ON a.projectID = b.projectID JOIN
(SELECT projectID, configuration_value FROM CONFIG WHERE configuration_item = 'VERSION') c ON a.projectID = c.projectID JOIN
(SELECT projectID, configuration_value FROM CONFIG WHERE configuration_item = 'CLIENT_NUMBER') d ON a.projectID = d.projectID JOIN
(SELECT projectID, configuration_value FROM CONFIG WHERE configuration_item = 'LOOP') e ON a.projectID = e.projectID JOIN
(SELECT projectID, configuration_value FROM CONFIG WHERE configuration_item = 'ServerIP') f ON a.projectID = f.projectID JOIN
(SELECT projectID, configuration_value FROM CONFIG WHERE configuration_item = 'CLIENT') g ON a.projectID = g.projectID
);
END IF;
CALL exists_view('configInsertInfo',isExits);
SELECT isExits;
IF(isExits = FALSE) THEN
CREATE
/*[ALGORITHM = {UNDEFINED | MERGE | TEMPTABLE}]
[DEFINER = { user | CURRENT_USER }]
[SQL SECURITY { DEFINER | INVOKER }]*/
VIEW `configInsertInfo`(projectID,`mode`,dbSwitch,`version`,clientNumber,`loop`,serverIP,clientName,
IS_OVERFLOW,MUL_DEV_BATCH,GROUP_NUMBER,DEVICE_NUMBER,SENSOR_NUMBER,CACHE_NUM,POINT_STEP,ENCODING)
AS
(SELECT DISTINCT (a.projectID),a.mode,a.dbSwitch,a.version,a.clientNumber,a.loop,a.serverIP,a.clientName,aa.configuration_value,
b.configuration_value,d.configuration_value,e.configuration_value ,f.configuration_value,g.configuration_value ,h.configuration_value,i.configuration_value FROM
(SELECT * FROM configCommonInfo ) a JOIN
(SELECT projectID, configuration_value FROM CONFIG WHERE configuration_item = 'IS_OVERFLOW') aa ON a.projectID = aa.projectID JOIN
(SELECT projectID, configuration_value FROM CONFIG WHERE configuration_item = 'MUL_DEV_BATCH') b ON a.projectID = b.projectID JOIN
(SELECT projectID, configuration_value FROM CONFIG WHERE configuration_item = 'GROUP_NUMBER') d ON a.projectID = d.projectID JOIN
(SELECT projectID, configuration_value FROM CONFIG WHERE configuration_item = 'DEVICE_NUMBER') e ON a.projectID = e.projectID JOIN
(SELECT projectID, configuration_value FROM CONFIG WHERE configuration_item = 'SENSOR_NUMBER') f ON a.projectID = f.projectID JOIN
(SELECT projectID, configuration_value FROM CONFIG WHERE configuration_item = 'BATCH_SIZE') g ON a.projectID = g.projectID JOIN
(SELECT projectID, configuration_value FROM CONFIG WHERE configuration_item = 'POINT_STEP') h ON a.projectID = h.projectID LEFT JOIN
(SELECT projectID, configuration_value FROM CONFIG WHERE configuration_item = 'ENCODING') i ON a.projectID = i.projectID
);
END IF;
CALL exists_view('configQueryBasicInfo',isExits);
SELECT isExits;
IF(isExits = FALSE) THEN
CREATE
/*[ALGORITHM = {UNDEFINED | MERGE | TEMPTABLE}]
[DEFINER = { user | CURRENT_USER }]
[SQL SECURITY { DEFINER | INVOKER }]*/
VIEW `configQueryBasicInfo`(projectID,QUERY_CHOICE,QUERY_DEVICE_NUM,QUERY_SENSOR_NUM,查询数据集存储组数,查询数据集设备数,查询数据集传感器数,IOTDB编码方式)
AS
(SELECT a.projectID,a.configuration_value,b.configuration_value,c.configuration_value,d.configuration_value,e.configuration_value ,f.configuration_value,g.configuration_value FROM
(SELECT projectID, configuration_value FROM CONFIG WHERE configuration_item = 'QUERY_CHOICE') a JOIN
(SELECT projectID, configuration_value FROM CONFIG WHERE configuration_item = 'QUERY_DEVICE_NUM') b ON a.projectID = b.projectID JOIN
(SELECT projectID, configuration_value FROM CONFIG WHERE configuration_item = 'QUERY_SENSOR_NUM') c ON a.projectID = c.projectID JOIN
(SELECT projectID, configuration_value FROM CONFIG WHERE configuration_item = '查询数据集存储组数') d ON a.projectID = d.projectID JOIN
(SELECT projectID, configuration_value FROM CONFIG WHERE configuration_item = '查询数据集设备数') e ON a.projectID = e.projectID JOIN
(SELECT projectID, configuration_value FROM CONFIG WHERE configuration_item = '查询数据集传感器数') f ON a.projectID = f.projectID LEFT JOIN
(SELECT projectID, configuration_value FROM CONFIG WHERE configuration_item = 'IOTDB编码方式') g ON a.projectID = g.projectID
);
END IF;
CALL exists_view('configQueryInfo',isExits);
SELECT isExits;
IF(isExits = FALSE) THEN
CREATE
/*[ALGORITHM = {UNDEFINED | MERGE | TEMPTABLE}]
[DEFINER = { user | CURRENT_USER }]
[SQL SECURITY { DEFINER | INVOKER }]*/
VIEW `configQueryInfo`(projectID,QUERY_CHOICE,`LOOP`,CLIENT_NUMBER,QUERY_DEVICE_NUM,QUERY_SENSOR_NUM,IS_RESULTSET_NULL,QUERY_AGGREGATE_FUN,
TIME_INTERVAL,FILTRATION_CONDITION,TIME_UNIT)
AS
(SELECT DISTINCT (a.projectID),a.QUERY_CHOICE, aa.loop, aa.clientNumber,a.QUERY_DEVICE_NUM,a.QUERY_SENSOR_NUM,
b.configuration_value,d.configuration_value,e.configuration_value ,f.configuration_value,g.configuration_value FROM
(SELECT projectID,QUERY_CHOICE,QUERY_DEVICE_NUM,QUERY_SENSOR_NUM FROM configQueryBasicInfo) a JOIN
(SELECT projectID, `loop`,clientNumber FROM configCommonInfo) aa ON a.projectID = aa.projectID LEFT JOIN
(SELECT projectID, configuration_value FROM CONFIG WHERE configuration_item = 'IS_RESULTSET_NULL') b ON a.projectID = b.projectID LEFT JOIN
(SELECT projectID, configuration_value FROM CONFIG WHERE configuration_item = 'QUERY_AGGREGATE_FUN') d ON a.projectID = d.projectID LEFT JOIN
(SELECT projectID, configuration_value FROM CONFIG WHERE configuration_item = 'TIME_INTERVAL') e ON a.projectID = e.projectID LEFT JOIN
(SELECT projectID, configuration_value FROM CONFIG WHERE configuration_item = 'FILTRATION_CONDITION') f ON a.projectID = f.projectID LEFT JOIN
(SELECT projectID, configuration_value FROM CONFIG WHERE configuration_item = 'TIME_UNIT') g ON a.projectID = g.projectID
);
END IF;
END $$
DELIMITER ;
CALL creatView(); | the_stack |
-- ----------------------------------------------------------------------
-- Test: setup_schema.sql
-- ----------------------------------------------------------------------
-- start_ignore
create schema qp_resource_queue;
set search_path to qp_resource_queue;
-- end_ignore
-- ----------------------------------------------------------------------
-- Test: setup.sql
-- ----------------------------------------------------------------------
-- start_ignore
drop role if exists tbl16369_user1;
drop role if exists tbl16369_user3;
drop resource queue tbl16369_resq1;
drop resource queue tbl16369_resq3;
drop function if exists tbl16369_func1();
drop function if exists tbl16369_func2();
drop function if exists tbl16369_func3(refcursor, refcursor);
drop function if exists tbl16369_func4();
drop function if exists tbl16369_func5();
drop function if exists tbl16369_func6();
drop function if exists tbl16369_func7();
drop function if exists tbl16369_func8();
drop function if exists tbl16369_func9();
drop function if exists tbl16369_func10(param_numcount integer);
drop function if exists tbl16369_func11(param_numcount integer);
drop function if exists tbl16369_func12();
drop table if exists tbl16369_test;
drop table if exists tbl16369_zipcode_gis;
drop table if exists tbl16369_test1;
drop table if exists tbl16369_x;
-- end_ignore
create resource queue tbl16369_resq1 WITH (ACTIVE_STATEMENTS=1);
CREATE ROLE tbl16369_user1 LOGIN PASSWORD 'tbl16369pwd' NOSUPERUSER INHERIT NOCREATEDB NOCREATEROLE RESOURCE QUEUE tbl16369_resq1;
create resource queue tbl16369_resq3 WITH (ACTIVE_STATEMENTS=1, MEMORY_LIMIT='200MB');
CREATE ROLE tbl16369_user3 LOGIN PASSWORD 'tbl16369pwd' NOSUPERUSER INHERIT NOCREATEDB NOCREATEROLE RESOURCE QUEUE tbl16369_resq3;
-- start_ignore
drop role if exists gpadmin;
create role gpadmin login superuser;
-- end_ignore
grant gpadmin to tbl16369_user1;
grant gpadmin to tbl16369_user3;
Drop table if exists tbl16369_test;
create table tbl16369_test(col text);
CREATE TABLE tbl16369_zipcode_gis ( zipcode INTEGER, zip_col1 INTEGER, zip_col2 INTEGER ) DISTRIBUTED BY ( zipcode );
insert into tbl16369_test values ('789'),('789'),('789'),('789'),('789'),('789');
create table tbl16369_test1(a text, b int);
insert into tbl16369_test1 values ('456',456),('012',12),('901',901),('678',678),('789',789),('345',345);
insert into tbl16369_test1 values ('456',456),('012',12),('901',901),('678',678),('789',789),('345',345);
create table tbl16369_x(x int);
insert into tbl16369_x values (456),(12),(901),(678),(789),(345);
insert into tbl16369_x values (456),(12),(901),(678),(789),(345);
INSERT INTO tbl16369_zipcode_gis VALUES ( 94403, 123, 123 );
INSERT INTO tbl16369_zipcode_gis VALUES ( 94404, 321, 321 );
INSERT INTO tbl16369_zipcode_gis VALUES ( 90405, 234, 234 );
CREATE FUNCTION tbl16369_func1() RETURNS tbl16369_test AS $$
DECLARE
res tbl16369_test;
BEGIN
select * into res from tbl16369_test;
return res;
END;
$$ LANGUAGE plpgsql READS SQL DATA;
CREATE FUNCTION tbl16369_func2() RETURNS tbl16369_test AS $$
DECLARE
rec tbl16369_test;
ref refcursor;
BEGIN
OPEN ref FOR SELECT * FROM tbl16369_test;
FETCH ref into rec;
CLOSE ref;
RETURN rec;
END;
$$ LANGUAGE plpgsql READS SQL DATA;
CREATE FUNCTION tbl16369_func3(refcursor, refcursor) RETURNS SETOF refcursor AS $$
BEGIN
OPEN $1 FOR SELECT * FROM tbl16369_zipcode_gis;
RETURN NEXT $1;
OPEN $2 FOR SELECT * FROM tbl16369_test;
RETURN NEXT $2;
END;
$$ LANGUAGE plpgsql READS SQL DATA;
CREATE FUNCTION tbl16369_func4() RETURNS tbl16369_test AS $$
DECLARE
res tbl16369_test;
BEGIN
select tbl16369_func1() into res;
return res;
END;
$$ LANGUAGE plpgsql READS SQL DATA;
CREATE FUNCTION tbl16369_func5() RETURNS tbl16369_test AS $$
DECLARE
res tbl16369_test;
BEGIN
select tbl16369_func2() into res;
return res;
END;
$$ LANGUAGE plpgsql READS SQL DATA;
CREATE FUNCTION tbl16369_func6() RETURNS setof refcursor AS $$
DECLARE
ref1 refcursor;
BEGIN
select tbl16369_func3('a','b') into ref1;
return next ref1;
END;
$$ LANGUAGE plpgsql READS SQL DATA;
CREATE FUNCTION tbl16369_func7() RETURNS tbl16369_test AS $$
DECLARE
ref refcursor;
rec tbl16369_test;
BEGIN
OPEN ref FOR SELECT tbl16369_func1();
FETCH ref into rec;
CLOSE ref;
RETURN rec;
END;
$$ LANGUAGE plpgsql READS SQL DATA;
CREATE FUNCTION tbl16369_func8() RETURNS tbl16369_test AS $$
DECLARE
ref refcursor;
rec tbl16369_test;
BEGIN
OPEN ref FOR SELECT tbl16369_func2();
FETCH ref into rec;
CLOSE ref;
RETURN rec;
END;
$$ LANGUAGE plpgsql READS SQL DATA;
CREATE FUNCTION tbl16369_func9() RETURNS setof refcursor AS $$
DECLARE
ref refcursor;
ref1 refcursor;
BEGIN
OPEN ref FOR SELECT tbl16369_func3('a','b');
FETCH ref into ref1;
CLOSE ref;
RETURN next ref1;
END;
$$ LANGUAGE plpgsql READS SQL DATA;
CREATE OR REPLACE FUNCTION tbl16369_func10(param_numcount integer)
RETURNS tbl16369_test AS $$
DECLARE res tbl16369_test;
BEGIN
IF param_numcount < 0 THEN
RAISE EXCEPTION 'Negative numbers are not allowed';
ELSIF param_numcount > 0 THEN
RAISE NOTICE 'Yo there I''m number %, next: %', param_numcount, param_numcount -1;
res:= tbl16369_func10(param_numcount - 1);
ELSE
RAISE INFO 'Alas we are at the end of our journey';
select * into res from tbl16369_test;
END IF;
RETURN res;
END;
$$ LANGUAGE plpgsql READS SQL DATA;
CREATE OR REPLACE FUNCTION tbl16369_func11(param_numcount integer) RETURNS tbl16369_test AS $$
DECLARE res tbl16369_test; ref refcursor;
BEGIN
IF param_numcount < 0 THEN
RAISE EXCEPTION 'Negative numbers are not allowed';
ELSIF param_numcount > 0 THEN
RAISE NOTICE 'Yo there I''m number %, next: %', param_numcount, param_numcount -1;
res := tbl16369_func11(param_numcount - 1);
ELSE
RAISE INFO 'Alas we are at the end of our journey';
open ref for select * from tbl16369_test;
FETCH ref into res;
CLOSE ref;
END IF;
RETURN res;
END;
$$ LANGUAGE plpgsql READS SQL DATA;
CREATE FUNCTION tbl16369_func12() RETURNS float AS $$
DECLARE
ref refcursor;
res float;
BEGIN
OPEN ref FOR select avg(foo.b) from (select tbl16369_test1.b from tbl16369_test,tbl16369_test1 where tbl16369_test.col=tbl16369_test1.a and tbl16369_test1.b in (select x from tbl16369_x)) as foo;
FETCH ref into res;
CLOSE ref;
RETURN res;
END;
$$ LANGUAGE plpgsql READS SQL DATA;
Drop table if exists zipcode_gis;
Drop table if exists x;
Drop table if exists test1;
Drop function complexquery();
Drop table if exists test;
create table test(col text);
CREATE TABLE zipcode_gis ( zipcode INTEGER, zip_col1 INTEGER, zip_col2 INTEGER ) DISTRIBUTED BY ( zipcode );
insert into test values ('456'),('789'),('012'),('345'),('678'),('901');
create table test1(a text, b int);
insert into test1 values ('456',456),('012',12),('901',901),('678',678),('789',789),('345',345);
insert into test1 values ('654',456),('210',12),('109',901),('876',678),('987',789),('543',345);
create table x(x int);
insert into x values (456),(12),(901),(678),(789),(345);
insert into x values (456),(12),(901),(678),(789),(345);
select avg(foo.b) from (select test1.b from test,test1 where test.col=test1.a and test1.b in (select x from x)) as foo;
CREATE FUNCTION complexquery() RETURNS float AS $$
DECLARE
ref refcursor;
res float;
BEGIN
OPEN ref FOR select avg(foo.b) from (select test1.b from test,test1 where test.col=test1.a and test1.b in (select x from x)) as foo;
FETCH ref into res;
CLOSE ref;
RETURN res;
END;
$$ LANGUAGE plpgsql;
-- ----------------------------------------------------------------------
-- Test: test01_simple_function.sql
-- ----------------------------------------------------------------------
select tbl16369_func1();
-- ----------------------------------------------------------------------
-- Test: test02_fn_with_simple_cursor.sql
-- ----------------------------------------------------------------------
select tbl16369_func2();
-- ----------------------------------------------------------------------
-- Test: test03_fn_with_cursor_as_arg_rtntype.sql
-- ----------------------------------------------------------------------
select tbl16369_func3('a','b');
-- ----------------------------------------------------------------------
-- Test: test04_nested_simple_qry_calls_simple_qry.sql
-- ----------------------------------------------------------------------
select tbl16369_func4();
-- ----------------------------------------------------------------------
-- Test: test05_nested_simple_qry_calls_cursor.sql
-- ----------------------------------------------------------------------
select tbl16369_func5();
-- ----------------------------------------------------------------------
-- Test: test06_nested_simple_qry_calls_cursor_as_arg_rtntype.sql
-- ----------------------------------------------------------------------
select tbl16369_func6();
-- ----------------------------------------------------------------------
-- Test: test07_nested_cursor_calls_simple_query_tbl16369_user1.sql
-- ----------------------------------------------------------------------
select tbl16369_func7();
-- ----------------------------------------------------------------------
-- Test: test07_nested_cursor_calls_simple_query_tbl16369_user3.sql
-- ----------------------------------------------------------------------
select tbl16369_func7();
-- ----------------------------------------------------------------------
-- Test: test08_nested_cursor_calls_cursor_tbl16369_user1.sql
-- ----------------------------------------------------------------------
select tbl16369_func8();
-- ----------------------------------------------------------------------
-- Test: test08_nested_cursor_calls_cursor_tbl16369_user3.sql
-- ----------------------------------------------------------------------
select tbl16369_func8();
-- ----------------------------------------------------------------------
-- Test: test09_nested_cursor_calls_cursor_as_arg_rtntype_tbl16369_user1.sql
-- ----------------------------------------------------------------------
select tbl16369_func9();
-- ----------------------------------------------------------------------
-- Test: test09_nested_cursor_calls_cursor_as_arg_rtntype_tbl16369_user3.sql
-- ----------------------------------------------------------------------
select tbl16369_func9();
-- ----------------------------------------------------------------------
-- Test: test10_recursive_plpgsql_functions.sql
-- ----------------------------------------------------------------------
select tbl16369_func10(5);
-- ----------------------------------------------------------------------
-- Test: test11_recursive_plpgsql_functions_with_curosr.sql
-- ----------------------------------------------------------------------
select tbl16369_func11(5);
-- ----------------------------------------------------------------------
-- Test: test12_funtion_with_complex_query.sql
-- ----------------------------------------------------------------------
select avg(foo.b) from (select test1.b from test,test1 where test.col=test1.a and test1.b in (select x from x)) as foo;
select complexquery();
-- ----------------------------------------------------------------------
-- Test: test13_funtion_with_complex_query_in_cursor.sql
-- ----------------------------------------------------------------------
select tbl16369_func12();
-- ----------------------------------------------------------------------
-- Test: test14_multiple_function_calls.sql
-- ----------------------------------------------------------------------
select tbl16369_func1(),tbl16369_func2(),tbl16369_func4(),tbl16369_func5(),tbl16369_func10(5), tbl16369_func11(5), tbl16369_func12(), generate_series(1,10);
-- ----------------------------------------------------------------------
-- Test: teardown.sql
-- ----------------------------------------------------------------------
-- start_ignore
drop schema qp_resource_queue cascade;
drop role if exists tbl16369_user1;
drop role if exists tbl16369_user3;
drop resource queue tbl16369_resq1;
drop resource queue tbl16369_resq3;
-- end_ignore | the_stack |
-- MariaDB dump 10.19 Distrib 10.5.10-MariaDB, for Linux (x86_64)
--
-- Host: 127.0.0.1 Database: mattermost_test
-- ------------------------------------------------------
-- Server version 5.7.12
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
--
-- Table structure for table `Audits`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `Audits` (
`Id` varchar(26) NOT NULL,
`CreateAt` bigint(20) DEFAULT NULL,
`UserId` varchar(26) DEFAULT NULL,
`Action` text,
`ExtraInfo` text,
`IpAddress` varchar(64) DEFAULT NULL,
`SessionId` varchar(26) DEFAULT NULL,
PRIMARY KEY (`Id`),
KEY `idx_audits_user_id` (`UserId`)
);
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `Bots`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `Bots` (
`UserId` varchar(26) NOT NULL,
`Description` text,
`OwnerId` varchar(190) DEFAULT NULL,
`LastIconUpdate` bigint(20) DEFAULT NULL,
`CreateAt` bigint(20) DEFAULT NULL,
`UpdateAt` bigint(20) DEFAULT NULL,
`DeleteAt` bigint(20) DEFAULT NULL,
PRIMARY KEY (`UserId`)
);
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `ChannelMemberHistory`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `ChannelMemberHistory` (
`ChannelId` varchar(26) NOT NULL,
`UserId` varchar(26) NOT NULL,
`JoinTime` bigint(20) NOT NULL,
`LeaveTime` bigint(20) DEFAULT NULL,
PRIMARY KEY (`ChannelId`,`UserId`,`JoinTime`)
);
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `ChannelMembers`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `ChannelMembers` (
`ChannelId` varchar(26) NOT NULL,
`UserId` varchar(26) NOT NULL,
`Roles` varchar(64) DEFAULT NULL,
`LastViewedAt` bigint(20) DEFAULT NULL,
`MsgCount` bigint(20) DEFAULT NULL,
`MentionCount` bigint(20) DEFAULT NULL,
`NotifyProps` json DEFAULT NULL,
`LastUpdateAt` bigint(20) DEFAULT NULL,
`SchemeUser` tinyint(4) DEFAULT NULL,
`SchemeAdmin` tinyint(4) DEFAULT NULL,
`SchemeGuest` tinyint(4) DEFAULT NULL,
`MentionCountRoot` bigint(20) DEFAULT NULL,
`MsgCountRoot` bigint(20) DEFAULT NULL,
PRIMARY KEY (`ChannelId`,`UserId`),
KEY `idx_channelmembers_user_id_channel_id_last_viewed_at` (`UserId`,`ChannelId`,`LastViewedAt`),
KEY `idx_channelmembers_channel_id_scheme_guest_user_id` (`ChannelId`,`SchemeGuest`,`UserId`)
);
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `Channels`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `Channels` (
`Id` varchar(26) NOT NULL,
`CreateAt` bigint(20) DEFAULT NULL,
`UpdateAt` bigint(20) DEFAULT NULL,
`DeleteAt` bigint(20) DEFAULT NULL,
`TeamId` varchar(26) DEFAULT NULL,
`Type` varchar(1) DEFAULT NULL,
`DisplayName` varchar(64) DEFAULT NULL,
`Name` varchar(64) DEFAULT NULL,
`Header` text,
`Purpose` varchar(250) DEFAULT NULL,
`LastPostAt` bigint(20) DEFAULT NULL,
`TotalMsgCount` bigint(20) DEFAULT NULL,
`ExtraUpdateAt` bigint(20) DEFAULT NULL,
`CreatorId` varchar(26) DEFAULT NULL,
`SchemeId` varchar(26) DEFAULT NULL,
`GroupConstrained` tinyint(1) DEFAULT NULL,
`Shared` tinyint(1) DEFAULT NULL,
`TotalMsgCountRoot` bigint(20) DEFAULT NULL,
PRIMARY KEY (`Id`),
UNIQUE KEY `Name` (`Name`,`TeamId`),
KEY `idx_channels_update_at` (`UpdateAt`),
KEY `idx_channels_create_at` (`CreateAt`),
KEY `idx_channels_delete_at` (`DeleteAt`),
KEY `idx_channels_scheme_id` (`SchemeId`),
KEY `idx_channels_team_id_display_name` (`TeamId`,`DisplayName`),
KEY `idx_channels_team_id_type` (`TeamId`,`Type`),
FULLTEXT KEY `idx_channel_search_txt` (`Name`,`DisplayName`,`Purpose`)
);
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `ClusterDiscovery`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `ClusterDiscovery` (
`Id` varchar(26) NOT NULL,
`Type` varchar(64) DEFAULT NULL,
`ClusterName` varchar(64) DEFAULT NULL,
`Hostname` text,
`GossipPort` int(11) DEFAULT NULL,
`Port` int(11) DEFAULT NULL,
`CreateAt` bigint(20) DEFAULT NULL,
`LastPingAt` bigint(20) DEFAULT NULL,
PRIMARY KEY (`Id`)
);
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `CommandWebhooks`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `CommandWebhooks` (
`Id` varchar(26) NOT NULL,
`CreateAt` bigint(20) DEFAULT NULL,
`CommandId` varchar(26) DEFAULT NULL,
`UserId` varchar(26) DEFAULT NULL,
`ChannelId` varchar(26) DEFAULT NULL,
`RootId` varchar(26) DEFAULT NULL,
`UseCount` int(11) DEFAULT NULL,
PRIMARY KEY (`Id`),
KEY `idx_command_webhook_create_at` (`CreateAt`)
);
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `Commands`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `Commands` (
`Id` varchar(26) NOT NULL,
`Token` varchar(26) DEFAULT NULL,
`CreateAt` bigint(20) DEFAULT NULL,
`UpdateAt` bigint(20) DEFAULT NULL,
`DeleteAt` bigint(20) DEFAULT NULL,
`CreatorId` varchar(26) DEFAULT NULL,
`TeamId` varchar(26) DEFAULT NULL,
`Trigger` varchar(128) DEFAULT NULL,
`Method` varchar(1) DEFAULT NULL,
`Username` varchar(64) DEFAULT NULL,
`IconURL` text,
`AutoComplete` tinyint(1) DEFAULT NULL,
`AutoCompleteDesc` text,
`AutoCompleteHint` text,
`DisplayName` varchar(64) DEFAULT NULL,
`Description` varchar(128) DEFAULT NULL,
`URL` text,
`PluginId` varchar(190) DEFAULT NULL,
PRIMARY KEY (`Id`),
KEY `idx_command_team_id` (`TeamId`),
KEY `idx_command_update_at` (`UpdateAt`),
KEY `idx_command_create_at` (`CreateAt`),
KEY `idx_command_delete_at` (`DeleteAt`)
);
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `Compliances`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `Compliances` (
`Id` varchar(26) NOT NULL,
`CreateAt` bigint(20) DEFAULT NULL,
`UserId` varchar(26) DEFAULT NULL,
`Status` varchar(64) DEFAULT NULL,
`Count` int(11) DEFAULT NULL,
`Desc` text,
`Type` varchar(64) DEFAULT NULL,
`StartAt` bigint(20) DEFAULT NULL,
`EndAt` bigint(20) DEFAULT NULL,
`Keywords` text,
`Emails` text,
PRIMARY KEY (`Id`)
);
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `Emoji`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `Emoji` (
`Id` varchar(26) NOT NULL,
`CreateAt` bigint(20) DEFAULT NULL,
`UpdateAt` bigint(20) DEFAULT NULL,
`DeleteAt` bigint(20) DEFAULT NULL,
`CreatorId` varchar(26) DEFAULT NULL,
`Name` varchar(64) DEFAULT NULL,
PRIMARY KEY (`Id`),
UNIQUE KEY `Name` (`Name`,`DeleteAt`),
KEY `idx_emoji_update_at` (`UpdateAt`),
KEY `idx_emoji_create_at` (`CreateAt`),
KEY `idx_emoji_delete_at` (`DeleteAt`)
);
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `FileInfo`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `FileInfo` (
`Id` varchar(26) NOT NULL,
`CreatorId` varchar(26) DEFAULT NULL,
`PostId` varchar(26) DEFAULT NULL,
`CreateAt` bigint(20) DEFAULT NULL,
`UpdateAt` bigint(20) DEFAULT NULL,
`DeleteAt` bigint(20) DEFAULT NULL,
`Path` text,
`ThumbnailPath` text,
`PreviewPath` text,
`Name` text,
`Extension` varchar(64) DEFAULT NULL,
`Size` bigint(20) DEFAULT NULL,
`MimeType` text,
`Width` int(11) DEFAULT NULL,
`Height` int(11) DEFAULT NULL,
`HasPreviewImage` tinyint(1) DEFAULT NULL,
`MiniPreview` mediumblob,
`Content` longtext,
`RemoteId` varchar(26) DEFAULT NULL,
PRIMARY KEY (`Id`),
KEY `idx_fileinfo_update_at` (`UpdateAt`),
KEY `idx_fileinfo_create_at` (`CreateAt`),
KEY `idx_fileinfo_delete_at` (`DeleteAt`),
KEY `idx_fileinfo_postid_at` (`PostId`),
KEY `idx_fileinfo_extension_at` (`Extension`),
FULLTEXT KEY `idx_fileinfo_name_txt` (`Name`),
FULLTEXT KEY `idx_fileinfo_content_txt` (`Content`)
);
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `GroupChannels`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `GroupChannels` (
`GroupId` varchar(26) NOT NULL,
`AutoAdd` tinyint(1) DEFAULT NULL,
`SchemeAdmin` tinyint(1) DEFAULT NULL,
`CreateAt` bigint(20) DEFAULT NULL,
`DeleteAt` bigint(20) DEFAULT NULL,
`UpdateAt` bigint(20) DEFAULT NULL,
`ChannelId` varchar(26) NOT NULL,
PRIMARY KEY (`GroupId`,`ChannelId`),
KEY `idx_groupchannels_channelid` (`ChannelId`),
KEY `idx_groupchannels_schemeadmin` (`SchemeAdmin`)
);
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `GroupMembers`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `GroupMembers` (
`GroupId` varchar(26) NOT NULL,
`UserId` varchar(26) NOT NULL,
`CreateAt` bigint(20) DEFAULT NULL,
`DeleteAt` bigint(20) DEFAULT NULL,
PRIMARY KEY (`GroupId`,`UserId`),
KEY `idx_groupmembers_create_at` (`CreateAt`)
);
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `GroupTeams`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `GroupTeams` (
`GroupId` varchar(26) NOT NULL,
`AutoAdd` tinyint(1) DEFAULT NULL,
`SchemeAdmin` tinyint(1) DEFAULT NULL,
`CreateAt` bigint(20) DEFAULT NULL,
`DeleteAt` bigint(20) DEFAULT NULL,
`UpdateAt` bigint(20) DEFAULT NULL,
`TeamId` varchar(26) NOT NULL,
PRIMARY KEY (`GroupId`,`TeamId`),
KEY `idx_groupteams_teamid` (`TeamId`),
KEY `idx_groupteams_schemeadmin` (`SchemeAdmin`)
);
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `IncomingWebhooks`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `IncomingWebhooks` (
`Id` varchar(26) NOT NULL,
`CreateAt` bigint(20) DEFAULT NULL,
`UpdateAt` bigint(20) DEFAULT NULL,
`DeleteAt` bigint(20) DEFAULT NULL,
`UserId` varchar(26) DEFAULT NULL,
`ChannelId` varchar(26) DEFAULT NULL,
`TeamId` varchar(26) DEFAULT NULL,
`DisplayName` varchar(64) DEFAULT NULL,
`Description` text,
`Username` varchar(255) DEFAULT NULL,
`IconURL` text,
`ChannelLocked` tinyint(1) DEFAULT NULL,
PRIMARY KEY (`Id`),
KEY `idx_incoming_webhook_user_id` (`UserId`),
KEY `idx_incoming_webhook_team_id` (`TeamId`),
KEY `idx_incoming_webhook_update_at` (`UpdateAt`),
KEY `idx_incoming_webhook_create_at` (`CreateAt`),
KEY `idx_incoming_webhook_delete_at` (`DeleteAt`)
);
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `Jobs`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `Jobs` (
`Id` varchar(26) NOT NULL,
`Type` varchar(32) DEFAULT NULL,
`Priority` bigint(20) DEFAULT NULL,
`CreateAt` bigint(20) DEFAULT NULL,
`StartAt` bigint(20) DEFAULT NULL,
`LastActivityAt` bigint(20) DEFAULT NULL,
`Status` varchar(32) DEFAULT NULL,
`Progress` bigint(20) DEFAULT NULL,
`Data` json DEFAULT NULL,
PRIMARY KEY (`Id`),
KEY `idx_jobs_type` (`Type`)
);
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `Licenses`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `Licenses` (
`Id` varchar(26) NOT NULL,
`CreateAt` bigint(20) DEFAULT NULL,
`Bytes` text,
PRIMARY KEY (`Id`)
);
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `LinkMetadata`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `LinkMetadata` (
`Hash` bigint(20) NOT NULL,
`URL` text,
`Timestamp` bigint(20) DEFAULT NULL,
`Type` varchar(16) DEFAULT NULL,
`Data` json DEFAULT NULL,
PRIMARY KEY (`Hash`),
KEY `idx_link_metadata_url_timestamp` (`URL`(512),`Timestamp`)
);
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `OAuthAccessData`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `OAuthAccessData` (
`ClientId` varchar(26) DEFAULT NULL,
`UserId` varchar(26) DEFAULT NULL,
`Token` varchar(26) NOT NULL,
`RefreshToken` varchar(26) DEFAULT NULL,
`RedirectUri` text,
`ExpiresAt` bigint(20) DEFAULT NULL,
`Scope` varchar(128) DEFAULT NULL,
PRIMARY KEY (`Token`),
UNIQUE KEY `ClientId` (`ClientId`,`UserId`),
KEY `idx_oauthaccessdata_user_id` (`UserId`),
KEY `idx_oauthaccessdata_refresh_token` (`RefreshToken`)
);
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `OAuthApps`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `OAuthApps` (
`Id` varchar(26) NOT NULL,
`CreatorId` varchar(26) DEFAULT NULL,
`CreateAt` bigint(20) DEFAULT NULL,
`UpdateAt` bigint(20) DEFAULT NULL,
`ClientSecret` varchar(128) DEFAULT NULL,
`Name` varchar(64) DEFAULT NULL,
`Description` text,
`IconURL` text,
`CallbackUrls` text,
`Homepage` text,
`IsTrusted` tinyint(1) DEFAULT NULL,
PRIMARY KEY (`Id`),
KEY `idx_oauthapps_creator_id` (`CreatorId`)
);
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `OAuthAuthData`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `OAuthAuthData` (
`ClientId` varchar(26) DEFAULT NULL,
`UserId` varchar(26) DEFAULT NULL,
`Code` varchar(128) NOT NULL,
`ExpiresIn` int(11) DEFAULT NULL,
`CreateAt` bigint(20) DEFAULT NULL,
`RedirectUri` text,
`State` text,
`Scope` varchar(128) DEFAULT NULL,
PRIMARY KEY (`Code`)
);
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `OutgoingWebhooks`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `OutgoingWebhooks` (
`Id` varchar(26) NOT NULL,
`Token` varchar(26) DEFAULT NULL,
`CreateAt` bigint(20) DEFAULT NULL,
`UpdateAt` bigint(20) DEFAULT NULL,
`DeleteAt` bigint(20) DEFAULT NULL,
`CreatorId` varchar(26) DEFAULT NULL,
`ChannelId` varchar(26) DEFAULT NULL,
`TeamId` varchar(26) DEFAULT NULL,
`TriggerWords` text,
`TriggerWhen` int(11) DEFAULT NULL,
`CallbackURLs` text,
`DisplayName` varchar(64) DEFAULT NULL,
`Description` text,
`ContentType` varchar(128) DEFAULT NULL,
`Username` varchar(64) DEFAULT NULL,
`IconURL` text,
PRIMARY KEY (`Id`),
KEY `idx_outgoing_webhook_team_id` (`TeamId`),
KEY `idx_outgoing_webhook_update_at` (`UpdateAt`),
KEY `idx_outgoing_webhook_create_at` (`CreateAt`),
KEY `idx_outgoing_webhook_delete_at` (`DeleteAt`)
);
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `PluginKeyValueStore`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `PluginKeyValueStore` (
`PluginId` varchar(190) NOT NULL,
`PKey` varchar(50) NOT NULL,
`PValue` mediumblob,
`ExpireAt` bigint(20) DEFAULT NULL,
PRIMARY KEY (`PluginId`,`PKey`)
);
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `Posts`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `Posts` (
`Id` varchar(26) NOT NULL,
`CreateAt` bigint(20) DEFAULT NULL,
`UpdateAt` bigint(20) DEFAULT NULL,
`EditAt` bigint(20) DEFAULT NULL,
`DeleteAt` bigint(20) DEFAULT NULL,
`IsPinned` tinyint(1) DEFAULT NULL,
`UserId` varchar(26) DEFAULT NULL,
`ChannelId` varchar(26) DEFAULT NULL,
`RootId` varchar(26) DEFAULT NULL,
`OriginalId` varchar(26) DEFAULT NULL,
`Message` text,
`Type` varchar(26) DEFAULT NULL,
`Props` json DEFAULT NULL,
`Hashtags` text,
`Filenames` text,
`FileIds` text,
`HasReactions` tinyint(1) DEFAULT NULL,
`RemoteId` varchar(26) DEFAULT NULL,
PRIMARY KEY (`Id`),
KEY `idx_posts_update_at` (`UpdateAt`),
KEY `idx_posts_create_at` (`CreateAt`),
KEY `idx_posts_delete_at` (`DeleteAt`),
KEY `idx_posts_user_id` (`UserId`),
KEY `idx_posts_is_pinned` (`IsPinned`),
KEY `idx_posts_channel_id_update_at` (`ChannelId`,`UpdateAt`),
KEY `idx_posts_channel_id_delete_at_create_at` (`ChannelId`,`DeleteAt`,`CreateAt`),
KEY `idx_posts_root_id_delete_at` (`RootId`,`DeleteAt`),
FULLTEXT KEY `idx_posts_message_txt` (`Message`),
FULLTEXT KEY `idx_posts_hashtags_txt` (`Hashtags`)
);
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `Preferences`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `Preferences` (
`UserId` varchar(26) NOT NULL,
`Category` varchar(32) NOT NULL,
`Name` varchar(32) NOT NULL,
`Value` text,
PRIMARY KEY (`UserId`,`Category`,`Name`),
KEY `idx_preferences_category` (`Category`),
KEY `idx_preferences_name` (`Name`)
);
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `ProductNoticeViewState`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `ProductNoticeViewState` (
`UserId` varchar(26) NOT NULL,
`NoticeId` varchar(26) NOT NULL,
`Viewed` int(11) DEFAULT NULL,
`Timestamp` bigint(20) DEFAULT NULL,
PRIMARY KEY (`UserId`,`NoticeId`),
KEY `idx_notice_views_timestamp` (`Timestamp`),
KEY `idx_notice_views_notice_id` (`NoticeId`)
);
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `PublicChannels`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `PublicChannels` (
`Id` varchar(26) NOT NULL,
`DeleteAt` bigint(20) DEFAULT NULL,
`TeamId` varchar(26) DEFAULT NULL,
`DisplayName` varchar(64) DEFAULT NULL,
`Name` varchar(64) DEFAULT NULL,
`Header` text,
`Purpose` varchar(250) DEFAULT NULL,
PRIMARY KEY (`Id`),
UNIQUE KEY `Name` (`Name`,`TeamId`),
KEY `idx_publicchannels_team_id` (`TeamId`),
KEY `idx_publicchannels_delete_at` (`DeleteAt`),
FULLTEXT KEY `idx_publicchannels_search_txt` (`Name`,`DisplayName`,`Purpose`)
);
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `Reactions`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `Reactions` (
`UserId` varchar(26) NOT NULL,
`PostId` varchar(26) NOT NULL,
`EmojiName` varchar(64) NOT NULL,
`CreateAt` bigint(20) DEFAULT NULL,
`UpdateAt` bigint(20) DEFAULT NULL,
`DeleteAt` bigint(20) DEFAULT NULL,
`RemoteId` varchar(26) DEFAULT NULL,
PRIMARY KEY (`PostId`,`UserId`,`EmojiName`)
);
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `RemoteClusters`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `RemoteClusters` (
`RemoteId` varchar(26) NOT NULL,
`RemoteTeamId` varchar(26) DEFAULT NULL,
`Name` varchar(64) NOT NULL,
`DisplayName` varchar(64) DEFAULT NULL,
`SiteURL` text,
`CreateAt` bigint(20) DEFAULT NULL,
`LastPingAt` bigint(20) DEFAULT NULL,
`Token` varchar(26) DEFAULT NULL,
`RemoteToken` varchar(26) DEFAULT NULL,
`Topics` text,
`CreatorId` varchar(26) DEFAULT NULL,
PRIMARY KEY (`RemoteId`,`Name`),
UNIQUE KEY `remote_clusters_site_url_unique` (`RemoteTeamId`,`SiteURL`(168))
);
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `RetentionPolicies`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `RetentionPolicies` (
`Id` varchar(26) NOT NULL,
`DisplayName` varchar(64) DEFAULT NULL,
`PostDuration` bigint(20) DEFAULT NULL,
PRIMARY KEY (`Id`),
KEY `IDX_RetentionPolicies_DisplayName` (`DisplayName`)
);
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `RetentionPoliciesChannels`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `RetentionPoliciesChannels` (
`PolicyId` varchar(26) DEFAULT NULL,
`ChannelId` varchar(26) NOT NULL,
PRIMARY KEY (`ChannelId`),
KEY `IDX_RetentionPoliciesChannels_PolicyId` (`PolicyId`),
CONSTRAINT `FK_RetentionPoliciesChannels_RetentionPolicies` FOREIGN KEY (`PolicyId`) REFERENCES `RetentionPolicies` (`Id`) ON DELETE CASCADE
);
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `RetentionPoliciesTeams`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `RetentionPoliciesTeams` (
`PolicyId` varchar(26) DEFAULT NULL,
`TeamId` varchar(26) NOT NULL,
PRIMARY KEY (`TeamId`),
KEY `IDX_RetentionPoliciesTeams_PolicyId` (`PolicyId`),
CONSTRAINT `FK_RetentionPoliciesTeams_RetentionPolicies` FOREIGN KEY (`PolicyId`) REFERENCES `RetentionPolicies` (`Id`) ON DELETE CASCADE
);
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `Roles`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `Roles` (
`Id` varchar(26) NOT NULL,
`Name` varchar(64) DEFAULT NULL,
`DisplayName` varchar(128) DEFAULT NULL,
`Description` text,
`CreateAt` bigint(20) DEFAULT NULL,
`UpdateAt` bigint(20) DEFAULT NULL,
`DeleteAt` bigint(20) DEFAULT NULL,
`Permissions` longtext,
`SchemeManaged` tinyint(1) DEFAULT NULL,
`BuiltIn` tinyint(1) DEFAULT NULL,
PRIMARY KEY (`Id`),
UNIQUE KEY `Name` (`Name`)
);
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `Schemes`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `Schemes` (
`Id` varchar(26) NOT NULL,
`Name` varchar(64) DEFAULT NULL,
`DisplayName` varchar(128) DEFAULT NULL,
`Description` text,
`CreateAt` bigint(20) DEFAULT NULL,
`UpdateAt` bigint(20) DEFAULT NULL,
`DeleteAt` bigint(20) DEFAULT NULL,
`Scope` varchar(32) DEFAULT NULL,
`DefaultTeamAdminRole` varchar(64) DEFAULT NULL,
`DefaultTeamUserRole` varchar(64) DEFAULT NULL,
`DefaultChannelAdminRole` varchar(64) DEFAULT NULL,
`DefaultChannelUserRole` varchar(64) DEFAULT NULL,
`DefaultTeamGuestRole` varchar(64) DEFAULT NULL,
`DefaultChannelGuestRole` varchar(64) DEFAULT NULL,
PRIMARY KEY (`Id`),
UNIQUE KEY `Name` (`Name`),
KEY `idx_schemes_channel_guest_role` (`DefaultChannelGuestRole`),
KEY `idx_schemes_channel_user_role` (`DefaultChannelUserRole`),
KEY `idx_schemes_channel_admin_role` (`DefaultChannelAdminRole`)
);
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `Sessions`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `Sessions` (
`Id` varchar(26) NOT NULL,
`Token` varchar(26) DEFAULT NULL,
`CreateAt` bigint(20) DEFAULT NULL,
`ExpiresAt` bigint(20) DEFAULT NULL,
`LastActivityAt` bigint(20) DEFAULT NULL,
`UserId` varchar(26) DEFAULT NULL,
`DeviceId` text,
`Roles` varchar(64) DEFAULT NULL,
`IsOAuth` tinyint(1) DEFAULT NULL,
`ExpiredNotify` tinyint(1) DEFAULT NULL,
`Props` json DEFAULT NULL,
PRIMARY KEY (`Id`),
KEY `idx_sessions_user_id` (`UserId`),
KEY `idx_sessions_token` (`Token`),
KEY `idx_sessions_expires_at` (`ExpiresAt`),
KEY `idx_sessions_create_at` (`CreateAt`),
KEY `idx_sessions_last_activity_at` (`LastActivityAt`)
);
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `SharedChannelAttachments`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `SharedChannelAttachments` (
`Id` varchar(26) NOT NULL,
`FileId` varchar(26) DEFAULT NULL,
`RemoteId` varchar(26) DEFAULT NULL,
`CreateAt` bigint(20) DEFAULT NULL,
`LastSyncAt` bigint(20) DEFAULT NULL,
PRIMARY KEY (`Id`),
UNIQUE KEY `FileId` (`FileId`,`RemoteId`)
);
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `SharedChannelRemotes`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `SharedChannelRemotes` (
`Id` varchar(26) NOT NULL,
`ChannelId` varchar(26) NOT NULL,
`CreatorId` varchar(26) DEFAULT NULL,
`CreateAt` bigint(20) DEFAULT NULL,
`UpdateAt` bigint(20) DEFAULT NULL,
`IsInviteAccepted` tinyint(1) DEFAULT NULL,
`IsInviteConfirmed` tinyint(1) DEFAULT NULL,
`RemoteId` varchar(26) DEFAULT NULL,
`LastPostUpdateAt` bigint(20) DEFAULT NULL,
`LastPostId` varchar(26) DEFAULT NULL,
PRIMARY KEY (`Id`,`ChannelId`),
UNIQUE KEY `ChannelId` (`ChannelId`,`RemoteId`)
);
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `SharedChannelUsers`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `SharedChannelUsers` (
`Id` varchar(26) NOT NULL,
`UserId` varchar(26) DEFAULT NULL,
`ChannelId` varchar(26) DEFAULT NULL,
`RemoteId` varchar(26) DEFAULT NULL,
`CreateAt` bigint(20) DEFAULT NULL,
`LastSyncAt` bigint(20) DEFAULT NULL,
PRIMARY KEY (`Id`),
UNIQUE KEY `UserId` (`UserId`,`ChannelId`,`RemoteId`),
KEY `idx_sharedchannelusers_remote_id` (`RemoteId`)
);
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `SharedChannels`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `SharedChannels` (
`ChannelId` varchar(26) NOT NULL,
`TeamId` varchar(26) DEFAULT NULL,
`Home` tinyint(1) DEFAULT NULL,
`ReadOnly` tinyint(1) DEFAULT NULL,
`ShareName` varchar(64) DEFAULT NULL,
`ShareDisplayName` varchar(64) DEFAULT NULL,
`SharePurpose` varchar(250) DEFAULT NULL,
`ShareHeader` text,
`CreatorId` varchar(26) DEFAULT NULL,
`CreateAt` bigint(20) DEFAULT NULL,
`UpdateAt` bigint(20) DEFAULT NULL,
`RemoteId` varchar(26) DEFAULT NULL,
PRIMARY KEY (`ChannelId`),
UNIQUE KEY `ShareName` (`ShareName`,`TeamId`)
);
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `SidebarCategories`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `SidebarCategories` (
`Id` varchar(128) NOT NULL,
`UserId` varchar(26) DEFAULT NULL,
`TeamId` varchar(26) DEFAULT NULL,
`SortOrder` bigint(20) DEFAULT NULL,
`Sorting` varchar(64) DEFAULT NULL,
`Type` varchar(64) DEFAULT NULL,
`DisplayName` varchar(64) DEFAULT NULL,
`Muted` tinyint(1) DEFAULT NULL,
`Collapsed` tinyint(1) DEFAULT NULL,
PRIMARY KEY (`Id`)
);
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `SidebarChannels`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `SidebarChannels` (
`ChannelId` varchar(26) NOT NULL,
`UserId` varchar(26) NOT NULL,
`CategoryId` varchar(128) NOT NULL,
`SortOrder` bigint(20) DEFAULT NULL,
PRIMARY KEY (`ChannelId`,`UserId`,`CategoryId`)
);
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `Status`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `Status` (
`UserId` varchar(26) NOT NULL,
`Status` varchar(32) DEFAULT NULL,
`Manual` tinyint(1) DEFAULT NULL,
`LastActivityAt` bigint(20) DEFAULT NULL,
`DNDEndTime` bigint(20) DEFAULT NULL,
`PrevStatus` varchar(32) DEFAULT NULL,
PRIMARY KEY (`UserId`),
KEY `idx_status_status_dndendtime` (`Status`,`DNDEndTime`)
);
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `Systems`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `Systems` (
`Name` varchar(64) NOT NULL,
`Value` text,
PRIMARY KEY (`Name`)
);
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `TeamMembers`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `TeamMembers` (
`TeamId` varchar(26) NOT NULL,
`UserId` varchar(26) NOT NULL,
`Roles` varchar(64) DEFAULT NULL,
`DeleteAt` bigint(20) DEFAULT NULL,
`SchemeUser` tinyint(4) DEFAULT NULL,
`SchemeAdmin` tinyint(4) DEFAULT NULL,
`SchemeGuest` tinyint(4) DEFAULT NULL,
PRIMARY KEY (`TeamId`,`UserId`),
KEY `idx_teammembers_user_id` (`UserId`),
KEY `idx_teammembers_delete_at` (`DeleteAt`)
);
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `Teams`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `Teams` (
`Id` varchar(26) NOT NULL,
`CreateAt` bigint(20) DEFAULT NULL,
`UpdateAt` bigint(20) DEFAULT NULL,
`DeleteAt` bigint(20) DEFAULT NULL,
`DisplayName` varchar(64) DEFAULT NULL,
`Name` varchar(64) DEFAULT NULL,
`Description` varchar(255) DEFAULT NULL,
`Email` varchar(128) DEFAULT NULL,
`Type` varchar(255) DEFAULT NULL,
`CompanyName` varchar(64) DEFAULT NULL,
`AllowedDomains` text,
`InviteId` varchar(32) DEFAULT NULL,
`SchemeId` varchar(26) DEFAULT NULL,
`AllowOpenInvite` tinyint(1) DEFAULT NULL,
`LastTeamIconUpdate` bigint(20) DEFAULT NULL,
`GroupConstrained` tinyint(1) DEFAULT NULL,
PRIMARY KEY (`Id`),
UNIQUE KEY `Name` (`Name`),
KEY `idx_teams_invite_id` (`InviteId`),
KEY `idx_teams_update_at` (`UpdateAt`),
KEY `idx_teams_create_at` (`CreateAt`),
KEY `idx_teams_delete_at` (`DeleteAt`),
KEY `idx_teams_scheme_id` (`SchemeId`)
);
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `TermsOfService`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `TermsOfService` (
`Id` varchar(26) NOT NULL,
`CreateAt` bigint(20) DEFAULT NULL,
`UserId` varchar(26) DEFAULT NULL,
`Text` text,
PRIMARY KEY (`Id`)
);
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `ThreadMemberships`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `ThreadMemberships` (
`PostId` varchar(26) NOT NULL,
`UserId` varchar(26) NOT NULL,
`Following` tinyint(1) DEFAULT NULL,
`LastViewed` bigint(20) DEFAULT NULL,
`LastUpdated` bigint(20) DEFAULT NULL,
`UnreadMentions` bigint(20) DEFAULT NULL,
PRIMARY KEY (`PostId`,`UserId`),
KEY `idx_thread_memberships_last_update_at` (`LastUpdated`),
KEY `idx_thread_memberships_last_view_at` (`LastViewed`),
KEY `idx_thread_memberships_user_id` (`UserId`)
);
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `Threads`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `Threads` (
`PostId` varchar(26) NOT NULL,
`ChannelId` varchar(26) DEFAULT NULL,
`ReplyCount` bigint(20) DEFAULT NULL,
`LastReplyAt` bigint(20) DEFAULT NULL,
`Participants` json DEFAULT NULL,
PRIMARY KEY (`PostId`),
KEY `idx_threads_channel_id_last_reply_at` (`ChannelId`,`LastReplyAt`)
);
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `Tokens`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `Tokens` (
`Token` varchar(64) NOT NULL,
`CreateAt` bigint(20) DEFAULT NULL,
`Type` varchar(64) DEFAULT NULL,
`Extra` text,
PRIMARY KEY (`Token`)
);
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `UploadSessions`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `UploadSessions` (
`Id` varchar(26) NOT NULL,
`Type` varchar(32) DEFAULT NULL,
`CreateAt` bigint(20) DEFAULT NULL,
`UserId` varchar(26) DEFAULT NULL,
`ChannelId` varchar(26) DEFAULT NULL,
`Filename` text,
`Path` text,
`FileSize` bigint(20) DEFAULT NULL,
`FileOffset` bigint(20) DEFAULT NULL,
`RemoteId` varchar(26) DEFAULT NULL,
`ReqFileId` varchar(26) DEFAULT NULL,
PRIMARY KEY (`Id`),
KEY `idx_uploadsessions_user_id` (`Type`),
KEY `idx_uploadsessions_create_at` (`CreateAt`)
);
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `UserAccessTokens`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `UserAccessTokens` (
`Id` varchar(26) NOT NULL,
`Token` varchar(26) DEFAULT NULL,
`UserId` varchar(26) DEFAULT NULL,
`Description` text,
`IsActive` tinyint(1) DEFAULT NULL,
PRIMARY KEY (`Id`),
UNIQUE KEY `Token` (`Token`),
KEY `idx_user_access_tokens_user_id` (`UserId`)
);
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `UserGroups`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `UserGroups` (
`Id` varchar(26) NOT NULL,
`Name` varchar(64) DEFAULT NULL,
`DisplayName` varchar(128) DEFAULT NULL,
`Description` text,
`Source` varchar(64) DEFAULT NULL,
`RemoteId` varchar(48) DEFAULT NULL,
`CreateAt` bigint(20) DEFAULT NULL,
`UpdateAt` bigint(20) DEFAULT NULL,
`DeleteAt` bigint(20) DEFAULT NULL,
`AllowReference` tinyint(1) DEFAULT NULL,
PRIMARY KEY (`Id`),
UNIQUE KEY `Name` (`Name`),
UNIQUE KEY `Source` (`Source`,`RemoteId`),
KEY `idx_usergroups_remote_id` (`RemoteId`),
KEY `idx_usergroups_delete_at` (`DeleteAt`)
);
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `UserTermsOfService`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `UserTermsOfService` (
`UserId` varchar(26) NOT NULL,
`TermsOfServiceId` varchar(26) DEFAULT NULL,
`CreateAt` bigint(20) DEFAULT NULL,
PRIMARY KEY (`UserId`)
);
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `Users`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `Users` (
`Id` varchar(26) NOT NULL,
`CreateAt` bigint(20) DEFAULT NULL,
`UpdateAt` bigint(20) DEFAULT NULL,
`DeleteAt` bigint(20) DEFAULT NULL,
`Username` varchar(64) DEFAULT NULL,
`Password` varchar(128) DEFAULT NULL,
`AuthData` varchar(128) DEFAULT NULL,
`AuthService` varchar(32) DEFAULT NULL,
`Email` varchar(128) DEFAULT NULL,
`EmailVerified` tinyint(1) DEFAULT NULL,
`Nickname` varchar(64) DEFAULT NULL,
`FirstName` varchar(64) DEFAULT NULL,
`LastName` varchar(64) DEFAULT NULL,
`Position` varchar(128) DEFAULT NULL,
`Roles` text,
`AllowMarketing` tinyint(1) DEFAULT NULL,
`Props` json DEFAULT NULL,
`NotifyProps` json DEFAULT NULL,
`LastPasswordUpdate` bigint(20) DEFAULT NULL,
`LastPictureUpdate` bigint(20) DEFAULT NULL,
`FailedAttempts` int(11) DEFAULT NULL,
`Locale` varchar(5) DEFAULT NULL,
`Timezone` json DEFAULT NULL,
`MfaActive` tinyint(1) DEFAULT NULL,
`MfaSecret` varchar(128) DEFAULT NULL,
`RemoteId` varchar(26) DEFAULT NULL,
PRIMARY KEY (`Id`),
UNIQUE KEY `Username` (`Username`),
UNIQUE KEY `AuthData` (`AuthData`),
UNIQUE KEY `Email` (`Email`),
KEY `idx_users_update_at` (`UpdateAt`),
KEY `idx_users_create_at` (`CreateAt`),
KEY `idx_users_delete_at` (`DeleteAt`),
FULLTEXT KEY `idx_users_all_txt` (`Username`,`FirstName`,`LastName`,`Nickname`,`Email`),
FULLTEXT KEY `idx_users_all_no_full_name_txt` (`Username`,`Nickname`,`Email`),
FULLTEXT KEY `idx_users_names_txt` (`Username`,`FirstName`,`LastName`,`Nickname`),
FULLTEXT KEY `idx_users_names_no_full_name_txt` (`Username`,`Nickname`)
);
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `schema_migrations`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `schema_migrations` (
`version` bigint(20) NOT NULL,
`dirty` tinyint(1) NOT NULL,
PRIMARY KEY (`version`)
);
/*!40101 SET character_set_client = @saved_cs_client */;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
-- Dump completed on 2021-08-31 11:45:07 | the_stack |
-- 2017-08-17T18:07:24.705
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Tab SET IsActive='Y', Name='Verlauf',Updated=TO_TIMESTAMP('2017-08-17 18:07:24','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=540737
;
-- 2017-08-17T18:12:58.095
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_Tab (AD_Client_ID,AD_Org_ID,AD_Tab_ID,AD_Table_ID,AD_Window_ID,Created,CreatedBy,EntityType,HasTree,ImportFields,IsActive,IsAdvancedTab,IsCheckParentsChanged,IsGenericZoomTarget,IsGridModeOnly,IsInfoTab,IsInsertRecord,IsQueryOnLoad,IsReadOnly,IsRefreshAllOnActivate,IsSearchActive,IsSearchCollapsed,IsSingleRow,IsSortTab,IsTranslationTab,MaxQueryRecords,Name,Processing,SeqNo,TabLevel,Updated,UpdatedBy) VALUES (0,0,540852,540148,540354,TO_TIMESTAMP('2017-08-17 18:12:58','YYYY-MM-DD HH24:MI:SS'),100,'de.metas.fresh','N','N','Y','N','Y','N','N','N','N','Y','Y','N','Y','Y','N','N','N',0,'Verlauf','N',90,0,TO_TIMESTAMP('2017-08-17 18:12:58','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 2017-08-17T18:12:58.098
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_Tab_Trl (AD_Language,AD_Tab_ID, CommitWarning,Description,Help,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Tab_ID, t.CommitWarning,t.Description,t.Help,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Tab t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Tab_ID=540852 AND NOT EXISTS (SELECT 1 FROM AD_Tab_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Tab_ID=t.AD_Tab_ID)
;
-- 2017-08-17T18:13:44.841
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_Field (AD_Client_ID,AD_Column_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,ColumnDisplayLength,Created,CreatedBy,Description,DisplayLength,EntityType,Help,IncludedTabHeight,IsActive,IsCentrallyMaintained,IsDisplayed,IsDisplayedGrid,IsEncrypted,IsFieldOnly,IsHeading,IsReadOnly,IsSameLine,Name,SeqNo,SeqNoGrid,SpanX,SpanY,Updated,UpdatedBy) VALUES (0,542726,559455,0,540852,0,TO_TIMESTAMP('2017-08-17 18:13:44','YYYY-MM-DD HH24:MI:SS'),100,'Database Table information',14,'de.metas.fresh','The Database Table provides the information of the table definition',0,'Y','Y','N','N','N','N','N','N','N','DB-Tabelle',0,0,1,1,TO_TIMESTAMP('2017-08-17 18:13:44','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 2017-08-17T18:13:44.843
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_Field_Trl (AD_Language,AD_Field_ID, Description,Help,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Field_ID, t.Description,t.Help,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Field t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Field_ID=559455 AND NOT EXISTS (SELECT 1 FROM AD_Field_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Field_ID=t.AD_Field_ID)
;
-- 2017-08-17T18:13:44.886
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_Field (AD_Client_ID,AD_Column_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,ColumnDisplayLength,Created,CreatedBy,Description,DisplayLength,EntityType,Help,IncludedTabHeight,IsActive,IsCentrallyMaintained,IsDisplayed,IsDisplayedGrid,IsEncrypted,IsFieldOnly,IsHeading,IsReadOnly,IsSameLine,Name,SeqNo,SeqNoGrid,SpanX,SpanY,Updated,UpdatedBy) VALUES (0,542720,559456,0,540852,0,TO_TIMESTAMP('2017-08-17 18:13:44','YYYY-MM-DD HH24:MI:SS'),100,'Mandant für diese Installation.',10,'de.metas.fresh','Ein Mandant ist eine Firma oder eine juristische Person. Sie können keine Daten über Mandanten hinweg verwenden. .',0,'Y','Y','N','N','N','N','N','N','N','Mandant',0,0,1,1,TO_TIMESTAMP('2017-08-17 18:13:44','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 2017-08-17T18:13:44.889
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_Field_Trl (AD_Language,AD_Field_ID, Description,Help,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Field_ID, t.Description,t.Help,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Field t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Field_ID=559456 AND NOT EXISTS (SELECT 1 FROM AD_Field_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Field_ID=t.AD_Field_ID)
;
-- 2017-08-17T18:13:44.923
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_Field (AD_Client_ID,AD_Column_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,ColumnDisplayLength,Created,CreatedBy,Description,DisplayLength,EntityType,Help,IncludedTabHeight,IsActive,IsCentrallyMaintained,IsDisplayed,IsDisplayedGrid,IsEncrypted,IsFieldOnly,IsHeading,IsReadOnly,IsSameLine,Name,SeqNo,SeqNoGrid,SpanX,SpanY,Updated,UpdatedBy) VALUES (0,542727,559457,0,540852,0,TO_TIMESTAMP('2017-08-17 18:13:44','YYYY-MM-DD HH24:MI:SS'),100,'Direct internal record ID',14,'de.metas.fresh','The Record ID is the internal unique identifier of a record. Please note that zooming to the record may not be successful for Orders, Invoices and Shipment/Receipts as sometimes the Sales Order type is not known.',0,'Y','Y','N','Y','N','N','N','N','N','Datensatz-ID',0,70,1,1,TO_TIMESTAMP('2017-08-17 18:13:44','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 2017-08-17T18:13:44.924
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_Field_Trl (AD_Language,AD_Field_ID, Description,Help,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Field_ID, t.Description,t.Help,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Field t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Field_ID=559457 AND NOT EXISTS (SELECT 1 FROM AD_Field_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Field_ID=t.AD_Field_ID)
;
-- 2017-08-17T18:13:44.953
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_Field (AD_Client_ID,AD_Column_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,ColumnDisplayLength,Created,CreatedBy,Description,DisplayLength,EntityType,Help,IncludedTabHeight,IsActive,IsCentrallyMaintained,IsDisplayed,IsDisplayedGrid,IsEncrypted,IsFieldOnly,IsHeading,IsReadOnly,IsSameLine,Name,SeqNo,SeqNoGrid,SpanX,SpanY,Updated,UpdatedBy) VALUES (0,542717,559458,0,540852,0,TO_TIMESTAMP('2017-08-17 18:13:44','YYYY-MM-DD HH24:MI:SS'),100,'Bezeichnet einen Geschäftspartner',10,'de.metas.fresh','Ein Geschäftspartner ist jemand, mit dem Sie interagieren. Dies kann Lieferanten, Kunden, Mitarbeiter oder Handelsvertreter umfassen.',0,'Y','Y','N','N','N','N','N','N','N','Geschäftspartner',0,0,1,1,TO_TIMESTAMP('2017-08-17 18:13:44','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 2017-08-17T18:13:44.954
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_Field_Trl (AD_Language,AD_Field_ID, Description,Help,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Field_ID, t.Description,t.Help,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Field t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Field_ID=559458 AND NOT EXISTS (SELECT 1 FROM AD_Field_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Field_ID=t.AD_Field_ID)
;
-- 2017-08-17T18:13:45.003
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_Field (AD_Client_ID,AD_Column_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,ColumnDisplayLength,Created,CreatedBy,Description,DisplayLength,EntityType,Help,IncludedTabHeight,IsActive,IsCentrallyMaintained,IsDisplayed,IsDisplayedGrid,IsEncrypted,IsFieldOnly,IsHeading,IsReadOnly,IsSameLine,Name,SeqNo,SeqNoGrid,SpanX,SpanY,Updated,UpdatedBy) VALUES (0,542722,559459,0,540852,0,TO_TIMESTAMP('2017-08-17 18:13:44','YYYY-MM-DD HH24:MI:SS'),100,'Datum, an dem dieser Eintrag erstellt wurde',29,'de.metas.fresh','Das Feld Erstellt zeigt an, zu welchem Datum dieser Eintrag erstellt wurde.',0,'Y','Y','Y','Y','N','N','N','N','N','Erstellt',10,10,1,1,TO_TIMESTAMP('2017-08-17 18:13:44','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 2017-08-17T18:13:45.005
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_Field_Trl (AD_Language,AD_Field_ID, Description,Help,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Field_ID, t.Description,t.Help,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Field t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Field_ID=559459 AND NOT EXISTS (SELECT 1 FROM AD_Field_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Field_ID=t.AD_Field_ID)
;
-- 2017-08-17T18:13:45.041
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_Field (AD_Client_ID,AD_Column_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,ColumnDisplayLength,Created,CreatedBy,DisplayLength,EntityType,IncludedTabHeight,IsActive,IsCentrallyMaintained,IsDisplayed,IsDisplayedGrid,IsEncrypted,IsFieldOnly,IsHeading,IsReadOnly,IsSameLine,Name,SeqNo,SeqNoGrid,SpanX,SpanY,Updated,UpdatedBy) VALUES (0,542719,559460,0,540852,0,TO_TIMESTAMP('2017-08-17 18:13:45','YYYY-MM-DD HH24:MI:SS'),100,30,'de.metas.fresh',0,'Y','Y','Y','Y','N','N','N','N','N','Typ',20,20,1,1,TO_TIMESTAMP('2017-08-17 18:13:45','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 2017-08-17T18:13:45.042
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_Field_Trl (AD_Language,AD_Field_ID, Description,Help,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Field_ID, t.Description,t.Help,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Field t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Field_ID=559460 AND NOT EXISTS (SELECT 1 FROM AD_Field_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Field_ID=t.AD_Field_ID)
;
-- 2017-08-17T18:13:45.074
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_Field (AD_Client_ID,AD_Column_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,ColumnDisplayLength,Created,CreatedBy,Description,DisplayLength,EntityType,Help,IncludedTabHeight,IsActive,IsCentrallyMaintained,IsDisplayed,IsDisplayedGrid,IsEncrypted,IsFieldOnly,IsHeading,IsReadOnly,IsSameLine,Name,SeqNo,SeqNoGrid,SpanX,SpanY,Updated,UpdatedBy) VALUES (0,542718,559461,0,540852,0,TO_TIMESTAMP('2017-08-17 18:13:45','YYYY-MM-DD HH24:MI:SS'),100,'Document sequence number of the document',30,'de.metas.fresh','The document number is usually automatically generated by the system and determined by the document type of the document. If the document is not saved, the preliminary number is displayed in "<>".
If the document type of your document has no automatic document sequence defined, the field is empty if you create a new document. This is for documents which usually have an external number (like vendor invoice). If you leave the field empty, the system will generate a document number for you. The document sequence used for this fallback number is defined in the "Maintain Sequence" window with the name "DocumentNo_<TableName>", where TableName is the actual name of the table (e.g. C_Order).',0,'Y','Y','Y','Y','N','N','N','N','N','Beleg Nr.',30,30,1,1,TO_TIMESTAMP('2017-08-17 18:13:45','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 2017-08-17T18:13:45.075
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_Field_Trl (AD_Language,AD_Field_ID, Description,Help,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Field_ID, t.Description,t.Help,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Field t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Field_ID=559461 AND NOT EXISTS (SELECT 1 FROM AD_Field_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Field_ID=t.AD_Field_ID)
;
-- 2017-08-17T18:13:45.107
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_Field (AD_Client_ID,AD_Column_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,ColumnDisplayLength,Created,CreatedBy,Description,DisplayLength,EntityType,Help,IncludedTabHeight,IsActive,IsCentrallyMaintained,IsDisplayed,IsDisplayedGrid,IsEncrypted,IsFieldOnly,IsHeading,IsReadOnly,IsSameLine,Name,SeqNo,SeqNoGrid,SpanX,SpanY,Updated,UpdatedBy) VALUES (0,542724,559462,0,540852,0,TO_TIMESTAMP('2017-08-17 18:13:45','YYYY-MM-DD HH24:MI:SS'),100,'Datum, an dem dieser Eintrag aktualisiert wurde',29,'de.metas.fresh','Aktualisiert zeigt an, wann dieser Eintrag aktualisiert wurde.',0,'Y','Y','Y','Y','N','N','N','N','N','Aktualisiert',40,40,1,1,TO_TIMESTAMP('2017-08-17 18:13:45','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 2017-08-17T18:13:45.108
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_Field_Trl (AD_Language,AD_Field_ID, Description,Help,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Field_ID, t.Description,t.Help,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Field t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Field_ID=559462 AND NOT EXISTS (SELECT 1 FROM AD_Field_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Field_ID=t.AD_Field_ID)
;
-- 2017-08-17T18:13:45.141
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_Field (AD_Client_ID,AD_Column_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,ColumnDisplayLength,Created,CreatedBy,Description,DisplayLength,EntityType,Help,IncludedTabHeight,IsActive,IsCentrallyMaintained,IsDisplayed,IsDisplayedGrid,IsEncrypted,IsFieldOnly,IsHeading,IsReadOnly,IsSameLine,Name,SeqNo,SeqNoGrid,SpanX,SpanY,Updated,UpdatedBy) VALUES (0,542725,559463,0,540852,0,TO_TIMESTAMP('2017-08-17 18:13:45','YYYY-MM-DD HH24:MI:SS'),100,'Nutzer, der diesen Eintrag aktualisiert hat',10,'de.metas.fresh','Aktualisiert durch zeigt an, welcher Nutzer diesen Eintrag aktualisiert hat.',0,'Y','Y','Y','Y','N','N','N','N','N','Aktualisiert durch',50,50,1,1,TO_TIMESTAMP('2017-08-17 18:13:45','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 2017-08-17T18:13:45.142
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_Field_Trl (AD_Language,AD_Field_ID, Description,Help,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Field_ID, t.Description,t.Help,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Field t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Field_ID=559463 AND NOT EXISTS (SELECT 1 FROM AD_Field_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Field_ID=t.AD_Field_ID)
;
-- 2017-08-17T18:13:45.170
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_Field (AD_Client_ID,AD_Column_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,ColumnDisplayLength,Created,CreatedBy,Description,DisplayLength,EntityType,Help,IncludedTabHeight,IsActive,IsCentrallyMaintained,IsDisplayed,IsDisplayedGrid,IsEncrypted,IsFieldOnly,IsHeading,IsReadOnly,IsSameLine,Name,SeqNo,SeqNoGrid,SpanX,SpanY,Updated,UpdatedBy) VALUES (0,542723,559464,0,540852,0,TO_TIMESTAMP('2017-08-17 18:13:45','YYYY-MM-DD HH24:MI:SS'),100,'Nutzer, der diesen Eintrag erstellt hat',10,'de.metas.fresh','Das Feld Erstellt durch zeigt an, welcher Nutzer diesen Eintrag erstellt hat.',0,'Y','Y','Y','Y','N','N','N','N','N','Erstellt durch',60,60,1,1,TO_TIMESTAMP('2017-08-17 18:13:45','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 2017-08-17T18:13:45.171
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_Field_Trl (AD_Language,AD_Field_ID, Description,Help,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Field_ID, t.Description,t.Help,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Field t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Field_ID=559464 AND NOT EXISTS (SELECT 1 FROM AD_Field_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Field_ID=t.AD_Field_ID)
;
-- 2017-08-17T18:13:45.204
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_Field (AD_Client_ID,AD_Column_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,ColumnDisplayLength,Created,CreatedBy,DisplayLength,EntityType,IncludedTabHeight,IsActive,IsCentrallyMaintained,IsDisplayed,IsDisplayedGrid,IsEncrypted,IsFieldOnly,IsHeading,IsReadOnly,IsSameLine,Name,SeqNo,SeqNoGrid,SortNo,SpanX,SpanY,Updated,UpdatedBy) VALUES (0,542728,559465,0,540852,0,TO_TIMESTAMP('2017-08-17 18:13:45','YYYY-MM-DD HH24:MI:SS'),100,0,'de.metas.fresh',0,'Y','Y','Y','Y','N','N','N','N','N','Beschreibung',70,80,0,1,1,TO_TIMESTAMP('2017-08-17 18:13:45','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 2017-08-17T18:13:45.205
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_Field_Trl (AD_Language,AD_Field_ID, Description,Help,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Field_ID, t.Description,t.Help,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Field t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Field_ID=559465 AND NOT EXISTS (SELECT 1 FROM AD_Field_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Field_ID=t.AD_Field_ID)
;
-- 2017-08-17T18:13:45.244
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_Field (AD_Client_ID,AD_Column_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,ColumnDisplayLength,Created,CreatedBy,Description,DisplayLength,EntityType,Help,IncludedTabHeight,IsActive,IsCentrallyMaintained,IsDisplayed,IsDisplayedGrid,IsEncrypted,IsFieldOnly,IsHeading,IsReadOnly,IsSameLine,Name,SeqNo,SeqNoGrid,SpanX,SpanY,Updated,UpdatedBy) VALUES (0,542721,559466,0,540852,0,TO_TIMESTAMP('2017-08-17 18:13:45','YYYY-MM-DD HH24:MI:SS'),100,'Organisatorische Einheit des Mandanten',10,'de.metas.fresh','Eine Organisation ist ein Bereich ihres Mandanten - z.B. Laden oder Abteilung. Sie können Daten über Organisationen hinweg gemeinsam verwenden.',0,'Y','Y','Y','N','N','N','N','N','N','Sektion',80,0,1,1,TO_TIMESTAMP('2017-08-17 18:13:45','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 2017-08-17T18:13:45.245
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_Field_Trl (AD_Language,AD_Field_ID, Description,Help,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Field_ID, t.Description,t.Help,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Field t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Field_ID=559466 AND NOT EXISTS (SELECT 1 FROM AD_Field_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Field_ID=t.AD_Field_ID)
;
-- 2017-08-17T18:14:03.966
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_UI_Section (AD_Client_ID,AD_Org_ID,AD_Tab_ID,AD_UI_Section_ID,Created,CreatedBy,IsActive,SeqNo,Updated,UpdatedBy) VALUES (0,0,540852,540412,TO_TIMESTAMP('2017-08-17 18:14:03','YYYY-MM-DD HH24:MI:SS'),100,'Y',10,TO_TIMESTAMP('2017-08-17 18:14:03','YYYY-MM-DD HH24:MI:SS'),100) RETURNING Value
;
-- 2017-08-17T18:14:03.968
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_UI_Section_Trl (AD_Language,AD_UI_Section_ID, Description,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_UI_Section_ID, t.Description,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_UI_Section t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_UI_Section_ID=540412 AND NOT EXISTS (SELECT 1 FROM AD_UI_Section_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_UI_Section_ID=t.AD_UI_Section_ID)
;
-- 2017-08-17T18:14:10.441
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_UI_Column (AD_Client_ID,AD_Org_ID,AD_UI_Column_ID,AD_UI_Section_ID,Created,CreatedBy,IsActive,SeqNo,Updated,UpdatedBy) VALUES (0,0,540552,540412,TO_TIMESTAMP('2017-08-17 18:14:10','YYYY-MM-DD HH24:MI:SS'),100,'Y',10,TO_TIMESTAMP('2017-08-17 18:14:10','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 2017-08-17T18:14:20.188
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_UI_ElementGroup (AD_Client_ID,AD_Org_ID,AD_UI_Column_ID,AD_UI_ElementGroup_ID,Created,CreatedBy,IsActive,Name,SeqNo,Updated,UpdatedBy) VALUES (0,0,540552,540977,TO_TIMESTAMP('2017-08-17 18:14:20','YYYY-MM-DD HH24:MI:SS'),100,'Y','default',10,TO_TIMESTAMP('2017-08-17 18:14:20','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 2017-08-17T18:15:14.616
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Field SET IsDisplayedGrid='N', SeqNoGrid=0,Updated=TO_TIMESTAMP('2017-08-17 18:15:14','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=559457
;
-- 2017-08-17T18:15:14.619
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Field SET IsDisplayedGrid='Y', SeqNoGrid=70,Updated=TO_TIMESTAMP('2017-08-17 18:15:14','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=559465
;
-- 2017-08-17T18:15:14.620
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Field SET IsDisplayedGrid='Y', SeqNoGrid=80,Updated=TO_TIMESTAMP('2017-08-17 18:15:14','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=559466
;
-- 2017-08-17T18:17:26.502
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,Created,CreatedBy,IsActive,IsAdvancedField,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,559460,0,540852,540977,547345,TO_TIMESTAMP('2017-08-17 18:17:26','YYYY-MM-DD HH24:MI:SS'),100,'Y','N','Y','N','N','Typ',10,0,0,TO_TIMESTAMP('2017-08-17 18:17:26','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 2017-08-17T18:17:59.903
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=10,Updated=TO_TIMESTAMP('2017-08-17 18:17:59','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=547345
;
-- 2017-08-17T18:18:45.049
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Tab SET AD_Column_ID=542717, Parent_Column_ID=2893, TabLevel=1,Updated=TO_TIMESTAMP('2017-08-17 18:18:45','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=540852
;
-- 2017-08-17T18:20:03.220
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,Created,CreatedBy,IsActive,IsAdvancedField,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,559461,0,540852,540977,547346,TO_TIMESTAMP('2017-08-17 18:20:03','YYYY-MM-DD HH24:MI:SS'),100,'Y','N','Y','N','N','Nr',20,0,0,TO_TIMESTAMP('2017-08-17 18:20:03','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 2017-08-17T18:20:16.097
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,Created,CreatedBy,IsActive,IsAdvancedField,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,559459,0,540852,540977,547347,TO_TIMESTAMP('2017-08-17 18:20:16','YYYY-MM-DD HH24:MI:SS'),100,'Y','N','Y','N','N','erstellt',30,0,0,TO_TIMESTAMP('2017-08-17 18:20:16','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 2017-08-17T18:20:29.691
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,Created,CreatedBy,IsActive,IsAdvancedField,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,559464,0,540852,540977,547348,TO_TIMESTAMP('2017-08-17 18:20:29','YYYY-MM-DD HH24:MI:SS'),100,'Y','N','Y','N','N','Erstellt durch',40,0,0,TO_TIMESTAMP('2017-08-17 18:20:29','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 2017-08-17T18:20:44.161
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,Created,CreatedBy,IsActive,IsAdvancedField,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,559465,0,540852,540977,547349,TO_TIMESTAMP('2017-08-17 18:20:44','YYYY-MM-DD HH24:MI:SS'),100,'Y','N','Y','N','N','Beschreibung',50,0,0,TO_TIMESTAMP('2017-08-17 18:20:44','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 2017-08-17T18:21:10.993
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,Created,CreatedBy,IsActive,IsAdvancedField,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,559457,0,540852,540977,547350,TO_TIMESTAMP('2017-08-17 18:21:10','YYYY-MM-DD HH24:MI:SS'),100,'Y','N','Y','N','N','Datensatz-ID',60,0,0,TO_TIMESTAMP('2017-08-17 18:21:10','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 2017-08-17T18:21:23.533
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=20,Updated=TO_TIMESTAMP('2017-08-17 18:21:23','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=547346
;
-- 2017-08-17T18:21:23.534
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=30,Updated=TO_TIMESTAMP('2017-08-17 18:21:23','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=547347
;
-- 2017-08-17T18:21:23.535
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=40,Updated=TO_TIMESTAMP('2017-08-17 18:21:23','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=547348
;
-- 2017-08-17T18:21:23.536
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=50,Updated=TO_TIMESTAMP('2017-08-17 18:21:23','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=547349
;
-- 2017-08-17T18:21:23.537
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=60,Updated=TO_TIMESTAMP('2017-08-17 18:21:23','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=547350
;
-- 2017-08-17T18:22:35.461
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Column SET IsIdentifier='Y', SeqNo=1,Updated=TO_TIMESTAMP('2017-08-17 18:22:35','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=542726
;
-- 2017-08-17T18:22:44.590
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Column SET IsIdentifier='Y', SeqNo=2,Updated=TO_TIMESTAMP('2017-08-17 18:22:44','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=542727
;
-- 2017-08-17T18:26:00.035
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Column SET IsIdentifier='N', SeqNo=NULL,Updated=TO_TIMESTAMP('2017-08-17 18:26:00','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=542727
;
-- 2017-08-17T18:26:03.810
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Column SET IsIdentifier='N', SeqNo=NULL,Updated=TO_TIMESTAMP('2017-08-17 18:26:03','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=542726
;
-- 2017-08-17T18:26:16.739
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Column SET IsKey='Y', IsUpdateable='N',Updated=TO_TIMESTAMP('2017-08-17 18:26:16','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=542719
;
-- 2017-08-17T18:26:33.395
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Column SET IsKey='N',Updated=TO_TIMESTAMP('2017-08-17 18:26:33','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=542719
;
-- 2017-08-17T18:26:44.611
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Column SET IsAlwaysUpdateable='N', IsKey='Y', IsUpdateable='N',Updated=TO_TIMESTAMP('2017-08-17 18:26:44','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=542727
;
-- 2017-08-17T18:27:22.361
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Column SET IsKey='N',Updated=TO_TIMESTAMP('2017-08-17 18:27:22','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=542727
;
-- 2017-08-17T18:32:28.285
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Tab SET IsReadOnly='N',Updated=TO_TIMESTAMP('2017-08-17 18:32:28','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=540474
;
-- 2017-08-17T18:32:57.470
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Tab SET IsReadOnly='Y',Updated=TO_TIMESTAMP('2017-08-17 18:32:57','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=540474
;
-- 2017-08-17T18:34:30.108
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Column SET IsKey='Y', IsUpdateable='N',Updated=TO_TIMESTAMP('2017-08-17 18:34:30','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=542727
;
-- 2017-08-17T18:43:47.328
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_Element (AD_Client_ID,AD_Element_ID,AD_Org_ID,ColumnName,Created,CreatedBy,EntityType,IsActive,Name,PrintName,Updated,UpdatedBy) VALUES (0,543397,0,'x_bpartner_history_id',TO_TIMESTAMP('2017-08-17 18:43:47','YYYY-MM-DD HH24:MI:SS'),100,'de.metas.fresh','Y','x_bpartner_history_id','x_bpartner_history_id',TO_TIMESTAMP('2017-08-17 18:43:47','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 2017-08-17T18:43:47.337
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_Element_Trl (AD_Language,AD_Element_ID, Description,Help,Name,PO_Description,PO_Help,PO_Name,PO_PrintName,PrintName, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Element_ID, t.Description,t.Help,t.Name,t.PO_Description,t.PO_Help,t.PO_Name,t.PO_PrintName,t.PrintName, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Element t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Element_ID=543397 AND NOT EXISTS (SELECT 1 FROM AD_Element_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Element_ID=t.AD_Element_ID)
;
-- 2017-08-17T18:45:01.320
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_Column (AD_Client_ID,AD_Column_ID,AD_Element_ID,AD_Org_ID,AD_Reference_ID,AD_Table_ID,AllowZoomTo,ColumnName,Created,CreatedBy,DDL_NoForeignKey,EntityType,FieldLength,IsActive,IsAdvancedText,IsAllowLogging,IsAlwaysUpdateable,IsAutocomplete,IsCalculated,IsDimension,IsDLMPartitionBoundary,IsEncrypted,IsGenericZoomKeyColumn,IsGenericZoomOrigin,IsIdentifier,IsKey,IsLazyLoading,IsMandatory,IsParent,IsSelectionColumn,IsStaleable,IsSyncDatabase,IsTranslated,IsUpdateable,IsUseDocSequence,Name,SeqNo,Updated,UpdatedBy,Version) VALUES (0,557049,543397,0,13,540148,'N','x_bpartner_history_id',TO_TIMESTAMP('2017-08-17 18:44:56','YYYY-MM-DD HH24:MI:SS'),100,'N','U',10,'Y','N','Y','N','N','N','N','N','N','N','N','N','Y','N','N','N','N','N','N','N','N','N','x_bpartner_history_id',0,TO_TIMESTAMP('2017-08-17 18:44:56','YYYY-MM-DD HH24:MI:SS'),100,0)
;
-- 2017-08-17T18:45:01.321
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=557049 AND NOT EXISTS (SELECT 1 FROM AD_Column_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Column_ID=t.AD_Column_ID)
;
-- 2017-08-17T18:45:48.177
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_Field (AD_Client_ID,AD_Column_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,ColumnDisplayLength,Created,CreatedBy,DisplayLength,EntityType,IncludedTabHeight,IsActive,IsCentrallyMaintained,IsDisplayed,IsDisplayedGrid,IsEncrypted,IsFieldOnly,IsHeading,IsReadOnly,IsSameLine,Name,SeqNo,SeqNoGrid,SortNo,SpanX,SpanY,Updated,UpdatedBy) VALUES (0,557049,559468,0,540852,0,TO_TIMESTAMP('2017-08-17 18:45:48','YYYY-MM-DD HH24:MI:SS'),100,0,'U',0,'Y','Y','Y','Y','N','N','N','N','N','x_bpartner_history_id',90,90,0,1,1,TO_TIMESTAMP('2017-08-17 18:45:48','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 2017-08-17T18:45:48.178
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_Field_Trl (AD_Language,AD_Field_ID, Description,Help,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Field_ID, t.Description,t.Help,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Field t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Field_ID=559468 AND NOT EXISTS (SELECT 1 FROM AD_Field_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Field_ID=t.AD_Field_ID)
;
-- 2017-08-17T18:46:11.403
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Column SET IsUpdateable='N', Name='x_bpartner_history_ID',Updated=TO_TIMESTAMP('2017-08-17 18:46:11','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=557049
;
-- 2017-08-17T18:46:11.404
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Field SET Name='x_bpartner_history_ID', Description=NULL, Help=NULL WHERE AD_Column_ID=557049 AND IsCentrallyMaintained='Y'
;
-- 2017-08-17T18:46:57.403
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Column SET IsActive='N', IsUpdateable='N',Updated=TO_TIMESTAMP('2017-08-17 18:46:57','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=557049
;
-- 2017-08-17T18:47:18.729
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Column SET IsKey='N',Updated=TO_TIMESTAMP('2017-08-17 18:47:18','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=542727
;
-- 2017-08-17T18:47:22.516
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Column SET IsActive='Y', IsKey='N',Updated=TO_TIMESTAMP('2017-08-17 18:47:22','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=557049
;
-- 2017-08-17T18:47:39.520
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Column SET IsKey='Y', IsUpdateable='N',Updated=TO_TIMESTAMP('2017-08-17 18:47:39','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=557049
;
-- 2017-08-17T18:52:13.999
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Field SET Name='Zoom',Updated=TO_TIMESTAMP('2017-08-17 18:52:13','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=559457
;
-- 2017-08-17T18:56:46.234
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Tab_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2017-08-17 18:56:46','YYYY-MM-DD HH24:MI:SS'),IsTranslated='Y',Name='History' WHERE AD_Tab_ID=540852 AND AD_Language='en_US'
; | the_stack |
--
-- XC_TRIGGER
--
set max_query_retry_times = 3;
-- Creation of a trigger-based method to improve run of count queries
-- by incrementation and decrementation of statement-based and row-based counters
-- Create tables
CREATE TABLE xc_trigger_rep_tab (a int, b int) DISTRIBUTE BY REPLICATION;
ALTER TABLE xc_trigger_rep_tab ADD PRIMARY KEY(A, B);
CREATE TABLE xc_trigger_hash_tab (a int, b int) DISTRIBUTE BY HASH(a);
CREATE TABLE xc_trigger_rr_tab (a int, b int) DISTRIBUTE BY ROUNDROBIN;
CREATE TABLE xc_trigger_modulo_tab (a int, b int) DISTRIBUTE BY MODULO(a);
CREATE TABLE table_stats (table_name text primary key,
num_insert_query int DEFAULT 0,
num_update_query int DEFAULT 0,
num_delete_query int DEFAULT 0,
num_truncate_query int DEFAULT 0,
num_insert_row int DEFAULT 0,
num_update_row int DEFAULT 0,
num_delete_row int DEFAULT 0);
-- Insert default entries
INSERT INTO table_stats (table_name) VALUES ('xc_trigger_rep_tab');
INSERT INTO table_stats (table_name) VALUES ('xc_trigger_hash_tab');
INSERT INTO table_stats (table_name) VALUES ('xc_trigger_rr_tab');
INSERT INTO table_stats (table_name) VALUES ('xc_trigger_modulo_tab');
-- Functions to manage stats of table
-- Count the number of queries run
CREATE FUNCTION count_insert_query() RETURNS TRIGGER AS $_$
BEGIN
UPDATE table_stats SET num_insert_query = num_insert_query + 1 WHERE table_name = TG_TABLE_NAME;
RETURN NEW;
END $_$ LANGUAGE 'plpgsql';
CREATE FUNCTION count_update_query() RETURNS TRIGGER AS $_$
BEGIN
UPDATE table_stats SET num_update_query = num_update_query + 1 WHERE table_name = TG_TABLE_NAME;
RETURN OLD;
END $_$ LANGUAGE 'plpgsql';
CREATE FUNCTION count_delete_query() RETURNS TRIGGER AS $_$
BEGIN
UPDATE table_stats SET num_delete_query = num_delete_query + 1 WHERE table_name = TG_TABLE_NAME;
RETURN OLD;
END $_$ LANGUAGE 'plpgsql';
CREATE FUNCTION count_truncate_query() RETURNS TRIGGER AS $_$
BEGIN
UPDATE table_stats SET num_truncate_query = num_truncate_query + 1 WHERE table_name = TG_TABLE_NAME;
RETURN OLD;
END $_$ LANGUAGE 'plpgsql';
-- Count the number of rows used
CREATE FUNCTION count_insert_row() RETURNS TRIGGER AS $_$
BEGIN
UPDATE table_stats SET num_insert_row = num_insert_row + 1 WHERE table_name = TG_TABLE_NAME;
RETURN NEW;
END $_$ LANGUAGE 'plpgsql';
CREATE FUNCTION count_update_row() RETURNS TRIGGER AS $_$
BEGIN
UPDATE table_stats SET num_update_row = num_update_row + 1 WHERE table_name = TG_TABLE_NAME;
RETURN OLD;
END $_$ LANGUAGE 'plpgsql';
CREATE FUNCTION count_delete_row() RETURNS TRIGGER AS $_$
BEGIN
UPDATE table_stats SET num_delete_row = num_delete_row + 1 WHERE table_name = TG_TABLE_NAME;
RETURN OLD;
END $_$ LANGUAGE 'plpgsql';
-- Define the events for each table
-- Replicated table
CREATE TRIGGER rep_count_insert_query AFTER INSERT ON xc_trigger_rep_tab
FOR EACH STATEMENT EXECUTE PROCEDURE count_insert_query();
CREATE TRIGGER rep_count_update_query BEFORE UPDATE ON xc_trigger_rep_tab
FOR EACH STATEMENT EXECUTE PROCEDURE count_update_query();
CREATE TRIGGER rep_count_delete_query BEFORE DELETE ON xc_trigger_rep_tab
FOR EACH STATEMENT EXECUTE PROCEDURE count_delete_query();
CREATE TRIGGER rep_count_truncate_query BEFORE TRUNCATE ON xc_trigger_rep_tab
FOR EACH STATEMENT EXECUTE PROCEDURE count_truncate_query();
CREATE TRIGGER rep_count_insert_row BEFORE INSERT ON xc_trigger_rep_tab
FOR EACH ROW EXECUTE PROCEDURE count_insert_row();
CREATE TRIGGER rep_count_update_row BEFORE UPDATE ON xc_trigger_rep_tab
FOR EACH ROW EXECUTE PROCEDURE count_update_row();
CREATE TRIGGER rep_count_delete_row BEFORE DELETE ON xc_trigger_rep_tab
FOR EACH ROW EXECUTE PROCEDURE count_delete_row();
-- Renaming of trigger based on a table
ALTER TRIGGER repcount_update_row ON my_table RENAME TO repcount_update_row2;
-- Hash table
CREATE TRIGGER hash_count_insert_query AFTER INSERT ON xc_trigger_hash_tab
FOR EACH STATEMENT EXECUTE PROCEDURE count_insert_query();
CREATE TRIGGER hash_count_update_query BEFORE UPDATE ON xc_trigger_hash_tab
FOR EACH STATEMENT EXECUTE PROCEDURE count_update_query();
CREATE TRIGGER hash_count_delete_query BEFORE DELETE ON xc_trigger_hash_tab
FOR EACH STATEMENT EXECUTE PROCEDURE count_delete_query();
CREATE TRIGGER hash_count_truncate_query BEFORE TRUNCATE ON xc_trigger_hash_tab
FOR EACH STATEMENT EXECUTE PROCEDURE count_truncate_query();
CREATE TRIGGER hash_count_insert_row BEFORE INSERT ON xc_trigger_hash_tab
FOR EACH ROW EXECUTE PROCEDURE count_insert_row();
CREATE TRIGGER hash_count_update_row BEFORE UPDATE ON xc_trigger_hash_tab
FOR EACH ROW EXECUTE PROCEDURE count_update_row();
CREATE TRIGGER hash_count_delete_row BEFORE DELETE ON xc_trigger_hash_tab
FOR EACH ROW EXECUTE PROCEDURE count_delete_row();
-- Round robin table
CREATE TRIGGER rr_count_insert_query AFTER INSERT ON xc_trigger_rr_tab
FOR EACH STATEMENT EXECUTE PROCEDURE count_insert_query();
CREATE TRIGGER rr_count_update_query BEFORE UPDATE ON xc_trigger_rr_tab
FOR EACH STATEMENT EXECUTE PROCEDURE count_update_query();
CREATE TRIGGER rr_count_delete_query BEFORE DELETE ON xc_trigger_rr_tab
FOR EACH STATEMENT EXECUTE PROCEDURE count_delete_query();
CREATE TRIGGER rr_count_truncate_query BEFORE TRUNCATE ON xc_trigger_rr_tab
FOR EACH STATEMENT EXECUTE PROCEDURE count_truncate_query();
CREATE TRIGGER rr_count_insert_row BEFORE INSERT ON xc_trigger_rr_tab
FOR EACH ROW EXECUTE PROCEDURE count_insert_row();
CREATE TRIGGER rr_count_update_row BEFORE UPDATE ON xc_trigger_rr_tab
FOR EACH ROW EXECUTE PROCEDURE count_update_row();
CREATE TRIGGER rr_count_delete_row BEFORE DELETE ON xc_trigger_rr_tab
FOR EACH ROW EXECUTE PROCEDURE count_delete_row();
-- Modulo table
CREATE TRIGGER modulo_count_insert_query AFTER INSERT ON xc_trigger_modulo_tab
FOR EACH STATEMENT EXECUTE PROCEDURE count_insert_query();
CREATE TRIGGER modulo_count_update_query BEFORE UPDATE ON xc_trigger_modulo_tab
FOR EACH STATEMENT EXECUTE PROCEDURE count_update_query();
CREATE TRIGGER modulo_count_delete_query BEFORE DELETE ON xc_trigger_modulo_tab
FOR EACH STATEMENT EXECUTE PROCEDURE count_delete_query();
CREATE TRIGGER modulo_count_truncate_query BEFORE TRUNCATE ON xc_trigger_modulo_tab
FOR EACH STATEMENT EXECUTE PROCEDURE count_truncate_query();
CREATE TRIGGER modulo_count_insert_row BEFORE INSERT ON xc_trigger_modulo_tab
FOR EACH ROW EXECUTE PROCEDURE count_insert_row();
CREATE TRIGGER modulo_count_update_row BEFORE UPDATE ON xc_trigger_modulo_tab
FOR EACH ROW EXECUTE PROCEDURE count_update_row();
CREATE TRIGGER modulo_count_delete_row BEFORE DELETE ON xc_trigger_modulo_tab
FOR EACH ROW EXECUTE PROCEDURE count_delete_row();
-- Insert some values to test the INSERT triggers
INSERT INTO xc_trigger_rep_tab VALUES (1,2);
INSERT INTO xc_trigger_rep_tab VALUES (3,4);
INSERT INTO xc_trigger_rep_tab VALUES (5,6),(7,8),(9,10);
INSERT INTO xc_trigger_hash_tab VALUES (1,2);
INSERT INTO xc_trigger_hash_tab VALUES (3,4);
INSERT INTO xc_trigger_hash_tab VALUES (5,6),(7,8),(9,10);
INSERT INTO xc_trigger_rr_tab VALUES (1,2);
INSERT INTO xc_trigger_rr_tab VALUES (3,4);
INSERT INTO xc_trigger_rr_tab VALUES (5,6),(7,8),(9,10);
INSERT INTO xc_trigger_modulo_tab VALUES (1,2);
INSERT INTO xc_trigger_modulo_tab VALUES (3,4);
INSERT INTO xc_trigger_modulo_tab VALUES (5,6),(7,8),(9,10);
SELECT * FROM table_stats ORDER BY table_name;
-- Update some values to test the UPDATE triggers
UPDATE xc_trigger_rep_tab SET b = b+1 WHERE a = 1;
UPDATE xc_trigger_rep_tab SET b = b+1 WHERE a = 3;
UPDATE xc_trigger_rep_tab SET b = b+1 WHERE a IN (5,7,9);
UPDATE xc_trigger_hash_tab SET b = b+1 WHERE a = 1;
UPDATE xc_trigger_hash_tab SET b = b+1 WHERE a = 3;
UPDATE xc_trigger_hash_tab SET b = b+1 WHERE a IN (5,7,9);
UPDATE xc_trigger_rr_tab SET b = b+1 WHERE a = 1;
UPDATE xc_trigger_rr_tab SET b = b+1 WHERE a = 3;
UPDATE xc_trigger_rr_tab SET b = b+1 WHERE a IN (5,7,9);
UPDATE xc_trigger_modulo_tab SET b = b+1 WHERE a = 1;
UPDATE xc_trigger_modulo_tab SET b = b+1 WHERE a = 3;
UPDATE xc_trigger_modulo_tab SET b = b+1 WHERE a IN (5,7,9);
SELECT * FROM table_stats ORDER BY table_name;
-- Delete some values to test the DELETE triggers
DELETE FROM xc_trigger_rep_tab WHERE a = 1;
DELETE FROM xc_trigger_rep_tab WHERE a = 3;
DELETE FROM xc_trigger_rep_tab WHERE a IN (5,7,9);
DELETE FROM xc_trigger_hash_tab WHERE a = 1;
DELETE FROM xc_trigger_hash_tab WHERE a = 3;
DELETE FROM xc_trigger_hash_tab WHERE a IN (5,7,9);
DELETE FROM xc_trigger_rr_tab WHERE a = 1;
DELETE FROM xc_trigger_rr_tab WHERE a = 3;
DELETE FROM xc_trigger_rr_tab WHERE a IN (5,7,9);
DELETE FROM xc_trigger_modulo_tab WHERE a = 1;
DELETE FROM xc_trigger_modulo_tab WHERE a = 3;
DELETE FROM xc_trigger_modulo_tab WHERE a IN (5,7,9);
SELECT * FROM table_stats ORDER BY table_name;
-- Truncate the table to test the TRUNCATE triggers
TRUNCATE xc_trigger_rep_tab;
TRUNCATE xc_trigger_hash_tab;
TRUNCATE xc_trigger_rr_tab;
TRUNCATE xc_trigger_modulo_tab;
SELECT * FROM table_stats ORDER BY table_name;
-- Clean up everything
DROP TABLE xc_trigger_rep_tab, xc_trigger_hash_tab, xc_trigger_rr_tab, xc_trigger_modulo_tab, table_stats;
DROP FUNCTION count_tuple_increment();
DROP FUNCTION count_tuple_decrement();
DROP FUNCTION count_insert_query();
DROP FUNCTION count_update_query();
DROP FUNCTION count_delete_query();
DROP FUNCTION count_truncate_query();
DROP FUNCTION count_insert_row();
DROP FUNCTION count_update_row();
DROP FUNCTION count_delete_row();
-- Tests for INSTEAD OF
-- Replace operations on a view by operations on a table
CREATE TABLE real_table (a int, b int) distribute by replication;
CREATE VIEW real_view AS SELECT a,b FROM real_table;
CREATE FUNCTION insert_real() RETURNS TRIGGER AS $_$
BEGIN
INSERT INTO real_table VALUES (NEW.a, NEW.b);
RETURN NEW;
END $_$ LANGUAGE 'plpgsql';
CREATE FUNCTION update_real() RETURNS TRIGGER AS $_$
BEGIN
UPDATE real_table SET a = NEW.a, b = NEW.b WHERE a = OLD.a AND b = OLD.b;
RETURN NEW;
END $_$ LANGUAGE 'plpgsql';
CREATE FUNCTION delete_real() RETURNS TRIGGER AS $_$
BEGIN
DELETE FROM real_table WHERE a = OLD.a AND b = OLD.b;
RETURN OLD;
END $_$ LANGUAGE 'plpgsql';
CREATE TRIGGER insert_real_trig INSTEAD OF INSERT ON real_view FOR EACH ROW EXECUTE PROCEDURE insert_real();
CREATE TRIGGER update_real_trig INSTEAD OF UPDATE ON real_view FOR EACH ROW EXECUTE PROCEDURE update_real();
CREATE TRIGGER delete_real_trig INSTEAD OF DELETE ON real_view FOR EACH ROW EXECUTE PROCEDURE delete_real();
-- Renaming of trigger based on a view
ALTER TRIGGER delete_real_trig ON real_view RENAME TO delete_real_trig2;
-- Actions
INSERT INTO real_view VALUES(1,1);
SELECT * FROM real_table;
UPDATE real_view SET b = 4 WHERE a = 1;
SELECT * FROM real_table;
DELETE FROM real_view WHERE a = 1;
SELECT * FROM real_table;
-- Clean up
DROP VIEW real_view CASCADE;
DROP FUNCTION insert_real() cascade;
DROP FUNCTION update_real() cascade;
DROP FUNCTION delete_real() cascade;
DROP TABLE real_table;
-- Test if distribution column value can be updated by a non-immutable trigger function.
CREATE TABLE xc_trig_dist(id int, id2 int, id3 int, v varchar) distribute by replication;
ALTER TABLE xc_trig_dist ADD PRIMARY KEY(id2);
insert into xc_trig_dist values (NULL, 1, 1, 'ppppppppppp'), (2, 2, 2, 'qqqqqqqqqqq'), (3, 3, 3, 'rrrrrrrrrrr');
CREATE FUNCTION xc_func_dist() RETURNS trigger AS $$
declare
BEGIN
NEW.v = regexp_replace(NEW.v , 'pp$', 'xx');
if NEW.id is NULL then
NEW.id = 999;
else
NEW.id = NULL;
end if;
return NEW;
END;
$$ LANGUAGE plpgsql;
CREATE TRIGGER xc_dist_trigger BEFORE UPDATE ON xc_trig_dist
FOR EACH ROW EXECUTE PROCEDURE xc_func_dist();
--This should pass because the table is replicated.
UPDATE xc_trig_dist set id3 = id3 * 2 where v like '%pppp%';
SELECT * from xc_trig_dist order by id2;
-- Reinitialize the rows
truncate table xc_trig_dist;
insert into xc_trig_dist values (NULL, 1, 1, 'ppppppppppp'), (2, 2, 2, 'qqqqqqqqqqq'), (3, 3, 3, 'rrrrrrrrrrr');
-- Now make the table distributed
ALTER TABLE xc_trig_dist distribute by hash(v);
--This should fail because v is a distributed col and trigger updates it.
UPDATE xc_trig_dist set id3 = id3 * 2 where v like '%pppp%';
ALTER TABLE xc_trig_dist distribute by hash(id);
--This should fail because id is a distributed col and trigger updates it.
UPDATE xc_trig_dist set id3 = id3 * 2 where v like '%pppp%';
ALTER TABLE xc_trig_dist distribute by hash(id2);
--This should pass because id2 is not updated.
UPDATE xc_trig_dist set id3 = id3 * 2 where v like '%pppp%';
UPDATE xc_trig_dist set id3 = id3 * 2 where v like '%qqq%';
SELECT * from xc_trig_dist order by id2;
ALTER TABLE xc_trig_dist distribute by hash(v);
--This should still pass because v does not get modified by the regexp_replace()
-- function in the trigger function.
UPDATE xc_trig_dist set id3 = id3 * 2 where v like '%pppp%';
SELECT * from xc_trig_dist order by id2;
DROP table xc_trig_dist cascade;
DROP function xc_func_dist() cascade;
--self add
--test insert and update trigger on merge into condition
create table merge_src_table_with_trigger(product_id integer,product_name varchar2(60),category varchar2(60));
insert into merge_src_table_with_trigger values (1501, 'vivitar 35mm', 'electrncs');
insert into merge_src_table_with_trigger values (1502, 'olympus is50', 'electrncs');
insert into merge_src_table_with_trigger values (1600, 'play gym', 'toys');
create table merge_des_table_with_trigger(product_id integer,product_name varchar2(60),category varchar2(60));
insert into merge_des_table_with_trigger values (1502, 'olympus camera', 'electrncs');
insert into merge_des_table_with_trigger values (1700, 'wait interface', 'books');
create or replace function tri_b_merge_src_table_with_trigger_insert_func() returns trigger as
$$
declare
begin
raise notice '% % % %', tg_relname, tg_op, tg_when, tg_level;
return new;
end
$$ language plpgsql;
create or replace function tri_b_merge_src_table_with_trigger_update_func() returns trigger as
$$
declare
begin
raise notice '% % % %', tg_relname, tg_op, tg_when, tg_level;
return new;
end
$$ language plpgsql;
create or replace function tri_b_merge_src_table_with_trigger_bs_update_func() returns trigger as
$$
declare
begin
raise notice '% % % %', tg_relname, tg_op, tg_when, tg_level;
return new;
end
$$ language plpgsql;
create or replace function tri_b_merge_src_table_with_trigger_as_update_func() returns trigger as
$$
declare
begin
raise notice '% % % %', tg_relname, tg_op, tg_when, tg_level;
return new;
end
$$ language plpgsql;
create or replace function tri_b_merge_src_table_with_trigger_bs_delete_func() returns trigger as
$$
declare
begin
raise notice '% % % %', tg_relname, tg_op, tg_when, tg_level;
return new;
end
$$ language plpgsql;
create or replace function tri_b_merge_src_table_with_trigger_as_delete_func() returns trigger as
$$
declare
begin
raise notice '% % % %', tg_relname, tg_op, tg_when, tg_level;
return new;
end
$$ language plpgsql;
create trigger tri_b_merge_src_table_with_trigger_insert
before insert on merge_src_table_with_trigger
for each row
execute procedure tri_b_merge_src_table_with_trigger_insert_func();
create trigger tri_b_merge_src_table_with_trigger_update
after update on merge_src_table_with_trigger
for each row
execute procedure tri_b_merge_src_table_with_trigger_update_func();
create trigger tri_b_merge_src_table_with_trigger_bs_update
before update on merge_src_table_with_trigger
for each statement
execute procedure tri_b_merge_src_table_with_trigger_bs_update_func();
create trigger tri_b_merge_src_table_with_trigger_as_update
before update on merge_src_table_with_trigger
for each statement
execute procedure tri_b_merge_src_table_with_trigger_as_update_func();
create trigger tri_b_merge_src_table_with_trigger_bs_delete
before update on merge_src_table_with_trigger
for each statement
execute procedure tri_b_merge_src_table_with_trigger_bs_delete_func();
create trigger tri_b_merge_src_table_with_trigger_as_delete
before update on merge_src_table_with_trigger
for each statement
execute procedure tri_b_merge_src_table_with_trigger_as_delete_func();
\d+ merge_src_table_with_trigger
merge into merge_src_table_with_trigger p
using merge_des_table_with_trigger np
on (p.product_id = np.product_id)
when matched then
update set p.product_name = np.product_name, p.category = np.category where p.product_name !=
'play gym'
when not matched then
insert values (np.product_id, np.product_name, np.category) where np.category = 'books';
select * from merge_des_table_with_trigger order by product_id;
select * from merge_src_table_with_trigger order by product_id;
drop table if exists merge_src_table_with_trigger;
drop table if exists merge_des_table_with_trigger;
drop function tri_b_merge_src_table_with_trigger_insert_func;
drop function tri_b_merge_src_table_with_trigger_update_func;
drop function tri_b_merge_src_table_with_trigger_bs_update_func;
drop function tri_b_merge_src_table_with_trigger_as_update_func;
drop function tri_b_merge_src_table_with_trigger_bs_delete_func;
drop function tri_b_merge_src_table_with_trigger_as_delete_func;
--test create trigger on difference type table
create table nor_column_table_with_trigger(c1 int,c2 int,c3 int) with(orientation=column);
create temp table temp_column_table_with_trigger(c1 int,c2 int,c3 int) with(orientation=column);
create temp table temp_row_table_with_trigger(c1 int,c2 int,c3 int unique deferrable);
create unlogged table unlogged_row_table_with_trigger(c1 int,c2 int,c3 int);
create unlogged table unlogged_column_table_with_trigger(c1 int,c2 int,c3 int) with(orientation=column);
create or replace function temp_trigger_func_for_test() returns trigger as $temp_trigger_func_for_test$
begin
raise notice '% % % %', tg_relname, tg_op, tg_when, tg_level;
return new ; --important!!! : if return null ,the update operator will not active
end;
$temp_trigger_func_for_test$ language plpgsql;
create trigger temp_trigger before update on nor_column_table_with_trigger
for each row execute procedure temp_trigger_func_for_test();
create trigger temp_trigger before update on temp_column_table_with_trigger
for each row execute procedure temp_trigger_func_for_test();
create trigger temp_trigger before update on temp_row_table_with_trigger
for each row execute procedure temp_trigger_func_for_test();
create trigger temp_trigger before update on unlogged_row_table_with_trigger
for each row execute procedure temp_trigger_func_for_test();
create trigger temp_trigger before update on unlogged_column_table_with_trigger
for each row execute procedure temp_trigger_func_for_test();
drop table if exists nor_column_table_with_trigger;
drop table if exists temp_column_table_with_trigger;
drop table if exists temp_row_table_with_trigger;
drop table if exists unlogged_row_table_with_trigger;
drop table if exists unlogged_column_table_with_trigger;
drop function temp_trigger_func_for_test;
--test trigger on repliaction table
create table replication_table_with_trigger(col char(100) primary key) distribute by replication;
insert into replication_table_with_trigger values('tom');
create or replace function replication_table_with_trigger_func() returns trigger as $$
begin
raise info 'trigger of replication_table_with_trigger is triggering';
return null;
end;
$$ language plpgsql;
create trigger temp_trigger after update on replication_table_with_trigger
for each row execute procedure replication_table_with_trigger_func();
\set verbosity verbose
update replication_table_with_trigger set col='amy';
select * from replication_table_with_trigger;
drop table replication_table_with_trigger;
--test multi node group
create node group test_trigger_min_group with(datanode1);
create or replace function multi_group_trigger_function1() returns trigger as
$$
begin
insert into multi_group_des_tbl values(new.id1, new.id2);
return null;
end
$$ language plpgsql;
create or replace function multi_group_trigger_function2() returns trigger as
$$
begin
update multi_group_des_tbl set id2 = new.id2 where id1 = 100;
return new;
end
$$ language plpgsql;
create or replace function multi_group_trigger_function3() returns trigger as
$$
begin
delete multi_group_des_tbl where id1 = old.id1;
return old;
end
$$ language plpgsql;
create table multi_group_src_tbl(id1 int, id2 int) to group test_trigger_min_group;
create table multi_group_des_tbl(id1 int, id2 int);
create trigger mg_insert_trigger after insert on multi_group_src_tbl for each row execute procedure multi_group_trigger_function1();
create trigger mg_update_trigger before update on multi_group_src_tbl for each row execute procedure multi_group_trigger_function2();
create trigger mg_delete_trigger before delete on multi_group_src_tbl for each row execute procedure multi_group_trigger_function3();
insert into multi_group_src_tbl values(100,200);
insert into multi_group_src_tbl values(200,400);
update multi_group_src_tbl set id2 = 800 where id1 = 100;
delete from multi_group_src_tbl where id1 = 200;
select * from multi_group_des_tbl;
select * from multi_group_src_tbl;
drop table multi_group_des_tbl;
drop table multi_group_src_tbl;
--exchange the node group of src and des table
create table multi_group_src_tbl(id1 int, id2 int);
create table multi_group_des_tbl(id1 int, id2 int) to group test_trigger_min_group;
create trigger mg_insert_trigger after insert on multi_group_src_tbl for each row execute procedure multi_group_trigger_function1();
create trigger mg_update_trigger before update on multi_group_src_tbl for each row execute procedure multi_group_trigger_function2();
create trigger mg_delete_trigger before delete on multi_group_src_tbl for each row execute procedure multi_group_trigger_function3();
insert into multi_group_src_tbl values(100,200);
insert into multi_group_src_tbl values(200,400);
update multi_group_src_tbl set id2 = 800 where id1 = 100;
delete from multi_group_src_tbl where id1 = 200;
select * from multi_group_des_tbl;
select * from multi_group_src_tbl;
drop table multi_group_des_tbl;
drop table multi_group_src_tbl;
drop node group test_trigger_min_group;
--test \h command
\h create trigger
\h alter trigger
\h drop trigger
\h alter table
create table trigger_with_rowtype_inexpr1(a int,b numeric);
create table trigger_with_rowtype_inexpr2(a int,b numeric);
create table trigger_with_rowtype_inexpr3(a int,b numeric);
insert into trigger_with_rowtype_inexpr1 values(generate_series(1,50),generate_series(1,50));
insert into trigger_with_rowtype_inexpr2 values(generate_series(1,50),generate_series(11,60));
insert into trigger_with_rowtype_inexpr3 values(generate_series(1,50),generate_series(38,-60,-2));
create or replace function tg_upt_1() returns trigger as '
declare
cursor c1 is select a from trigger_with_rowtype_inexpr1 order by 1 limit 10;
cursor c2 is select a from trigger_with_rowtype_inexpr2 order by 1 desc;
rec trigger_with_rowtype_inexpr1%ROWTYPE;
begin
begin
open c1;
loop
fetch c1 into rec;
update trigger_with_rowtype_inexpr1 set b=b-30 where a = rec.a;
update trigger_with_rowtype_inexpr2 set b=b+30 where a = rec.a;
exit when c1%NOTFOUND;
end loop;
close c1;
select 1/0;
exception
when others then
raise notice ''1-ERROR OCCURS'';
end;
update trigger_with_rowtype_inexpr2 set b=b-40;
update trigger_with_rowtype_inexpr3 set b=b+40;
begin
open c2;
loop
fetch c2 into rec;
update trigger_with_rowtype_inexpr1 set b=b-5 where a=rec.a;
update trigger_with_rowtype_inexpr2 set b=b-10 where a=rec.a;
update trigger_with_rowtype_inexpr3 set b=b+15 where a=rec.a;
exit when c2%NOTFOUND;
end loop;
open c2;
exception
when others then
raise notice ''2-ERROR OCCURS.'';
end;
begin
open c2;
loop
fetch c2 into rec;
update trigger_with_rowtype_inexpr1 set b=b-5 where a=rec.a;
update trigger_with_rowtype_inexpr2 set b=b-10 where a=rec.a;
update trigger_with_rowtype_inexpr3 set b=b+15 where a=rec.a;
exit when c2%NOTFOUND;
end loop;
close c2;
exception
when others then
raise notice ''3-ERROR OCCURS.'';
end;
begin
open c2;
loop
fetch c2 into rec;
update trigger_with_rowtype_inexpr1 set b=b+8 where a=rec.a;
update trigger_with_rowtype_inexpr2 set b=b+12 where a=rec.a;
update trigger_with_rowtype_inexpr3 set b=b-20 where a=rec.a;
exit when c2%NOTFOUND;
end loop;
close c2;
exception
when others then
raise notice ''4-ERROR OCCURS.'';
end;
end;
' language plpgsql;
create trigger tg_upt after insert or delete on trigger_with_rowtype_inexpr1 for each row execute procedure tg_upt_1();
insert into trigger_with_rowtype_inexpr1 values(99,50);
drop table trigger_with_rowtype_inexpr1;
drop table trigger_with_rowtype_inexpr2;
drop table trigger_with_rowtype_inexpr3; | the_stack |
---------------------------
-- prepare data
---------------------------
create schema upserttest;
set current_schema to upserttest;
create table data1(a int);
create table data2(a int, b int);
create table aa (a1 int primary key, a2 int, a3 int not NULL, a4 int unique);
create table ff (f1 int primary key, f2 int references aa, f3 int);
create table gg (g1 int primary key, g2 int, g3 int);
create table hh (h1 int primary key, h2 int, h3 int);
insert into data1 values(1),(2),(3),(4),(1),(2),(3),(4),(5);
insert into data2 values(1,2),(2,3),(3,4),(4,5),(1,1),(2,2),(3,3),(4,4),(5,5),(6,6);
insert into aa values (1,1,1,1),(2,2,2,2),(3,3,3,3),(4,4,4,4);
insert into ff values (1,1),(2,2),(3,3),(4,4);
insert into gg values (1,1,1),(2,2,2),(3,3,3),(4,4,4),(5,5,5);
insert into hh select generate_series(1,100000), generate_series(2,100001), generate_series(3,100002);
insert into hh select h1 + 100000, h2, h3 from hh;
analyze data1;
analyze data2;
analyze aa;
analyze ff;
analyze gg;
analyze hh;
---------------------------
-- basic test
---------------------------
insert into aa values(1,1,1,1) on duplicate key update a2 = (select a from data1 where a > 2 limit 1); -- suc
explain (costs off, verbose) insert into aa values(1,1) on duplicate key update a2 = (select a from data1 where a > 2 limit 1);
insert into aa values(2,2,2,2) on duplicate key update a2 = (select * from data1 order by a ASC limit 1) + (select * from data1 order by a DESC limit 1); -- suc
explain (costs off, verbose) insert into aa values(2,2) on duplicate key update a2 = (select * from data1 order by a ASC limit 1) + (select * from data1 order by a DESC limit 1);
insert into aa values(3,3,3,3) on duplicate key update a2 = (select * from data1); -- err, muilt row
insert into aa values(3,3,3,3) on duplicate key update a2 = (select * from data2 limit 1); -- err, muilt column
insert into aa values(3,3,3,3) on duplicate key update a2 = (select * from data2 limit 1).b; -- err, not support, reference follow
update aa set a2 = ((select * from data2 limit 1).b) where a1 = 1; -- err
insert into aa values(3,3,3,3) on duplicate key update a2 = (select * from data1 where a > 5); -- suc, 0 row means NULL
explain (costs off, verbose) insert into aa values(3,3,3,3) on duplicate key update a2 = (select * from data1 where a > 5);
insert into aa values(3,3,3,3) on duplicate key update a2 = (select * from data2 where a > 5); -- err, muilt column, even 0 row
insert into aa values(4,4,4,4) on duplicate key update a2 = (select * from data1 where a > 5) + 1; -- suc, 0 row + 1 means NULL
select * from aa order by a1;
insert into ff values(1,1,1) on duplicate key update f2 = (select a + 10 from data1 where a > 2 limit 1); -- err, invalid fk
insert into aa values(1,1,1,1) on duplicate key update a3 = (select a from data1 where a > 10 limit 1); -- err, a3 is not null
insert into aa values(1,1,1,1) on duplicate key update a4 = (select a from data1 where a = 3 limit 1); -- err, a4 is unique key
select * from ff order by f1;
select * from aa order by a1;
---------------------------
-- muilt-set
---------------------------
insert into gg values(1,1,1) on duplicate key update (g2, g3) = select * from data2 where a = 5; -- err, invalid syntax
insert into gg values(1,1,1) on duplicate key update (g2, g3) = (select * from data2 where a = 5 limit 1); -- err, there is some syntax limitations for muilt-set, limit is not allowed;
insert into gg values(1,1,1) on duplicate key update (g2, g3) = (with tmptb(c1, c2) as (select * from data2) select * from tmptb limit 1); -- err, there is some syntax limitations;
insert into gg values(2,2,2) on duplicate key update (g2, g3) = (select a, b from data2 where a = 5); -- suc
explain (costs off, verbose) insert into gg values(2,2,2) on duplicate key update (g2, g3) = (select a, b from data2 where a = 5);
insert into gg values(3,3,3) on duplicate key update (g2, g3) = (select a, a, b from data2 where a = 5); -- err, columns not match
update gg set (g2) = (select * from data2 where a = 5) where g1 = 3; -- suc, maybe, it could be a bug, we only update one column, and * means two.
insert into gg values(4,4,4) on duplicate key update (g2) = (select * from data2 where a = 5); -- suc, only g2 be updated
insert into gg values(5,5,5) on duplicate key update (g2) = (select * from data2 where a = 7); -- suc, only g2 be updated to NULL
explain (costs off, verbose) insert into gg values(5,5,5) on duplicate key update (g2) = (select * from data2 where a = 7);
select * from gg order by g1;
---------------------------
-- complex subquery
---------------------------
insert into aa values(1,1,1,1) on duplicate key update a2 = (select max(a) from data1); -- suc
insert into aa values(2,2,2,2) on duplicate key update a2 = (select max(b) from data2 group by a limit 1); -- suc
insert into aa values(3,3,3,3) on duplicate key update a2 = (select a from data2 except select a from data2) + 5; -- suc
insert into aa values(4,4,4,4) on duplicate key update a2 = (with tmptb(c1) as (select * from data1) select data2.b from data2 where data2.a not in (select c1 from tmptb)); -- suc
explain (costs off, verbose) insert into aa values(1,1,1,1) on duplicate key update a2 = (select max(a) from data1);
explain (costs off, verbose) insert into aa values(2,2,2,2) on duplicate key update a2 = (select max(b) from data2 group by a limit 1);
explain (costs off, verbose) insert into aa values(3,3,3,3) on duplicate key update a2 = (select a from data2 except select a from data1) + 5;
explain (costs off, verbose) insert into aa values(4,4,4,4) on duplicate key update a2 = (with tmptb(c1) as (select * from data1) select data2.b from data2 where data2.a not in (select c1 from tmptb));
select * from aa order by a1;
insert into aa values(1,1,1,1) on duplicate key update a2 = (1 in (1,2,3)); -- suc, true means 1
insert into aa values(2,2,2,2) on duplicate key update a2 = (5 not in (select * from data1)); -- suc, false means 0
insert into aa values(3,3,3,3) on duplicate key update a2 = (select a from data1 except select a1 from aa); -- suc, only one row
insert into aa values(4,4,4,4) on duplicate key update a2 = (select min (data2.a) from data1 left join data2 on data1.a = data2.a - 1 where data1.a in (select a1 from aa)); -- suc
explain (costs off, verbose) insert into aa values(1,1,1,1) on duplicate key update a2 = (1 not in (1,2,3));
explain (costs off, verbose) insert into aa values(2,2,2,2) on duplicate key update a2 = (5 not in (select * from data1));
explain (costs off, verbose) insert into aa values(3,3,3,3) on duplicate key update a2 = (select a from data1 except select a1 from aa);
explain (costs off, verbose) insert into aa values(4,4,4,4) on duplicate key update a2 = (select min (data2.a) from data1 left join data2 on data1.a = data2.a - 1 where data1.a in (select a1 from aa));
select * from aa order by a1;
------------------------------
-- pbe
------------------------------
prepare sub1 as select a from data1 where a = $1 limit 1;
insert into aa values(1,3,3,3) on duplicate key update a2 = (select sub(3)); -- err, invalid syntax
insert into aa values(1,3,3,3) on duplicate key update a2 = (execute sub(3)); -- err, invalid syntax
prepare sub2 as insert into aa values(1,1,1,1) on duplicate key update a2 =(select max(a) from data1);
execute sub2; -- suc
explain (costs off, verbose) execute sub2;
prepare sub3 as insert into aa values($1,0,0,0) on duplicate key update a2 =( select count(*)+ excluded.a1 from hh);
execute sub3(2); -- suc
explain (costs off, verbose) execute sub3(2);
select * from aa order by a1;
------------------------------
-- hint
------------------------------
explain select /*+tablescan(hh) */ h1 from hh where h1 = 2000; -- should be a seqscan plan
insert into aa values(1,3,3,3) on duplicate key update a2 = (select /*+tablescan(hh) */ h1 from hh where h1 = 2000); -- suc
explain (costs off, verbose) insert into aa values(1,3,3,3) on duplicate key update a2 = (select /*+tablescan(hh) */ h1 from hh where h1 = 2000);
explain (costs off, verbose) insert into aa values(1,3,3,3) on duplicate key update a2 = (select h1 from hh where h1 = 2000);
select * from aa order by a1;
------------------------------
-- bypass and smp
------------------------------
explain (costs off, verbose) select h1 from hh where h1 = 20; -- should be a bypass query
insert into aa values(2,2,2,2) on duplicate key update a2 = (select h1 from hh where h1 = 20); -- suc
explain (costs off, verbose) insert into aa values(2,3,3,3) on duplicate key update a2 = (select h1 from hh where h1 = 20); -- upsert not support bypass, so subquery is not a bypass, too.
set query_dop = 2;
explain (costs off, verbose) select count(*) from hh; -- should be a smp query
insert into aa values(3,3,3,3) on duplicate key update a2 = (select count(*) from hh); -- suc
explain (costs off, verbose) insert into aa values(3,3,3,3) on duplicate key update a2 = (select count(*) from hh); -- subquery is not execute by smp, but there still is a two-level agg.
explain (costs off, verbose) select 4,count(*), 4, 4 from hh; -- should be a smp query
insert into aa select 4,count(*), 4, 4 from hh on duplicate key update a2 = (select count(*) from hh); -- suc
explain (costs off, verbose) insert into aa select 4,count(*), 4, 4 from hh on duplicate key update a2 = (select count(*) from hh); -- insert-part is a smp plan, but update-part not
prepare sub4 as insert into aa select $1, count(*), 4, 4 from hh on duplicate key update a2 =(select count(*) + $1 from hh);
execute sub4(1); -- suc
explain (costs off, verbose) execute sub4(1); -- insert-part is a smp plan, but update-part not
set query_dop = 1;
select * from aa order by a1;
execute sub4(2); -- suc
explain (costs off, verbose) execute sub4(2); -- the plan was rebuilt, not a smp any more.
select * from aa order by a1;
------------------------------
-- subquery has excluded
------------------------------
insert into gg values(1,1) on duplicate key update g2 = (select max(a) from data1 where a > excluded.g2); -- suc
insert into gg values(2,2) on duplicate key update g2 = (select max(data2.b) from data1 left join data2 on data1.a = data2.a - excluded.g2); -- suc
insert into gg values(4,3,1) on duplicate key update (g2,g3) = (select min (data2.a), max(data2.b) - excluded.g3 from data1 left join data2 on data1.a = data2.a - excluded.g2 where data1.a in (1,2, excluded.g1)); -- suc
explain (costs off, verbose) insert into gg values(1,1) on duplicate key update g2 = (select max(a) from data1 where a > excluded.g2);
explain (costs off, verbose) insert into gg values(2,2) on duplicate key update g2 = (select max(data2.b) from data1 left join data2 on data1.a = data2.a - excluded.g2);
explain (costs off, verbose) insert into gg values(4,3,1) on duplicate key update (g2,g3) = (select min (data2.a), max(data2.b) - excluded.g3 from data1 left join data2 on data1.a = data2.a - excluded.g2 where data1.a in (1,2, excluded.g1));
select * from gg order by g1;
insert into gg select *,1 from data2 on duplicate key update (g2,g3) = (select min (data2.a), max(data2.b) - excluded.g3 from data1 left join data2 on data1.a = data2.a - excluded.g2 where data1.a in (1,2, excluded.g1)); -- suc
explain (costs off, verbose) insert into gg select *,1 from data2 on duplicate key update (g2,g3) = (select min (data2.a), max(data2.b) - excluded.g3 from data1 left join data2 on data1.a = data2.a - excluded.g2 where data1.a in (1,2, excluded.g1));
select * from gg order by g1;
insert into gg select * from data2 on duplicate key update (g2,g3) = (select min (data2.a), max(data2.b) - excluded.g3 from data1 left join data2 on data1.a = data2.a - excluded.g2 where data1.a in (1,2, excluded.g1)); -- suc
explain (costs off, verbose) insert into gg select * from data2 on duplicate key update (g2,g3) = (select min (data2.a), max(data2.b) - excluded.g3 from data1 left join data2 on data1.a = data2.a - excluded.g2 where data1.a in (1,2, excluded.g1));
select * from gg order by g1;
insert into gg values(2,2) on duplicate key update g2 = (excluded.g2 not in (select * from data1)); -- suc
explain (costs off, verbose) insert into gg values(2,2) on duplicate key update g2 = (excluded.g2 not in (select * from data1));
select * from gg order by g1;
set query_dop = 2;
prepare sub5 as insert into aa select $1, count(*), 4, 4 from hh on duplicate key update a2 =(select count(*) * excluded.a1 + $1 from hh);
execute sub5(1); -- suc
explain (costs off, verbose) execute sub5(1); -- insert-part is a smp plan, but update-part not
set query_dop = 1;
execute sub5(2); -- suc
explain (costs off, verbose) execute sub5(2); -- the plan was rebuilt, not a smp any more.
select * from aa order by a1;
------------------------------
-- column-table, partition table, mtview
------------------------------
create table bb (b1 int primary key, b2 int) with (orientation=column);
insert into bb values(1,1),(2,2),(3,3),(4,4);
insert into bb values(1,1),(2,2) on duplicate key update b2 = (select max(a) from data1 where a > excluded.g2);
create table dd (d1 int primary key, d2 int, d3 int) partition by range(d1) (partition dd1 values less than (10), partition dd2 values less than (20),partition dd3 values less than (maxvalue));
insert into dd values (1,1),(2,2),(3,3),(4,4),(11,11),(12,12),(13,13),(14,14),(21,21),(22,22),(33,33),(44,44);
insert into dd values(1,1) on duplicate key update d2 = (select max(a) from data1 where a > excluded.g2);
explain (costs off, verbose) insert into gg values(1,1) on duplicate key update g2 = (select max(a) from data1 where a > excluded.g2);
insert into dd values(2,2) on duplicate key update d3 = (select max(data2.b) from data1 left join data2 on data1.a = data2.a - excluded.g2);
explain (costs off, verbose) insert into gg values(2,2) on duplicate key update g2 = (select max(data2.b) from data1 left join data2 on data1.a = data2.a - excluded.g2);
insert into dd values(3,3) on duplicate key update d3 = (select max(data2.b) from data1 left join data2 on data1.a = data2.a - excluded.g2 where data1.a in (1,2, excluded.g1));
explain (costs off, verbose) insert into gg values(3,3) on duplicate key update g2 = (select max(data2.b) from data1 left join data2 on data1.a = data2.a - excluded.g2 where data1.a in (1,2, excluded.g1));
select * from dd;
------------------------------
-- transaction
------------------------------
begin;
insert into gg values(1,1) on duplicate key update g2 = (select max(a) + 1 from data1 where a > excluded.g2);
rollback;
select * from gg order by g1;
------------------------------
-- priviliege
------------------------------
CREATE USER upsert_subquery_tester PASSWORD '123456@cc';
SET SESSION SESSION AUTHORIZATION upsert_subquery_tester PASSWORD '123456@cc';
select * from data1; -- must have no permission
create table gg (g1 int primary key, g2 int, g3 int);
insert into gg values (1,1),(2,2),(3,3),(4,4);
insert into gg values(1,1) on duplicate key update g2 = (select max(a) from data1 where a > excluded.g2); -- err
insert into gg values(1,1) on duplicate key update g2 = (select 1 from data1 limit 1); -- err
------------------------------
-- clean up
------------------------------
\c
drop user upsert_subquery_tester cascade;
drop schema upserttest cascade; | the_stack |
-- phpMyAdmin SQL Dump
-- version 4.2.11
-- http://www.phpmyadmin.net
--
-- Host: localhost:3306
-- Generation Time: Mag 11, 2018 alle 15:21
-- Versione del server: 5.6.21-log
-- PHP Version: 5.4.24
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
--
-- DB name: `mrp`
--
-- --------------------------------------------------------
--
-- Struttura della tabella `access_level`
--
CREATE TABLE IF NOT EXISTS `access_level` (
`id_access_level` int(11) NOT NULL,
`name` varchar(45) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Access levels';
--
-- Dump dei dati per la tabella `access_level`
--
INSERT INTO `access_level` (`id_access_level`, `name`) VALUES
(50, 'user'),
(60, 'manager'),
(100, 'admin');
-- --------------------------------------------------------
--
-- Struttura della tabella `bom`
--
CREATE TABLE IF NOT EXISTS `bom` (
`parent_part_code` varchar(40) NOT NULL,
`child_part_code` varchar(40) NOT NULL,
`quantity` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Bills of matirials';
-- --------------------------------------------------------
--
-- Struttura della tabella `customer`
--
CREATE TABLE IF NOT EXISTS `customer` (
`customer_id` int(11) NOT NULL,
`customer_name` varchar(45) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- Struttura della tabella `customer_order`
--
CREATE TABLE IF NOT EXISTS `customer_order` (
`order_id` int(11) NOT NULL,
`order_date` date DEFAULT NULL,
`customer_id` int(11) NOT NULL,
`order_status_id` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- Struttura della tabella `file_type`
--
CREATE TABLE IF NOT EXISTS `file_type` (
`file_type_id` int(11) NOT NULL,
`name` varchar(45) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- Struttura della tabella `good_movement`
--
CREATE TABLE IF NOT EXISTS `good_movement` (
`good_movement_id` int(11) NOT NULL,
`movement_date` varchar(45) DEFAULT NULL,
`part_code` varchar(40) NOT NULL,
`store_code` int(11) NOT NULL,
`quantity` decimal(11,2) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- Struttura della tabella `measurement_unit`
--
CREATE TABLE IF NOT EXISTS `measurement_unit` (
`measurement_unit_code` varchar(10) NOT NULL,
`name` varchar(45) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Unit of measurament';
--
-- Dump dei dati per la tabella `measurement_unit`
--
INSERT INTO `measurement_unit` (`measurement_unit_code`, `name`) VALUES
('kg', 'kg'),
('pz', 'pieces');
-- --------------------------------------------------------
--
-- Struttura della tabella `order_file`
--
CREATE TABLE IF NOT EXISTS `order_file` (
`order_file_id` int(11) NOT NULL,
`name` varchar(45) DEFAULT NULL,
`path` varchar(45) DEFAULT NULL,
`order_id` int(11) NOT NULL,
`file_type_id` int(11) NOT NULL,
`revision_n` varchar(10) DEFAULT NULL,
`revision_date` date DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- Struttura della tabella `order_macro_activity`
--
CREATE TABLE IF NOT EXISTS `order_macro_activity` (
`activity_id` int(11) NOT NULL,
`order_id` int(11) NOT NULL,
`activity_name` varchar(200) DEFAULT NULL,
`cost` decimal(11,2) DEFAULT NULL,
`start_time` date DEFAULT NULL,
`end_time` date DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- Struttura della tabella `order_status`
--
CREATE TABLE IF NOT EXISTS `order_status` (
`order_status_id` int(11) NOT NULL,
`name` varchar(45) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- Struttura della tabella `part`
--
CREATE TABLE IF NOT EXISTS `part` (
`part_code` varchar(40) NOT NULL,
`description` varchar(45) DEFAULT NULL,
`source` enum('MAKE','BUY') DEFAULT NULL COMMENT 'Make or Buy',
`source_lead_time` int(11) DEFAULT NULL,
`measurement_unit_code` varchar(10) NOT NULL,
`part_type_code` varchar(20) NOT NULL COMMENT 'Product, Assembly, Component,Raw',
`part_category_code` varchar(20) NOT NULL COMMENT 'Market class',
`wastage` float DEFAULT NULL COMMENT 'Waste ratio',
`bom_levels` int(11) DEFAULT NULL COMMENT 'Hierarchy depth of its BOM'
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Inventory parts';
--
-- Dump dei dati per la tabella `part`
--
INSERT INTO `part` (`part_code`, `description`, `source`, `source_lead_time`, `measurement_unit_code`, `part_type_code`, `part_category_code`, `wastage`, `bom_levels`) VALUES
('01', 'Descrizione 2', 'MAKE', 10000, 'kg', 'PRODUCT', '01', 1, 10),
('02', 'Demodulator', 'MAKE', 2, 'kg', 'PRODUCT', '01', 1, 1),
('03', 'Converter', 'BUY', 5, 'pz', 'PRODUCT', '01', 10, 1),
('04', 'Jack', 'BUY', 10, 'pz', 'PRODUCT', '02', 1, 2),
('05', 'Mouse Wheel4', 'MAKE', 5, 'kg', 'ASSEMBLY', '01', 10, NULL),
('06', 'Board rz-048', 'BUY', 10, 'pz', 'PRODUCT', '01', 1, 0),
('07', 'Led mm 02 red', 'MAKE', 5, 'pz', 'PRODUCT', '01', 2, NULL),
('08', 'Led mm 02 green', 'BUY', 10, 'pz', 'PRODUCT', '01', 1, 0),
('09', 'RS232', 'BUY', 5, 'pz', 'PRODUCT', '01', 10, 0),
('10', 'RJ45', 'BUY', 10, 'pz', 'PRODUCT', '01', 1, 0),
('11', 'Cable', 'BUY', 5, 'pz', 'PRODUCT', '02', 10, 0);
-- --------------------------------------------------------
--
-- Struttura della tabella `part_category`
--
CREATE TABLE IF NOT EXISTS `part_category` (
`part_category_code` varchar(20) NOT NULL,
`name` varchar(45) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Product categories, market classes';
--
-- Dump dei dati per la tabella `part_category`
--
INSERT INTO `part_category` (`part_category_code`, `name`) VALUES
('01', 'electronic'),
('02', 'electric');
-- --------------------------------------------------------
--
-- Struttura della tabella `part_type`
--
CREATE TABLE IF NOT EXISTS `part_type` (
`part_type_code` varchar(20) NOT NULL,
`name` varchar(45) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Levels classification for parts, e.g. assembly, raw material etc';
--
-- Dump dei dati per la tabella `part_type`
--
INSERT INTO `part_type` (`part_type_code`, `name`) VALUES
('ASSEMBLY', 'ASSEMBLED PART '),
('PRODUCT', 'PRODUCT'),
('RAW', 'RAW MATERIAL'),
('SUB-ASSEMBLY', 'SUB-ASSEMBLY');
-- --------------------------------------------------------
--
-- Struttura della tabella `stock`
--
CREATE TABLE IF NOT EXISTS `stock` (
`store_code` int(11) NOT NULL,
`part_code` varchar(40) NOT NULL,
`quantity` decimal(11,2) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- Struttura stand-in per le viste `stock_store`
--
CREATE TABLE IF NOT EXISTS `stock_store` (
`part_code` varchar(40)
,`store_code` int(11)
,`quantity` decimal(11,2)
,`name` varchar(45)
);
-- --------------------------------------------------------
--
-- Struttura della tabella `store`
--
CREATE TABLE IF NOT EXISTS `store` (
`store_code` int(11) NOT NULL,
`name` varchar(45) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- Struttura della tabella `user`
--
CREATE TABLE IF NOT EXISTS `user` (
`id_user` int(11) NOT NULL,
`id_access_level` int(11) NOT NULL,
`full_name` varchar(45) NOT NULL,
`email` varchar(100) NOT NULL,
`password` varchar(200) NOT NULL,
`enabled` int(11) NOT NULL DEFAULT '1'
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8 COMMENT='Users credentials';
--
-- Dump dei dati per la tabella `user`
-- ALL PASSWORDS ARE: 'password'
INSERT INTO `user` (`id_user`, `id_access_level`, `full_name`, `email`, `password`, `enabled`) VALUES
(1, 100, 'Administrator', 'admin@email.com', '5f4dcc3b5aa765d61d8327deb882cf99', 1),
(2, 60, 'Manager', 'manager@email.it', '5f4dcc3b5aa765d61d8327deb882cf99', 1);
-- --------------------------------------------------------
--
-- Struttura per la vista `stock_store`
--
DROP TABLE IF EXISTS `stock_store`;
CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `stock_store` AS select `stock`.`part_code` AS `part_code`,`stock`.`store_code` AS `store_code`,`stock`.`quantity` AS `quantity`,`store`.`name` AS `name` from (`stock` join `store`) where (`store`.`store_code` = `stock`.`store_code`);
--
-- Indexes for dumped tables
--
--
-- Indexes for table `access_level`
--
ALTER TABLE `access_level`
ADD PRIMARY KEY (`id_access_level`);
--
-- Indexes for table `bom`
--
ALTER TABLE `bom`
ADD PRIMARY KEY (`parent_part_code`,`child_part_code`), ADD KEY `fk_bom_part1_idx` (`child_part_code`);
--
-- Indexes for table `customer`
--
ALTER TABLE `customer`
ADD PRIMARY KEY (`customer_id`);
--
-- Indexes for table `customer_order`
--
ALTER TABLE `customer_order`
ADD PRIMARY KEY (`order_id`), ADD KEY `fk_order_customer1_idx` (`customer_id`), ADD KEY `fk_order_order_status1_idx` (`order_status_id`);
--
-- Indexes for table `file_type`
--
ALTER TABLE `file_type`
ADD PRIMARY KEY (`file_type_id`);
--
-- Indexes for table `good_movement`
--
ALTER TABLE `good_movement`
ADD PRIMARY KEY (`good_movement_id`), ADD KEY `fk_inventory_log_part1_idx` (`part_code`), ADD KEY `fk_inventory_log_store1_idx` (`store_code`);
--
-- Indexes for table `measurement_unit`
--
ALTER TABLE `measurement_unit`
ADD PRIMARY KEY (`measurement_unit_code`);
--
-- Indexes for table `order_file`
--
ALTER TABLE `order_file`
ADD PRIMARY KEY (`order_file_id`), ADD KEY `fk_order_file_order1_idx` (`order_id`), ADD KEY `fk_order_file_file_type1_idx` (`file_type_id`);
--
-- Indexes for table `order_macro_activity`
--
ALTER TABLE `order_macro_activity`
ADD PRIMARY KEY (`activity_id`), ADD KEY `fk_order_macro_activity_order1_idx` (`order_id`);
--
-- Indexes for table `order_status`
--
ALTER TABLE `order_status`
ADD PRIMARY KEY (`order_status_id`);
--
-- Indexes for table `part`
--
ALTER TABLE `part`
ADD PRIMARY KEY (`part_code`), ADD KEY `fk_part_part_type1_idx` (`part_type_code`), ADD KEY `fk_part_part_category1_idx` (`part_category_code`), ADD KEY `fk_part_part_unit_type1_idx` (`measurement_unit_code`);
--
-- Indexes for table `part_category`
--
ALTER TABLE `part_category`
ADD PRIMARY KEY (`part_category_code`);
--
-- Indexes for table `part_type`
--
ALTER TABLE `part_type`
ADD PRIMARY KEY (`part_type_code`);
--
-- Indexes for table `stock`
--
ALTER TABLE `stock`
ADD PRIMARY KEY (`store_code`,`part_code`), ADD KEY `fk_stock_part1_idx` (`part_code`), ADD KEY `fk_stock_store1_idx` (`store_code`);
--
-- Indexes for table `store`
--
ALTER TABLE `store`
ADD PRIMARY KEY (`store_code`);
--
-- Indexes for table `user`
--
ALTER TABLE `user`
ADD PRIMARY KEY (`id_user`), ADD UNIQUE KEY `unique_email` (`email`), ADD KEY `fk_user_access_level_idx` (`id_access_level`), ADD KEY `idx_full_name` (`full_name`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `customer`
--
ALTER TABLE `customer`
MODIFY `customer_id` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `customer_order`
--
ALTER TABLE `customer_order`
MODIFY `order_id` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `order_macro_activity`
--
ALTER TABLE `order_macro_activity`
MODIFY `activity_id` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `user`
--
ALTER TABLE `user`
MODIFY `id_user` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=3;
--
-- Limiti per le tabelle scaricate
--
--
-- Limiti per la tabella `bom`
--
ALTER TABLE `bom`
ADD CONSTRAINT `fk_bom_part` FOREIGN KEY (`parent_part_code`) REFERENCES `part` (`part_code`) ON DELETE NO ACTION ON UPDATE NO ACTION,
ADD CONSTRAINT `fk_bom_part1` FOREIGN KEY (`child_part_code`) REFERENCES `part` (`part_code`) ON DELETE NO ACTION ON UPDATE NO ACTION;
--
-- Limiti per la tabella `customer_order`
--
ALTER TABLE `customer_order`
ADD CONSTRAINT `fk_order_customer1` FOREIGN KEY (`customer_id`) REFERENCES `customer` (`customer_id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
ADD CONSTRAINT `fk_order_order_status1` FOREIGN KEY (`order_status_id`) REFERENCES `order_status` (`order_status_id`) ON DELETE NO ACTION ON UPDATE NO ACTION;
--
-- Limiti per la tabella `good_movement`
--
ALTER TABLE `good_movement`
ADD CONSTRAINT `fk_inventory_log_part1` FOREIGN KEY (`part_code`) REFERENCES `part` (`part_code`) ON DELETE NO ACTION ON UPDATE NO ACTION,
ADD CONSTRAINT `fk_inventory_log_store1` FOREIGN KEY (`store_code`) REFERENCES `store` (`store_code`) ON DELETE NO ACTION ON UPDATE NO ACTION;
--
-- Limiti per la tabella `order_file`
--
ALTER TABLE `order_file`
ADD CONSTRAINT `fk_order_file_file_type1` FOREIGN KEY (`file_type_id`) REFERENCES `file_type` (`file_type_id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
ADD CONSTRAINT `fk_order_file_order1` FOREIGN KEY (`order_id`) REFERENCES `customer_order` (`order_id`) ON DELETE NO ACTION ON UPDATE NO ACTION;
--
-- Limiti per la tabella `order_macro_activity`
--
ALTER TABLE `order_macro_activity`
ADD CONSTRAINT `fk_order_macro_activity_order1` FOREIGN KEY (`order_id`) REFERENCES `customer_order` (`order_id`) ON DELETE NO ACTION ON UPDATE NO ACTION;
--
-- Limiti per la tabella `part`
--
ALTER TABLE `part`
ADD CONSTRAINT `fk_part_part_category1` FOREIGN KEY (`part_category_code`) REFERENCES `part_category` (`part_category_code`) ON DELETE NO ACTION ON UPDATE NO ACTION,
ADD CONSTRAINT `fk_part_part_type1` FOREIGN KEY (`part_type_code`) REFERENCES `part_type` (`part_type_code`) ON DELETE NO ACTION ON UPDATE NO ACTION,
ADD CONSTRAINT `fk_part_part_unit_type1` FOREIGN KEY (`measurement_unit_code`) REFERENCES `measurement_unit` (`measurement_unit_code`) ON DELETE NO ACTION ON UPDATE NO ACTION;
--
-- Limiti per la tabella `stock`
--
ALTER TABLE `stock`
ADD CONSTRAINT `fk_stock_part1` FOREIGN KEY (`part_code`) REFERENCES `part` (`part_code`) ON DELETE NO ACTION ON UPDATE NO ACTION,
ADD CONSTRAINT `fk_stock_store1` FOREIGN KEY (`store_code`) REFERENCES `store` (`store_code`) ON DELETE NO ACTION ON UPDATE NO ACTION;
--
-- Limiti per la tabella `user`
--
ALTER TABLE `user`
ADD CONSTRAINT `fk_user_access_level1` FOREIGN KEY (`id_access_level`) REFERENCES `access_level` (`id_access_level`) ON DELETE NO ACTION ON UPDATE NO ACTION;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; | the_stack |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.