Revision 12654
Added by Aaron Marcuse-Kubitza almost 11 years ago
util.sql | ||
---|---|---|
1676 | 1676 |
|
1677 | 1677 |
|
1678 | 1678 |
-- |
1679 |
-- Name: freq_always_1(regclass, text); Type: FUNCTION; Schema: util; Owner: - |
|
1680 |
-- |
|
1681 |
|
|
1682 |
CREATE FUNCTION freq_always_1(table_ regclass, freq_col text DEFAULT 'copies'::text) RETURNS boolean |
|
1683 |
LANGUAGE sql STABLE |
|
1684 |
AS $_$ |
|
1685 |
SELECT util.eval2val( |
|
1686 |
$$SELECT NOT EXISTS( -- there is no row that is != 1 |
|
1687 |
SELECT NULL |
|
1688 |
FROM $$||$1||$$ |
|
1689 |
WHERE $$||quote_ident(freq_col)||$$ IS DISTINCT FROM 1 |
|
1690 |
LIMIT 1 |
|
1691 |
) |
|
1692 |
$$, NULL::boolean) |
|
1693 |
$_$; |
|
1694 |
|
|
1695 |
|
|
1696 |
-- |
|
1679 | 1697 |
-- Name: grants_users(); Type: FUNCTION; Schema: util; Owner: - |
1680 | 1698 |
-- |
1681 | 1699 |
|
Also available in: Unified diff
schemas/util.sql: added freq_always_1(regclass)