Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: always return database table columns #429

Merged
merged 1 commit into from
Feb 10, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions database/pkg/cmd/rows.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ func ListDatabaseTableRows(ctx context.Context, dbFile *os.File, table string) (
}

// Build the query to fetch all rows from the table
query := fmt.Sprintf("SELECT * FROM %q;", table)
query := fmt.Sprintf("SELECT group_concat(name, '|') FROM pragma_table_info(%q); SELECT * FROM %q;", table, table)

// Execute the query using RunDatabaseCommand
rawOutput, err := RunDatabaseCommand(ctx, dbFile, fmt.Sprintf("-header %q", query))
rawOutput, err := RunDatabaseCommand(ctx, dbFile, fmt.Sprintf("%q", query))
if err != nil {
return "", fmt.Errorf("error executing query for table %q: %w", table, err)
}
Expand Down