when SQL is provided for customers to run, provide it as a file
Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.
Proposal
In a recent merge request, we discussed providing a SQL workaround to customers as a SQL file, to avoid potential issues with copy and paste.
Thread: !173514 (comment 2223978473)
This also came up in the the upgrade improvements working group; GitLab team members should search Google Docs for 'Upgrade Improvements Project Plan', but relevant section is quoted here:
Sometimes, developers and support engineers also share plain SQL query with customers and suggest they run manually, which introduces human error and other unexpected risks. It would be better to provide SQL files and as a last resort in emergencies only.
Customers have a variety of database solutions,, we need to provide instructions for how to do this. In some cases (example: cloud providers, Azure for one) there's a web interface for running queries. Providing a SQL script file to this interface might not be possible. But as a starting point, all the deployment types for which we currently have Database console instructions: https://docs.gitlab.com/ee/administration/troubleshooting/postgresql.html#start-a-database-console
- the file needs to be readable by the database console.
sudo gitlab-psqlswitches to thegitlab-psqlaccount and so can't access SQL files uploaded to other users'* home directories, for example. (*including root) - starting a database console then using
\include /foo/bar/baz - passing a SQL file as parameter when starting the database console
- piping the file into the database console from the command line
- how to interact with the database console command like using
gitlab-rails dbconsole? Can we pass in SQL scripts at all, or only useinclude?