Skip to content

Deleted-then-recreated collections don't always update items relation table name #389

@tanyamarton

Description

@tanyamarton

I'm using PGSTAC 0.8.6, deleting and recreating collections with the same collection id. In this circumstance, I sometimes get an error upserting items. Items can't be added to the recreated collection.

The traceback shows an attempt to find an items relation table associated with the key of the deleted collection, not the new key of the recreated collection. I can see the collections relation table deleting the associated row when the collection is deleted and recreating a new row with a new key when the collection is recreated. I can also see the items relation table associated with the old key deleted and a new items relation table created. Yet the error's traceback indicates a search for the deleted items relation table, one based on the key prior to collection deletion and recreation.

  • Initial Condition with demo-collection:
    collections relation table: key: 100, collection: demo-collection
    _items_100 relation table exists
  • After deleting collection demo-collection:
    collections relation table doesn't have an entry for demo-collection
    no _items_100 relation table
  • After recreating collection demo-collection:
    collections relation table: key: 101, collection: demo-collection
    _items_101 relation table exists
    failure to ingest items with traceback "psycopg.errors.UndefinedTable: relation "_items_100" does not exist"

Perhaps there is somewhere the deleted collection-key relationship is persisted and not being properly updated?

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions