1617 |
1617 |
-- Name: materialize_query(text, text); Type: FUNCTION; Schema: util; Owner: -
|
1618 |
1618 |
--
|
1619 |
1619 |
|
1620 |
|
CREATE FUNCTION materialize_query(table_ text, sql text) RETURNS void
|
|
1620 |
CREATE FUNCTION materialize_query(table_esc text, sql text) RETURNS void
|
1621 |
1621 |
LANGUAGE sql
|
1622 |
1622 |
AS $_$
|
1623 |
|
SELECT util.create_if_not_exists($$CREATE TABLE $$||quote_ident($1)||$$ AS
|
|
1623 |
SELECT util.create_if_not_exists($$CREATE TABLE $$||$1||$$ AS
|
1624 |
1624 |
$$||$2)
|
1625 |
1625 |
$_$;
|
1626 |
1626 |
|
1627 |
1627 |
|
1628 |
1628 |
--
|
1629 |
|
-- Name: FUNCTION materialize_query(table_ text, sql text); Type: COMMENT; Schema: util; Owner: -
|
|
1629 |
-- Name: FUNCTION materialize_query(table_esc text, sql text); Type: COMMENT; Schema: util; Owner: -
|
1630 |
1630 |
--
|
1631 |
1631 |
|
1632 |
|
COMMENT ON FUNCTION materialize_query(table_ text, sql text) IS '
|
|
1632 |
COMMENT ON FUNCTION materialize_query(table_esc text, sql text) IS '
|
1633 |
1633 |
idempotent
|
1634 |
1634 |
';
|
1635 |
1635 |
|
... | ... | |
1638 |
1638 |
-- Name: materialize_view(text, regclass); Type: FUNCTION; Schema: util; Owner: -
|
1639 |
1639 |
--
|
1640 |
1640 |
|
1641 |
|
CREATE FUNCTION materialize_view(table_ text, view_ regclass) RETURNS void
|
|
1641 |
CREATE FUNCTION materialize_view(table_esc text, view_ regclass) RETURNS void
|
1642 |
1642 |
LANGUAGE sql
|
1643 |
1643 |
AS $_$
|
1644 |
1644 |
SELECT util.materialize_query($1, $$SELECT * FROM $$||$2)
|
... | ... | |
1646 |
1646 |
|
1647 |
1647 |
|
1648 |
1648 |
--
|
1649 |
|
-- Name: FUNCTION materialize_view(table_ text, view_ regclass); Type: COMMENT; Schema: util; Owner: -
|
|
1649 |
-- Name: FUNCTION materialize_view(table_esc text, view_ regclass); Type: COMMENT; Schema: util; Owner: -
|
1650 |
1650 |
--
|
1651 |
1651 |
|
1652 |
|
COMMENT ON FUNCTION materialize_view(table_ text, view_ regclass) IS '
|
|
1652 |
COMMENT ON FUNCTION materialize_view(table_esc text, view_ regclass) IS '
|
1653 |
1653 |
idempotent
|
1654 |
1654 |
';
|
1655 |
1655 |
|
... | ... | |
2015 |
2015 |
-- Name: rematerialize_view(text, regclass); Type: FUNCTION; Schema: util; Owner: -
|
2016 |
2016 |
--
|
2017 |
2017 |
|
2018 |
|
CREATE FUNCTION rematerialize_view(table_ text, view_ regclass) RETURNS void
|
|
2018 |
CREATE FUNCTION rematerialize_view(table_esc text, view_ regclass) RETURNS void
|
2019 |
2019 |
LANGUAGE sql
|
2020 |
2020 |
AS $_$
|
2021 |
2021 |
SELECT util.drop_table($1);
|
... | ... | |
2024 |
2024 |
|
2025 |
2025 |
|
2026 |
2026 |
--
|
2027 |
|
-- Name: FUNCTION rematerialize_view(table_ text, view_ regclass); Type: COMMENT; Schema: util; Owner: -
|
|
2027 |
-- Name: FUNCTION rematerialize_view(table_esc text, view_ regclass); Type: COMMENT; Schema: util; Owner: -
|
2028 |
2028 |
--
|
2029 |
2029 |
|
2030 |
|
COMMENT ON FUNCTION rematerialize_view(table_ text, view_ regclass) IS '
|
|
2030 |
COMMENT ON FUNCTION rematerialize_view(table_esc text, view_ regclass) IS '
|
2031 |
2031 |
idempotent, but repeats action each time
|
2032 |
2032 |
';
|
2033 |
2033 |
|
schemas/vegbien.sql: materialize_query(): support schema-qualified tables. this requires escaping tables in calls to this function.