Improved handling of PostgreSQL table name generation and management.

Fixed table name handling so that table names are connected to the
original data source, match the raw sqlite upload file, and get
incrementing serial numbers if a data source is uploaded multiple times.