jamf / go-mysqldump

Create SQL dumps in Go without external dependencies
MIT License
18 stars 24 forks source link

Databases with Views produce errors and fail to backup #8

Open BrandonRoehl opened 5 years ago

BrandonRoehl commented 5 years ago

Steps to recreate

  1. Create the view
  2. Backup the database

Example view

CREATE VIEW testview AS SELECT 'test' as c1, 'other as c2;

Error with line number. This happends in the CreateSQL function in dump.go

template:mysqldumpTable:9.3: executing "mysqldumpTable" at <.CreateSQL>:error calling CreateSQL: sql: expected 4 destination arguments in Scan, not 2
billyaustin84 commented 3 years ago

Hey @BrandonRoehl have you ever looked into what would be required to resolve this?

BrandonRoehl commented 3 years ago

Yes the first of 2 PRs is now open you can see it here at #11 after the virtual column fix. I am going to need to make a new PR to do the same dynamic scanning for the show sql statement since the columns are not predetermined