0001-reuse-older-id-for-open-item-fields-fixes-25982.patch
wcs_olap/feeder.py | ||
---|---|---|
557 | 557 |
else: |
558 | 558 |
# open item field, from data sources... |
559 | 559 |
self.create_labeled_table(table_name, [], serial=True, comment=comment) |
560 |
# take old id, value paris an inject them |
|
561 |
try: |
|
562 |
self.ex('INSERT INTO {table_name} SELECT * FROM {schema}.{table_name}', |
|
563 |
ctx={'table_name': table_name}) |
|
564 |
# update sequence to allow inserting new values |
|
565 |
sequence_name = table_name[:63 - len('_id_seq')] + '_id_seq' |
|
566 |
selx.ex('SELECT SETVAL(%s, (SELECT MAX(id) from {item_table}))', vars=[sequence_name], |
|
567 |
ctx={'item_table': table_name}) |
|
568 |
except pyscopg2.Error: |
|
569 |
pass |
|
570 | ||
571 | ||
560 | 572 | |
561 | 573 |
at = 'field_%s' % field.varname |
562 | 574 |
columns.append([at, 'smallint REFERENCES %s (id)' % table_name]) |
563 |
- |