Revision 14382
Added by Aaron Marcuse-Kubitza over 10 years ago
trunk/schemas/util.sql | ||
---|---|---|
6145 | 6145 |
regexp_replace( |
6146 | 6146 |
$1 |
6147 | 6147 |
, |
6148 |
/* unexpand expanded * expressions. any list of 6+ cols from the same table is
|
|
6148 |
/* unexpand expanded * expressions. any list of 6+ util.col_re()s from the same table is
|
|
6149 | 6149 |
treated as a * expression. */ |
6150 |
'('||col||'\.)'||col||
|
|
6151 |
/* 1st col, which lacks separator before.
|
|
6150 |
'('||util.col_re()||'\.)'||util.col_re()||
|
|
6151 |
/* 1st util.col_re(), which lacks separator before.
|
|
6152 | 6152 |
*note*: can't prepend \y because it considers only \w chars, not " */ |
6153 | 6153 |
'(,[[:blank:]]* |
6154 |
[[:blank:]]*)\1'||col|| -- 2nd col, which has separator before
|
|
6155 |
'(?:\2\1'||col||'){4,}', -- later cols, w/ same table name and separator
|
|
6154 |
[[:blank:]]*)\1'||util.col_re()|| -- 2nd util.col_re(), which has separator before
|
|
6155 |
'(?:\2\1'||util.col_re()||'){4,}', -- later util.col_re()s, w/ same table name and separator
|
|
6156 | 6156 |
'\1*'/*prefix w/ table*/, |
6157 | 6157 |
'g') |
6158 | 6158 |
, |
6159 | 6159 |
/* merge .* expressions resulting from a SELECT * of a join. any list of |
6160 | 6160 |
multiple .* expressions is treated as a SELECT * . */ |
6161 |
''||col||'\.\*'||
|
|
6161 |
''||util.col_re()||'\.\*'||
|
|
6162 | 6162 |
/* 1st table, which lacks separator before. |
6163 | 6163 |
*note*: can't prepend \y because it considers only \w chars, not " */ |
6164 | 6164 |
'(,[[:blank:]]* |
6165 |
[[:blank:]]*)'||col||'\.\*'|| -- 2nd table, which has separator before
|
|
6166 |
'(?:\1'||col||'\.\*)*', -- later tables, w/ same separator
|
|
6165 |
[[:blank:]]*)'||util.col_re()||'\.\*'|| -- 2nd table, which has separator before
|
|
6166 |
'(?:\1'||util.col_re()||'\.\*)*', -- later tables, w/ same separator
|
|
6167 | 6167 |
'*', |
6168 | 6168 |
'g') |
6169 | 6169 |
END |
6170 |
FROM (SELECT util.col_re() AS col) s |
|
6171 | 6170 |
$_$; |
6172 | 6171 |
|
6173 | 6172 |
|
Also available in: Unified diff
fix: schemas/util.sql: view_def_to_orig(): can't use FROM to alias util.col_re() because that prevents inlining the function