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

Drush sql:query ON_ERROR_STOP is not implemented correctly (postgres) #6050

Open
ryansabir opened this issue Jun 27, 2024 · 1 comment
Open

Comments

@ryansabir
Copy link

Describe the bug
src/Sql/SqlPgsql.php line 47 is:
return 'psql -q ON_ERROR_STOP=1 ';

This is the wrong syntax. The ON_ERROR_STOP is being ignored, you can see this if you remove the '-q' option.

To Reproduce
Execute any drush sql command, e.g.:
drush -v --debug sql-query "SELECT 1"

Now look at the SQL generated with the label 'Executing':
Executing: psql -q ON_ERROR_STOP=1 --dbname=etc...

Expected behavior
The sql generated should be:
psql -q --set ON_ERROR_STOP=1

Actual behavior
This causes an error on Windows when running any drush sql command. On MacOS (and presumably Linux) the variable is ignored.

Workaround
Changing line 47 of src/Sql/SqlPgsql.php:
return 'psql -q ON_ERROR_STOP=1 ';
to
return 'psql -q --set ON_ERROR_STOP=1 ';

Fixes it temporarily.

System Configuration

Q A
Drush version? 12.5.1.0
Drupal version? 10.2.4
PHP version 8.1.28
OS? Mac/Windows

Additional information
This code was added as a fix for #5650. Tagging @weitzman .

@flow6979
Copy link

Hey @ryansabir i would like to work on this issue, you can assign it to me.
Thank you!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants
@ryansabir @flow6979 and others