Revision 13535
Added by Aaron Marcuse-Kubitza over 10 years ago
trunk/schemas/util.sql | ||
---|---|---|
2406 | 2406 |
LANGUAGE sql IMMUTABLE |
2407 | 2407 |
AS $_$ |
2408 | 2408 |
SELECT $$DROP $$||(util.regexp_match($1, |
2409 |
'(?m)^CREATE(?: OR REPLACE)? ((?:)??[[:upper:]]+ .*?)(?: AS ?)?$'))[1]||$$;$$
|
|
2409 |
'(?m)^CREATE(?: OR REPLACE)? ((?:)??[[:upper:]]+ .*?)(?: AS(?: (?:SELECT\y.*)?)?)?$'))[1]||$$;$$
|
|
2410 | 2410 |
/* (?:)?? makes the surrounding () group non-greedy, so that (?: AS ?)? |
2411 | 2411 |
works properly (due to nonstandard Postgres regexp behavior: |
2412 | 2412 |
http://www.postgresql.org/docs/9.3/static/functions-matching.html#POSIX-MATCHING-RULES) */ |
Also available in: Unified diff
fix: schemas/util.sql: mk_drop_from_create(): also support CREATE queries that include the SELECT statement on the same line as the CREATE