DO $$
BEGIN
IF NOT EXISTS(
SELECT schema_name
FROM information_schema.schemata
WHERE schema_name = 'pph'
)
THEN
EXECUTE 'CREATE SCHEMA pph';
END IF;
END
$$;
DROP VIEW IF EXISTS pph.cash_hand_hero_statistics CASCADE;
CREATE OR REPLACE VIEW pph.cash_hand_hero_statistics AS
SELECT cash_hand_player_statistics.id_hand,
cash_hand_player_statistics."position",
cash_hand_player_statistics.amt_before,
cash_hand_player_statistics.amt_blind,
cash_hand_player_statistics.amt_ante,
cash_hand_player_statistics.id_action_p,
cash_hand_player_statistics.flg_vpip,
cash_hand_player_statistics.flg_p_open_opp,
cash_hand_player_statistics.cnt_p_face_limpers,
cash_hand_player_statistics.flg_p_first_raise,
cash_hand_player_statistics.cnt_p_raise,
cash_hand_player_statistics.amt_p_raise_facing,
cash_hand_player_statistics.cnt_p_call,
cash_hand_player_statistics.flg_p_3bet,
cash_hand_player_statistics.flg_p_3bet_opp,
cash_hand_player_statistics.enum_p_3bet_action,
cash_hand_player_statistics.flg_p_3bet_def_opp,
cash_hand_player_statistics.flg_p_4bet,
cash_hand_player_statistics.flg_p_4bet_opp,
cash_hand_player_statistics.amt_p_4bet_facing,
cash_hand_player_statistics.enum_p_4bet_action,
cash_hand_player_statistics.amt_p_5bet_facing,
cash_hand_player_statistics.flg_blind_def_opp,
cash_hand_player_statistics.flg_steal_att,
cash_hand_player_statistics.flg_steal_opp,
cash_hand_player_statistics.flg_f_saw,
cash_hand_player_statistics.flg_f_cbet,
cash_hand_player_statistics.flg_f_cbet_opp,
cash_hand_player_statistics.flg_f_cbet_def_opp,
cash_hand_player_statistics.enum_f_cbet_action,
cash_hand_player_statistics.flg_f_face_raise,
cash_hand_player_statistics.flg_f_3bet,
cash_hand_player_statistics.flg_t_saw,
cash_hand_player_statistics.flg_t_cbet,
cash_hand_player_statistics.flg_t_cbet_opp,
cash_hand_player_statistics.flg_t_cbet_def_opp,
cash_hand_player_statistics.enum_t_cbet_action,
cash_hand_player_statistics.flg_t_face_raise,
cash_hand_player_statistics.flg_r_saw,
cash_hand_player_statistics.flg_r_cbet,
cash_hand_player_statistics.flg_r_cbet_opp,
cash_hand_player_statistics.flg_r_cbet_def_opp,
cash_hand_player_statistics.enum_r_cbet_action
FROM cash_hand_player_statistics
WHERE cash_hand_player_statistics.flg_hero;
ALTER TABLE pph.cash_hand_hero_statistics
OWNER TO postgres;
DROP FUNCTION IF EXISTS pph.hero_cash(integer);
CREATE OR REPLACE FUNCTION pph.hero_cash(id_hand integer)
RETURNS pph.cash_hand_hero_statistics AS
$BODY$
select *
from pph.cash_hand_hero_statistics
where id_hand = $1
$BODY$
LANGUAGE sql STABLE
COST 100;
ALTER FUNCTION pph.hero_cash(integer)
OWNER TO postgres;
DROP VIEW IF EXISTS pph.tourney_hand_hero_statistics CASCADE;
CREATE OR REPLACE VIEW pph.tourney_hand_hero_statistics AS
SELECT tourney_hand_player_statistics.id_hand,
tourney_hand_player_statistics."position",
tourney_hand_player_statistics.amt_before,
tourney_hand_player_statistics.amt_blind,
tourney_hand_player_statistics.amt_ante,
tourney_hand_player_statistics.id_action_p,
tourney_hand_player_statistics.flg_vpip,
tourney_hand_player_statistics.flg_p_open_opp,
tourney_hand_player_statistics.cnt_p_face_limpers,
tourney_hand_player_statistics.flg_p_first_raise,
tourney_hand_player_statistics.cnt_p_raise,
tourney_hand_player_statistics.amt_p_raise_facing,
tourney_hand_player_statistics.cnt_p_call,
tourney_hand_player_statistics.flg_p_3bet,
tourney_hand_player_statistics.flg_p_3bet_opp,
tourney_hand_player_statistics.enum_p_3bet_action,
tourney_hand_player_statistics.flg_p_3bet_def_opp,
tourney_hand_player_statistics.flg_p_4bet,
tourney_hand_player_statistics.flg_p_4bet_opp,
tourney_hand_player_statistics.amt_p_4bet_facing,
tourney_hand_player_statistics.enum_p_4bet_action,
tourney_hand_player_statistics.amt_p_5bet_facing,
tourney_hand_player_statistics.flg_blind_def_opp,
tourney_hand_player_statistics.flg_steal_att,
tourney_hand_player_statistics.flg_steal_opp,
tourney_hand_player_statistics.flg_f_saw,
tourney_hand_player_statistics.flg_f_cbet,
tourney_hand_player_statistics.flg_f_cbet_opp,
tourney_hand_player_statistics.flg_f_cbet_def_opp,
tourney_hand_player_statistics.enum_f_cbet_action,
tourney_hand_player_statistics.flg_f_face_raise,
tourney_hand_player_statistics.flg_f_3bet,
tourney_hand_player_statistics.flg_t_saw,
tourney_hand_player_statistics.flg_t_cbet,
tourney_hand_player_statistics.flg_t_cbet_opp,
tourney_hand_player_statistics.flg_t_cbet_def_opp,
tourney_hand_player_statistics.enum_t_cbet_action,
tourney_hand_player_statistics.flg_t_face_raise,
tourney_hand_player_statistics.flg_r_saw,
tourney_hand_player_statistics.flg_r_cbet,
tourney_hand_player_statistics.flg_r_cbet_opp,
tourney_hand_player_statistics.flg_r_cbet_def_opp,
tourney_hand_player_statistics.enum_r_cbet_action
FROM tourney_hand_player_statistics
WHERE tourney_hand_player_statistics.flg_hero;
ALTER TABLE pph.tourney_hand_hero_statistics
OWNER TO postgres;
DROP FUNCTION IF EXISTS pph.hero_tourney(integer);
CREATE OR REPLACE FUNCTION pph.hero_tourney(id_hand integer)
RETURNS pph.tourney_hand_hero_statistics AS
$BODY$
select *
from pph.tourney_hand_hero_statistics
where id_hand = $1
$BODY$
LANGUAGE sql STABLE
COST 100;
ALTER FUNCTION pph.hero_tourney(integer)
OWNER TO postgres;