Project

General

Profile

« Previous | Next » 

Revision 14387

fix: schemas/util.sql: view_def_to_orig(): need to support aliased columns (produced when a column is renamed)

View differences:

trunk/schemas/util.sql
6169 6169
,
6170 6170
/* unexpand expanded * expressions. any list of 6+ cols from the same table is
6171 6171
treated as a * expression. */
6172
'('||util.col_re()||'\.)'||util.col_re()||
6172
'('||util.aliased_col_re()||'\.)'||util.aliased_col_re()||
6173 6173
	/* 1st col, which lacks separator before.
6174 6174
	*note*: can't prepend \y because it considers only \w chars, not " */
6175 6175
'(,[[:blank:]]*
6176
[[:blank:]]*)\1'||util.col_re()|| -- 2nd col, which has separator before
6177
'(?:\2\1'||util.col_re()||'){4,}', -- later cols, w/ same table name & separator
6176
[[:blank:]]*)\1'||util.aliased_col_re()|| -- 2nd col, which has separator before
6177
'(?:\2\1'||util.aliased_col_re()||'){4,}', --later cols, w/ same table/separator
6178 6178
'\1*'/*prefix w/ table*/,
6179 6179
'g')
6180 6180
,
6181 6181
/* merge .* expressions resulting from a SELECT * of a join. any list of
6182 6182
multiple .* expressions is treated as a SELECT * . */
6183
''||util.col_re()||'\.\*'||
6183
''||util.aliased_col_re()||'\.\*'||
6184 6184
	/* 1st table, which lacks separator before.
6185 6185
	*note*: can't prepend \y because it considers only \w chars, not " */
6186 6186
'(,[[:blank:]]*
6187
[[:blank:]]*)'||util.col_re()||'\.\*'|| -- 2nd table, which has separator before
6188
'(?:\1'||util.col_re()||'\.\*)*', -- later tables, w/ same separator
6187
[[:blank:]]*)'||util.aliased_col_re()||'\.\*'|| --2nd table, w/ separator before
6188
'(?:\1'||util.aliased_col_re()||'\.\*)*', -- later tables, w/ same separator
6189 6189
'*',
6190 6190
'g')
6191 6191
END

Also available in: Unified diff