Project

General

Profile

« Previous | Next » 

Revision 6865

schemas/vegbien.sql: Added materialized view provider_count, generated from provider_count_view

View differences:

schemas/vegbien.my.sql
423 423

  
424 424

  
425 425
--
426
-- Name: sync_provider_count_to_view(); Type: FUNCTION; Schema: public; Owner: -
427
--
428

  
429

  
430

  
431

  
432
--
426 433
-- Name: taxondetermination_set_iscurrent(); Type: FUNCTION; Schema: public; Owner: -
427 434
--
428 435

  
......
2664 2671

  
2665 2672

  
2666 2673
--
2674
-- Name: provider_count; Type: TABLE; Schema: public; Owner: -; Tablespace: 
2675
--
2676

  
2677
CREATE TABLE provider_count (
2678
    provider varchar(255) NOT NULL,
2679
    count varchar(255)
2680
);
2681

  
2682

  
2683
--
2667 2684
-- Name: provider_count_view; Type: VIEW; Schema: public; Owner: -
2668 2685
--
2669 2686

  
......
4150 4167

  
4151 4168

  
4152 4169
--
4170
-- Data for Name: provider_count; Type: TABLE DATA; Schema: public; Owner: -
4171
--
4172

  
4173

  
4174

  
4175
--
4153 4176
-- Data for Name: revision; Type: TABLE DATA; Schema: public; Owner: -
4154 4177
--
4155 4178

  
......
4666 4689

  
4667 4690

  
4668 4691
--
4692
-- Name: provider_count_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
4693
--
4694

  
4695
ALTER TABLE provider_count
4696
    ADD CONSTRAINT provider_count_pkey PRIMARY KEY (provider);
4697

  
4698

  
4699
--
4669 4700
-- Name: revision_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
4670 4701
--
4671 4702

  
......
7044 7075

  
7045 7076

  
7046 7077
--
7078
-- Name: provider_count; Type: ACL; Schema: public; Owner: -
7079
--
7080

  
7081

  
7082

  
7083

  
7084

  
7085

  
7086

  
7087

  
7088
--
7047 7089
-- Name: provider_count_view; Type: ACL; Schema: public; Owner: -
7048 7090
--
7049 7091

  
schemas/vegbien.sql
973 973

  
974 974

  
975 975
--
976
-- Name: sync_provider_count_to_view(); Type: FUNCTION; Schema: public; Owner: -
977
--
978

  
979
CREATE FUNCTION sync_provider_count_to_view() RETURNS void
980
    LANGUAGE sql
981
    AS $$
982
DROP TABLE IF EXISTS provider_count;
983
CREATE TABLE provider_count AS SELECT * FROM provider_count_view LIMIT 0;
984

  
985
GRANT SELECT ON TABLE provider_count TO bien_read;
986
GRANT SELECT ON TABLE provider_count TO public_;
987
GRANT SELECT ON TABLE provider_count_view TO bien_read;
988
GRANT SELECT ON TABLE provider_count_view TO public_;
989

  
990
ALTER TABLE provider_count ADD PRIMARY KEY (provider);
991
$$;
992

  
993

  
994
--
976 995
-- Name: taxondetermination_set_iscurrent(); Type: FUNCTION; Schema: public; Owner: -
977 996
--
978 997

  
......
3630 3649

  
3631 3650

  
3632 3651
--
3652
-- Name: provider_count; Type: TABLE; Schema: public; Owner: -; Tablespace: 
3653
--
3654

  
3655
CREATE TABLE provider_count (
3656
    provider text NOT NULL,
3657
    count bigint
3658
);
3659

  
3660

  
3661
--
3633 3662
-- Name: provider_count_view; Type: VIEW; Schema: public; Owner: -
3634 3663
--
3635 3664

  
......
5237 5266

  
5238 5267

  
5239 5268
--
5269
-- Data for Name: provider_count; Type: TABLE DATA; Schema: public; Owner: -
5270
--
5271

  
5272

  
5273

  
5274
--
5240 5275
-- Data for Name: revision; Type: TABLE DATA; Schema: public; Owner: -
5241 5276
--
5242 5277

  
......
5753 5788

  
5754 5789

  
5755 5790
--
5791
-- Name: provider_count_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
5792
--
5793

  
5794
ALTER TABLE ONLY provider_count
5795
    ADD CONSTRAINT provider_count_pkey PRIMARY KEY (provider);
5796

  
5797

  
5798
--
5756 5799
-- Name: revision_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
5757 5800
--
5758 5801

  
......
8179 8222

  
8180 8223

  
8181 8224
--
8225
-- Name: provider_count; Type: ACL; Schema: public; Owner: -
8226
--
8227

  
8228
REVOKE ALL ON TABLE provider_count FROM PUBLIC;
8229
REVOKE ALL ON TABLE provider_count FROM bien;
8230
GRANT ALL ON TABLE provider_count TO bien;
8231
GRANT SELECT ON TABLE provider_count TO bien_read;
8232
GRANT SELECT ON TABLE provider_count TO public_;
8233

  
8234

  
8235
--
8182 8236
-- Name: provider_count_view; Type: ACL; Schema: public; Owner: -
8183 8237
--
8184 8238

  

Also available in: Unified diff