3 ms·
If you have a table with two columns and you do a 'select *', adding a column to the table can break code that is only expecting 2 columns.
by cwbriscoe 3y ago
If you have a table with two columns and you do a 'select *', adding a column to the table can break code that is only expecting 2 columns.
- croes 3y agoUsually code refers to columns by name and additional columns are just ignored, the only case I know is when you add a column to a joined table and the column name already exists in the other table resulting in ambiguous column names. In an exists clause the * is harmless
- cwbriscoe 3y agoI am talking about 'select ' at the top level, they can be harmless in exists, sub-selects and CTE's. The number of columns sent to the client (the program) will change when you add a column to the database. If you don't remember to change all of the places in your code where you used a 'select ', you program is likely going to fail or have unexpected results.