--
-- PostgreSQL database dump
--

-- Dumped from database version 12.9
-- Dumped by pg_dump version 12.9

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: db_to_csv(text); Type: FUNCTION; Schema: public; Owner: -
--

CREATE FUNCTION public.db_to_csv(path text) RETURNS void
    LANGUAGE plpgsql
    AS $$
declare
   tables RECORD;
   statement TEXT;
begin
FOR tables IN 
   SELECT (table_schema || '.' || table_name) AS schema_table
   FROM information_schema.tables t INNER JOIN information_schema.schemata s 
   ON s.schema_name = t.table_schema 
   WHERE t.table_schema NOT IN ('pg_catalog', 'information_schema')
   AND t.table_type NOT IN ('VIEW')
   ORDER BY schema_table
LOOP
   statement := 'COPY ' || tables.schema_table || ' TO ''' || path || '/' || tables.schema_table || '.csv' ||''' DELIMITER '';'' CSV HEADER';
   EXECUTE statement;
END LOOP;
return;  
end;
$$;

--
-- Name: customer; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.customer (
    c_custkey bigint NOT NULL,
    c_name character varying(25) DEFAULT NULL::character varying,
    c_address character varying(40) DEFAULT NULL::character varying,
    c_nationkey bigint,
    c_phone character(15) DEFAULT NULL::bpchar,
    c_acctbal double precision,
    c_mktsegment character(10) DEFAULT NULL::bpchar,
    c_comment character varying(117) DEFAULT NULL::character varying
);


--
-- Name: lineitem; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.lineitem (
    l_orderkey bigint DEFAULT '0'::bigint NOT NULL,
    l_partkey bigint,
    l_suppkey bigint,
    l_linenumber bigint DEFAULT '0'::bigint NOT NULL,
    l_quantity double precision,
    l_extendedprice double precision,
    l_discount double precision,
    l_tax double precision,
    l_returnflag character(1) DEFAULT NULL::bpchar,
    l_linestatus character(1) DEFAULT NULL::bpchar,
    l_shipdate date,
    l_commitdate date,
    l_receiptdate date,
    l_shipinstruct character(25) DEFAULT NULL::bpchar,
    l_shipmode character(10) DEFAULT NULL::bpchar,
    l_comment character varying(44) DEFAULT NULL::character varying
);


--
-- Name: nation; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.nation (
    n_nationkey bigint NOT NULL,
    n_name character(25) DEFAULT NULL::bpchar,
    n_regionkey bigint,
    n_comment character varying(152) DEFAULT NULL::character varying
);


--
-- Name: orders; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.orders (
    o_orderkey bigint NOT NULL,
    o_custkey bigint,
    o_orderstatus character(1) DEFAULT NULL::bpchar,
    o_totalprice double precision,
    o_orderdate date,
    o_orderpriority character(15) DEFAULT NULL::bpchar,
    o_clerk character(15) DEFAULT NULL::bpchar,
    o_shippriority bigint,
    o_comment character varying(79) DEFAULT NULL::character varying
);


--
-- Name: part; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.part (
    p_partkey bigint NOT NULL,
    p_name character varying(55) DEFAULT NULL::character varying,
    p_mfgr character(25) DEFAULT NULL::bpchar,
    p_brand character(10) DEFAULT NULL::bpchar,
    p_type character varying(25) DEFAULT NULL::character varying,
    p_size bigint,
    p_container character(10) DEFAULT NULL::bpchar,
    p_retailprice double precision,
    p_comment character varying(23) DEFAULT NULL::character varying
);


--
-- Name: partsupp; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.partsupp (
    ps_partkey bigint DEFAULT '0'::bigint NOT NULL,
    ps_suppkey bigint DEFAULT '0'::bigint NOT NULL,
    ps_availqty bigint,
    ps_supplycost double precision,
    ps_comment character varying(199) DEFAULT NULL::character varying
);


--
-- Name: region; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.region (
    r_regionkey bigint NOT NULL,
    r_name character(25) DEFAULT NULL::bpchar,
    r_comment character varying(152) DEFAULT NULL::character varying
);


--
-- Name: supplier; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.supplier (
    s_suppkey bigint NOT NULL,
    s_name character(25) DEFAULT NULL::bpchar,
    s_address character varying(40) DEFAULT NULL::character varying,
    s_nationkey bigint,
    s_phone character(15) DEFAULT NULL::bpchar,
    s_acctbal double precision,
    s_comment character varying(101) DEFAULT NULL::character varying
);


--
-- Name: time_statistics; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.time_statistics (
    task_name character varying(40) DEFAULT NULL::character varying,
    s_time timestamp with time zone,
    e_time timestamp with time zone,
    int_time bigint
);
