Revision 14292
Added by Aaron Marcuse-Kubitza over 10 years ago
trunk/schemas/util.sql | ||
---|---|---|
5957 | 5957 |
CREATE FUNCTION view_body(view_def text) RETURNS text |
5958 | 5958 |
LANGUAGE sql IMMUTABLE |
5959 | 5959 |
AS $_$ |
5960 |
SELECT (SELECT regexp_matches(view_def, '(?w).*?^CREATE .*?; |
|
5960 |
-- support both CREATE statements and view bodies |
|
5961 |
SELECT (SELECT regexp_matches(view_def,'(?w).*?^ *(?:CREATE|SELECT|VALUES)\y.*?; |
|
5961 | 5962 |
'))[1] -- (?w) : ^$ multiline but . dotall |
5962 | 5963 |
$_$; |
5963 | 5964 |
|
Also available in: Unified diff
bugfix: schemas/util.sql: view_body(): need to support both CREATE statements and view bodies