gtfs-lib icon indicating copy to clipboard operation
gtfs-lib copied to clipboard

Editor: Extra fields added to tables during export

Open landonreed opened this issue 5 years ago • 1 comments

Observed behavior

A GTFS feed that is loaded and snapshotted for the RDBMS-backed editor will contain additional fields not attached to the originally imported tables. E.g., the editor-specific route_branding_url field will be added to the routes table on export.

Expected behavior

Ideally a GTFS feed making a round trip would contain no additional fields/modifications. There is a related issue #283 that modifies stop_sequence values.

Steps to reproduce the problem

  1. Import any GTFS feed
  2. Load into editor
  3. Snapshot and publish feed.
  4. Download GTFS and observe addition of routes#route_branding_url field.

Notes on configuration and files required to reproduce the issue

n/a

landonreed avatar Apr 22 '20 13:04 landonreed

As discussed outside of GH, there may be a potential fix here with pg_stats to determine which columns have all null values and skip those on the export of the table from the GTFS Editor: https://dba.stackexchange.com/a/2932/206444.

E.g.:

vacuum analyze; -- if needed
select schemaname, tablename, attname
from pg_stats
where most_common_vals is null
and most_common_freqs is null
and histogram_bounds is null
and correlation is null
and null_frac = 1;

landonreed avatar Apr 22 '20 13:04 landonreed