Revision 3187
Added by Aaron Marcuse-Kubitza over 12 years ago
lib/sql_io.py | ||
---|---|---|
466 | 466 |
db.log_debug('Adding pkey on pkeys table to enable fast joins', level=2.5) |
467 | 467 |
sql.add_pkey(db, into) |
468 | 468 |
|
469 |
log_debug('Setting pkeys of missing rows to '+strings.as_tt(repr(default))) |
|
470 |
missing_rows_joins = input_joins+[sql_gen.Join(into, |
|
471 |
{in_pkey: sql_gen.join_same_not_null}, sql_gen.filter_out)] |
|
472 |
# must use join_same_not_null or query will take forever |
|
473 |
insert_into_pkeys(missing_rows_joins, |
|
474 |
[in_pkey_col, sql_gen.NamedCol(out_pkey, default)]) |
|
469 |
if not is_function: |
|
470 |
log_debug('Setting pkeys of missing rows to ' |
|
471 |
+strings.as_tt(repr(default))) |
|
472 |
missing_rows_joins = input_joins+[sql_gen.Join(into, |
|
473 |
{in_pkey: sql_gen.join_same_not_null}, sql_gen.filter_out)] |
|
474 |
# must use join_same_not_null or query will take forever |
|
475 |
insert_into_pkeys(missing_rows_joins, |
|
476 |
[in_pkey_col, sql_gen.NamedCol(out_pkey, default)]) |
|
477 |
# otherwise, there is already an entry for every row |
|
475 | 478 |
|
476 | 479 |
assert sql.table_row_count(db, into) == sql.table_row_count(db, in_table) |
477 | 480 |
|
Also available in: Unified diff
sql_io.py: put_table(): Don't set pkeys of missing rows to default value if out_table is a SQL function, because then there is already an entry for every row