@@ -205,6 +205,25 @@ export class ResultSetPanelProvider implements WebviewViewProvider {
205
205
} ) ) ;
206
206
207
207
if ( ! currentColumns . some ( c => c . useInWhere ) ) {
208
+ const cName = ref . alias || `t` ;
209
+
210
+ // Support for using a custom column list
211
+ const selectClauseStart = basicSelect . toLowerCase ( ) . indexOf ( `select ` ) ;
212
+ const fromClauseStart = basicSelect . toLowerCase ( ) . indexOf ( `from` ) ;
213
+ let possibleColumnList : string | undefined ;
214
+
215
+ possibleColumnList = `${ cName } .*` ;
216
+ if ( fromClauseStart > 0 ) {
217
+ possibleColumnList = basicSelect . substring ( 0 , fromClauseStart ) ;
218
+ if ( selectClauseStart >= 0 ) {
219
+ possibleColumnList = possibleColumnList . substring ( selectClauseStart + 7 ) ;
220
+
221
+ if ( possibleColumnList . trim ( ) === `*` ) {
222
+ possibleColumnList = `${ cName } .*` ;
223
+ }
224
+ }
225
+ }
226
+
208
227
// We need to override the input statement if they want to do updatable
209
228
const whereClauseStart = basicSelect . toLowerCase ( ) . indexOf ( `where` ) ;
210
229
let fromWhereClause : string | undefined ;
@@ -213,7 +232,8 @@ export class ResultSetPanelProvider implements WebviewViewProvider {
213
232
fromWhereClause = basicSelect . substring ( whereClauseStart ) ;
214
233
}
215
234
216
- basicSelect = `select rrn(t) as RRN, t.* from ${ schema } .${ ref . object . name } as t ${ fromWhereClause || `` } ` ;
235
+
236
+ basicSelect = `select rrn(${ cName } ) as RRN, ${ possibleColumnList } from ${ schema } .${ ref . object . name } as ${ cName } ${ fromWhereClause || `` } ` ;
217
237
currentColumns = [ { name : `RRN` , jsType : `number` , useInWhere : true } , ...currentColumns ] ;
218
238
}
219
239
0 commit comments