Revision 14381
Added by Aaron Marcuse-Kubitza over 10 years ago
trunk/schemas/util.sql | ||
---|---|---|
6147 | 6147 |
, |
6148 | 6148 |
/* unexpand expanded * expressions. any list of 6+ cols from the same table is |
6149 | 6149 |
treated as a * expression. */ |
6150 |
'((?:"[^"\s]+"|\w+)\.)(?:"[^"\s]+"|\w+)'||
|
|
6150 |
'('||col||'\.)'||col||
|
|
6151 | 6151 |
/* 1st col, which lacks separator before. |
6152 | 6152 |
*note*: can't prepend \y because it considers only \w chars, not " */ |
6153 | 6153 |
'(,[[:blank:]]* |
6154 |
[[:blank:]]*)\1(?:"[^"\s]+"|\w+)'|| -- 2nd col, which has separator before
|
|
6155 |
'(?:\2\1(?:"[^"\s]+"|\w+)){4,}', -- later cols, w/ same table name and separator
|
|
6154 |
[[:blank:]]*)\1'||col|| -- 2nd col, which has separator before
|
|
6155 |
'(?:\2\1'||col||'){4,}', -- later cols, 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 |
'(?:"[^"\s]+"|\w+)\.\*'||
|
|
6161 |
''||col||'\.\*'||
|
|
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:]]*)(?:"[^"\s]+"|\w+)\.\*'|| -- 2nd table, which has separator before
|
|
6166 |
'(?:\1(?:"[^"\s]+"|\w+)\.\*)*', -- later tables, w/ same separator
|
|
6165 |
[[:blank:]]*)'||col||'\.\*'|| -- 2nd table, which has separator before
|
|
6166 |
'(?:\1'||col||'\.\*)*', -- later tables, w/ same separator
|
|
6167 | 6167 |
'*', |
6168 | 6168 |
'g') |
6169 | 6169 |
END |
6170 |
FROM (SELECT util.col_re() AS col) s |
|
6170 | 6171 |
$_$; |
6171 | 6172 |
|
6172 | 6173 |
|
Also available in: Unified diff
schemas/util.sql: view_def_to_orig(): use util.col_re() for clarity